Skip to content

Commit

Permalink
Update debug runner
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchLeaders committed Apr 23, 2024
1 parent e291a21 commit 2f88d2a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
33 changes: 23 additions & 10 deletions src/MessageStudio.Runner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,27 @@

#else

// using MessageStudio.Formats.BinaryText;
//
// byte[] buffer = File.ReadAllBytes(args[0]);
//
// Msbt msbt = Msbt.FromBinary(buffer);
// string yaml = msbt.ToYaml();
//
// Msbt yamlMsbt = Msbt.FromYaml(yaml);
// Console.WriteLine(yaml + "\n\n");
// Console.WriteLine(yaml == yamlMsbt.ToYaml());
using MessageStudio.Common;
using MessageStudio.Formats.BinaryText;

byte[] buffer = File.ReadAllBytes(args[0]);

Msbt msbt = Msbt.FromBinary(buffer);
string yaml = msbt.ToYaml();

Msbt yamlMsbt = Msbt.FromYaml(yaml);

File.WriteAllText(args[1], yaml);

byte[] toBinary = yamlMsbt.ToBinary(TextEncoding.UTF8);
File.WriteAllBytes(args[2], toBinary);

Msbt fromBinary = Msbt.FromBinary(toBinary);
string toYaml = fromBinary.ToYaml();

Console.WriteLine(yaml == toYaml);

/*
using MessageStudio.Formats.BinaryText;
using MessageStudio.Formats.BinaryText.Components;
Expand Down Expand Up @@ -69,4 +80,6 @@
stopwatch.Stop();
Console.WriteLine($"{stopwatch.ElapsedMilliseconds}ms");
*/

#endif
2 changes: 1 addition & 1 deletion src/MessageStudio.Runner/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"MessageStudio.Runner": {
"commandName": "Project",
"commandLineArgs": "\"D:\\bin\\Msbt\\test.msbt\""
"commandLineArgs": "\"D:\\bin\\.todo\\MessageStudio\\UTF-8\\Shop.msbt\" \"D:\\bin\\.todo\\MessageStudio\\UTF-8\\Shop.yml\" \"D:\\bin\\.todo\\MessageStudio\\UTF-8\\(dst)-Shop.msbt\""
}
}
}

0 comments on commit 2f88d2a

Please sign in to comment.