Exemplo n.º 1
0
 /// <summary>
 /// Releases unmanaged and - optionally - managed resources
 /// </summary>
 /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         DirectoryInfo dir = new DirectoryInfo(mStoragePath);
         try
         {
             foreach (FileInfo f in dir.GetFiles())
             {
                 try
                 {
                     f.Delete();
                 }
                 catch (Exception ex)
                 {
                     if (LOGGER.IsErrorEnabled)
                     {
                         LOGGER.Error(String.Format("Failed to delete a persistent file: {0}", f.FullName), ex);
                     }
                 }
             }
             dir.Delete();
         }
         catch (Exception ex)
         {
             if (LOGGER.IsErrorEnabled)
             {
                 LOGGER.Error(String.Format("Failed to delete a persistent folder: {0}", dir.FullName), ex);
             }
         }
     }
     mAllocationTable = null;
     mTableFormatter  = null;
     base.Dispose(disposing);
 }
Exemplo n.º 2
0
        private void LoadAllocationTable()
        {
            FileInfo fi = new FileInfo(mTableFile);

            if (fi.Exists)
            {
                try
                {
                    mAllocationTable = SerializationHelper.Read <ItemAllocationTable>(fi, mTableFormatter, false);
                }
                catch (Exception ex)
                {
                    throw new Exception("Unable to read allocation table. Invalid file.", ex);
                }
            }
            else
            {
                mAllocationTable = new ItemAllocationTable();
            }
        }