Esempio n. 1
0
        private static void Serialize(RealTimeConfig config)
        {
            var serializer = new XmlSerializer(typeof(RealTimeConfig));

            using (var sw = new StreamWriter(SettingsFileName))
            {
                serializer.Serialize(sw, config);
            }
        }
Esempio n. 2
0
 public static void SaveConfiguration(RealTimeConfig config)
 {
     try
     {
         Serialize(config);
     }
     catch (Exception ex)
     {
         Log.Error("The 'Real Time' mod cannot save its configuration, error message: " + ex.Message);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Stores the provided <paramref name="config"/> object to the storage.
        /// </summary>
        ///
        /// <exception cref="ArgumentNullException">Thrown when the argument is null.</exception>
        ///
        /// <param name="config">A <see cref="RealTimeConfig"/> object to store.</param>
        public static void SaveConfiguration(RealTimeConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            try
            {
                Serialize(config);
            }
            catch (Exception ex)
            {
                Log.Error("The 'Real Time' mod cannot save its configuration, error message: " + ex);
            }
        }