예제 #1
0
        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(@"\", @"\\");
예제 #2
0
        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();
        }