Exemple #1
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
            public static NSFileSystemAttributes GetFileSystemAttributesForRoot()
            {
                IntPtr fileSystemAttributes   = GetFileSystemAttributes(GetDefaultFileManager(), "/");
                NSFileSystemAttributes result = null;

                if (fileSystemAttributes != IntPtr.Zero)
                {
                    result = NSFileSystemAttributes.FromDictionary(fileSystemAttributes);
                }
                return(result);
            }
Exemple #5
0
                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);
                }