Class AppDataAbstractBase<StorageFolder, StorageFile>
- Namespace
- SunamoPlatformUwpInterop.AppData
- Assembly
- SunamoPlatformUwpInterop.dll
Abstract base class for desktop application data management providing root folder management, file operations, and common settings access.
public abstract class AppDataAbstractBase<StorageFolder, StorageFile> : AppDataBase<StorageFolder, StorageFile>, IAppDataBase<StorageFolder, StorageFile>
Type Parameters
StorageFolderThe type representing a storage folder.
StorageFileThe type representing a storage file.
- Inheritance
-
AppDataBase<StorageFolder, StorageFile>AppDataAbstractBase<StorageFolder, StorageFile>
- Implements
-
IAppDataBase<StorageFolder, StorageFile>
- Derived
- Inherited Members
- Extension Methods
Methods
AppendAllText(AppFolders, string, string)
Appends text content to a file in the specified application folder.
public abstract Task AppendAllText(AppFolders appFolders, string fileName, string value)
Parameters
appFoldersAppFoldersThe application folder category.
fileNamestringThe file name.
valuestringThe text to append.
Returns
AppendAllText(string, StorageFile)
Appends text content to the specified storage file.
public abstract Task AppendAllText(string value, StorageFile storageFile)
Parameters
valuestringThe text to append.
storageFileStorageFileThe storage file to append to.
Returns
GetCommonSettings(string, bool)
Gets a common settings value for the specified key.
public abstract StorageFolder GetCommonSettings(string key, bool isCrypted = true)
Parameters
Returns
- StorageFolder
The common settings value.
GetFile(AppFolders, string)
Gets the file path for the specified file in the given application folder. Automatically creates the parent folder if it does not exist.
public abstract StorageFile GetFile(AppFolders appFolders, string fileName)
Parameters
appFoldersAppFoldersThe application folder category.
fileNamestringThe file name.
Returns
- StorageFile
The storage file path.
GetFileString(string, string, bool)
Gets the file path as a string for the specified application folder name and file name.
public abstract StorageFile GetFileString(string appFolderName, string fileName, bool isUsingParentAppFolder = false)
Parameters
appFolderNamestringThe application folder name as a string.
fileNamestringThe file name.
isUsingParentAppFolderboolWhether to use the parent application root folder.
Returns
- StorageFile
The file path as a string.
GetRootFolder(string)
Gets the root folder for the application with the specified name.
public abstract StorageFolder GetRootFolder(string appName)
Parameters
appNamestringThe application name.
Returns
- StorageFolder
The root folder for the application.
IsRootFolderNull()
Checks whether the root folder is null or empty.
public abstract bool IsRootFolderNull()
Returns
- bool
True if the root folder is null or empty; otherwise false.
IsRootFolderOk()
Checks whether the root folder exists in the file system. If rootFolder is empty or null, returns false.
public abstract bool IsRootFolderOk()
Returns
- bool
True if the root folder exists; otherwise false.
ReadFileOfSettingsDirectoryOrFile(string)
Reads a settings file value for a directory or file key. If the file does not exist, creates it with empty content.
public string ReadFileOfSettingsDirectoryOrFile(string key)
Parameters
keystringThe settings key.
Returns
- string
The settings value.
ReadFileOfSettingsOther(string)
Reads a string settings value for the specified key from loaded settings.
public string ReadFileOfSettingsOther(string key)
Parameters
keystringThe settings key.
Returns
- string
The settings value.
SaveFile(string, StorageFile)
Saves the specified content to the given storage file.
protected abstract Task SaveFile(string content, StorageFile storageFile)
Parameters
contentstringThe text content to save.
storageFileStorageFileThe storage file to save to.
Returns
SetCommonSettings(string, string)
Sets a common settings value for the specified key.
public abstract void SetCommonSettings(string key, string value)