Example #1
0
 public static MasterFile Create(IPersistenceManager persistenceManager, string directoryPath,
                                 StoreConfiguration storeConfiguration, Guid storeSetId)
 {
     var masterFilePath = Path.Combine(directoryPath, MasterFileName);
     if (persistenceManager.FileExists(masterFilePath))
     {
         throw new StoreManagerException(directoryPath, "Master file already exists");
     }
     persistenceManager.CreateFile(masterFilePath);
     using (var stream = persistenceManager.GetOutputStream(masterFilePath, FileMode.Open))
     {
         var newMaster = new MasterFile(persistenceManager, directoryPath, masterFilePath, storeConfiguration,
                                        storeSetId);
         newMaster.Save(stream);
         return newMaster;
     }
 }
Example #2
0
        public static MasterFile Open(IPersistenceManager persistenceManager, string directoryPath)
        {
            var masterFilePath = Path.Combine(directoryPath, MasterFileName);

            if (!persistenceManager.FileExists(masterFilePath))
            {
                throw new StoreManagerException(directoryPath, "Master file not found");
            }
            var mf = new MasterFile(persistenceManager, directoryPath, masterFilePath,
                                    StoreConfiguration.DefaultStoreConfiguration, Guid.Empty);

            using (var mfStream = persistenceManager.GetInputStream(masterFilePath))
            {
                mf.Load(mfStream);
            }
            return(mf);
        }
Example #3
0
        public static MasterFile Create(IPersistenceManager persistenceManager, string directoryPath,
                                        StoreConfiguration storeConfiguration, Guid storeSetId)
        {
            var masterFilePath = Path.Combine(directoryPath, MasterFileName);

            if (persistenceManager.FileExists(masterFilePath))
            {
                throw new StoreManagerException(directoryPath, "Master file already exists");
            }
            persistenceManager.CreateFile(masterFilePath);
            using (var stream = persistenceManager.GetOutputStream(masterFilePath, FileMode.Open))
            {
                var newMaster = new MasterFile(persistenceManager, directoryPath, masterFilePath, storeConfiguration,
                                               storeSetId);
                newMaster.Save(stream);
                return(newMaster);
            }
        }
Example #4
0
        public static MasterFile Open(IPersistenceManager persistenceManager, string directoryPath)
        {
            var masterFilePath = Path.Combine(directoryPath, MasterFileName);
            var mf             = new MasterFile(persistenceManager, directoryPath, masterFilePath,
                                                StoreConfiguration.DefaultStoreConfiguration, Guid.Empty);

            try
            {
                using (var mfStream = persistenceManager.GetInputStream(masterFilePath))
                {
                    mf.Load(mfStream);
                }
            }
            catch (Exception ex)
            {
                throw new StoreManagerException(directoryPath, "Error opening master file. " + ex.Message);
            }
            return(mf);
        }
Example #5
0
 public static MasterFile Open(IPersistenceManager persistenceManager, string directoryPath)
 {
     var masterFilePath = Path.Combine(directoryPath, MasterFileName);
     if (!persistenceManager.FileExists(masterFilePath))
     {
         throw new StoreManagerException(directoryPath, "Master file not found");
     }
     var mf = new MasterFile(persistenceManager, directoryPath, masterFilePath,
                             StoreConfiguration.DefaultStoreConfiguration, Guid.Empty);
     using (var mfStream = persistenceManager.GetInputStream(masterFilePath))
     {
         mf.Load(mfStream);
     }
     return mf;
 }
Example #6
0
 public static MasterFile Open(IPersistenceManager persistenceManager, string directoryPath)
 {
     var masterFilePath = Path.Combine(directoryPath, MasterFileName);
     var mf = new MasterFile(persistenceManager, directoryPath, masterFilePath,
                             StoreConfiguration.DefaultStoreConfiguration, Guid.Empty);
     try
     {
         using (var mfStream = persistenceManager.GetInputStream(masterFilePath))
         {
             mf.Load(mfStream);
         }
     }
     catch (Exception ex)
     {
         throw new StoreManagerException(directoryPath, "Error opening master file. " + ex.Message);
     }
     return mf;
 }