Class Storage
Definition
- Assembly:
- Tizen.System.Storage.dll
The class to access the storage device information.
public class Storage
- Inheritance
-
objectStorage
Properties
View SourceAvaliableSpace
The available storage size in bytes.
Declaration
public ulong AvaliableSpace { get; }
Property Value
Type | Description |
---|---|
ulong |
Id
The storage ID.
Declaration
public int Id { get; }
Property Value
Type | Description |
---|---|
int |
RootDirectory
The root directory for the storage.
Declaration
public string RootDirectory { get; }
Property Value
Type | Description |
---|---|
string |
State
The StorageState.
Declaration
public StorageState State { get; }
Property Value
Type | Description |
---|---|
StorageState |
StorageType
The type of storage.
Declaration
public StorageArea StorageType { get; }
Property Value
Type | Description |
---|---|
StorageArea |
TotalSpace
The total storage size in bytes.
Declaration
public ulong TotalSpace { get; }
Property Value
Type | Description |
---|---|
ulong |
Methods
View SourceGetAbsolutePath(DirectoryType)
Absolute path for a given directory type in the storage.
Declaration
public string GetAbsolutePath(DirectoryType dirType)
Parameters
Type | Name | Description |
---|---|---|
DirectoryType | dirType | Directory type. |
Returns
Type | Description |
---|---|
string | Absolute path for a given directory type in the storage. |
Remarks
The returned directory path may not exist, so you must make sure that it exists before using it. For accessing internal storage except the ringtones directory, the application should have http://tizen.org/privilege/mediastorage privilege. For accessing ringtones directory, the application should have http://tizen.org/privilege/systemsettings privilege. For accessing external storage, the application should have http://tizen.org/privilege/externalstorage privilege.
Examples
// To get the video directories for all the supported storage,
var storageList = StorageManager.Storages as List<Storage>;
foreach (var storage in storageList)
{
string pathForVideoDir = storage.GetAbsolutePath(DirectoryType.Videos);
}
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when failed because of an invalid argument. |
System.OutOfMemoryException | Thrown when failed due to out of memory exception. |
System.NotSupportedException | Thrown when failed if the storage is not supported or the application does not have the permission to access the directory path. |
Events
View SourceStorageStateChanged
StorageStateChanged event. This event is occurred when a storage state changes.
Declaration
public event EventHandler StorageStateChanged
Event Type
Type | Description |
---|---|
System.EventHandler |
Remarks
The storage state will be updated before calling the event handler.
Examples
myStorage.StorageStateChanged += (s, e) =>
{
var storage = s as Storage;
Console.WriteLine(string.Format("State Changed to {0}", storage.State));
}