public void SetConfig()
        {
            int startX;
            int startY;
            int width;
            int height;

            BTVManager.GetStreamDimensionInfo(out startX, out startY, out width, out height);
            BTVManager.SendBTVRequest("setconfig", new Dictionary <string, string>()
            {
                {
                    "startX",
                    startX.ToString((IFormatProvider)CultureInfo.InvariantCulture)
                },
                {
                    "startY",
                    startY.ToString((IFormatProvider)CultureInfo.InvariantCulture)
                },
                {
                    "width",
                    width.ToString((IFormatProvider)CultureInfo.InvariantCulture)
                },
                {
                    "height",
                    height.ToString((IFormatProvider)CultureInfo.InvariantCulture)
                }
            });
        }
        public void PingBTV()
        {
            bool flag1 = false;
            bool flag2 = false;

            try
            {
                string json = BTVManager.SendBTVRequest("ping", (Dictionary <string, string>)null);
                JArray.Parse(json);
                JObject jobject = JObject.Parse(json[0].ToString((IFormatProvider)CultureInfo.InvariantCulture));
                if (jobject["success"].ToObject <bool>())
                {
                    flag1 = jobject["recording"].ToObject <bool>();
                    flag2 = jobject["streaming"].ToObject <bool>();
                }
                Logger.Info("Ping BTV response recording: {0}, streaming: {1}", (object)flag1, (object)flag2);
                this.sStopPingBTVThread = false;
            }
            catch (Exception ex)
            {
                this.sStopPingBTVThread = true;
                Logger.Error("PingBTV : {0}", (object)ex.Message);
            }
            this.sRecording = flag1;
            this.sStreaming = flag2;
        }
 public void StreamStopped()
 {
     BTVManager.sWritingToFile = false;
     this.sStreaming           = false;
     this.sRecording           = false;
     BTVManager.RestrictWindowResize(false);
 }
 public void HideStreamWindow()
 {
     if (!ProcessUtils.FindProcessByName("BlueStacksTV"))
     {
         return;
     }
     BTVManager.SendBTVAsyncRequest("hidestreamwindow", (Dictionary <string, string>)null);
 }
 public void Stop()
 {
     if (!this.sStreaming && !this.sRecording)
     {
         return;
     }
     BTVManager.SendBTVRequest("sessionswitch", (Dictionary <string, string>)null);
     this.sWasRecording = false;
 }
 public static void SendBTVAsyncRequest(string request, Dictionary <string, string> data)
 {
     new Thread((ThreadStart)(() =>
     {
         Logger.Info("Sending btv async request");
         BTVManager.SendBTVRequest(request, data);
     }))
     {
         IsBackground = true
     }.Start();
 }
 public void ShowStreamWindow()
 {
     if (!ProcessUtils.FindProcessByName("BlueStacksTV"))
     {
         this.StartBlueStacksTV();
     }
     else
     {
         BTVManager.SendBTVAsyncRequest("showstreamwindow", (Dictionary <string, string>)null);
     }
 }
 public void WindowResized()
 {
     if (!ProcessUtils.FindProcessByName("BlueStacksTV"))
     {
         return;
     }
     try
     {
         BTVManager.SendBTVRequest("windowresized", (Dictionary <string, string>)null);
     }
     catch (Exception ex)
     {
         Logger.Error("{0}", (object)ex);
     }
 }
 private void CancelBTvDownload(object sender, EventArgs e)
 {
     Logger.Info("User cancelled BTV download");
     this.sDownloading = false;
     if (this.sDownloader == null)
     {
         return;
     }
     this.sDownloader.AbortDownload();
     if (!BTVManager.IsBTVInstalled())
     {
         return;
     }
     Directory.Delete(RegistryStrings.ObsDir, true);
 }
 public void SendTabChangeData(string[] tabChangedData)
 {
     new Thread((ThreadStart)(() => BTVManager.SendBTVRequest("tabchangeddata", new Dictionary <string, string>()
     {
         {
             "type",
             tabChangedData[0]
         },
         {
             "name",
             tabChangedData[1]
         },
         {
             "data",
             tabChangedData[2]
         }
     })))
     {
         IsBackground = true
     }.Start();
 }
 public void SetFrontendPosition(int width, int height, bool isPortrait)
 {
     if (!ProcessUtils.FindProcessByName("BlueStacksTV"))
     {
         return;
     }
     BTVManager.SendBTVRequest("setfrontendposition", new Dictionary <string, string>()
     {
         {
             nameof(width),
             width.ToString((IFormatProvider)CultureInfo.InvariantCulture)
         },
         {
             nameof(height),
             height.ToString((IFormatProvider)CultureInfo.InvariantCulture)
         },
         {
             nameof(isPortrait),
             isPortrait.ToString((IFormatProvider)CultureInfo.InvariantCulture)
         }
     });
 }
 public void CheckNewFiltersAvailable()
 {
     BTVManager.SendBTVRequest("checknewfilters", (Dictionary <string, string>)null);
 }
 public void HideStreamWindowFromTaskbar()
 {
     BTVManager.SendBTVAsyncRequest("hidestreamwindowfromtaskbar", (Dictionary <string, string>)null);
 }
 public void MaybeDownloadAndLaunchBTv(MainWindow parentWindow)
 {
     if (!BTVManager.IsBTVInstalled())
     {
         if (this.sDownloading && this.sWindow != null)
         {
             BTVManager.BringToFront((CustomWindow)this.sWindow);
         }
         else
         {
             ExtensionPopupControl btvExtPopup = new ExtensionPopupControl();
             btvExtPopup.LoadExtensionPopupFromFolder("BTVExtensionPopup");
             System.Action action1;
             System.Action action2;
             btvExtPopup.DownloadClicked += (EventHandler)((o, e) =>
             {
                 BlueStacksUIUtils.CloseContainerWindow((FrameworkElement)btvExtPopup);
                 this.sDownloading = true;
                 this.sWindow = new CustomMessageWindow();
                 BlueStacksUIBinding.Bind(this.sWindow.TitleTextBlock, "STRING_BTV_DOWNLOAD", "");
                 BlueStacksUIBinding.Bind(this.sWindow.BodyTextBlock, "STRING_BTV_INSTALL_WAIT", "");
                 BlueStacksUIBinding.Bind(this.sWindow.BodyWarningTextBlock, "STRING_BTV_WARNING", "");
                 this.sWindow.AddButton(ButtonColors.Blue, "STRING_CANCEL", new EventHandler(this.CancelDownloadConfirmation), (string)null, false, (object)null, true);
                 this.sWindow.BodyWarningTextBlock.Visibility = Visibility.Visible;
                 this.sWindow.ProgressBarEnabled = true;
                 this.sWindow.IsWindowMinizable = true;
                 this.sWindow.IsWindowClosable = false;
                 this.sWindow.ImageName = "BTVTopBar";
                 this.sWindow.ShowInTaskbar = true;
                 this.sWindow.Owner = (Window)parentWindow;
                 this.sWindow.IsShowGLWindow = true;
                 this.sWindow.Show();
                 new Thread(closure_3 ?? (closure_3 = (ThreadStart)(() =>
                 {
                     if (!string.IsNullOrEmpty(RegistryManager.Instance.BtvDevServer))
                     {
                         BTVManager.sBTvUrl = RegistryManager.Instance.BtvDevServer;
                     }
                     string redirectedUrl = BTVManager.GetRedirectedUrl(BTVManager.sBTvUrl);
                     if (redirectedUrl == null)
                     {
                         Logger.Error("The download url was null");
                     }
                     else
                     {
                         string downloadPath = Path.Combine(Path.GetTempPath(), Path.GetFileName(new Uri(redirectedUrl).LocalPath));
                         this.sDownloader = new LegacyDownloader(3, redirectedUrl, downloadPath);
                         this.sDownloader.Download((LegacyDownloader.UpdateProgressCallback)(percent =>
                         {
                             // ISSUE: variable of a compiler-generated type
                             BTVManager.\u003C\u003Ec__DisplayClass25_0 cDisplayClass250 = this;
                             int percent1 = percent;
                             // ISSUE: reference to a compiler-generated field
                             this.sWindow.Dispatcher.Invoke((Delegate)(() => cDisplayClass250.\u003C\u003E4__this.sWindow.CustomProgressBar.Value = (double)percent1));
                         }), (LegacyDownloader.DownloadCompletedCallback)(filePath =>
                         {
                             this.sWindow.Dispatcher.Invoke((Delegate)(action1 ?? (action1 = (System.Action)(() =>
                             {
                                 this.sWindow.CustomProgressBar.Value = 100.0;
                                 this.sWindow.Close();
                             }))));
                             Logger.Info("Successfully downloaded BlueStacks TV");
                             this.sDownloading = false;
                             BTVManager.ExtractBTv(downloadPath);
                             parentWindow.Dispatcher.Invoke((Delegate)(action2 ?? (action2 = (System.Action)(() => parentWindow.mTopBar.mBtvButton.ImageName = "btv"))));
                         }), (LegacyDownloader.ExceptionCallback)(ex => Logger.Error("Failed to download file: {0}. err: {1}", (object)downloadPath, (object)ex.Message)), (LegacyDownloader.ContentTypeCallback)null, (LegacyDownloader.SizeDownloadedCallback)null, (LegacyDownloader.PayloadInfoCallback)null);
                     }
                 })))
                 {
                     IsBackground = true
                 }.Start();
             });
             btvExtPopup.Height = parentWindow.ActualHeight * 0.8;
             btvExtPopup.Width  = btvExtPopup.Height * 16.0 / 9.0;
             ContainerWindow containerWindow = new ContainerWindow(parentWindow, (System.Windows.Controls.UserControl)btvExtPopup, (double)(int)btvExtPopup.Width, (double)(int)btvExtPopup.Height, false, true, false, -1.0, (Brush)null);
         }
     }
     else
     {
         this.StartBlueStacksTV();
     }
 }