コード例 #1
0
        // Initialization
        public void Start()
        {
            _fileSystemState = new FileSystemState();
            _terminalState   = new TerminalState();
            _commandState    = new CommandState();

            _directoryController     = new DirectoryController();
            _fileController          = new FileController();
            _permissionController    = new PermissionController();
            _userInterfaceController = new UserInterfaceController();
            _commandController       = new CommandController();

            _terminalStateInitializer   = new TerminalStateInitializer();
            _fileSystemStateInitializer = new FileSystemStateInitializer();
            _commandStateInitializer    = new CommandStateInitializer();
            _userInterfaceInitializer   = new UserInterfaceInitializer();

            _userInputParser = new UserInputParser();

            // Initialize the state of each system piece for game start
            _terminalStateInitializer.InitializeTerminalState(_terminalState, InputLengthCharacterLimit, InputHistoryLimit);
            _terminalStateInitializer.ClearTerminalState(_terminalState);

            var commandsInitialized = _commandStateInitializer.InitializeCommandState(
                _commandState,
                _terminalState,
                _fileSystemState,
                _directoryController);

            _fileSystemStateInitializer.InitializeFileSystemState(
                _fileSystemState,
                _permissionController,
                _directoryController);
            _fileSystemStateInitializer.InitializeCommandsInFileSystemState(
                _fileSystemState,
                _permissionController,
                _directoryController,
                _fileController,
                commandsInitialized);

            _userInterfaceInitializer.InitializeConsoleText(
                _userInterfaceController,
                _fileSystemState,
                _directoryController,
                InputTextObject,
                OutputTextObject);
        }