コード例 #1
0
        internal static void SendCalendarStats(
            string eventType,
            string calendarstartdate,
            string calendarenddate,
            string calendarlink,
            string success      = "",
            string rowsaffected = "")
        {
            Dictionary <string, string> getCommonData = ClientStats.GetCommonData;

            getCommonData.Add("event_type", eventType);
            getCommonData.Add("calendar_start_date", calendarstartdate);
            getCommonData.Add("calendar_end_date", calendarenddate);
            getCommonData.Add("calendar_link", calendarlink);
            getCommonData.Add(nameof(success), success);
            getCommonData.Add("rows_affected", rowsaffected);
            ClientStats.SendStatsAsync(RegistryManager.Instance.Host + "/bs4/stats/calendar_stats", getCommonData, (Dictionary <string, string>)null);
        }
コード例 #2
0
        private void GridElement_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (this.ParentWindow.mIsMacroRecorderActive)
            {
                return;
            }
            string         macroFileName = (string)(sender as Grid).Tag;
            MacroRecording record        = MacroGraph.Instance.Vertices.Cast <MacroRecording>().Where <MacroRecording>((Func <MacroRecording, bool>)(macro => string.Equals(macro.Name, macroFileName, StringComparison.InvariantCultureIgnoreCase))).FirstOrDefault <MacroRecording>();

            if (record == null)
            {
                this.mMainStackPanel.Children.Remove((UIElement)(sender as Grid));
            }
            else
            {
                try
                {
                    if (!this.ParentWindow.mIsMacroPlaying)
                    {
                        this.ParentWindow.mCommonHandler.FullMacroScriptPlayHandler(record);
                        ClientStats.SendMiscellaneousStatsAsync("MacroOperations", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, "macro_play", "bookmark", record.RecordingType.ToString(), string.IsNullOrEmpty(record.MacroId) ? "local" : "community", (string)null, (string)null, "Android");
                    }
                    else
                    {
                        CustomMessageWindow customMessageWindow = new CustomMessageWindow();
                        BlueStacksUIBinding.Bind(customMessageWindow.TitleTextBlock, "STRING_CANNOT_RUN_MACRO", "");
                        BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlock, "STRING_STOP_MACRO_SCRIPT", "");
                        customMessageWindow.AddButton(ButtonColors.Blue, "STRING_OK", (EventHandler)null, (string)null, false, (object)null, true);
                        customMessageWindow.Owner = (Window)this.ParentWindow;
                        customMessageWindow.ShowDialog();
                    }
                    if (this.ParentWindow.mSidebar == null)
                    {
                        return;
                    }
                    this.ParentWindow.mSidebar.mMacroButtonPopup.IsOpen = false;
                    this.ParentWindow.mSidebar.ToggleSidebarVisibilityInFullscreen(false);
                }
                catch (Exception ex)
                {
                    int num = (int)MessageBox.Show(ex.ToString());
                }
            }
        }
コード例 #3
0
        private void LogoutButtonGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Logger.Info("Clicked logout button");
            if (!this.ParentWindow.mGuestBootCompleted)
            {
                return;
            }
            CustomMessageWindow customMessageWindow = new CustomMessageWindow();

            BlueStacksUIBinding.Bind(customMessageWindow.TitleTextBlock, "STRING_LOGOUT_BLUESTACKS3", "");
            BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlock, "STRING_REMOVE_GOOGLE_ACCOUNT", "");
            customMessageWindow.AddButton(ButtonColors.Red, "STRING_LOGOUT_BUTTON", this.LogoutConfirmationResetAccountAcceptedHandler, (string)null, false, (object)null, true);
            customMessageWindow.AddButton(ButtonColors.White, "STRING_CANCEL", (EventHandler)null, (string)null, false, (object)null, true);
            this.ParentWindow.ShowDimOverlay((IDimOverlayControl)null);
            customMessageWindow.Owner = (Window)this.ParentWindow.mDimOverlay;
            customMessageWindow.ShowDialog();
            this.ParentWindow.HideDimOverlay();
            ClientStats.SendMiscellaneousStatsAsync("hamburgerMenu", RegistryManager.Instance.UserGuid, "Logout", "MouseClick", RegistryManager.Instance.ClientVersion, RegistryManager.Instance.Version, RegistryManager.Instance.Oem, (string)null, (string)null, "Android");
        }
コード例 #4
0
        private void PinToTop_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            CustomPictureBox customPictureBox = sender as CustomPictureBox;

            if (customPictureBox.ImageName.Contains("_off"))
            {
                customPictureBox.ImageName = "toggle_on";
                this.ParentWindow.EngineInstanceRegistry.IsClientOnTop = true;
                this.ParentWindow.Topmost = true;
                ClientStats.SendMiscellaneousStatsAsync("hamburgerMenu", RegistryManager.Instance.UserGuid, "PinToTopOn", "MouseClick", RegistryManager.Instance.ClientVersion, RegistryManager.Instance.Version, RegistryManager.Instance.Oem, (string)null, (string)null, "Android");
            }
            else
            {
                customPictureBox.ImageName = "toggle_off";
                this.ParentWindow.EngineInstanceRegistry.IsClientOnTop = false;
                this.ParentWindow.Topmost = false;
                ClientStats.SendMiscellaneousStatsAsync("hamburgerMenu", RegistryManager.Instance.UserGuid, "PinToTopOff", "MouseClick", RegistryManager.Instance.ClientVersion, RegistryManager.Instance.Version, RegistryManager.Instance.Oem, (string)null, (string)null, "Android");
            }
        }
コード例 #5
0
 private void RemoveAppSuggestion(object sender, EventArgs e)
 {
     this.ParentWindow.mWelcomeTab.mHomeAppManager.RemoveAppIcon(this.mAppIconModel.PackageName, (AppIconModel)null);
     ClientStats.SendMiscellaneousStatsAsync("cross_promotion_icon_removed", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, RegistryManager.Instance.Version, this.mAppIconModel.PackageName, "bgp", (string)null, (string)null, (string)null, "Android");
     try
     {
         XmlWriterSettings settings = new XmlWriterSettings()
         {
             OmitXmlDeclaration = true,
             Indent             = true
         };
         XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces(new XmlQualifiedName[1]
         {
             new XmlQualifiedName("", "")
         });
         string str  = System.IO.Path.Combine(RegistryStrings.PromotionDirectory, "app_suggestion_removed");
         string data = "";
         if (File.Exists(str))
         {
             data = File.ReadAllText(str);
         }
         List <string> stringList = new List <string>();
         if (!string.IsNullOrEmpty(data))
         {
             stringList = AppIconUI.DoDeserialize <List <string> >(data);
         }
         if (!stringList.Contains(this.mAppIconModel.PackageName))
         {
             if (stringList.Count >= 20)
             {
                 stringList.RemoveAt(0);
             }
             stringList.Add(this.mAppIconModel.PackageName);
         }
         using (XmlWriter xmlWriter = XmlWriter.Create(str, settings))
             new XmlSerializer(typeof(List <string>)).Serialize(xmlWriter, (object)stringList, namespaces);
     }
     catch (Exception ex)
     {
         Logger.Error("Error in writing removed suggested app icon package name in file " + ex.ToString());
     }
 }
コード例 #6
0
        internal void ChooseAndInstallApk()
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter           = "Android Files (*.apk, *.xapk)|*.apk; *.xapk";
            openFileDialog1.Multiselect      = true;
            openFileDialog1.RestoreDirectory = true;
            using (OpenFileDialog openFileDialog2 = openFileDialog1)
            {
                if (openFileDialog2.ShowDialog() == DialogResult.OK)
                {
                    foreach (string fileName in openFileDialog2.FileNames)
                    {
                        Logger.Info("File Selected : " + fileName);
                        this.InstallApk(fileName, true);
                    }
                }
                ClientStats.SendMiscellaneousStatsAsync("close_window_apk", RegistryManager.Instance.UserGuid, "close_apk_window", string.Empty, RegistryManager.Instance.ClientVersion, RegistryManager.Instance.Version, RegistryManager.Instance.Oem, (string)null, (string)null, "Android");
            }
        }
コード例 #7
0
 internal static void SendClientStatsAsync(
     string op,
     string status,
     string uri,
     string package   = "",
     string errorCode = "",
     string vmName    = "")
 {
     ThreadPool.QueueUserWorkItem((WaitCallback)(obj =>
     {
         try
         {
             ClientStats.SendStatsSync(op, status, uri, package, errorCode, vmName);
         }
         catch (Exception ex)
         {
             Logger.Error("Failed to send stats for uri : " + uri + ". Reason : " + ex.ToString());
         }
     }));
 }
コード例 #8
0
 private void BookMarkScriptImg_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (this.IsBookmarked)
     {
         this.IsBookmarked = false;
         SingleMacroControl.DeleteScriptNameFromBookmarkedScriptListIfPresent(this.mRecording.Name);
         this.ParentWindow.mCommonHandler.OnMacroBookmarkChanged(this.mRecording.Name, false);
     }
     else if (RegistryManager.Instance.BookmarkedScriptList.Length < 5)
     {
         this.IsBookmarked = true;
         this.AddScriptNameToBookmarkedScriptListIfNotPresent(this.mRecording.Name);
         this.ParentWindow.mCommonHandler.OnMacroBookmarkChanged(this.mRecording.Name, true);
     }
     else
     {
         this.ParentWindow.mCommonHandler.AddToastPopup((Window)this.mMacroRecorderWindow, LocaleStrings.GetLocalizedString("STRING_BOOKMARK_MACRO_WARNING", ""), 2.5, true);
     }
     ClientStats.SendMiscellaneousStatsAsync("MacroOperations", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, "macro_window_bookmark", (string)null, this.mRecording.RecordingType.ToString(), (string)null, (string)null, (string)null, "Android");
 }
コード例 #9
0
        private void pikanotificationcontrol_MouseUp(object sender, MouseButtonEventArgs e)
        {
            if (this.ParentWindow == null || !this.ParentWindow.mGuestBootCompleted)
            {
                return;
            }
            this.ParentWindow.Utils.HandleGenericActionFromDictionary((Dictionary <string, string>) this.mNotificationItem.ExtraPayload, "notification_ribbon", this.mNotificationItem.NotificationMenuImageName);
            ClientStats.SendMiscellaneousStatsAsync("RibbonClicked", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, this.mNotificationItem.Id, this.mNotificationItem.Title, JsonConvert.SerializeObject((object)this.mNotificationItem.ExtraPayload), (string)null, (string)null, (string)null, "Android");
            GenericNotificationManager.MarkNotification((IEnumerable <string>) new List <string>()
            {
                this.mNotificationItem.Id
            }, (System.Action <GenericNotificationItem>)(x => x.IsRead = true));
            IEnumerable <NotificationDrawerItem> source = (this.ParentWindow.mTopBar.mNotificationDrawerControl.mNotificationScroll.Content as StackPanel).Children.OfType <NotificationDrawerItem>().Where <NotificationDrawerItem>((Func <NotificationDrawerItem, bool>)(_ => _.Id == this.mNotificationItem.Id));

            if (source.Any <NotificationDrawerItem>())
            {
                source.First <NotificationDrawerItem>().ChangeToReadBackground();
            }
            this.ParentWindow.mTopBar.RefreshNotificationCentreButton();
            this.CloseClicked(sender, (EventArgs)e);
        }
コード例 #10
0
        private void mPromoButton_Click(object sender, RoutedEventArgs e)
        {
            this.StopSlider();
            ClientStats.SendMiscellaneousStatsAsync("BootPromotion", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, JsonConvert.SerializeObject((object)this.currentBootPromotion.ExtraPayload), (string)null, (string)null, (string)null, (string)null, (string)null, "Android");
            GenericAction genericAction = GenericAction.None;

            if (this.currentBootPromotion.ExtraPayload.ContainsKey("click_generic_action"))
            {
                genericAction = EnumHelper.Parse <GenericAction>(this.currentBootPromotion.ExtraPayload["click_generic_action"], GenericAction.None);
            }
            switch (genericAction)
            {
            case GenericAction.ApplicationBrowser:
            case GenericAction.UserBrowser:
            case GenericAction.HomeAppTab:
            case GenericAction.SettingsMenu:
                this.isPerformActionOnClose = false;
                break;

            default:
                this.isPerformActionOnClose = true;
                break;
            }
            if (this.isPerformActionOnClose)
            {
                this.mPromotionInfoBorder.Visibility = Visibility.Visible;
                this.mPromoButton.Visibility         = Visibility.Hidden;
                this.mPromoInfoText.Text             = this.currentBootPromotion.PromoBtnClickStatusText.ToString((IFormatProvider)CultureInfo.InvariantCulture);
                if (!string.Equals(this.currentBootPromotion.ThemeEnabled, "true", StringComparison.InvariantCultureIgnoreCase))
                {
                    return;
                }
                this.ParentWindow.Utils.ApplyTheme(this.currentBootPromotion.ThemeName);
            }
            else
            {
                this.mExtraPayloadClicked = this.currentBootPromotion.ExtraPayload;
                this.ParentWindow.Utils.HandleGenericActionFromDictionary((Dictionary <string, string>) this.currentBootPromotion.ExtraPayload, "boot_promo", "");
            }
        }
コード例 #11
0
        private void mStartSyncBtn_Click(object sender, RoutedEventArgs e)
        {
            this.mStartSyncBtn.IsEnabled = false;
            this.ParentWindow._TopBar.ShowSyncPanel(true);
            this.ParentWindow.mIsSyncMaster = true;
            ClientStats.SendMiscellaneousStatsAsync("MultipleInstancesSynced", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, RegistryManager.Instance.Version, RegistryManager.Instance.Oem, (string)null, (string)null, (string)null, (string)null, "Android");
            Dictionary <string, string>  data   = new Dictionary <string, string>();
            IEnumerable <CustomCheckbox> source = this.mActiveWindowsPanel.Children.OfType <CustomCheckbox>().Where <CustomCheckbox>((Func <CustomCheckbox, bool>)(_ =>
            {
                bool?isChecked = _.IsChecked;
                bool flag      = true;
                return(isChecked.GetValueOrDefault() == flag & isChecked.HasValue);
            }));

            if (source.Any <CustomCheckbox>())
            {
                this.ParentWindow.mIsSynchronisationActive = true;
                data.Add("instances", string.Join(",", source.Select <CustomCheckbox, string>((Func <CustomCheckbox, string>)(_ => _.Tag.ToString())).ToArray <string>()));
                this.ParentWindow.mFrontendHandler.SendFrontendRequestAsync("startOperationsSync", data);
                source.ToList <CustomCheckbox>().ForEach((System.Action <CustomCheckbox>)(customCheckbox => BlueStacksUIUtils.DictWindows[customCheckbox.Tag.ToString()]._TopBar.ShowSyncPanel(false)));
            }
            foreach (CustomCheckbox customCheckbox in source.ToList <CustomCheckbox>())
            {
                if (!BlueStacksUIUtils.sSyncInvolvedInstances.Contains(customCheckbox.Tag.ToString()))
                {
                    BlueStacksUIUtils.sSyncInvolvedInstances.Add(customCheckbox.Tag.ToString());
                }
            }
            if (!BlueStacksUIUtils.sSyncInvolvedInstances.Contains(this.ParentWindow.mVmName))
            {
                BlueStacksUIUtils.sSyncInvolvedInstances.Add(this.ParentWindow.mVmName);
            }
            this.UpdateOtherSyncWindows(true);
            this.Close_MouseLeftButtonUp((object)null, (MouseButtonEventArgs)null);
            if (!RegistryManager.Instance.IsShowToastNotification)
            {
                return;
            }
            this.ParentWindow.ShowGeneralToast(LocaleStrings.GetLocalizedString("STRING_SYNC_STARTED", ""));
        }
コード例 #12
0
        internal static void SendFrontendClickStats(
            string eventType,
            string keyword,
            string app_loc,
            string app_pkg,
            string is_installed,
            string app_position,
            string app_rank,
            string apps_recommendation_obj)
        {
            Dictionary <string, string> getCommonData = ClientStats.GetCommonData;

            getCommonData.Add("event", eventType);
            getCommonData.Add(nameof(keyword), keyword);
            getCommonData.Add(nameof(app_loc), app_loc);
            getCommonData.Add(nameof(app_pkg), app_pkg);
            getCommonData.Add(nameof(is_installed), is_installed);
            getCommonData.Add(nameof(app_position), app_position);
            getCommonData.Add(nameof(app_rank), app_rank);
            getCommonData.Add(nameof(apps_recommendation_obj), apps_recommendation_obj);
            ClientStats.SendStatsAsync(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}/bs3/stats/{1}", (object)RegistryManager.Instance.Host, (object)"frontend_click_stats"), getCommonData, (Dictionary <string, string>)null);
        }
コード例 #13
0
 internal static void SendGPlayClickStats(Dictionary <string, string> clientData)
 {
     ThreadPool.QueueUserWorkItem((WaitCallback)(obj =>
     {
         try
         {
             Dictionary <string, string> getCommonData = ClientStats.GetCommonData;
             if (clientData != null)
             {
                 foreach (KeyValuePair <string, string> keyValuePair in clientData)
                 {
                     getCommonData.Add(keyValuePair.Key, keyValuePair.Value);
                 }
             }
             ClientStats.SendStats(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}/bs3/stats/gplay_click_stats", string.IsNullOrEmpty(ClientStats.sDevUrl) ? (object)RegistryManager.Instance.Host : (object)ClientStats.sDevUrl), getCommonData, (Dictionary <string, string>)null, "");
         }
         catch (Exception ex)
         {
             Logger.Error("Failed to send gplay stats... Err : " + ex.ToString());
         }
     }));
 }
コード例 #14
0
        private void Settings_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (!(sender is CustomPictureBox customPictureBox))
            {
                return;
            }
            ListBoxItem visualParent             = WpfUtils.FindVisualParent <ListBoxItem>((DependencyObject)customPictureBox);
            MergedMacroConfiguration dataContext = visualParent.DataContext as MergedMacroConfiguration;

            dataContext.IsSettingsVisible = !dataContext.IsSettingsVisible;
            (visualParent.Template.FindName("mMacroSettingsImage", (FrameworkElement)visualParent) as CustomPictureBox).ImageName = dataContext.IsSettingsVisible ? "outline_settings_collapse" : "outline_settings_expand";
            ClientStats.SendMiscellaneousStatsAsync("MacroOperations", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, dataContext.IsSettingsVisible ? "merge_dropdown_expand" : "merge_dropdown_collapse", (string)null, (string)null, (string)null, (string)null, (string)null, "Android");
            foreach (object obj in (IEnumerable)this.mListBox.Items)
            {
                ListBoxItem listBoxItem = this.mListBox.ItemContainerGenerator.ContainerFromItem(obj) as ListBoxItem;
                if (listBoxItem != visualParent)
                {
                    (listBoxItem.DataContext as MergedMacroConfiguration).IsSettingsVisible = false;
                    (listBoxItem.Template.FindName("mMacroSettingsImage", (FrameworkElement)listBoxItem) as CustomPictureBox).ImageName = "outline_settings_expand";
                }
            }
        }
コード例 #15
0
 private void GuidanceVideoWindow_IsVisibleChanged(
     object _1,
     DependencyPropertyChangedEventArgs eventArgs)
 {
     if (this.IsVisible)
     {
         ClientStats.SendKeyMappingUIStatsAsync("video_clicked", KMManager.sPackageName, KMManager.sVideoMode.ToString());
         this.mBrowser = new BrowserControl();
         this.mBrowser.InitBaseControl(BlueStacksUIUtils.GetVideoTutorialUrl(KMManager.sPackageName, KMManager.sVideoMode.ToString().ToLower(CultureInfo.InvariantCulture), this.ParentWindow?.SelectedConfig?.SelectedControlScheme?.Name), 0.0f);
         this.mBrowser.ParentWindow = this.ParentWindow;
         this.mBrowser.Visibility   = Visibility.Visible;
         this.mBrowserGrid.Children.Add((UIElement)this.mBrowser);
     }
     try
     {
         if ((bool)eventArgs.NewValue)
         {
             HTTPUtils.SendRequestToEngineAsync("mute", new Dictionary <string, string>()
             {
                 ["explicit"] = "False"
             }, this.ParentWindow.mVmName, 0, (Dictionary <string, string>)null, false, 1, 0, "bgp");
             this.ParentWindow.mCommonHandler.OnVolumeMuted(true);
         }
         else
         {
             if (this.ParentWindow.IsMuted)
             {
                 return;
             }
             HTTPUtils.SendRequestToEngineAsync("unmute", (Dictionary <string, string>)null, this.ParentWindow.mVmName, 0, (Dictionary <string, string>)null, false, 1, 0, "bgp");
             this.ParentWindow.mCommonHandler.OnVolumeMuted(false);
         }
     }
     catch (Exception ex)
     {
         Logger.Error("Failed to send mute to frontend. Ex: " + ex.Message);
     }
 }
コード例 #16
0
 public void StopMacro()
 {
     try
     {
         this.StopTimer();
         this.mBlinkPlayingIconTimer = (DispatcherTimer)null;
         this.ParentWindow?.mCommonHandler?.StopMacroScriptHandling();
         if (this.mOperationsRecord == null)
         {
             return;
         }
         MacroTopBarPlayControl.ScriptStopDelegate scriptStopEvent = this.ScriptStopEvent;
         if (scriptStopEvent != null)
         {
             scriptStopEvent(this.mOperationsRecord.Name);
         }
         ClientStats.SendMiscellaneousStatsAsync("MacroOperations", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, "macro_stop", (string)null, this.mOperationsRecord.RecordingType.ToString(), (string)null, (string)null, (string)null, "Android");
     }
     catch (Exception ex)
     {
         Logger.Error("Error in StopMacro: " + ex.Message);
     }
 }
コード例 #17
0
 private void Recommendation_Click(object sender, MouseButtonEventArgs e)
 {
     try
     {
         ClientStats.SendFrontendClickStats("apps_recommendation", "click", (string)null, this.AppRecomendation.ExtraPayload["click_action_packagename"], (string)null, (string)null, (string)null, new JArray()
         {
             (JToken) new JObject()
             {
                 {
                     "app_loc",
                     (JToken)(this.AppRecomendation.ExtraPayload["click_generic_action"] == "InstallCDN" ? "cdn" : "gplay")
                 },
                 {
                     "app_pkg",
                     (JToken)this.AppRecomendation.ExtraPayload["click_action_packagename"]
                 },
                 {
                     "is_installed",
                     (JToken)(this.ParentWindow.mAppHandler.IsAppInstalled(this.AppRecomendation.ExtraPayload["click_action_packagename"]) ? "true" : "false")
                 },
                 {
                     "app_position",
                     (JToken)this.RecommendedAppPosition.ToString((IFormatProvider)CultureInfo.InvariantCulture)
                 },
                 {
                     "app_rank",
                     (JToken)this.RecommendedAppRank.ToString((IFormatProvider)CultureInfo.InvariantCulture)
                 }
             }
         }.ToString(Formatting.None));
     }
     catch (Exception ex)
     {
         Logger.Error("Exception while sending stats to cloud for apps_recommendation_click " + ex.ToString());
     }
     this.ParentWindow.Utils.HandleGenericActionFromDictionary((Dictionary <string, string>) this.AppRecomendation.ExtraPayload, "search_suggestion", "");
 }
コード例 #18
0
 internal static void SendGeneralStats(string op, Dictionary <string, string> sourceData)
 {
     ThreadPool.QueueUserWorkItem((WaitCallback)(obj =>
     {
         try
         {
             Dictionary <string, string> getCommonData = ClientStats.GetCommonData;
             getCommonData.Add(nameof(op), op);
             if (sourceData != null)
             {
                 foreach (KeyValuePair <string, string> keyValuePair in sourceData)
                 {
                     getCommonData.Add(keyValuePair.Key, keyValuePair.Value);
                 }
             }
             getCommonData.Add("os_ver", string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}.{1}", (object)Environment.OSVersion.Version.Major, (object)Environment.OSVersion.Version.Minor));
             ClientStats.SendStats(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}/bs3/stats/general_json", string.IsNullOrEmpty(ClientStats.sDevUrl) ? (object)RegistryManager.Instance.Host : (object)ClientStats.sDevUrl), getCommonData, (Dictionary <string, string>)null, "");
         }
         catch (Exception ex)
         {
             Logger.Info("Failed to send general stat for op : " + op + "...Err : " + ex.ToString());
         }
     }));
 }
コード例 #19
0
 private void AutoAlign_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     this.ParentWindow.mTopBar.mSettingsMenuPopup.IsOpen = false;
     CommonHandlers.ArrangeWindow();
     ClientStats.SendMiscellaneousStatsAsync("hamburgerMenu", RegistryManager.Instance.UserGuid, "AutoAlign", "MouseClick", RegistryManager.Instance.ClientVersion, RegistryManager.Instance.Version, RegistryManager.Instance.Oem, (string)null, (string)null, "Android");
 }
コード例 #20
0
 private void SyncGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     this.ParentWindow.mTopBar.mSettingsMenuPopup.IsOpen = false;
     this.ParentWindow.ShowSynchronizerWindow();
     ClientStats.SendMiscellaneousStatsAsync("hamburgerMenu", RegistryManager.Instance.UserGuid, "OperationSync", "MouseClick", RegistryManager.Instance.ClientVersion, RegistryManager.Instance.Version, RegistryManager.Instance.Oem, (string)null, (string)null, "Android");
 }
コード例 #21
0
 private void Close_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     ClientStats.SendMiscellaneousStatsAsync("MacroOperations", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, "merge_macro_close", (string)null, (string)null, (string)null, (string)null, (string)null, "Android");
     this.CloseWindow();
 }
コード例 #22
0
 private void mLaunchInstanceManagerBtn_Click(object sender, RoutedEventArgs e)
 {
     BlueStacksUIUtils.LaunchMultiInstanceManager();
     ClientStats.SendMiscellaneousStatsAsync("syncWindow", RegistryManager.Instance.UserGuid, "MultiInstance", "shortcut", RegistryManager.Instance.ClientVersion, RegistryManager.Instance.Version, RegistryManager.Instance.Oem, (string)null, (string)null, "Android");
 }
コード例 #23
0
        private void UnifyButton_Click(object sender, RoutedEventArgs e1)
        {
            if (this.mOriginalMacroRecording == null)
            {
                this.mOriginalMacroRecording = new MacroRecording();
            }
            this.mOriginalMacroRecording.CopyFrom(this.MergedMacroRecording);
            CustomMessageWindow customMessageWindow = new CustomMessageWindow();

            customMessageWindow.TitleTextBlock.Text = string.Format((IFormatProvider)CultureInfo.InvariantCulture, LocaleStrings.GetLocalizedString("STRING_UNIFY_0", ""), (object)this.mOriginalMacroRecording.Name);
            BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlock, "STRING_UNIFIYING_LOSE_CONFIGURE", "");
            bool closeWindow = false;

            customMessageWindow.AddButton(ButtonColors.Blue, string.Format((IFormatProvider)CultureInfo.InvariantCulture, LocaleStrings.GetLocalizedString("STRING_CONTINUE", ""), (object)"").Trim(), (EventHandler)((o, evt) =>
            {
                ClientStats.SendMiscellaneousStatsAsync("MacroOperations", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, "merge_unify", (string)null, (string)null, (string)null, (string)null, (string)null, "Android");
                this.mMacroRecorderWindow.FlattenRecording(this.mOriginalMacroRecording, false);
                CommonHandlers.SaveMacroJson(this.mOriginalMacroRecording, this.mOriginalMacroRecording.Name + ".json");
                CommonHandlers.RefreshAllMacroRecorderWindow();
                closeWindow = true;
            }), (string)null, false, (object)null, true);
            customMessageWindow.AddButton(ButtonColors.White, "STRING_CANCEL", (EventHandler)((o, evt) => ClientStats.SendMiscellaneousStatsAsync("MacroOperations", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, "merge_unify_cancel", (string)null, (string)null, (string)null, (string)null, (string)null, "Android")), (string)null, false, (object)null, true);
            customMessageWindow.CloseButtonHandle((EventHandler)((o, e2) => ClientStats.SendMiscellaneousStatsAsync("MacroOperations", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, "merge_unify_cancel", (string)null, (string)null, (string)null, (string)null, (string)null, "Android")), (object)null);
            customMessageWindow.Owner = (Window)this;
            customMessageWindow.ShowDialog();
            if (!closeWindow)
            {
                return;
            }
            this.CloseWindow();
        }
コード例 #24
0
 private void SendCTAStat()
 {
     ClientStats.SendLocalQuitPopupStatsAsync(this.ParentPopupTag, this.mCTAEventName);
 }
コード例 #25
0
 private void Close_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     this.Close();
     ClientStats.SendLocalQuitPopupStatsAsync(this.CurrentPopupTag, "click_action_close");
 }
コード例 #26
0
 private void SaveScriptSettings()
 {
     try
     {
         if (string.Equals(this.mRecording.Shortcut, this.mMacroShortcutTextBox.Tag.ToString(), StringComparison.InvariantCulture) && string.Equals(this.mRecording.Name.Trim(), this.mScriptName.Text.Trim(), StringComparison.InvariantCultureIgnoreCase))
         {
             return;
         }
         JsonSerializerSettings serializerSettings = Utils.GetSerializerSettings();
         serializerSettings.Formatting = Formatting.Indented;
         string str1 = Path.Combine(RegistryStrings.MacroRecordingsFolderPath, this.mRecording.Name + ".json");
         if (this.mRecording.Shortcut != this.mMacroShortcutTextBox.Tag.ToString())
         {
             if (!string.IsNullOrEmpty(this.mRecording.Shortcut) && MainWindow.sMacroMapping.ContainsKey(this.mRecording.Shortcut))
             {
                 MainWindow.sMacroMapping.Remove(this.mRecording.Shortcut);
             }
             if (this.mMacroShortcutTextBox.Tag != null && !string.IsNullOrEmpty(this.mMacroShortcutTextBox.Tag.ToString()))
             {
                 MainWindow.sMacroMapping[this.mMacroShortcutTextBox.Tag.ToString()] = this.mScriptName.Text;
             }
             if (this.mRecording.Shortcut != null && this.mMacroShortcutTextBox.Tag != null && !string.Equals(this.mRecording.Shortcut, this.mMacroShortcutTextBox.Tag.ToString(), StringComparison.InvariantCulture))
             {
                 ClientStats.SendMiscellaneousStatsAsync("MacroOperations", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, "macro_window_shortcutkey", (string)null, this.mRecording.RecordingType.ToString(), (string)null, (string)null, (string)null, "Android");
             }
             if (this.mMacroShortcutTextBox.Tag != null)
             {
                 this.mRecording.Shortcut = this.mMacroShortcutTextBox.Tag.ToString();
             }
             if (this.mRecording.PlayOnStart)
             {
                 this.ParentWindow.mAutoRunMacro = this.mRecording;
             }
             string contents = JsonConvert.SerializeObject((object)this.mRecording, serializerSettings);
             File.WriteAllText(str1, contents);
         }
         if (!string.Equals(this.mRecording.Name.Trim(), this.mScriptName.Text.Trim(), StringComparison.InvariantCultureIgnoreCase))
         {
             string         oldMacroName   = this.mRecording.Name;
             MacroRecording macroRecording = MacroGraph.Instance.Vertices.Cast <MacroRecording>().Where <MacroRecording>((Func <MacroRecording, bool>)(macro => string.Equals(macro.Name, this.mRecording.Name, StringComparison.InvariantCultureIgnoreCase))).FirstOrDefault <MacroRecording>();
             macroRecording.Name  = this.mScriptName.Text.ToLower(CultureInfo.InvariantCulture).Trim();
             this.mRecording.Name = this.mScriptName.Text.Trim();
             if (this.mRecording.PlayOnStart)
             {
                 this.ParentWindow.mAutoRunMacro = this.mRecording;
             }
             string contents = JsonConvert.SerializeObject((object)this.mRecording, serializerSettings);
             File.WriteAllText(str1, contents);
             string destFileName = Path.Combine(RegistryStrings.MacroRecordingsFolderPath, this.mScriptName.Text.Trim() + ".json");
             File.Move(str1, destFileName);
             foreach (MacroRecording record in macroRecording.Parents.Cast <MacroRecording>())
             {
                 foreach (MergedMacroConfiguration macroConfiguration in (Collection <MergedMacroConfiguration>)record.MergedMacroConfigurations)
                 {
                     List <string> stringList = new List <string>();
                     foreach (string str2 in macroConfiguration.MacrosToRun.Select <string, string>((Func <string, string>)(macroToRun => !string.Equals(oldMacroName, macroToRun, StringComparison.CurrentCultureIgnoreCase) ? macroToRun : macroToRun.Replace(macroToRun, this.mRecording.Name))))
                     {
                         stringList.Add(str2);
                     }
                     macroConfiguration.MacrosToRun.Clear();
                     foreach (string str2 in stringList)
                     {
                         macroConfiguration.MacrosToRun.Add(str2);
                     }
                 }
                 CommonHandlers.SaveMacroJson(record, CommonHandlers.GetCompleteMacroRecordingPath(record.Name));
                 CommonHandlers.OnMacroSettingChanged(record);
             }
             if (this.IsBookmarked)
             {
                 SingleMacroControl.DeleteScriptNameFromBookmarkedScriptListIfPresent(oldMacroName);
                 this.AddScriptNameToBookmarkedScriptListIfNotPresent(this.mRecording.Name);
             }
         }
         CommonHandlers.OnMacroSettingChanged(this.mRecording);
         CommonHandlers.RefreshAllMacroRecorderWindow();
         CommonHandlers.ReloadMacroShortcutsForAllInstances();
     }
     catch (Exception ex)
     {
         Logger.Error("Error in saving macro settings: " + ex.ToString());
     }
 }
コード例 #27
0
        internal static void HandleGenericNotification(JObject resJson, string vmName)
        {
            GenericNotificationItem genericItem = new GenericNotificationItem();

            try
            {
                JObject resJson1 = JObject.Parse(resJson["bluestacks_notification"][(object)"payload"][(object)"GenericNotificationItem"].ToString());
                resJson1.AssignIfContains <string>("id", (System.Action <string>)(x => genericItem.Id             = x));
                resJson1.AssignIfContains <string>("priority", (System.Action <string>)(x => genericItem.Priority = EnumHelper.Parse <NotificationPriority>(x, NotificationPriority.Normal)));
                resJson1.AssignIfContains <string>("title", (System.Action <string>)(x => genericItem.Title       = x));
                resJson1.AssignIfContains <string>("message", (System.Action <string>)(x => genericItem.Message   = x));
                resJson1.AssignIfContains <bool>("showribbon", (System.Action <bool>)(x => genericItem.ShowRibbon = x));
                resJson1.AssignIfContains <string>("menuimagename", (System.Action <string>)(x => genericItem.NotificationMenuImageName = x));
                resJson1.AssignIfContains <string>("menuimageurl", (System.Action <string>)(x => genericItem.NotificationMenuImageUrl   = x));
                resJson1.AssignIfContains <bool>("isread", (System.Action <bool>)(x => genericItem.IsRead                 = x));
                resJson1.AssignIfContains <bool>("isdeleted", (System.Action <bool>)(x => genericItem.IsDeleted           = x));
                resJson1.AssignIfContains <bool>("deferred", (System.Action <bool>)(x => genericItem.IsDeferred           = x));
                resJson1.AssignIfContains <string>("creationtime", (System.Action <string>)(x => genericItem.CreationTime = DateTime.ParseExact(x, "yyyy/MM/dd HH:mm:ss", (IFormatProvider)CultureInfo.InvariantCulture)));
                if (!string.IsNullOrEmpty(genericItem.NotificationMenuImageName) && !string.IsNullOrEmpty(genericItem.NotificationMenuImageUrl))
                {
                    genericItem.NotificationMenuImageName = Utils.TinyDownloader(genericItem.NotificationMenuImageUrl, genericItem.NotificationMenuImageName, RegistryStrings.PromotionDirectory, false);
                }
                if (resJson1["ExtraPayload"] != null && !JsonExtensions.IsNullOrEmptyBrackets(resJson1.GetValue("ExtraPayload", StringComparison.InvariantCulture).ToString()))
                {
                    resJson1["ExtraPayload"].AssignIfContains <string>("payloadtype", (System.Action <string>)(x => genericItem.PayloadType = EnumHelper.Parse <NotificationPayloadType>(x, NotificationPayloadType.Generic)));
                    SerializableDictionary <string, string> extraPayload = genericItem.ExtraPayload;
                    if (extraPayload != null)
                    {
                        extraPayload.ClearAddRange <string, string>((Dictionary <string, string>)CloudNotificationManager.HandleExtraPayload(resJson1.GetValue("ExtraPayload", StringComparison.InvariantCulture).ToObject <JObject>(), genericItem.PayloadType));
                    }
                }
                ClientStats.SendMiscellaneousStatsAsync("notification_received", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, genericItem.Id, genericItem.Title, genericItem.ExtraPayload.ContainsKey("campaign_id") ? genericItem.ExtraPayload["campaign_id"] : "", (string)null, (string)null, (string)null, "Android");
                genericItem.IsReceivedStatSent = true;
                if (resJson1["conditions"] != null && !JsonExtensions.IsNullOrEmptyBrackets(resJson1.GetValue("conditions", StringComparison.InvariantCulture).ToString()))
                {
                    resJson1["conditions"].AssignIfContains <string>("app_pkg_on_top", (System.Action <string>)(x => genericItem.DeferredApp     = x));
                    resJson1["conditions"].AssignIfContains <long>("app_usage_seconds", (System.Action <long>)(x => genericItem.DeferredAppUsage = x));
                }
                if (genericItem.ShowRibbon)
                {
                    if (resJson["bluestacks_notification"][(object)"payload"].ToObject <JObject>()["RibbonDesign"] != null)
                    {
                        if (!JsonExtensions.IsNullOrEmptyBrackets(resJson["bluestacks_notification"][(object)"payload"].GetValue("RibbonDesign")))
                        {
                            genericItem.NotificationDesignItem = new GenericNotificationDesignItem();
                            JObject resJson2 = JObject.Parse(resJson["bluestacks_notification"][(object)"payload"][(object)"RibbonDesign"].ToString());
                            resJson2.AssignIfContains <string>("titleforegroundcolor", (System.Action <string>)(x => genericItem.NotificationDesignItem.TitleForeGroundColor     = x));
                            resJson2.AssignIfContains <string>("messageforegroundcolor", (System.Action <string>)(x => genericItem.NotificationDesignItem.MessageForeGroundColor = x));
                            resJson2.AssignIfContains <string>("bordercolor", (System.Action <string>)(x => genericItem.NotificationDesignItem.BorderColor           = x));
                            resJson2.AssignIfContains <string>("ribboncolor", (System.Action <string>)(x => genericItem.NotificationDesignItem.Ribboncolor           = x));
                            resJson2.AssignIfContains <double>("auto_hide_timer", (System.Action <double>)(x => genericItem.NotificationDesignItem.AutoHideTime      = x));
                            resJson2.AssignIfContains <string>("hoverbordercolor", (System.Action <string>)(x => genericItem.NotificationDesignItem.HoverBorderColor = x));
                            resJson2.AssignIfContains <string>("hoverribboncolor", (System.Action <string>)(x => genericItem.NotificationDesignItem.HoverRibboncolor = x));
                            resJson2.AssignIfContains <string>("leftgifname", (System.Action <string>)(x => genericItem.NotificationDesignItem.LeftGifName           = x));
                            resJson2.AssignIfContains <string>("leftgifurl", (System.Action <string>)(x => genericItem.NotificationDesignItem.LeftGifUrl             = x));
                            if (!string.IsNullOrEmpty(genericItem.NotificationDesignItem.LeftGifName) && !string.IsNullOrEmpty(genericItem.NotificationDesignItem.LeftGifUrl))
                            {
                                Utils.TinyDownloader(genericItem.NotificationDesignItem.LeftGifUrl, genericItem.NotificationDesignItem.LeftGifName, RegistryStrings.PromotionDirectory, false);
                            }
                            if (resJson2["background_gradient"] != null)
                            {
                                foreach (JObject jobject in JArray.Parse(resJson2["background_gradient"].ToString()).ToObject <List <JObject> >())
                                {
                                    genericItem.NotificationDesignItem.BackgroundGradient.Add(new SerializableKeyValuePair <string, double>(jobject["color"].ToString(), jobject["offset"].ToObject <double>()));
                                }
                            }
                            if (resJson2["hover_background_gradient"] != null)
                            {
                                foreach (JObject jobject in JArray.Parse(resJson2["hover_background_gradient"].ToString()).ToObject <List <JObject> >())
                                {
                                    genericItem.NotificationDesignItem.HoverBackGroundGradient.Add(new SerializableKeyValuePair <string, double>(jobject["color"].ToString(), jobject["offset"].ToObject <double>()));
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("Exception while parsing generic notification. Not showing notification and not adding in notification menu." + ex.ToString());
                return;
            }
            try
            {
                if (string.IsNullOrEmpty(genericItem.Title) && string.IsNullOrEmpty(genericItem.Message))
                {
                    genericItem.IsDeleted = true;
                }
                if (!genericItem.IsDeferred)
                {
                    GenericNotificationManager.AddNewNotification(genericItem, false);
                }
                if (genericItem.ShowRibbon && resJson["bluestacks_notification"][(object)"payload"].ToObject <JObject>()["RibbonDesign"] != null && !JsonExtensions.IsNullOrEmptyBrackets(resJson["bluestacks_notification"][(object)"payload"].GetValue("RibbonDesign")))
                {
                    if (!genericItem.IsDeferred)
                    {
                        BlueStacksUIUtils.DictWindows[vmName].HandleGenericNotificationPopup(genericItem);
                    }
                    else
                    {
                        CloudNotificationManager.HandleDeferredNotification(genericItem);
                    }
                }
                BlueStacksUIUtils.DictWindows[vmName].mTopBar.RefreshNotificationCentreButton();
            }
            catch (Exception ex)
            {
                Logger.Error("Exception when handling notification json. Id " + genericItem.Id + " Error: " + ex.ToString());
            }
        }
コード例 #28
0
 private void StopScriptImg_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     this.ToggleScriptPlayPauseUi(false);
     this.ParentWindow.mCommonHandler.StopMacroScriptHandling();
     ClientStats.SendMiscellaneousStatsAsync("MacroOperations", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, "macro_stop", (string)null, this.mRecording.RecordingType.ToString(), (string)null, (string)null, (string)null, "Android");
 }
コード例 #29
0
        private static IntPtr KeyboardHookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            try
            {
                if (GlobalKeyBoardMouseHooks.sIsEnableKeyboardHookLogging)
                {
                    Logger.Info("Keyboard hook .." + nCode.ToString() + ".." + wParam.ToString() + ".." + lParam.ToString());
                }
                MainWindow window = BlueStacksUIUtils.ActivatedWindow;
                if (nCode >= 0)
                {
                    if (!(wParam == (IntPtr)256) && !(wParam == (IntPtr)260))
                    {
                        if (!(wParam == (IntPtr)257))
                        {
                            goto label_19;
                        }
                    }
                    int virtualKey = Marshal.ReadInt32(lParam);
                    Logger.Debug("Keyboard hook .." + virtualKey.ToString() + ".." + GlobalKeyBoardMouseHooks.sKey);
                    if (!(wParam == (IntPtr)256))
                    {
                        if (!(wParam == (IntPtr)260))
                        {
                            goto label_19;
                        }
                    }
                    if (!string.IsNullOrEmpty(GlobalKeyBoardMouseHooks.sKey) && (Keys)virtualKey == (Keys)Enum.Parse(typeof(Keys), GlobalKeyBoardMouseHooks.sKey, false) && (GlobalKeyBoardMouseHooks.sIsControlUsedInBossKey ? 1 : 0) == (Keyboard.IsKeyDown(Key.LeftCtrl) ? 1 : (Keyboard.IsKeyDown(Key.RightCtrl) ? 1 : 0)) && ((GlobalKeyBoardMouseHooks.sIsAltUsedInBossKey ? 1 : 0) == (Keyboard.IsKeyDown(Key.LeftAlt) ? 1 : (Keyboard.IsKeyDown(Key.RightAlt) ? 1 : 0)) && (GlobalKeyBoardMouseHooks.sIsShiftUsedInBossKey ? 1 : 0) == (Keyboard.IsKeyDown(Key.LeftShift) ? 1 : (Keyboard.IsKeyDown(Key.RightShift) ? 1 : 0))))
                    {
                        ThreadPool.QueueUserWorkItem((WaitCallback)(obj =>
                        {
                            if (BlueStacksUIUtils.DictWindows.Values.Count <= 0)
                            {
                                return;
                            }
                            MainWindow mainWindow = BlueStacksUIUtils.DictWindows.Values.ToList <MainWindow>()[0];
                            mainWindow.Dispatcher.Invoke((Delegate)(() =>
                            {
                                try
                                {
                                    if (mainWindow.OwnedWindows.OfType <OnBoardingPopupWindow>().Any <OnBoardingPopupWindow>() || mainWindow.OwnedWindows.OfType <GameOnboardingControl>().Any <GameOnboardingControl>())
                                    {
                                        return;
                                    }
                                    GlobalKeyBoardMouseHooks.mIsHidden = !GlobalKeyBoardMouseHooks.mIsHidden;
                                    BlueStacksUIUtils.HideUnhideBlueStacks(GlobalKeyBoardMouseHooks.mIsHidden);
                                }
                                catch
                                {
                                }
                            }));
                        }));
                        return((IntPtr)1);
                    }
                    if (window != null)
                    {
                        if (!Keyboard.IsKeyDown(Key.LeftCtrl))
                        {
                            if (!Keyboard.IsKeyDown(Key.RightCtrl))
                            {
                                goto label_19;
                            }
                        }
                        if (!Keyboard.IsKeyDown(Key.LeftAlt))
                        {
                            if (!Keyboard.IsKeyDown(Key.RightAlt))
                            {
                                goto label_19;
                            }
                        }
                        if (virtualKey >= 96 && virtualKey <= 105)
                        {
                            virtualKey -= 48;
                        }
                        string vkString = IMAPKeys.GetStringForFile(KeyInterop.KeyFromVirtualKey(virtualKey));
                        if (MainWindow.sMacroMapping.Keys.Contains <string>(vkString))
                        {
                            ThreadPool.QueueUserWorkItem((WaitCallback)(obj =>
                            {
                                try
                                {
                                    window.Dispatcher.Invoke((Delegate)(() =>
                                    {
                                        if (window.mSidebar.GetElementFromTag("sidebar_macro") != null && window.mSidebar.GetElementFromTag("sidebar_macro").Visibility == Visibility.Visible && window.mSidebar.GetElementFromTag("sidebar_macro").IsEnabled)
                                        {
                                            if (window.mIsMacroRecorderActive)
                                            {
                                                window.ShowToast(LocaleStrings.GetLocalizedString("STRING_STOP_RECORDING_FIRST", ""), "", "", false);
                                            }
                                            else if (window.mIsMacroPlaying)
                                            {
                                                CustomMessageWindow customMessageWindow = new CustomMessageWindow();
                                                BlueStacksUIBinding.Bind(customMessageWindow.TitleTextBlock, "STRING_CANNOT_RUN_MACRO", "");
                                                BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlock, "STRING_STOP_MACRO_SCRIPT", "");
                                                customMessageWindow.AddButton(ButtonColors.Blue, "STRING_OK", (EventHandler)null, (string)null, false, (object)null, true);
                                                customMessageWindow.Owner = (Window)window;
                                                customMessageWindow.ShowDialog();
                                            }
                                            else
                                            {
                                                try
                                                {
                                                    string path = Path.Combine(RegistryStrings.MacroRecordingsFolderPath, MainWindow.sMacroMapping[vkString] + ".json");
                                                    if (!File.Exists(path))
                                                    {
                                                        return;
                                                    }
                                                    MacroRecording record = JsonConvert.DeserializeObject <MacroRecording>(File.ReadAllText(path), Utils.GetSerializerSettings());
                                                    record.Name = MainWindow.sMacroMapping[vkString];
                                                    window.mCommonHandler.FullMacroScriptPlayHandler(record);
                                                    ClientStats.SendMiscellaneousStatsAsync("MacroOperations", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, "macro_play", "shortcut_keys", record.RecordingType.ToString(), string.IsNullOrEmpty(record.MacroId) ? "local" : "community", (string)null, (string)null, "Android");
                                                }
                                                catch (Exception ex)
                                                {
                                                    Logger.Error("Exception in macro play with shortcut: " + ex.ToString());
                                                }
                                            }
                                        }
                                        else
                                        {
                                            Logger.Info("Macro not enabled for the current package: " + window.StaticComponents.mSelectedTabButton.PackageName);
                                        }
                                    }));
                                }
                                catch
                                {
                                }
                            }));
                        }
                    }
                }
            }
            catch
            {
            }
label_19:
            return(NativeMethods.CallNextHookEx(GlobalKeyBoardMouseHooks.mKeyboardHookID, nCode, wParam, lParam));
        }
コード例 #30
0
        internal static void HandleCallMethod(JObject resJson, string vmName)
        {
            string result = "";

            JObject.Parse(resJson["bluestacks_notification"][(object)"payload"].ToString()).AssignStringIfContains("methodName", ref result);
            string lower = result.ToLower(CultureInfo.InvariantCulture);

            if (lower != null)
            {
                // ISSUE: reference to a compiler-generated method
                switch (\u003CPrivateImplementationDetails\u003E.ComputeStringHash(lower))
                {
                case 443221764:
                    if (lower == "updategrm")
                    {
                        GrmManager.UpdateGrmAsync(resJson["bluestacks_notification"][(object)"payload"][(object)"app_pkg_list"].ToIenumerableString());
                        return;
                    }
                    break;

                case 886249708:
                    if (lower == "openquitpopup")
                    {
                        CloudNotificationManager.OpenQuitPopup(resJson, vmName);
                        return;
                    }
                    break;

                case 1238708169:
                    if (lower == "calendarentry")
                    {
                        try
                        {
                            JObject androidPayload = (JObject)resJson["bluestacks_notification"][(object)"payload"][(object)"androidPayload"];
                            ClientStats.SendCalendarStats("calendar_" + resJson["bluestacks_notification"][(object)"payload"][(object)"methodType"].ToString() + "_firebase", androidPayload.ContainsKey("startDate") ? androidPayload["startDate"].ToString() : "", androidPayload.ContainsKey("endDate") ? androidPayload["endDate"].ToString() : "", androidPayload["location"].ToString(), "", "");
                            string str;
                            switch (resJson["bluestacks_notification"][(object)"payload"][(object)"methodType"].ToString())
                            {
                            case "add":
                                str = "addcalendarevent";
                                break;

                            case "update":
                                str = "updatecalendarevent";
                                break;

                            case "delete":
                                str = "deletecalendarevent";
                                break;

                            default:
                                throw new Exception("could not identify the methodType ");
                            }
                            string  endpoint = str;
                            JObject jobject1 = new JObject((object)new JProperty("event", (object)androidPayload));
                            Dictionary <string, string> data = new Dictionary <string, string>()
                            {
                                ["event"] = jobject1.ToString()
                            };
                            CloudNotificationManager.WorkQueue.Enqueue((SerialWorkQueue.Work)(() =>
                            {
                                try
                                {
                                    string guest = HTTPUtils.SendRequestToGuest(endpoint, data, vmName, 0, (Dictionary <string, string>)null, false, 1, 0, "bgp");
                                    Logger.Info("Response for calendarEntry " + guest);
                                    JObject jobject = JObject.Parse(guest);
                                    ClientStats.SendCalendarStats("calendar_" + resJson["bluestacks_notification"][(object)"payload"][(object)"methodType"].ToString() + "_android", androidPayload.ContainsKey("startDate") ? androidPayload["startDate"].ToString() : "", androidPayload.ContainsKey("endDate") ? androidPayload["endDate"].ToString() : "", androidPayload["location"].ToString(), string.Equals(jobject["result"].ToString(), "ok", StringComparison.InvariantCultureIgnoreCase).ToString((IFormatProvider)CultureInfo.InvariantCulture), jobject.ContainsKey("rowsDeleted") ? jobject["rowsDeleted"].ToString() : (jobject.ContainsKey("rowsUpdated") ? jobject["rowsUpdated"].ToString() : ""));
                                }
                                catch (Exception ex)
                                {
                                    Logger.Warning(string.Format("Guest not booted, error in sending Calendar entry event: {0}", (object)ex));
                                }
                            }));
                            return;
                        }
                        catch (Exception ex)
                        {
                            Logger.Warning(string.Format("Error in sending Calendar entry event data to android.. Json:{0} error:  {1}", (object)resJson, (object)ex));
                            return;
                        }
                    }
                    else
                    {
                        break;
                    }

                case 1286957143:
                    if (lower == "updatebstconfig")
                    {
                        CloudNotificationManager.UpdateBstConfig();
                        return;
                    }
                    break;

                case 1330308668:
                    if (lower == "downloadkeymappingcfg")
                    {
                        try
                        {
                            if (resJson["bluestacks_notification"][(object)"payload"][(object)"parserVersionList"] != null && resJson["bluestacks_notification"][(object)"payload"][(object)"parserVersionList"] is JArray jarray)
                            {
                                List <string> stringList = jarray.ToObject <List <string> >();
                                int           num1       = int.Parse(KMManager.MinParserVersion, (IFormatProvider)CultureInfo.InvariantCulture);
                                int           num2       = int.Parse(KMManager.ParserVersion, (IFormatProvider)CultureInfo.InvariantCulture);
                                using (List <string> .Enumerator enumerator = stringList.GetEnumerator())
                                {
                                    while (enumerator.MoveNext())
                                    {
                                        int num3 = int.Parse(enumerator.Current, (IFormatProvider)CultureInfo.InvariantCulture);
                                        if (num3 <= num2 && num3 >= num1)
                                        {
                                            string packageName = resJson["bluestacks_notification"][(object)"payload"][(object)"pkgName"].ToString();
                                            Logger.Info("downloadkeymappingcfg request sent to Android due to pv " + num3.ToString() + " pkg:" + packageName);
                                            Utils.SendKeymappingFiledownloadRequest(packageName, vmName);
                                            break;
                                        }
                                    }
                                    return;
                                }
                            }
                            else
                            {
                                Logger.Warning("Not processing downloadkeymappingcfg as parserVersionList not found");
                                return;
                            }
                        }
                        catch (Exception ex)
                        {
                            Logger.Warning("Error in sending download keymapping cfg request " + ex?.ToString());
                            return;
                        }
                    }
                    else
                    {
                        break;
                    }

                case 3602408690:
                    if (lower == "updatepromotions")
                    {
                        PromotionManager.ReloadPromotionsAsync();
                        return;
                    }
                    break;

                case 4066957630:
                    if (lower == "appusagestats")
                    {
                        CloudNotificationManager.HandleUsageNotification(resJson, vmName);
                        return;
                    }
                    break;
                }
            }
            Logger.Error("No method type found in HandleCallMethod json: " + resJson?.ToString());
        }