private static void Serialize(RealTimeConfig config) { var serializer = new XmlSerializer(typeof(RealTimeConfig)); using (var sw = new StreamWriter(SettingsFileName)) { serializer.Serialize(sw, config); } }
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); } }
/// <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); } }