public static void SaveConfiguration(InstanceConfiguration configuration) { CheckLoaded(); _instances.Clear(); foreach (ServerConfiguration instance in configuration.Instances.Values) { _instances.Add(instance); } Save(); }
public static InstanceConfiguration LoadConfiguration() { InstanceConfiguration configuration = new InstanceConfiguration(); Load(); foreach (ServerConfiguration instance in _instances.Values) { configuration.Instances.Add(instance); } return(configuration); }
public static void Load() { Reset(); // Load Machine Instances InstanceConfiguration machineConfiguration = LoadMachineInstanceConfiguration(); foreach (ServerConfiguration instance in machineConfiguration.Instances.Values) { _instances.Add(instance); } }
public static void Save() { CheckLoaded(); InstanceConfiguration machineConfiguration = new InstanceConfiguration(); foreach (ServerConfiguration instance in _instances.Values) { machineConfiguration.Instances.Add(instance); } SaveMachineInstanceConfiguration(machineConfiguration); }
/// <summary> Loads a new Instance configuration. </summary> /// <remarks> Creates a default Instance configuration if the file doesn't exist. </remarks> public static InstanceConfiguration Load(string fileName) { InstanceConfiguration configuration = new InstanceConfiguration(); if (File.Exists(fileName)) { using (Stream stream = File.OpenRead(fileName)) { new Deserializer().Deserialize(stream, configuration); } } return(configuration); }
private static void SaveMachineInstanceConfiguration(InstanceConfiguration configuration) { configuration.Save(GetMachineInstanceConfigurationFileName()); }
private static InstanceConfiguration LoadMachineInstanceConfiguration() { return(InstanceConfiguration.Load(GetMachineInstanceConfigurationFileName())); }