internal BaseMotionPlayer(TaPa_XYCyl Owner, string MotionDataPath, string GamePath, string StartOptionsRunArgs, string RuntimeProcess, string StartOptionsInput, AvalibleProtocols MotionDeviceProtocol, string ConnectonString) { this.Owner = Owner; FrameData = PositionAndTimingDataModel.DataLoadFromFile(MotionDataPath); this.MotionDeviceProtocol = MotionDeviceProtocol; switch (MotionDeviceProtocol) { case AvalibleProtocols.ComPort: if (MotionHardwareInterface != null) { MotionHardwareInterface.Dispose(); } MotionHardwareInterface = JMDM_CylinderPortControlUpdated.ConnectionFactory(ConnectonString); break; default: Owner.PlayBacksEnd.Invoke(); throw new Exception("Error: not a valid Protocol."); } this.GamePath = GamePath; this.StartOptionsRunArgs = StartOptionsRunArgs; this.StartOptionsInput = StartOptionsInput; this.RuntimeProcess = RuntimeProcess; Start(); }
bool StartGame() { if (!File.Exists(GamePath)) { MessageBox.Show(EnglishText.HelpMessage_GameNotFoundHelpMessage); return(false); } try { GameRunTime = new Process(); GameRunTime.StartInfo = new ProcessStartInfo() { FileName = GamePath, WorkingDirectory = Path.GetDirectoryName(GamePath), Arguments = StartOptionsRunArgs }; GameRunTime.Start(); } catch (Exception ex) { MessageBox.Show($"{EnglishText.HelpMessage_GameLaunchErrorHelpMessage}\n{ex}"); return(false); } if (RuntimeProcess != null && RuntimeProcess != "") { Task FindGameTask = Task.Run(() => { GameRunTime = null; while (GameRunTime == null) { GameRunTime = Process.GetProcesses().FirstOrDefault(P => P.MainWindowHandle != IntPtr.Zero && P.ProcessName.ToLower() == RuntimeProcess); } while (!GameRunTime.Responding) { ; } }); TimeSpan TimeoutSpan = TimeSpan.FromMilliseconds(1000); FindGameTask.Wait(TimeoutSpan); } WindowHandleInfo Window = new WindowHandleInfo(GameRunTime.MainWindowHandle); Task InputTask = new Task(() => { if (StartOptionsInput != null && StartOptionsInput != "") { Thread.Sleep(50); Action[] Commands = TaPa_XYCyl.GetCommands(StartOptionsInput, Window); foreach (Action Command in Commands) { Command.Invoke(); } } }); Window.SetForegroundWindow(); InputTask.Start(); return(true); }
internal ParachuteMotionController(TaPa_XYCyl Owner) : base(Owner) { MaxTravel = 210; MinTravel = 0; MidWay = (byte)(((MaxTravel - MinTravel) / 2) + MinTravel); Cylinder1 = MidWay; Cylinder2 = MidWay; Cylinder3 = MidWay; }
internal XY2CylMotionPlayer(TaPa_XYCyl Owner, string MotionDataPath, string GamePath, string StartOptionsRunArgs, string RuntimeProccess, string StartOptionsInput, AvalibleProtocols MotionDeviceProtocol, string ConnectionString) : base(Owner, MotionDataPath, GamePath, StartOptionsRunArgs, RuntimeProccess, StartOptionsInput, MotionDeviceProtocol, ConnectionString) { }
internal XY2CylMotionController(TaPa_XYCyl Owner) : base(Owner) { }
#pragma warning restore CS0649 internal BaseMotionController(TaPa_XYCyl Owner) { this.Owner = Owner; }