Release 4.0.0-preview1-00172
[platform/core/csapi/tizenfx.git] / src / Tizen.Content.MediaContent / Tizen.Content.MediaContent / Storage.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18
19 namespace Tizen.Content.MediaContent
20 {
21     /// <summary>
22     /// Represents the storage information for media.
23     /// </summary>
24     /// <remarks>
25     /// The system generates the storage ID when the external storage is added and manages the media information
26     /// in each of the storage by using the storage ID.
27     /// </remarks>
28     public class Storage
29     {
30         internal Storage(IntPtr handle)
31         {
32             Path = InteropHelper.GetString(handle, Interop.Storage.GetPath);
33             Id = InteropHelper.GetString(handle, Interop.Storage.GetId);
34             Type = InteropHelper.GetValue<StorageType>(handle, Interop.Storage.GetType);
35         }
36
37         internal static Storage FromHandle(IntPtr handle) => new Storage(handle);
38
39         /// <summary>
40         /// Gets the ID of the storage.
41         /// </summary>
42         /// <value>The unique ID of the storage.</value>
43         public string Id { get; }
44
45         /// <summary>
46         /// Gets the path of the storage.
47         /// </summary>
48         /// <value>The path of the storage.</value>
49         public string Path { get; }
50
51         /// <summary>
52         /// Gets the type of the storage.
53         /// </summary>
54         /// <value>The type of the storage.</value>
55         public StorageType Type { get; }
56
57         /// <summary>
58         /// Returns a string representation of the storage.
59         /// </summary>
60         /// <returns>A string representation of the current storage.</returns>
61         public override string ToString() =>
62             $"Id={Id}, Path={Path}, Type={Type}";
63     }
64 }