public static void Deserialize(string filename, out Launch launch) { var settings = File.ReadAllText(filename); if (!settings.StartsWith("[VERSN1]")) { throw new InvalidVersionException(1); } settings = settings[8..].Replace(@"\", @"\\");
public static void Serialize(string filename, Launch launch) { var settings = JsonSerializer.Serialize(launch, options); settings = settings.Replace(@"\\", @"\"); using var sw = new StreamWriter(File.Open(filename, FileMode.Create)); sw.WriteLine("[VERSN1]"); sw.WriteLine(); sw.Write(settings); sw.WriteLine(); }