static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Usage:"); Console.WriteLine(" gvas-converter path_to_save_file|path_to_json"); return; } var ext = Path.GetExtension(args[0]).ToLower(); if (ext == ".json") { Console.WriteLine("Not implemented atm"); } else { Console.WriteLine("Parsing UE4 save file structure..."); Gvas save; using (var stream = File.Open(args[0], FileMode.Open, FileAccess.Read, FileShare.Read)) save = UESerializer.Read(stream); Console.WriteLine("Converting to json..."); var json = JsonConvert.SerializeObject(save, new JsonSerializerSettings { Formatting = Formatting.Indented }); Console.WriteLine("Saving json..."); using (var stream = File.Open(args[0] + ".json", FileMode.Create, FileAccess.Write, FileShare.Read)) using (var writer = new StreamWriter(stream, new UTF8Encoding(false))) writer.Write(json); } Console.WriteLine("Done."); Console.ReadKey(true); }
static void Main(string[] args) { Console.WriteLine(); Console.WriteLine(@" __ __"); Console.WriteLine(@" /__ \ / /\ (_ "); Console.WriteLine(@" \_| \/ /--\ __) v" + GetAppVersion()); Console.WriteLine(); if (args.Length != 1) { Console.WriteLine(); Console.WriteLine("Usage:"); Console.WriteLine(); Console.WriteLine(" gvas-converter [path_to_save_file]"); Console.WriteLine(); return; } Console.WriteLine("Parsing UE4 save file structure..."); Gvas save; if (!File.Exists(args[0])) { Console.WriteLine("Error: File not found"); return; } using (var stream = File.Open(args[0], FileMode.Open, FileAccess.Read, FileShare.Read)) save = UESerializer.Read(stream); Console.WriteLine("Converting to JSON..."); var json = JsonConvert.SerializeObject(save, new JsonSerializerSettings { Formatting = Formatting.Indented }); Console.WriteLine("Saving JSON..."); using (var stream = File.Open(args[0] + ".json", FileMode.Create, FileAccess.Write, FileShare.Read)) using (var writer = new StreamWriter(stream, new UTF8Encoding(false))) writer.Write(json); Console.WriteLine("Done"); Console.ReadKey(true); }
static void ReadSave(FileInfo file) { var bytes = ReadBytes(file.FullName); var parsedFile = new SaveFile(file, bytes); Console.WriteLine($"{bytes.Length} bytes in {file.Name}: {bytes[0]}, {bytes[1]}, {bytes[2]}, {bytes[3]}"); Gvas save; using (var stream = File.Open(file.FullName, FileMode.Open, FileAccess.Read, FileShare.Read)) save = UESerializer.Read(stream); var json = JsonConvert.SerializeObject(save, new JsonSerializerSettings { Formatting = Formatting.Indented }); using (var stream = File.Open(file.FullName + ".json", FileMode.Create, FileAccess.Write, FileShare.Read)) using (var writer = new StreamWriter(stream, new UTF8Encoding(false))) writer.Write(json); //Console.WriteLine(FormatSave(parsedFile.Text)); }
static void Main(string[] args) { if (args.Length != 2) { Console.WriteLine("Usage:"); Console.WriteLine(" gvas-converter infile outfile"); return; } var ext = Path.GetExtension(args[0]).ToLower(); if (ext == ".json") { Console.WriteLine("Loading json..."); Gvas data = JsonConvert.DeserializeObject <Gvas>(File.ReadAllText(args[0]), new GvasJsonConverter()); var stream = File.Open(args[1], FileMode.Create, FileAccess.Write); Console.WriteLine("Converting and saving file..."); UESerializer.Write(stream, data); } else { Console.WriteLine("Parsing UE4 save file structure..."); Gvas save; using (var stream = File.Open(args[0], FileMode.Open, FileAccess.Read, FileShare.Read)) save = UESerializer.Read(stream); Console.WriteLine("Converting to json..."); var json = JsonConvert.SerializeObject(save, new JsonSerializerSettings { Formatting = Formatting.Indented }); Console.WriteLine("Saving json..."); using (var stream = File.Open(args[1], FileMode.Create, FileAccess.Write, FileShare.Read)) using (var writer = new StreamWriter(stream, new UTF8Encoding(false))) writer.Write(json); } Console.WriteLine("Done."); }
private void LoadPlaylist(object sender, EventArgs e) { var fd = new OpenFileDialog(); fd.DefaultExt = "plo"; fd.AddExtension = true; fd.Filter = "Playlist (*.plo) | *.plo"; var res = fd.ShowDialog(); if (res.Accept()) { try { using (var stream = File.Open(fd.FileName, FileMode.Open, FileAccess.Read, FileShare.Read)) _playlist = UESerializer.Read(stream); } catch { _playlist = null; new UserMessages().InvalidIO(); } if (_playlist != null && PlaylistScenarios.Items.Count() > 0) { _playlistPath = fd.FileName; _shuffledPlaylist = new KovaakHandler().ImportPlaylist(PlaylistScenarios.Items); _importedListPlaylist = new GroupUtil().UngroupBySame(_shuffledPlaylist); _playlistNameTextbox.Text = $"{PlaylistName.Value} - Shuffled"; UpdateProgramState(); } } else { new UserMessages().InvalidIO(); } }