Exemplo n.º 1
0
 public static void SaveConfiguration(InstanceConfiguration configuration)
 {
     CheckLoaded();
     _instances.Clear();
     foreach (ServerConfiguration instance in configuration.Instances.Values)
     {
         _instances.Add(instance);
     }
     Save();
 }
Exemplo n.º 2
0
        public static InstanceConfiguration LoadConfiguration()
        {
            InstanceConfiguration configuration = new InstanceConfiguration();

            Load();
            foreach (ServerConfiguration instance in _instances.Values)
            {
                configuration.Instances.Add(instance);
            }
            return(configuration);
        }
Exemplo n.º 3
0
        public static void Load()
        {
            Reset();

            // Load Machine Instances
            InstanceConfiguration machineConfiguration = LoadMachineInstanceConfiguration();

            foreach (ServerConfiguration instance in machineConfiguration.Instances.Values)
            {
                _instances.Add(instance);
            }
        }
Exemplo n.º 4
0
        public static void Save()
        {
            CheckLoaded();

            InstanceConfiguration machineConfiguration = new InstanceConfiguration();

            foreach (ServerConfiguration instance in _instances.Values)
            {
                machineConfiguration.Instances.Add(instance);
            }

            SaveMachineInstanceConfiguration(machineConfiguration);
        }
Exemplo n.º 5
0
        /// <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);
        }
Exemplo n.º 6
0
 private static void SaveMachineInstanceConfiguration(InstanceConfiguration configuration)
 {
     configuration.Save(GetMachineInstanceConfigurationFileName());
 }
Exemplo n.º 7
0
 private static InstanceConfiguration LoadMachineInstanceConfiguration()
 {
     return(InstanceConfiguration.Load(GetMachineInstanceConfigurationFileName()));
 }