Storage

Read and write files

You must have requested the correct permissions in the app manifest when accessing certain libraries. Local does not require any special permissions

Calls to storage functions should be wrapped in try / catch blocks as they can throw exceptions

Reference the library

C#
using CI.WSANative.FileStorage;

Get a file

C#
WSANativeStorageLibrary.GetFile(WSAStorageLibrary.Pictures, "MyPicture.png", (r) => { });

Get all files in a folder

C#
WSANativeStorageLibrary.GetFiles(WSAStorageLibrary.Pictures, "", (r) => { });

Get all folders in a specified folder

C#
WSANativeStorageLibrary.GetFolders(WSAStorageLibrary.Pictures, "", (t) => { });

Check if a file exists

C#
WSANativeStorageLibrary.DoesFileExist(WSAStorageLibrary.Pictures, "MyPicture.png");

Check if a folder exists

C#
WSANativeStorageLibrary.DoesFolderExist(WSAStorageLibrary.Pictures, "MyFolder");

Create a file

Creates a new file and returns a handle to it, parent folders will be created automatically if necessary. If the file already exists it will be overwritten

C#
WSANativeStorageLibrary.CreateFile(WSAStorageLibrary.Pictures, "MyPicture.png");

Create a folder

Creates a new folder, parent folders will be created automatically if necessary. If the folder already exists it will be overwritten

C#
WSANativeStorageLibrary.CreateFolder(WSAStorageLibrary.Pictures, "MyFolder");

Delete a file

C#
WSANativeStorageLibrary.DeleteFile(WSAStorageLibrary.Pictures, "MyPicture.png");

Delete a folder

C#
WSANativeStorageLibrary.DeleteFolder(WSAStorageLibrary.Pictures, "MyFolder");