System.IO.IsolatedStorage.IsolatedStorageFile.IncreaseQuotaTo C# (CSharp) Method

IncreaseQuotaTo() public method

public IncreaseQuotaTo ( long newQuotaSize ) : bool
newQuotaSize long
return bool
        public override bool IncreaseQuotaTo(long newQuotaSize) { throw null; }
        public void MoveDirectory(string sourceDirectoryName, string destinationDirectoryName) { }

Usage Example

Esempio n. 1
0
        /// <summary>
        /// 申请500M的存储空间
        /// </summary>
        /// <returns></returns>
        public static bool IncreaseQuotaTo()
        {
            //如果本函数代码断点调试将不能正常执行。申请缓存对话框将不能阻塞。
            long StorageSpace          = 200 * 1024 * 1024; //申请空间大小
            long IncreaseSpace         = 100 * 1024 * 1024; //增量空间
            long MinAvailableFreeSpace = 10 * 1024 * 1024;  //最小可用空间

            try
            {
                lock (lockStorageObject)
                {
                    using (System.IO.IsolatedStorage.IsolatedStorageFile file = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForSite())
                    {
                        if (file.Quota < StorageSpace)
                        {
                            return(file.IncreaseQuotaTo(StorageSpace));
                        }
                        else if (file.AvailableFreeSpace < MinAvailableFreeSpace)
                        {
                            return(file.IncreaseQuotaTo(file.Quota + IncreaseSpace));
                        }
                    }
                }
                return(true);
            }
            catch (System.IO.IsolatedStorage.IsolatedStorageException)
            {
                return(false);
            }
        }
All Usage Examples Of System.IO.IsolatedStorage.IsolatedStorageFile::IncreaseQuotaTo