Example #1
0
 public void Dispose()
 {
     if (Storage != null)
     {
         Storage.Dispose();
         Storage = null;
     }
 }
Example #2
0
        public void CreateFileStorage(string storagePath)
        {
            if (!File.Exists(storagePath))
            {
                Storage = new SolFS.SolFSStorage(storagePath, true, 512, false, false, '\\', "SolFS Explorer sample storage",
                                                 new SolFSCreateFileEvent(OnCreateFile),
                                                 new SolFSOpenFileEvent(OnOpenFile),
                                                 new SolFSCloseFileEvent(OnCloseFile),
                                                 new SolFSFlushFileEvent(OnFlushFile),
                                                 new SolFSDeleteFileEvent(OnDeleteFile),
                                                 new SolFSGetFileSizeEvent(OnGetFileSize),
                                                 new SolFSSetFileSizeEvent(OnSetFileSize),
                                                 new SolFSSeekFileEvent(OnSeekFile),
                                                 new SolFSReadFileEvent(OnReadFile),
                                                 new SolFSWriteFileEvent(OnWriteFile));
            }
            else
            {
                Storage = new SolFS.SolFSStorage();

                Storage.FileName        = storagePath;
                Storage.UseTransactions = true;
                Storage.PathSeparator   = '\\';
                Storage.UseTransactions = false;
                Storage.UseAccessTime   = false;

                Storage.OnHashCalculate = new SolFS.SolFSCalculateHashEvent(Sample_CalculateHash);
                Storage.OnHashValidate  = new SolFS.SolFSValidateHashEvent(Sample_ValidateHash);
                Storage.OnDataEncrypt   = new SolFS.SolFSCryptDataEvent(Sample_EncryptData);
                Storage.OnDataDecrypt   = new SolFS.SolFSCryptDataEvent(Sample_DecryptData);

                Storage.Open(StorageOpenMode.somOpenExisting);
            }
            //Storage = new SolFS.SolFSStorage(storagePath,
            //              false,
            //              false,
            //              '\\',
            //              false,
            //              new SolFSCreateFileEvent(OnCreateFile),
            //              new SolFSOpenFileEvent(OnOpenFile),
            //              new SolFSCloseFileEvent(OnCloseFile),
            //              new SolFSFlushFileEvent(OnFlushFile),
            //              new SolFSDeleteFileEvent(OnDeleteFile),
            //              new SolFSGetFileSizeEvent(OnGetFileSize),
            //              new SolFSSetFileSizeEvent(OnSetFileSize),
            //              new SolFSSeekFileEvent(OnSeekFile),
            //              new SolFSReadFileEvent(OnReadFile),
            //              new SolFSWriteFileEvent(OnWriteFile));
        }