Пример #1
0
        internal void Unreserve(ulong lFree, ulong quota) {
            if (IsRoaming())  // No Quota enforcement for roaming 
                return;

            ulong free = lFree;
 
            lock (m_internalLock) {
                if (m_bDisposed) 
                    throw new ObjectDisposedException(null, Environment.GetResourceString("IsolatedStorage_StoreNotOpen")); 

                if (m_closed) 
                    throw new InvalidOperationException(
                        Environment.GetResourceString(
                            "IsolatedStorage_StoreNotOpen"));
 
                if (InvalidFileHandle)
                    m_handle = Open(m_InfoFile, GetSyncObjectName()); 
 
                Reserve(m_handle, quota, free, true);
            } 
        }
 internal static extern bool GetQuota(SafeIsolatedStorageFileHandle scope, out long quota);
Пример #3
0
 protected override bool ReleaseHandle()
 {
     SafeIsolatedStorageFileHandle.Close(this.handle);
     return(true);
 }
 internal void Unreserve(ulong lFree, ulong quota)
 {
     if (!base.IsRoaming())
     {
         ulong plReserve = lFree;
         lock (this.m_internalLock)
         {
             if (this.m_bDisposed)
             {
                 throw new ObjectDisposedException(null, Environment.GetResourceString("IsolatedStorage_StoreNotOpen"));
             }
             if (this.m_closed)
             {
                 throw new InvalidOperationException(Environment.GetResourceString("IsolatedStorage_StoreNotOpen"));
             }
             if (this.InvalidFileHandle)
             {
                 this.m_handle = Open(this.m_InfoFile, this.GetSyncObjectName());
             }
             Reserve(this.m_handle, quota, plReserve, true);
         }
     }
 }
 private void UpdateQuotaFromInfoFile()
 {
     bool locked = false;
     RuntimeHelpers.PrepareConstrainedRegions();
     try
     {
         this.Lock(ref locked);
         lock (this.m_internalLock)
         {
             if (this.InvalidFileHandle)
             {
                 this.m_handle = Open(this.m_InfoFile, this.GetSyncObjectName());
             }
             long quota = 0L;
             if (GetQuota(this.m_handle, out quota))
             {
                 base.Quota = quota;
             }
         }
     }
     finally
     {
         if (locked)
         {
             this.Unlock();
         }
     }
 }
 internal void Unlock()
 {
     if (!base.IsRoaming())
     {
         lock (this.m_internalLock)
         {
             if (this.m_bDisposed)
             {
                 throw new ObjectDisposedException(null, Environment.GetResourceString("IsolatedStorage_StoreNotOpen"));
             }
             if (this.m_closed)
             {
                 throw new InvalidOperationException(Environment.GetResourceString("IsolatedStorage_StoreNotOpen"));
             }
             if (this.InvalidFileHandle)
             {
                 this.m_handle = Open(this.m_InfoFile, this.GetSyncObjectName());
             }
             Lock(this.m_handle, false);
         }
     }
 }
 internal static extern void SetQuota(SafeIsolatedStorageFileHandle scope, long quota);
 internal static extern void Reserve(SafeIsolatedStorageFileHandle handle, ulong plQuota, ulong plReserve, [MarshalAs(UnmanagedType.Bool)] bool fFree);
 internal static extern bool Lock(SafeIsolatedStorageFileHandle handle, [MarshalAs(UnmanagedType.Bool)] bool fLock);
 internal static extern ulong GetUsage(SafeIsolatedStorageFileHandle handle);