Change names not to use the same name for a namespace and a type in that namespace
[platform/core/csapi/tizenfx.git] / src / Tizen.System / Storage / StorageManager.cs
1 // Copyright 2016 by Samsung Electronics, Inc.,
2 //
3 // This software is the confidential and proprietary information
4 // of Samsung Electronics, Inc. ("Confidential Information"). You
5 // shall not disclose such Confidential Information and shall use
6 // it only in accordance with the terms of the license agreement
7 // you entered into with Samsung.
8
9 using System;
10 using System.Collections.Generic;
11
12 namespace Tizen.System
13 {
14     /// <summary>
15     /// Storage Manager, provides properties/ methods to access storage in the device.
16     /// </summary>
17     public static class StorageManager
18     {
19         private const string LogTag = "Tizen.System";
20
21         /// <summary>
22         /// List of all storage in the device
23         /// </summary>
24         public static IEnumerable<Storage> Storages
25         {
26             get
27             {
28                 List<Storage> storageList = new List<Storage>();
29                 Interop.Storage.StorageDeviceSupportedCallback cb = (int storageID, Interop.Storage.StorageArea type, Interop.Storage.StorageState state, string rootDirectory, IntPtr userData) =>
30                 {
31                     storageList.Add(new Storage(storageID, type, state, rootDirectory));
32                     return true;
33                 };
34
35                 Interop.Storage.ErrorCode err = Interop.Storage.StorageManagerGetForeachDeviceSupported(cb, IntPtr.Zero);
36                 if (err != Interop.Storage.ErrorCode.None)
37                 {
38                     Log.Warn(LogTag, string.Format("Failed to get storage list. err = {0}", err));
39                 }
40                 return storageList;
41             }
42         }
43     }
44 }