public Task <UInt64> GetFreeSpace() { // var personalFolder = NSFileManager.DefaultManager.GetFileSystemAttributes(Environment.GetFolderPath(Environment.SpecialFolder.Personal)); NSFileSystemAttributes applicationFolder = NSFileManager.DefaultManager.GetFileSystemAttributes(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)); var freeSpace = applicationFolder.FreeSize; var totalSpace = applicationFolder.Size; return(Task.FromResult(applicationFolder.FreeSize)); }
public StorageInfo GetStorage() { StorageInfo storageInfo = new StorageInfo(); NSFileSystemAttributes values = NSFileManager.DefaultManager.GetFileSystemAttributes(Environment.GetFolderPath(Environment.SpecialFolder.Personal)); storageInfo.LocalStorage.TotalSpace = values.Size; storageInfo.LocalStorage.FreeSpace = values.FreeSize; storageInfo.LocalStorage.AvailableSpace = values.FreeSize; return(storageInfo); }
public ulong GetAvailableDiskSpace(FolderUri uri) { ulong totalFreeSpace = 0; // Use below as suggested by Miguel de Icaza :) NSFileSystemAttributes values = NSFileManager.DefaultManager.GetFileSystemAttributes(uri.AbsolutePath); totalFreeSpace = values.FreeSize; return(totalFreeSpace); }
public static NSFileSystemAttributes GetFileSystemAttributesForRoot() { IntPtr fileSystemAttributes = GetFileSystemAttributes(GetDefaultFileManager(), "/"); NSFileSystemAttributes result = null; if (fileSystemAttributes != IntPtr.Zero) { result = NSFileSystemAttributes.FromDictionary(fileSystemAttributes); } return(result); }
internal static NSFileSystemAttributes FromDictionary(IntPtr dict) { if (dict == IntPtr.Zero) { return(null); } NSFileSystemAttributes nSFileSystemAttributes = new NSFileSystemAttributes(); IntPtr intPtr = NSString.CreateNative("NSFileSystemSize", false); nSFileSystemAttributes.Size = (Fetch_ulong(dict, intPtr) ?? 0); NSString.ReleaseNative(intPtr); intPtr = NSString.CreateNative("NSFileSystemFreeSize", false); nSFileSystemAttributes.FreeSize = (Fetch_ulong(dict, intPtr) ?? 0); NSString.ReleaseNative(intPtr); return(nSFileSystemAttributes); }