/// <summary> /// Assume we're running a command and have save game data. /// </summary> /// <param name="gameFile"></param> /// <param name="saveFile"></param> /// <param name="command"></param> public EngineWrapper(byte[] gameFile, byte[] saveFile, string command) { if (gameFile == null) throw new Exception("Missing game data."); if (saveFile == null) throw new Exception("Missing required save file."); if (command == "") throw new Exception("Missing command."); MemoryStream gameData = new MemoryStream(gameFile); saveFileData = new MemoryStream(saveFile); vm = new Engine(gameData, saveFileData); wrapperState = VMWrapperState.LoadGame; if (command == "restore.current.game") { requestType = VMRequestType.NoCommand; } else { requestType = VMRequestType.ExecuteCommand; } // save the user's command for later saveCommand = command; Run(); }
public void SendCommand(string command) { wrapperState = VMWrapperState.RunCommand; requestType = VMRequestType.ExecuteCommand; saveCommand = command; vm.Continue(); }
public void Restore(byte[] restoreData) { restoreStream = new MemoryStream(restoreData); wrapperState = VMWrapperState.RequestRestore; requestType = VMRequestType.ExecuteCommand; needLine = true; vm.Continue(); }
/// <summary> /// Load the game and return data. /// </summary> /// <param name="gameFile"></param> public EngineWrapper(byte[] gameFile) { if (gameFile == null) { throw new Exception("Missing game file."); } MemoryStream gameData = new MemoryStream(gameFile); vm = new Engine(gameData); requestType = VMRequestType.StartGame; wrapperState = VMWrapperState.LoadGame; Run(); }
/// <summary> /// Load the game and return data. /// </summary> /// <param name="gameFile"></param> public EngineWrapper(byte[] gameFile) { if (gameFile == null) throw new Exception("Missing game file."); MemoryStream gameData = new MemoryStream(gameFile); vm = new Engine(gameData); requestType = VMRequestType.StartGame; wrapperState = VMWrapperState.LoadGame; Run(); }
public void SendCommand(string command) { wrapperState = VMWrapperState.LoadGame; requestType = VMRequestType.ExecuteCommand; saveCommand = command; vm.Continue(); }