예제 #1
0
        private static void Serialize(RealTimeConfig config)
        {
            var serializer = new XmlSerializer(typeof(RealTimeConfig));

            using (var sw = new StreamWriter(SettingsFileName))
            {
                serializer.Serialize(sw, config);
            }
        }
예제 #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);
     }
 }
예제 #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);
            }
        }