Beispiel #1
0
        /// <summary>
        ///  Load the document store from workspace volume
        /// </summary>
        /// <param name="workspaceFolder">Workspace location</param>
        public DocumentStoreModel LoadStore(string workspaceFolder)
        {
            if (_storeIndex == null)
            {
                this._storeIndex = new DocumentIndex(workspaceFolder);

            }

            DocumentStoreModel docStore = new DocumentStoreModel();

            documentLocationFile = Path.Combine(workspaceFolder, "DocumentStore.lucy");
            documentLocationDocFile = Path.Combine(workspaceFolder, "DocumentStoreDoc.lucy");


            if (File.Exists(documentLocationFile))
            {
                using (Stream stream = File.Open(documentLocationFile, FileMode.Open))
                {
                    docStore = (DocumentStoreModel)serializer.Deserialize(stream);
                }
                using (Stream stream = File.Open(documentLocationDocFile, FileMode.Open))
                {
                    _storeIndex.DocumentIdentity = (List<DocumentIdentity>)serializerIndex.Deserialize(stream);
                }

            }
            

            this._storeIndex.PluginManager = new PluginManager();
            _storeIndex.PluginManager.Load();

            return docStore;
        }
Beispiel #2
0
        /// <summary>
        /// Save de document store to the workspace volume
        /// </summary>
        public void SaveStore(DocumentStoreModel model)
        {

            using (Stream stream = File.Open(documentLocationFile, FileMode.Create))
            {
                serializer.Serialize(stream, model);
            }
            using (Stream stream = File.Open(documentLocationDocFile, FileMode.Create))
            {
                serializerIndex .Serialize(stream, _storeIndex.DocumentIdentity);
            }

        }
 /// <summary>
 /// Handle the document store loading
 /// </summary>
 public void OnLoadDocumentStore()
 {
     StoreModel = this._documentStoreService.LoadStore(this._workspaceLocation);
 }