Example #1
0
        /// <summary>
        /// How to use:
        /// Specify file path of the game script that want to change.
        /// Then this tool will make directory as 'Output' to the same directory that specified it, output the changed game script to 'Output' directory.
        /// If there are some problem, output log to 'Log' directory.
        /// </summary>
        /// <param name="args">Specify file path of the game script that want to change.</param>
        public static void Main(string[] args)
        {
            // Read all of the game script lines.
            string gameScriptPath = null;

            // If the game script is not specified, notify usage.
            if (args.Length <= 0)
            {
                //if no arguments specified, look in the repository for the game file
                if (File.Exists(defaultGamePath))
                {
                    Console.WriteLine("Detected program is run from git repository - Using latest question arcs script");
                    gameScriptPath = defaultGamePath;
                }
                else
                {
                    Console.WriteLine("ERROR: No arguments provided, and game script not found in default path.");
                    Console.WriteLine("Please specify file path of the game script that want to change.");
                    Console.WriteLine("Usage: VoicesPuter <file path>");
                    return;
                }
            }
            else
            {
                gameScriptPath = args[0];
            }

            ChangedGameScriptMaker changedGameScriptMaker = new ChangedGameScriptMaker(gameScriptPath);
            List <string>          gameScriptLines        = changedGameScriptMaker.ReadGameScript();

            //setup logging
            string voiceDatabaseLogPath = Path.Combine(Path.GetDirectoryName(gameScriptPath), "Log", $"voiceDatabaseLog.utf");

            Utils.DeleteIfExists(voiceDatabaseLogPath);
            Logger voiceDatabaseLogger = new LoggerConfiguration().WriteTo.File(voiceDatabaseLogPath, outputTemplate: outputTemplate).CreateLogger();

            string voiceDelayLogPath = Path.Combine(Path.GetDirectoryName(gameScriptPath), "Log", $"voiceDelayLog.utf");

            Utils.DeleteIfExists(voiceDelayLogPath);
            Logger logger = new LoggerConfiguration().WriteTo.File(voiceDelayLogPath, outputTemplate: outputTemplate).CreateLogger();

            //scan script for dwave commands and construct a database of all dwave commands
            VoicesDatabase voicesDatabase = new VoicesDatabase(gameScriptPath, voiceDatabaseLogger);

            // Put voice scripts into Japanese line and change voice script's function name of both.
            VoicesPuter   voicesPuter            = new VoicesPuter(gameScriptPath, overwrite: true, voicesDatabase: voicesDatabase);
            List <string> changedGameScriptLines = voicesPuter.PutVoiceScriptsIntoLines(gameScriptLines, voicesDatabase);

            //fix 'voiceDelay' commands
            FixVoiceDelay.FixVoiceDelaysInScript(changedGameScriptLines, logger, logNoOldDelay: false, logSuccessfulInsertions: false);

            // Make the changed game script into output directory.
            changedGameScriptMaker.MakeChangedGameScript(changedGameScriptLines);
            Console.WriteLine("Completed putting voice scripts into Japanese lines.");
            Console.WriteLine("Press any key to close this window...");
            Console.ReadKey();
        }
        /// <summary>
        /// How to use:
        /// Specify file path of the game script that want to change.
        /// Then this tool will make directory as 'Output' to the same directory that specified it, output the changed game script to 'Output' directory.
        /// If there are some problem, output log to 'Log' directory.
        /// </summary>
        /// <param name="args">Specify file path of the game script that want to change.</param>
        public static void Main(string[] args)
        {
            // If the game script is not specified, notify usage.
            if (args.Length <= 0)
            {
                Console.WriteLine("Please specify file path of the game script that want to change.");
                Console.WriteLine("Usage: VoicesPuter <file path>");
                return;
            }

            // Read all of the game script lines.
            string gameScriptPath = args[0];
            ChangedGameScriptMaker changedGameScriptMaker = new ChangedGameScriptMaker(gameScriptPath);
            List <string>          gameScriptLines        = changedGameScriptMaker.ReadGameScript();

            // Put voice scripts into Japanese line and change voice script's function name of both.
            VoicesPuter   voicesPuter            = new VoicesPuter(gameScriptPath);
            List <string> changedGameScriptLines = voicesPuter.PutVoiceScriptsIntoLines(gameScriptLines);

            // Make the changed game script into output directory.
            changedGameScriptMaker.MakeChangedGameScript(changedGameScriptLines);
            Console.WriteLine("Completed putting voice scripts into Japanese lines.");
            Console.ReadKey();
        }