public static void RandomizeMessageScript(string path) { var messageScript = MessageScript.FromFile(path); RandomizeMessageScript(messageScript); messageScript.ToFile(path + ".randomized"); }
public static void ReplaceMessageScript(string path, string originalPath) { var messageScript = MessageScript.FromFile(path); ReplaceMessageScript(messageScript); messageScript.ToFile(path + ".Replaced"); }
public static void FixMessageScript(string path, string originalPath) { var messageScript = MessageScript.FromFile(path); var originalMessageScript = MessageScript.FromFile(originalPath); FixMessageScript(messageScript, originalMessageScript); messageScript.ToFile(path + ".Fixd"); }
static void Main(string[] args) { if (args.Length == 0) { Console.WriteLine($"Missing filename"); return; } MessageScript msg = null; var filePath = args[0]; if (filePath.EndsWith("bf", StringComparison.InvariantCultureIgnoreCase)) { msg = FlowScript.FromFile(filePath).MessageScript; } else if (filePath.EndsWith("bmd")) { msg = MessageScript.FromFile(args[0]); } else if (filePath.EndsWith("msg")) { var msgCompiler = new MessageScriptCompiler(AtlusScriptLibrary.MessageScriptLanguage.FormatVersion.Version1); msg = msgCompiler.Compile(File.OpenText(filePath)); } else { Console.WriteLine("Can't detect input type (unknown extension)"); return; } using (var writer = File.CreateText($"{Path.GetFileNameWithoutExtension( args[ 0 ] )}_ids.txt")) { for (var i = 0; i < msg.Dialogs.Count; i++) { var dialog = msg.Dialogs[i]; writer.WriteLine($"{i}\t\t{dialog.Name}"); } } }
private static bool TryDoMessageScriptDecompilation() { // load binary file Logger.Info("Loading binary MessageScript file..."); MessageScript script = null; var encoding = MessageScriptEncoding; var format = GetMessageScriptFormatVersion(); if (!TryPerformAction("Failed to load message script from file.", () => script = MessageScript.FromFile(InputFilePath, format, encoding))) { return(false); } Logger.Info("Decompiling MessageScript..."); if (!TryPerformAction("Failed to decompile message script to file.", () => { using (var decompiler = new MessageScriptDecompiler(new FileTextWriter(OutputFilePath))) { if (LibraryName != null) { var library = LibraryLookup.GetLibrary(LibraryName); if (library == null) { Logger.Error("Invalid library name specified"); } decompiler.Library = library; } decompiler.Decompile(script); } })) { return(false); } return(true); }
public void FromFile_ShouldNotThrow_Version1BigEndian() { var script = MessageScript.FromFile("TestResources\\Version1BigEndian.bmd"); }