public static void Create(string fileStorageName, List<FileStorageFeatureEnum> fileStorageFeatures, CreateFileStorageBehaviour createFileStorageBehaviour) { string indexFilename = FilenameFactory.GetFileStorageIndexFilename(fileStorageName); string dataFilename = FilenameFactory.GetFileStorageDataFilename(fileStorageName); switch (createFileStorageBehaviour) { case CreateFileStorageBehaviour.IgnoreWhenExists: if (!File.Exists(indexFilename)) { CreateNewFileStorage_IndexFile(indexFilename); } if (!File.Exists(dataFilename)) { CreateNewFileStorage_DataFile(dataFilename, fileStorageFeatures); } break; case CreateFileStorageBehaviour.ThrowExceptionWhenExists: if (File.Exists(indexFilename)) { throw new Exception(string.Format("Index file {0} already exists", indexFilename)); } if (File.Exists(dataFilename)) { throw new Exception(string.Format("Data file {0} already exists", dataFilename)); } CreateNewFileStorage_IndexFile(indexFilename); CreateNewFileStorage_DataFile(dataFilename, fileStorageFeatures); break; default: throw new NotSupportedException(string.Format("Unsupported creation behaviour {0}", createFileStorageBehaviour)); } }
public static void Create(string fileStorageName, CreateFileStorageBehaviour createFileStorageBehaviour) { FileStorageHandler.Create(fileStorageName, FileStorageFeatureFactory.GetDefaultFeatures(), createFileStorageBehaviour); }