示例#1
0
 private void SetupStoreFile(string storePath, string storeFileName, Sop.Profile fileConfig)
 {
     // sample storePath and storeFilename:
     // storePath = "MyStore", storeFilename = null
     // storePath = "MyDataFile/MyStore", storeFilename = "f://CacheData/MyDataFile.dta"
     // storePath = "MyDataFile/MyStore", storeFilename = null
     if (!string.IsNullOrWhiteSpace(storeFileName))
     {
         // if File was referenced in the storePath && the storeFilename was specified,
         // configure/create this File to contain the Store.
         string[] parts;
         if (!_server.StoreNavigator.TryParse(storePath, out parts))
         {
             throw new ArgumentException(string.Format("storePath {0} is not a valid Store URI path.", storePath));
         }
         if (parts.Length > 1)
         {
             var f = _server.GetFile(parts[0]);
             if (f == null)
             {
                 // delete the storeFilename if it exists but is not registered in the SystemFile...
                 if (Sop.Utility.Utility.FileExists(storeFileName))
                 {
                     Sop.Utility.Utility.FileDelete(storeFileName);
                 }
             }
             // create the storeFilename and use it to contain the Store referenced in storePath.
             _server.FileSet.Add(parts[0], storeFileName, fileConfig);
         }
     }
 }