コード例 #1
0
ファイル: CommandInput.cs プロジェクト: xlexi/StraySouls
        /// <summary> Returns whether the input is valid </summary>
        public static bool Command(string input)
        {
            string command = SplitCommand(input, out string[] args);

            string[] fileList = null;
            Game     game     = TargetGame.Game;

            switch (game)
            {
            case Game.DS3:
                fileList = LIST_FILE_RANDOM_DS3;
                break;

            case Game.Sekiro:
                fileList = LIST_FILE_RANDOM_SEKIRO;
                break;
            }

            if (TABLE_COMMANDS.TryGetValue(command, out ICommand commandEntry))
            {
                for (int i = 0; i < fileList.Length; i++)
                {
                    if (File.Exists(GamePath.GetMapStudioPath() + fileList[i]))
                    {
                        commandEntry.Command(game, fileList[i], args);
                    }
                }

                return(true);
            }
            return(false);
        }
コード例 #2
0
ファイル: BackupCommand.cs プロジェクト: xlexi/StraySouls
        protected override void Execute(Game game, string msbName)
        {
            string _backupFolderPath = GamePath.GetBackupPath();

            Directory.CreateDirectory(_backupFolderPath);

            string backupFilePath = _backupFolderPath + msbName;

            if (!File.Exists(backupFilePath))
            {
                File.Copy(GamePath.GetMapStudioPath() + msbName, backupFilePath);
            }
        }
コード例 #3
0
        protected override void Execute(Game game, string msbName)
        {
            string source = GamePath.GetMapStudioPath() + msbName;

            if (File.Exists(source))
            {
                File.Copy(GamePath.GetBackupPath() + msbName, GamePath.GetMapStudioPath() + msbName, overwrite: true);
            }
            else
            {
                Console.WriteLine($"{source} backup not found");
            }
        }
コード例 #4
0
        protected override void Execute(Game game, string msbName)
        {
            Randomizer.Clear();

            string filePath = GamePath.GetMapStudioPath() + msbName;

            switch (game)
            {
            case Game.DS3:
                MSB3 msb3 = MSB3.Read(filePath);
                EnemyWrapper.Overwrite(Randomizer.Randomize(EnemyWrapper.Read(msb3.Parts.Enemies).ToList()), msb3.Parts.Enemies);
                msb3.Write(filePath);
                break;

            case Game.Sekiro:
                MSBS msbs = MSBS.Read(filePath);
                EnemyWrapper.Overwrite(Randomizer.Randomize(EnemyWrapper.Read(msbs.Parts.Enemies).ToList()), msbs.Parts.Enemies);
                msbs.Write(filePath);
                break;
            }
        }
コード例 #5
0
        /// <summary> Returns whether the input is valid </summary>
        public static bool Command(string input)
        {
            string command = SplitCommand(input, out string[] args);
            Game   game    = TargetGame.Game;

            SelectFileListAndCommandTable(game, out string[] fileList, out Dictionary <string, ICommand> commandTable);

            if (commandTable.TryGetValue(command, out ICommand commandEntry))
            {
                string filePath;
                for (int i = 0; i < fileList.Length; i++)
                {
                    if (File.Exists(filePath = GamePath.GetMapStudioPath() + fileList[i]))
                    {
                        commandEntry.Command(filePath, fileList[i], args);
                    }
                }

                return(true);
            }
            return(false);
        }