示例#1
0
 static public void Save(string storageDir = null)
 {
     storageDir = storageDir != null ? storageDir : DefaultStorageDir;
     if (ReadOnly && PathRoutines.ArePathsEqual(storageDir, StorageDir))
     {
         throw new Exception("Config is read-only and cannot be saved to the same location.");
     }
     StorageDir = storageDir;
     lock (objectFullNames2serializable)
     {
         foreach (Serializable s in objectFullNames2serializable.Values)
         {
             s.Save(StorageDir + System.IO.Path.DirectorySeparatorChar + PathRoutines.GetFileNameFromPath(s.__File));
         }
     }
 }
示例#2
0
 static public void CopyFiles(string toDirectory)
 {
     lock (objectFullNames2serializable)
     {
         string d = FileSystemRoutines.CreateDirectory(toDirectory + System.IO.Path.DirectorySeparatorChar + CONFIG_FOLDER_NAME);
         foreach (Serializable s in objectFullNames2serializable.Values)
         {
             if (File.Exists(s.__File))//it can be absent if default settings used still
             {
                 File.Copy(s.__File, d + System.IO.Path.DirectorySeparatorChar + PathRoutines.GetFileNameFromPath(s.__File));
             }
         }
     }
 }