Пример #1
0
 public void SetStatusLogger(ProgressDialogStatusLogger status)
 {
     if (OnFinishToRun != null)
     {
         OnFinishToRun.StatusLogger = status;
     }
     StatusLogger = status;
 }
Пример #2
0
 public void LoadDatabase(IOConnectionInfo ioConnectionInfo, MemoryStream memoryStream, CompositeKey compKey, ProgressDialogStatusLogger statusLogger, IDatabaseFormat databaseFormat)
 {
     _db.LoadData(this, ioConnectionInfo, memoryStream, compKey, statusLogger, databaseFormat);
 }
Пример #3
0
 protected virtual void PopulateDatabaseFromStream(PwDatabase pwDatabase, Stream s, IOConnectionInfo iocInfo, CompositeKey compositeKey, ProgressDialogStatusLogger status, IDatabaseFormat databaseFormat)
 {
     IFileStorage fileStorage = _app.GetFileStorage(iocInfo);
     var filename = fileStorage.GetFilenameWithoutPathAndExt(iocInfo);
     pwDatabase.Open(s, filename, iocInfo, compositeKey, status, databaseFormat);
 }
Пример #4
0
        /// <summary>
        /// Do not call this method directly. Call App.Kp2a.LoadDatabase instead.
        /// </summary>
        public void LoadData(IKp2aApp app, IOConnectionInfo iocInfo, MemoryStream databaseData, CompositeKey compositeKey, ProgressDialogStatusLogger status, IDatabaseFormat databaseFormat)
        {
            PwDatabase pwDatabase = new PwDatabase();

            IFileStorage fileStorage = _app.GetFileStorage(iocInfo);
            Stream s = databaseData ?? fileStorage.OpenFileForRead(iocInfo);
            var fileVersion = _app.GetFileStorage(iocInfo).GetCurrentFileVersionFast(iocInfo);
            PopulateDatabaseFromStream(pwDatabase, s, iocInfo, compositeKey, status, databaseFormat);
            try
            {
                LastFileVersion = fileVersion;

                status.UpdateSubMessage("");

                Root = pwDatabase.RootGroup;
                PopulateGlobals(Root);

                Loaded = true;
                KpDatabase = pwDatabase;
                SearchHelper = new SearchDbHelper(app);

                _databaseFormat = databaseFormat;

                CanWrite = databaseFormat.CanWrite && !fileStorage.IsReadOnly(iocInfo);
            }
            catch (Exception)
            {
                Clear();
                throw;
            }
        }