public string WriteOutput(string input) { Console.WriteLine(input); Wrote?.Invoke(this, new ConsoleEventArgs { Message = input }); return(input); }
public static void Write() { var bytes = MessagePackSerializer.Serialize(MainWindow.MainViewModel); if (!Directory.Exists(PATH)) { Directory.CreateDirectory(PATH); } File.WriteAllBytes(FILEPATH, bytes); Wrote?.Invoke(bytes); }
/// <summary> /// Writes the settings. /// </summary> public void Write() { try { // valide settings values Validate(); // write settings values using (var stream = new FileStream(Target, FileMode.Create, FileAccess.Write)) { var serializer = new DataContractJsonSerializer(typeof(UserSettings)); serializer.WriteObject(stream, this); } Wrote?.Invoke(this, EventArgs.Empty); } catch (Exception exception) { throw new InvalidOperationException("failed to save settings", exception); } }