示例#1
0
 static ClientServices()
 {
     OldMessages = new List<string>();
     ConfigName = "";
     IsRunning = true;
     CurrentInstance = null;
     CurrentRenderProcess = null;
     Settings = new ClientSettings();
 }
示例#2
0
        public static ClientSettings LoadSettings()
        {
            string settingsFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Amleto");
            Directory.CreateDirectory(settingsFile);
            settingsFile = Path.Combine(settingsFile, "ClientSettings.xml");
            ClientSettings settings = new ClientSettings();

            try
            {
                if (File.Exists(settingsFile))
                {
                    XmlSerializer serializer = new XmlSerializer(settings.GetType());
                    TextReader reader = new StreamReader(settingsFile);
                    object deserialised = serializer.Deserialize(reader);
                    reader.Close();

                    settings = (ClientSettings) deserialised;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Unable to load ClientSettings.xml");
            }
            return settings;
        }
示例#3
0
        public static void SaveSettings(ClientSettings settings)
        {
            try
            {
                string settingsFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Amleto");
                settingsFile = Path.Combine(settingsFile, "ClientSettings.xml");

                XmlSerializer seriaizer = new XmlSerializer(settings.GetType());
                TextWriter writer = new StreamWriter(settingsFile);
                seriaizer.Serialize(writer, settings);
                writer.Close();
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Unable to save ClientSettings.xml");
            }
        }
示例#4
0
 /// <summary>
 /// Gets the configuration settings from the registry
 /// </summary>
 public static void RestoreSettings()
 {
     Settings = ClientSettings.LoadSettings();
 }