public DetailForm(ReplayFile replayFile, RequestManager requestManager, ExeManager exeManager, ReplayPlayer replayPlayer, Scribe scribe) { _replayFile = replayFile; _requestManager = requestManager; _exeManager = exeManager; _replayPlayer = replayPlayer; _logger = scribe; InitializeComponent(); // Load split button menu for game executables LeagueExecutable[] listOfExecs = _exeManager.GetExecutables(); // No items? Don't load the menu if (listOfExecs.Count() > 0) { var execMenu = new ContextMenuStrip { ShowCheckMargin = false, ShowImageMargin = false, }; execMenu.ItemClicked += new ToolStripItemClickedEventHandler(GeneralStartReplayMenuItem_Click); foreach (var item in listOfExecs) { execMenu.Items.Add(item.Name); } this.GeneralPlayReplaySplitButton.Menu = execMenu; } }
/// <summary> /// Miner indítása /// </summary> /// <returns></returns> public bool StartMiner() { bool success = false; if (_pools != null && _pools.Count > 0) { if (MinerType == MinerType.GPU) { switch (Algorithm) { case (int)SupportedAlgos.CryptoNight: default: Stratum.Stratum mainPool = createStratumFromPoolSettings(_pools, (int)SupportedAlgos.CryptoNight); if (mainPool != null && mainPool is CryptoNightStratum) { foreach (var device in Devices.Where(x => x.IsEnabled)) { for (int i = 0; i < device.Threads; ++i) { OpenCLCryptoNightMiner miner = null; try { miner = new OpenCLCryptoNightMiner(device); miner.Start(mainPool as CryptoNightStratum, device.Intensity, device.WorkSize, true); Miners.Add(miner); } catch (Exception ex) { Messenger.Default.Send <MinerOutputMessage>(new MinerOutputMessage() { OutputText = $"Faild to start GPU miner on Device# {device.ADLAdapterIndex} Thread# {i+1}", Exception = ex, IsError = true }); } } } success = true; } break; } } else if (MinerType == MinerType.CPU) { exeMinerManager = new ExeManager(ApplicationPath, ExeFileName); string minerParameter = generateMinerCall(); MinerThread = new Thread(() => exeMinerManager.ExecuteResource(minerParameter)); MinerThread.Start(); success = true; } } else { Messenger.Default.Send <MinerOutputMessage>(new MinerOutputMessage() { OutputText = "WARNING: No main pool selected." }); } return(success); }
private void Window_Loaded(object sender, RoutedEventArgs e) { _enableLogging = Properties.Settings.Default.EnableLogging; _scriptsLocation = String.IsNullOrEmpty(Properties.Settings.Default.ScriptsLocation) ? Environment.GetFolderPath(Environment.SpecialFolder.Desktop) : Properties.Settings.Default.ScriptsLocation; ExeManager.ScanForInstalls(); ConversionEngine.StartNew(_scriptsLocation, _enableLogging); OriginalSinsRadioButton.IsEnabled = ExeManager.HasExeForEdition(GameEdition.OriginalSins); EntrenchmentRadioButton.IsEnabled = ExeManager.HasExeForEdition(GameEdition.Entrenchment); DiplomacyRadioButton.IsEnabled = ExeManager.HasExeForEdition(GameEdition.Diplomacy); RebellionRadioButton.IsEnabled = ExeManager.HasExeForEdition(GameEdition.Rebellion); }
public SettingsForm(ExeManager exeManager) { _exeManager = exeManager; InitializeComponent(); // Do sizing on objects this.GeneralGameComboBox.AutoSize = false; this.GeneralGameComboBox.Size = new System.Drawing.Size(200, 23); this.GeneralLaunchComboBox.AutoSize = false; this.GeneralLaunchComboBox.Size = new System.Drawing.Size(200, 23); this.GeneralUsernameTextBox.AutoSize = false; this.GeneralUsernameTextBox.Size = new Size(200, 23); this.GeneralRegionComboBox.AutoSize = false; this.GeneralRegionComboBox.Size = new Size(200, 23); }
private static void StartReplay(string replayPath, ExeManager exeManager, ReplayPlayer replayPlayer, string execName = "default") { LeagueExecutable exec = null; // Get default exec or specified exec if (execName.Equals("default")) { // Start update form with default var result = new UpdateSplashForm(exeManager).ShowDialog(); if (result == DialogResult.OK) { exec = exeManager.GetDefaultExecutable(); } else { // Failed to get exec, stop MessageBox.Show("Failed to start replay", $"Could not find executable data {execName}", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { // Start update form with target var result = new UpdateSplashForm(exeManager, execName).ShowDialog(); if (result == DialogResult.OK) { exec = exeManager.GetExecutable(execName); } else { // Failed to get exec, stop MessageBox.Show("Failed to start replay", $"Could not find executable data {execName}", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (exec == null) { MessageBox.Show("Failed to start replay", $"Could not find executable data {execName}", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } replayPlayer.Play(exec, replayPath); }
public ReplayPlayer(ExeManager exeManager) { _exeManager = exeManager; }
public UpdateSplashForm(ExeManager exeManager, string targetExec) { _exeManager = exeManager; TargetExecToUpdate = targetExec; InitializeComponent(); }
public UpdateSplashForm(ExeManager exeManager) { _exeManager = exeManager; InitializeComponent(); }
[STAThread] // This is required for system dialogs static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Scribe logger = new Scribe(); //*/ try { ExeManager exeManager = null; try { exeManager = new ExeManager(); } catch (Exception ex) { MessageBox.Show("ROFLPlayer was not able to find League of Legends. Please add it now.", "First time setup", MessageBoxButtons.OK, MessageBoxIcon.Information); logger.Info(_className, $"First time setup kicked off by exception:\n{ex.ToString()}"); // Start add exec form var addForm = new ExecAddForm(new ExeTools()); var formResult = addForm.ShowDialog(); // If form exited with ok if (formResult == DialogResult.OK) { // Get new exec LeagueExecutable newExec = addForm.NewLeagueExec; newExec.IsDefault = true; // Save execinfo file exeManager = new ExeManager(newExec); exeManager.Save(); } else { // Exit if form exited any other way Environment.Exit(1); } addForm.Dispose(); } ReplayPlayer replayPlayer = new ReplayPlayer(exeManager); if (args.Length == 0) { // Update default exec Application.Run(new UpdateSplashForm(exeManager)); Application.Run(new SettingsForm(exeManager)); } else { // StartupMode, 1 = show detailed information, 0 = launch replay immediately if (RoflSettings.Default.StartupMode == 0) { StartReplay(args[0], exeManager, replayPlayer); } else { var replayFile = Task.Run(() => SetupReplayFileAsync(args[0])); replayFile.Wait(); RequestManager requestManager = new RequestManager(); Application.Run(new DetailForm(replayFile.Result, requestManager, exeManager, replayPlayer, logger)); } } } catch (Exception ex) { MessageBox.Show(@"ROFLPlayer encountered an unhandled exception, please record this message and report it here https://github.com/andrew1421lee/ROFL-Player/issues" + "\n\n" + ex.ToString(), "Critical Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); logger.Error(_className, "Unhandled exception: " + ex.ToString()); Environment.Exit(1); } //*/ }