public void CancelStream() { try { StreamManager.StopStream(StreamName); // request cancel Program.MainFormInstance.CancelStream(this); } catch (Exception ex) { RiotTool.Instance.Log.Log.Error("Failed to stop streaming", ex); } }
public void LoadAndStart(string gamepath, string deploy, GhostReplay rep) { replay = rep; deploy = deploy.Replace("/", "\\"); StreamName = rep.GameId.ToString() + "-" + rep.Platform; try { using (SmartWebClient wbc = new SmartWebClient(4000)) { string ip = wbc.DownloadString("https://api.ipify.org/?format=text"); cmd = "\"8394\" \"LoLLauncher.exe\" \"\" \"spectator " + ip + ":" + SettingsManager.Settings.GhostStreamPort.ToString() + " " + rep.ObserverKey + " " + rep.GameId.ToString() + " " + rep.Platform + "\""; } } catch { cmd = "\"8394\" \"LoLLauncher.exe\" \"\" \"spectator " + "127.0.0.1" + ":" + SettingsManager.Settings.GhostStreamPort.ToString() + " " + rep.ObserverKey + " " + rep.GameId.ToString() + " " + rep.Platform + "\""; } if (!StreamManager.IsRuning) { StreamManager.InitStream(); } StreamManager.AddStream(rep); //WatchProc = new System.Diagnostics.Process(); //WatchProc.StartInfo.WorkingDirectory = deploy; //WatchProc.StartInfo.UseShellExecute = false; //WatchProc.StartInfo.FileName = Path.Combine(deploy, "League of Legends.exe"); //WatchProc.StartInfo.Arguments = "\"8394\" \"LoLLauncher.exe\" \"\" \"spectator " // + "127.0.0.1:"+SettingsManager.Settings.GhostStreamPort.ToString() + " " // + rep.ObserverKey + " " // + rep.GameId.ToString() + " " // + rep.Platform + "\""; }
static void Main() { try{ if (!SingleInstance.Start()) { File.WriteAllLines(Application.StartupPath + @"\ARGS.t", Environment.GetCommandLineArgs()); SingleInstance.ShowFirstInstance(); return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); GhostBase.GhostbladeInstance.Init(); RiotSharp.ApiCache.CacheEnabled = true; RiotSharp.ApiCache.Initialize(); // Register App ApplicationInstance.Instance.Register("CID"); if (!File.Exists(Application.StartupPath + @"\Config.txt")) { SettingsManager.Default(); SettingsForm frm = new SettingsForm(); frm.ShowDialog(); } else { SettingsManager.Init(); if (System.Windows.Forms.SystemInformation.Network) { Thread thr = new Thread(new ThreadStart(CheckForUpdates)); thr.Start(); thr.Join(); } } // Api cache RiotSharp.ApiCache.CacheEnabled = SettingsManager.Settings.ApiCacheEnabled; Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); // Load Interfaces MethodInvoker mi = new MethodInvoker(NetworkManager.Init); mi.BeginInvoke(null, null); // GHOSTOVERLAY GhostOverlay.StartServer(); MainFormInstance = new MainForm(); GhostbladeInstance.MainForm = MainFormInstance; Application.Run(MainFormInstance); } catch (Exception ex) { SendCrashReport(ex); Logger.Instance.Log.Fatal("Global fail", ex); } finally { if (RiotTool.pi != null) { RiotTool.pi.Dispose(); } if (SettingsManager.Settings.ProxyOption == ProxyType.Network && NetworkManager.DefaultProxy != null) { ((NetworkInterfaceProxy)NetworkManager.DefaultProxy).Stop(); } // Api cache RiotSharp.ApiCache.Close (); GhostOverlay.Stop(); StreamManager.Stop(); SingleInstance.Stop(); } }