public BaseMixpanelObject()
 {
     this.Cg5Upgrade = SettingsHolder.get_Settings().get_IsCg5Upgrade();
     this.DistinctId = ((!this.Cg5Upgrade) ? SettingsHolder.get_Settings().get_DistinctId() : BaseMixpanelObject.GetDistinctIdHmac(SettingsHolder.get_Settings().get_DistinctId()));
     if (SettingsHolder.get_Settings().get_LoginServer().Contains("dev-api.cyberghostvpn.com"))
     {
         this.Environment = "dev";
     }
     else if (SettingsHolder.get_Settings().get_LoginServer().Contains("beta-api.cyberghostvpn.com"))
     {
         this.Environment = "beta";
     }
     else
     {
         this.Environment = "live";
     }
     if (ObjectHolder.CurrentStatus != null)
     {
         this.ApiVersion = string.Format("{0}-{1}", ObjectHolder.CurrentStatus.get_JsApi(), ObjectHolder.CurrentStatus.get_PhpApi());
         this.Ip         = ObjectHolder.CurrentStatus.get_RealIp();
     }
     this.Country        = HelperFunctions.GetSystemRegionCode();
     this.ClientLanguage = SettingsHolder.get_Settings().get_Language();
     this.AppName        = Theming.GetProductName();
     if (ObjectHolder.CurrentUser != null && ObjectHolder.CurrentUser.get_Subscription() != null && ObjectHolder.CurrentUser.get_Subscription().get_Product() != null)
     {
         this.PlanId   = ObjectHolder.CurrentUser.get_Subscription().get_Product().get_PlansId();
         this.PlanName = ObjectHolder.CurrentUser.get_Subscription().get_Product().get_Plan().get_InternalName();
         if (ObjectHolder.CurrentUser.get_Subscription().get_Product().get_Plan().get_TrialPeriodDays() > 0)
         {
             this.PlanType = "trial";
         }
         else
         {
             this.PlanType = (ObjectHolder.CurrentUser.get_Subscription().get_Product().get_Plan().get_Free() ? "free" : (ObjectHolder.CurrentUser.get_Subscription().get_Product().get_Plan().get_Promo() ? "promo" : "paid"));
         }
         this.ProductId             = ObjectHolder.CurrentUser.get_Subscription().get_Product().get_Id();
         this.ProductName           = ObjectHolder.CurrentUser.get_Subscription().get_Product().get_InternalName();
         this.BillingType           = (ObjectHolder.CurrentUser.get_Subscription().get_Product().get_Recurring() ? "recurring" : "prepaid");
         this.BillingIntervalMonths = ObjectHolder.CurrentUser.get_Subscription().get_Product().get_Months();
         this.BillingIntervalDays   = ObjectHolder.CurrentUser.get_Subscription().get_Product().get_Days();
     }
     this.Currency                       = NumberFormatInfo.CurrentInfo.CurrencySymbol;
     this.Os                             = "win";
     this.Architecture                   = (System.Environment.Is64BitOperatingSystem ? "x64" : "x86");
     this.OsVersion                      = HelperFunctions.GetOsVersion().ToString();
     this.AffiliateId                    = Constants.get_AffiliateId();
     this.ClientVersion                  = Assembly.GetExecutingAssembly().GetName().Version.ToString();
     this.SuccesfullConnections          = SettingsHolder.get_Settings().get_TotalConnectionsOk();
     this.UnsuccesfullConnections        = SettingsHolder.get_Settings().get_TotalConnectionFailed();
     this.ConnectionAttempts             = SettingsHolder.get_Settings().get_TotalConnectionAttempts();
     this.ApplicationLaunches            = SettingsHolder.get_Settings().get_TotalApplicationLaunches();
     this.TotalSecureHotspotsProtected   = SettingsHolder.get_Settings().get_WiFiSecureSsids().Count;
     this.TotalUnsecureHotspotsProtected = SettingsHolder.get_Settings().get_WiFiUnsecureSsids().Count;
     this.LastUsedProfile                = SettingsHolder.get_Settings().get_LastConnectedProfile();
 }
示例#2
0
        public static void MutateKnownSsid(string ssid, WifiPopup.WifiConnectionResult action)
        {
            try
            {
                if (SettingsHolder.get_Settings().get_KnownSsids() == null)
                {
                    SettingsHolder.get_Settings().set_KnownSsids(new ObservableCollection <SsidItem>());
                }
                bool flag = false;
                ObservableCollection <SsidItem> knownSsids = SettingsHolder.get_Settings().get_KnownSsids();
                lock (knownSsids)
                {
                    foreach (SsidItem current in SettingsHolder.get_Settings().get_KnownSsids())
                    {
                        if (current != null && current.get_Ssid().Equals(ssid))
                        {
                            if (action == WifiPopup.WifiConnectionResult.Always)
                            {
                                current.set_Action(2);
                            }
                            else if (action == WifiPopup.WifiConnectionResult.Never)
                            {
                                current.set_Action(0);
                            }
                            else
                            {
                                if (action != WifiPopup.WifiConnectionResult.Ask)
                                {
                                    if (action != WifiPopup.WifiConnectionResult.Once)
                                    {
                                        if (action == WifiPopup.WifiConnectionResult.Disconnect)
                                        {
                                            current.set_Action(3);
                                            goto IL_9B;
                                        }
                                        goto IL_9B;
                                    }
                                }
                                current.set_Action(1);
                            }
IL_9B:
                            flag = true;
                        }
                    }
                }
                if (!flag)
                {
                    WifiHelpers.AddNewWifi(ssid, action);
                }
            }
            catch (Exception ex)
            {
                HelperFunctions.DebugLine(string.Format("Exception in MutateKnownSsid could not get entry EX: {0}", ex.Message));
            }
        }
示例#3
0
 public Task ConnectToServer()
 {
     if (!ObjectHolder.CurrentUser.HasUserAccessToFeature(17))
     {
         ConversionPopUpHelpers.ShowConversionPopUp(17);
         return(null);
     }
     ObjectHolder.ConnectionType    = "manual";
     ObjectHolder.CurrentProfileTab = "none";
     return(ObjectHolder.MainForm.ConnectWithProfile(SettingsHolder.get_Settings().get_ProfileNetwork(), false, false, true));
 }
示例#4
0
 public void OnNavigatedTo(NavigationEventArgs e)
 {
     ObjectHolder.MainForm.set_IsNavigationVisible(true);
     ObjectHolder.CurrentProfile      = SettingsHolder.get_Settings().get_ProfileNetwork();
     this.FeatureGroup.CurrentProfile = SettingsHolder.get_Settings().get_ProfileNetwork();
     this.FeatureGroup.BindFeatures();
     this.InfoFooter.Profile        = SettingsHolder.get_Settings().get_ProfileNetwork();
     this.UpgradeBtn.CurrentProfile = SettingsHolder.get_Settings().get_ProfileNetwork();
     this.UpgradeBtn.SetVisibility(this.ConnectBtn, 17);
     GuiHelper.SetUpgradeBarVisiblity(this.FeatureGroup);
     this.ConnectBtn.Content = ((Theming.CurrentTheme == Theming.Theme.Pro) ? Profiles.Start_Ghost_Network : Profiles.NetworkConnect);
 }
示例#5
0
 public Wifi()
 {
     this.InitializeComponent();
     base.DataContext        = SettingsHolder.get_Settings().get_ProfileWifi();
     this.InfoFooter.Profile = SettingsHolder.get_Settings().get_ProfileWifi();
     this.ConnectBtn.Command = new AsyncDelegateCommand(new Func <Task>(this.ConnectToServer), new Func <bool>(this.CanExecute));
     this._wiFiDetector      = new WiFiDetector();
     this._wiFiDetector.add_OnNewWiFiDetected(new WiFiDetector.NewWiFiDetected(this._wiFiDetector_OnNewWiFiDetected));
     this._wiFiDetector.add_OnSignalStrengthChanged(new WiFiDetector.SignalStrengthChanged(this._wiFiDetector_OnSignalStrengthChanged));
     this._wiFiDetector.add_OnWifiDisconnected(new WiFiDetector.NewWiFiDetected(this._wiFiDetector_OnWifiDisconnected));
     this._wiFiDetector.set_Enabled(true);
 }
 public void OnNavigatedTo(NavigationEventArgs e)
 {
     ObjectHolder.MainForm.set_IsNavigationVisible(true);
     ObjectHolder.CurrentProfile    = SettingsHolder.get_Settings().get_ProfileAnonymousBrowsing();
     this.UpgradeBtn.CurrentProfile = SettingsHolder.get_Settings().get_ProfileAnonymousBrowsing();
     this.UpgradeBtn.SetVisibility(this.ConnectBtn, 13);
     this.FeatureGroup.CurrentProfile = SettingsHolder.get_Settings().get_ProfileAnonymousBrowsing();
     this.FeatureGroup.BindFeatures();
     GuiHelper.SetUpgradeBarVisiblity(this.FeatureGroup);
     GuiHelper.InitializeServerList(AnonymousBrowsing.Servers, this.CountryComboBox);
     this.ConnectBtn.Content = ((Theming.CurrentTheme == Theming.Theme.Pro) ? Profiles.Start_Ghost_Browsing : Profiles.anonBrowsing_connect);
 }
示例#7
0
 private void SetCountryLabel()
 {
     try
     {
         if (!string.IsNullOrEmpty(SettingsHolder.get_Settings().get_ProfileUnblock().get_SelectedItemCountryCode()))
         {
             this.LblImageCountry.Source = new BitmapImage(new Uri(Theming.GetThemedImage(Path.Combine("Icons\\Flags\\24", string.Format("{0}.png", SettingsHolder.get_Settings().get_ProfileUnblock().get_SelectedItemCountryCode())))));
         }
     }
     catch (Exception)
     {
     }
 }
 private Task ConnectToServer()
 {
     this.FeatureGroup.FSpeed.FeatureBoxLabel.Content = Profiles.speed_head;
     this.FeatureGroup.FSpeed.Premium = true;
     if (!ObjectHolder.CurrentUser.HasUserAccessToFeature(18))
     {
         ConversionPopUpHelpers.ShowConversionPopUp(18);
         return(null);
     }
     ObjectHolder.ConnectionType    = "manual";
     ObjectHolder.CurrentProfileTab = "none";
     return(ObjectHolder.MainForm.ConnectWithProfile(SettingsHolder.get_Settings().get_ProfileAnonymousDownloading(), false, false, true));
 }
        public void OnAfterConnected(bool isReconnect, bool isAppProtection)
        {
            ObjectHolder.DownloadTimerCounter = 0;
            this._timercounter = 0;
            this._timerForDownload.Start();
            this._featureStatsUpdateTimer.Start();
            VpnServerLastConnectionInfos expr_32 = ObjectHolder.CurrentConnectionInfos;

            if (!string.IsNullOrEmpty((expr_32 != null) ? expr_32.ServerIp : null))
            {
                TextBlock arg_5C_0 = this.LblUpRightFirstLine;
                VpnServerLastConnectionInfos expr_50 = ObjectHolder.CurrentConnectionInfos;
                arg_5C_0.Text = ((expr_50 != null) ? expr_50.ServerIp : null);
            }
            if (ObjectHolder.CurrentProfile.Equals(SettingsHolder.get_Settings().get_ProfileAnonymousBrowsing()))
            {
                this.SwitchLeft.Style  = (base.FindResource("AnonSurfing") as Style);
                this.SwitchRight.Style = (base.FindResource("AnonSurfing") as Style);
                this.LblUpRightFirstLine.Foreground = (base.FindResource("BrushColorYellow") as SolidColorBrush);
            }
            if (ObjectHolder.CurrentProfile.Equals(SettingsHolder.get_Settings().get_ProfileAnonymousDownloading()))
            {
                this.SwitchLeft.Style  = (base.FindResource("AnonDown") as Style);
                this.SwitchRight.Style = (base.FindResource("AnonDown") as Style);
                this.LblUpRightFirstLine.Foreground = (base.FindResource("ProfileAnonDownloadColorBrush") as SolidColorBrush);
            }
            if (ObjectHolder.CurrentProfile.Equals(SettingsHolder.get_Settings().get_ProfileCustom()))
            {
                this.SwitchLeft.Style  = (base.FindResource("Custom") as Style);
                this.SwitchRight.Style = (base.FindResource("Custom") as Style);
                this.LblUpRightFirstLine.Foreground = (base.FindResource("MangentaBaseBrush") as SolidColorBrush);
            }
            if (ObjectHolder.CurrentProfile.Equals(SettingsHolder.get_Settings().get_ProfileNetwork()))
            {
                this.SwitchLeft.Style  = (base.FindResource("Wifi") as Style);
                this.SwitchRight.Style = (base.FindResource("Wifi") as Style);
                this.LblUpRightFirstLine.Foreground = (base.FindResource("ProfileWifiColorBrush") as SolidColorBrush);
            }
            if (ObjectHolder.CurrentProfile.Equals(SettingsHolder.get_Settings().get_ProfileWifi()))
            {
                this.SwitchLeft.Style  = (base.FindResource("Wifi") as Style);
                this.SwitchRight.Style = (base.FindResource("Wifi") as Style);
                this.LblUpRightFirstLine.Foreground = (base.FindResource("ProfileWifiColorBrush") as SolidColorBrush);
            }
            this.LblUpRightSecondLine.Text = Profiles.ConnectedAnonymousBrowsing_OnAfterConnected_IP_REPLACED_BY_CYBERGHOST;
            this.SwitchLeft.Visibility     = Visibility.Visible;
            this.SwitchRight.Visibility    = Visibility.Visible;
            this.SwitchToPageNumber(ObjectHolder.CurrentProfile.Equals(SettingsHolder.get_Settings().get_ProfileAnonymousDownloading()) ? 1 : 2);
        }
 public void SetTrayIconBySelectedProfile(bool isConnected, bool isRegularAsFallbackIcon)
 {
     if (ObjectHolder.TaskbarIcon == null)
     {
         return;
     }
     if (string.IsNullOrWhiteSpace(SettingsHolder.get_Settings().get_ConnectedProfileName()))
     {
         return;
     }
     if (ObjectHolder.TaskbarIcon != null)
     {
         ObjectHolder.TaskbarIcon.set_Icon(this.GetTrayIconBySelectedProfile(isConnected, isRegularAsFallbackIcon));
     }
 }
        public void ResetFeatureSettings()
        {
            CgBase cgBase = CgApiHelper.SetFeaturesByProfile(this.CurrentProfile, null);

            if (cgBase != null)
            {
                SettingsHolder.get_Settings().SaveSettingsAsync(false);
                this.FMalware.FeatureBoxButton.IsChecked  = new bool?(cgBase.get_FeatureMalware());
                this.FAddblock.FeatureBoxButton.IsChecked = new bool?(cgBase.get_FeatureAdBlock());
                this.FHttps.FeatureBoxButton.IsChecked    = new bool?(cgBase.get_FeatureHttps());
                this.FTracking.FeatureBoxButton.IsChecked = new bool?(cgBase.get_FeatureTracking());
                this.FZip.FeatureBoxButton.IsChecked      = new bool?(cgBase.get_FeatureZip());
                this.FSpeed.FeatureBoxButton.IsChecked    = new bool?(ObjectHolder.CurrentUser.HasUserAccessToFeature(9));
            }
        }
示例#12
0
        public void OnAfterConnected(bool isReconnect, bool isAppProtection)
        {
            string selectedItemCountryCode = SettingsHolder.get_Settings().get_ProfileUnblock().get_SelectedItemCountryCode();

            this.LblCountry.Text = GuiHelper.FindTranslationForCountry(selectedItemCountryCode);
            SettingsHolder.get_Settings().get_ProfileUnblock().set_DidItWorkDisabled(false);
            if (!this.VisitCounterIncremented)
            {
                GuiHelper.SetLastUsedProfile(ObjectHolder.CurrentProfile.GetBaseName());
                this.VisitCounterIncremented = true;
            }
            this.CancelConnection.Visibility = Visibility.Hidden;
            if (SettingsHolder.get_Settings().get_ProfileUnblock().get_SelectedItemCountryImage() != null && !SettingsHolder.get_Settings().get_ProfileUnblock().get_SelectedItemCountryImage().Contains("24/.png"))
            {
                this.LblImageCountry.Source = new BitmapImage(new Uri(SettingsHolder.get_Settings().get_ProfileUnblock().get_SelectedItemCountryImage()));
            }
            this.DescriptionText.Text          = SettingsHolder.get_Settings().get_ProfileUnblock().get_SelectedItemDescription();
            this.DescriptionText.Visibility    = Visibility.Hidden;
            this.DescriptionGrid.Visibility    = Visibility.Hidden;
            this.HintContainer.Visibility      = Visibility.Hidden;
            this.FeatureContainer.Visibility   = Visibility.Visible;
            this.StatusMessage.Content         = string.Format("{0} {1}", Status._YOU_ARE_CURRENTLY_UNBLOCKING_, SettingsHolder.get_Settings().get_ProfileUnblock().get_SelectedItemName());
            this.LoadingBar.Visibility         = Visibility.Hidden;
            this.Unblocking.Visibility         = Visibility.Hidden;
            this.UnblockingAnimated.Visibility = Visibility.Visible;
            this.FeatureContainer.Visibility   = Visibility.Visible;
            this.ConnectBtn.Visibility         = Visibility.Visible;
            if (ObjectHolder.FirstTimeVisitedConnectedScreen)
            {
                if (ObjectHolder.CurrentProfile != null)
                {
                    McProfileLogItem expr_173 = new McProfileLogItem();
                    expr_173.set_FeatureAdBlock(ObjectHolder.CurrentProfile.get_FeatureAdBlock());
                    expr_173.set_FeatureApp(ObjectHolder.CurrentProfile.get_FeatureApp());
                    expr_173.set_FeatureBrowserAgent(ObjectHolder.CurrentProfile.get_FeatureBrowserAgent());
                    expr_173.set_FeatureBrowserLanguage(ObjectHolder.CurrentProfile.get_FeatureBrowserLanguage());
                    expr_173.set_FeatureHttps(ObjectHolder.CurrentProfile.get_FeatureHttps());
                    expr_173.set_FeatureMalware(ObjectHolder.CurrentProfile.get_FeatureMalware());
                    expr_173.set_FeatureScout(ObjectHolder.CurrentProfile.get_FeatureScout());
                    expr_173.set_FeatureTracking(ObjectHolder.CurrentProfile.get_FeatureTracking());
                    expr_173.set_FeatureZip(ObjectHolder.CurrentProfile.get_FeatureZip());
                    expr_173.set_ProfileName(ObjectHolder.CurrentProfile.get_ProfileName());
                    McProfileLogItem aEvent = expr_173;
                    ObjectHolder.EventLogger.LogLocalEvent(aEvent);
                }
                ObjectHolder.FirstTimeVisitedConnectedScreen = false;
            }
        }
        private void Trash_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Label label = sender as Label;

            if (label == null)
            {
                return;
            }
            string      strB      = label.ToolTip.ToString();
            int         num       = 0;
            ProgramData foundItem = null;
            int         num2      = -1;

            using (IEnumerator enumerator = ((IEnumerable)this.TorrentComboBox.Items).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ProgramData programData = enumerator.Current as ProgramData;
                    if (programData != null && string.Compare(programData.ToolTip, strB, StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        num2      = num;
                        foundItem = programData;
                        break;
                    }
                    num++;
                }
            }
            try
            {
                CgProfileAnonymousDownloading profileAnonymousDownloading = SettingsHolder.get_Settings().get_ProfileAnonymousDownloading();
                if (foundItem != null && num2 > -1)
                {
                    CgProfileAnonymousDownloading arg_BE_0 = profileAnonymousDownloading;
                    string downloadToolExeName;
                    profileAnonymousDownloading.set_DownloadToolApplicationPath(downloadToolExeName = "empty");
                    arg_BE_0.set_DownloadToolExeName(downloadToolExeName);
                    this.ProgramDataList.RemoveAt(num2);
                    int index = profileAnonymousDownloading.get_CustomApps().FindIndex((string x) => x.Equals(foundItem.ApplicationExe, StringComparison.OrdinalIgnoreCase));
                    profileAnonymousDownloading.get_CustomApps().RemoveAt(index);
                    SettingsHolder.get_Settings().SaveSettingsAsync(false);
                }
            }
            catch (ArgumentOutOfRangeException ex)
            {
                HelperFunctions.DebugLine(string.Format("{0}::{1}:index --> {2}", base.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message));
            }
            this.TorrentComboBox.SelectedIndex = 0;
        }
示例#14
0
        public ConnectionEstablishedEvent()
        {
            SettingsHolder expr_0B            = SettingsHolder.get_Settings();
            int            totalConnectionsOk = expr_0B.get_TotalConnectionsOk();

            expr_0B.set_TotalConnectionsOk(totalConnectionsOk + 1);
            base.SuccesfullConnections = SettingsHolder.get_Settings().get_TotalConnectionsOk();
            if (ObjectHolder.CurrentProfile != null)
            {
                this.FeaturesEnabled = ObjectHolder.CurrentProfile.GetEnabledFeatures();
                this.Profile         = ObjectHolder.CurrentProfile.GetBaseName();
            }
            this.TabUsed          = ObjectHolder.CurrentProfileTab;
            this.ConnectionType   = ObjectHolder.ConnectionType;
            this.ConnectionSource = ObjectHolder.ConnectionSource;
        }
示例#15
0
 public void OnNavigatedTo(NavigationEventArgs e)
 {
     ObjectHolder.MainForm.set_IsNavigationVisible(true);
     ObjectHolder.CurrentProfile      = SettingsHolder.get_Settings().get_ProfileWifi();
     this.FeatureGroup.CurrentProfile = SettingsHolder.get_Settings().get_ProfileWifi();
     this.FeatureGroup.BindFeatures();
     this.UpgradeBtn.CurrentProfile = SettingsHolder.get_Settings().get_ProfileWifi();
     this.UpgradeBtn.SetVisibility(this.ConnectBtn, 11);
     GuiHelper.SetUpgradeBarVisiblity(this.FeatureGroup);
     this.SetWifiSettingToCombobox(SettingsHolder.get_Settings().get_ProfileWifi().CurrentSSID);
     if (this._wiFiDetector.GetCurrentWiFi().Length != 0)
     {
         this.UpdateWifiDisplay(this._wiFiDetector.GetCurrentWiFi()[0], true);
     }
     this.ConnectBtn.Content = ((Theming.CurrentTheme == Theming.Theme.Pro) ? Profiles.Start_Ghost_Wi_Fi : Profiles.wifi_connect_button);
 }
示例#16
0
        public ConnectionAttemptEvent()
        {
            SettingsHolder expr_0B = SettingsHolder.get_Settings();
            int            totalConnectionAttempts = expr_0B.get_TotalConnectionAttempts();

            expr_0B.set_TotalConnectionAttempts(totalConnectionAttempts + 1);
            base.ConnectionAttempts = SettingsHolder.get_Settings().get_TotalConnectionAttempts();
            if (ObjectHolder.CurrentProfile != null)
            {
                this.FeaturesEnabled = ObjectHolder.CurrentProfile.GetEnabledFeatures();
                this.Profile         = ObjectHolder.CurrentProfile.GetBaseName();
            }
            this.TabUsed          = ObjectHolder.CurrentProfileTab;
            this.ConnectionType   = ObjectHolder.ConnectionType;
            this.ConnectionSource = ObjectHolder.ConnectionSource;
        }
 public void OnNavigatedTo(NavigationEventArgs e)
 {
     ObjectHolder.MainForm.set_IsNavigationVisible(true);
     ObjectHolder.CurrentProfile = SettingsHolder.get_Settings().get_ProfileAnonymousDownloading();
     this.FillProgramList();
     this.BindingProgramList();
     this.FeatureGroup.CurrentProfile = SettingsHolder.get_Settings().get_ProfileAnonymousDownloading();
     this.FeatureGroup.BindFeatures();
     GuiHelper.SetUpgradeBarVisiblity(this.FeatureGroup);
     this.SendCustomProgramInfoToApi();
     this.ConnectBtn.IsEnabled      = true;
     this.TorrentComboBox.IsEnabled = true;
     this.UpgradeBtn.CurrentProfile = SettingsHolder.get_Settings().get_ProfileAnonymousDownloading();
     this.UpgradeBtn.SetVisibility(this.ConnectBtn, 18);
     this.SetSelectedIndexToLastUsedOption(this.TorrentComboBox);
     this.ConnectBtn.Content = ((Theming.CurrentTheme == Theming.Theme.Pro) ? Profiles.Start_Ghost_Downloads : Profiles.download_connect_button);
 }
 public void OnAfterConnected(bool isReconnect, bool isAppProtection)
 {
     this._isbeforeConnectForWifiState = false;
     this.FeatureDisplay.OnAfterConnected(isReconnect, isAppProtection);
     this.ConnectedSlider.OnAfterConnected(isReconnect, isAppProtection);
     if (!this.VisitCounterIncremented)
     {
         GuiHelper.SetLastUsedProfile(ObjectHolder.CurrentProfile.GetBaseName());
         this.VisitCounterIncremented = true;
     }
     this.CancelConnection.Visibility             = Visibility.Hidden;
     this.StatusMessage.Content                   = Profiles._YOUR_WIFI___ + SettingsHolder.get_Settings().get_ProfileWifi().CurrentSSID + " " + Profiles.IS_CURRENTLY_PROTECTED;
     this.LoadingBar.Visibility                   = Visibility.Hidden;
     this.Surfing.Visibility                      = Visibility.Hidden;
     this.SurfingAnimated.Visibility              = Visibility.Visible;
     this.ConnectBtn.Visibility                   = Visibility.Visible;
     ObjectHolder.FirstTimeVisitedConnectedScreen = false;
 }
示例#19
0
 private Task ConnectToServer()
 {
     if (ObjectHolder.CurrentUser.HasUserAccessToFeature(16))
     {
         ObjectHolder.ConnectionType = "automatic";
         if (SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedServerId() > 0)
         {
             ObjectHolder.ConnectionType = "specific server";
         }
         if (!string.IsNullOrEmpty(SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedCountry()))
         {
             ObjectHolder.ConnectionType = "specific country";
         }
         return(ObjectHolder.MainForm.ConnectWithProfile(SettingsHolder.get_Settings().get_ProfileCustom(), false, false, true));
     }
     GuiHelper.ShowUpgradeDialog(SettingsHolder.get_Settings().get_ProfileCustom().GetBaseName());
     return(null);
 }
示例#20
0
        public virtual LinkedList <MixpanelMessage> GetMessages(IMixpanelClient mixpanelClient)
        {
            LinkedList <MixpanelMessage> linkedList = new LinkedList <MixpanelMessage>();

            linkedList.AddLast(mixpanelClient.GetPeopleSetMessage(this));
            linkedList.AddLast(mixpanelClient.GetPeopleSetOnceMessage(base.DistinctId, new Dictionary <string, object>
            {
                {
                    "First seen",
                    DateTime.Now
                }
            }));
            Dictionary <string, string> settingsAsDictionary = SettingsHolder.get_Settings().get_BannerSettings().GetSettingsAsDictionary();

            if (settingsAsDictionary.Count > 0)
            {
                linkedList.AddLast(mixpanelClient.GetPeopleSetMessage(base.DistinctId, settingsAsDictionary));
            }
            return(linkedList);
        }
示例#21
0
 private void UpdateConnectedPanel()
 {
     if (ObjectHolder.ConnectionStatus != -1 && ObjectHolder.CurrentConnectionInfos != null)
     {
         this.connected_Profile.Text    = SettingsHolder.get_Settings().get_ConnectedProfileNamePretty();
         this.connected_ServerName.Text = string.Format("{0} ({1})", ObjectHolder.CurrentConnectionInfos.ServerName, ObjectHolder.CurrentConnectionInfos.ServerIp);
         string themedImage = Theming.GetThemedImage(Path.Combine("Icons\\Flags\\24", string.Format("{0}.png", ObjectHolder.CurrentConnectionInfos.ServerCountry.ToLower())));
         if (File.Exists(themedImage))
         {
             BitmapImage bitmapImage = new BitmapImage();
             bitmapImage.BeginInit();
             bitmapImage.UriSource = new Uri(themedImage);
             bitmapImage.EndInit();
             this.connected_CountryImage.Source = bitmapImage;
         }
         this.connected_Info.Visibility = Visibility.Visible;
         return;
     }
     this.connected_Info.Visibility = Visibility.Collapsed;
 }
示例#22
0
        public void OnBeforeConnect(bool isReconnect, bool isAppProtection)
        {
            this.CancelConnection.Visibility = Visibility.Visible;
            this.LblFeedback.Visibility      = Visibility.Hidden;
            this.YesButton.Visibility        = Visibility.Hidden;
            this.LblYes.Visibility           = Visibility.Hidden;
            this.NoButton.Visibility         = Visibility.Hidden;
            this.LblNo.Visibility            = Visibility.Hidden;
            this.HintContainer.Visibility    = Visibility.Visible;
            this.FeatureContainer.Visibility = Visibility.Hidden;
            this.StatusMessage.Content       = Status._CONNECTING;
            this.ConnectBtn.Visibility       = Visibility.Hidden;
            this.LoadingBar.Visibility       = Visibility.Visible;
            this.FeatureContainer.Visibility = Visibility.Hidden;
            this.Unblocking.Visibility       = Visibility.Visible;
            string selectedItemCountryCode = SettingsHolder.get_Settings().get_ProfileUncensoring().get_SelectedItemCountryCode();

            this.LblCountry.Text = GuiHelper.FindTranslationForCountry(selectedItemCountryCode);
            this.SetCountryImage();
        }
示例#23
0
 public static void AddNewWifi(string ssid, WifiPopup.WifiConnectionResult action)
 {
     try
     {
         SsidItem expr_05 = new SsidItem();
         expr_05.set_Ssid(ssid);
         SsidItem ssidItem = expr_05;
         if (!string.IsNullOrEmpty(ssid))
         {
             if (action == WifiPopup.WifiConnectionResult.Always)
             {
                 ssidItem.set_Action(2);
             }
             else if (action == WifiPopup.WifiConnectionResult.Never)
             {
                 ssidItem.set_Action(0);
             }
             else if (action == WifiPopup.WifiConnectionResult.Ask)
             {
                 ssidItem.set_Action(1);
             }
             else if (action == WifiPopup.WifiConnectionResult.Disconnect)
             {
                 ssidItem.set_Action(3);
             }
             if (SettingsHolder.get_Settings().get_KnownSsids() == null)
             {
                 SettingsHolder.get_Settings().set_KnownSsids(new ObservableCollection <SsidItem>());
             }
             ObservableCollection <SsidItem> knownSsids = SettingsHolder.get_Settings().get_KnownSsids();
             lock (knownSsids)
             {
                 SettingsHolder.get_Settings().get_KnownSsids().Add(ssidItem);
             }
         }
     }
     catch (Exception ex)
     {
         HelperFunctions.DebugLine(string.Format("Exception in AddNewWifi could not get entry EX: {0}", ex.Message));
     }
 }
示例#24
0
        public static Channel GetLoginSystemChannel()
        {
            string text = SettingsHolder.get_Settings().get_LoginServer();

            if (string.IsNullOrEmpty(text))
            {
                text = "rest.cyberghostvpn.com";
            }
            if (text.Contains("rest"))
            {
                return(5);
            }
            if (text.Contains("beta-api"))
            {
                return(3);
            }
            if (text.Contains("dev-api"))
            {
                return(1);
            }
            return(0);
        }
示例#25
0
        public void OnNavigatedTo(NavigationEventArgs e)
        {
            this.UpgradeBtn.CurrentProfile = SettingsHolder.get_Settings().get_ProfileCustom();
            this.UpgradeBtn.SetVisibility(this.ConnectBtn, 16);
            this.InfoFooter.Profile       = SettingsHolder.get_Settings().get_ProfileCustom();
            this.ConnectBtn.IsEnabled     = false;
            this.SelectedLabel.Visibility = Visibility.Hidden;
            if (SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedServerId() > 0 || !string.IsNullOrEmpty(SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedCountry()) || !string.IsNullOrEmpty(SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedCountryDisplay()))
            {
                this.SelectedLabel.Visibility = Visibility.Visible;
                this.ConnectBtn.IsEnabled     = true;
            }
            ObjectHolder.MainForm.set_IsNavigationVisible(true);
            this.ServerOption.Content = SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedServerName();
            if (string.IsNullOrEmpty(SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedServerName()))
            {
                this.ServerOption.Content = SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedServerDisplayName();
            }
            string themedImage = Theming.GetThemedImage(Path.Combine("Icons\\Flags\\24", string.Format("{0}.png", SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedCountry())));

            if (string.IsNullOrEmpty(SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedCountry()))
            {
                themedImage = Theming.GetThemedImage(Path.Combine("Icons\\Flags\\24", string.Format("{0}.png", SettingsHolder.get_Settings().get_ProfileCustom().get_SelectedCountryDisplay())));
            }
            if (!string.IsNullOrEmpty(themedImage) && File.Exists(themedImage))
            {
                this.ServerImage.Visibility = Visibility.Visible;
                this.ServerImage.Source     = new BitmapImage(new Uri(string.Format(themedImage, new object[0])));
            }
            else
            {
                this.ServerImage.Visibility = Visibility.Hidden;
            }
            this.FeatureGroup.CurrentProfile = SettingsHolder.get_Settings().get_ProfileCustom();
            this.FeatureGroup.BindFeatures();
            ObjectHolder.CurrentProfileTab = "extra features";
            GuiHelper.SetUpgradeBarVisiblity(this.FeatureGroup);
        }
示例#26
0
        private static string GetPublicSettings(RegistrySettingsStorage settingsObject)
        {
            JObject     jObject     = new JObject();
            RegistryKey settingsKey = settingsObject.GetSettingsKey(false, false, false);

            if (settingsKey != null)
            {
                string[] valueNames = settingsKey.GetValueNames();
                for (int i = 0; i < valueNames.Length; i++)
                {
                    string text  = valueNames[i];
                    string text2 = string.Empty;
                    string text3 = string.Empty;
                    try
                    {
                        if (text.StartsWith("Public_", StringComparison.InvariantCultureIgnoreCase))
                        {
                            text3 = settingsKey.GetValue(text, string.Empty).ToString();
                            text2 = text.Substring(7);
                        }
                        if (!string.IsNullOrEmpty(text2))
                        {
                            if (text2.StartsWith("ENC_", StringComparison.InvariantCultureIgnoreCase))
                            {
                                text3 = SettingsHolder.get_Settings().DecryptUserString(text3, false);
                            }
                            jObject.Add(new JProperty(text2, text3));
                        }
                    }
                    catch (Exception ex)
                    {
                        HelperFunctions.DebugLine("COULD NOT LOAD KEY " + text2 + ex.Message);
                    }
                }
                settingsKey.Close();
            }
            return(jObject.ToString());
        }
示例#27
0
 private void SetCountryImage()
 {
     try
     {
         if (ObjectHolder.ConnectionStatus != null)
         {
             this.LblCountry.Text = Profiles.COUNTRY;
             if (File.Exists(this.IcoBlankFlag.ToString()))
             {
                 this.LblImageCountry.Source = new BitmapImage(this.IcoBlankFlag);
             }
         }
         else if (!string.IsNullOrEmpty(SettingsHolder.get_Settings().get_ProfileUncensoring().get_SelectedItemCountryCode()))
         {
             string selectedItemCountryCode = SettingsHolder.get_Settings().get_ProfileUncensoring().get_SelectedItemCountryCode();
             this.LblCountry.Text        = GuiHelper.FindTranslationForCountry(selectedItemCountryCode);
             this.LblImageCountry.Source = new BitmapImage(new Uri(Theming.GetThemedImage(Path.Combine("Icons\\Flags\\24", string.Format("{0}.png", SettingsHolder.get_Settings().get_ProfileUncensoring().get_SelectedItemCountryCode())))));
         }
     }
     catch (Exception)
     {
     }
 }
示例#28
0
 public Task ConnectToServer(string ssid)
 {
     if (ObjectHolder.CurrentUser != null && !ObjectHolder.CurrentUser.HasUserAccessToFeature(11))
     {
         ConversionPopUpHelpers.ShowConversionPopUp(11);
         return(null);
     }
     if (!string.IsNullOrEmpty(ssid))
     {
         SettingsHolder.get_Settings().get_ProfileWifi().CurrentSSID = ssid;
     }
     else
     {
         Label  expr_3E = this.WifiLabel;
         string arg_56_0;
         if (expr_3E == null)
         {
             arg_56_0 = null;
         }
         else
         {
             object expr_4A = expr_3E.Content;
             arg_56_0 = ((expr_4A != null) ? expr_4A.ToString() : null);
         }
         if (!string.IsNullOrEmpty(arg_56_0))
         {
             SettingsHolder.get_Settings().get_ProfileWifi().CurrentSSID = this.WifiLabel.Content.ToString();
         }
     }
     if (ObjectHolder.CurrentUser != null && ObjectHolder.CurrentUser.HasUserAccessToFeature(11))
     {
         ObjectHolder.ConnectionType    = "automatic";
         ObjectHolder.CurrentProfileTab = "none";
         return(ObjectHolder.MainForm.ConnectWithProfile(SettingsHolder.get_Settings().get_ProfileWifi(), false, false, true));
     }
     return(Task.FromResult <bool>(false));
 }
        public void OnNavigatedTo(NavigationEventArgs e)
        {
            this.ConnectedSlider.OnNavigatedTo();
            ObjectHolder.CurrentProfile          = SettingsHolder.get_Settings().get_ProfileWifi();
            ObjectHolder.CurrentConnectingScreen = this;
            this.FeatureDisplay.SetFeatureVisibility(SettingsHolder.get_Settings().get_ProfileWifi());
            GuiHelper.StopInactivityCheck();
            ConnectionStatus connectionStatus = ObjectHolder.ConnectionStatus;

            if (connectionStatus != null)
            {
                if (connectionStatus == 10)
                {
                    this.OnBeforeConnect(false, false);
                }
            }
            else
            {
                this.OnAfterConnected(false, false);
            }
            ObjectHolder.MainForm.set_IsNavigationVisible(true);
            ObjectHolder.MainForm.set_IsSubNavigationVisible(false);
            this.ConnectBtn.Content = ((Theming.CurrentTheme == Theming.Theme.Pro) ? Profiles.Stop_Ghost_Wi_Fi : Profiles.STOP_PROTECTION);
        }
示例#30
0
        public static async Task <CgApiUser> GetUserByCredentials(CgApiUser.CgApiOauthCredentials credentials)
        {
            SettingsHolder.get_Settings().set_ENC_AuthToken(credentials.ToString());
            SettingsHolder.get_Settings().SaveSettingsAsync(false).ConfigureAwait(false);
            OAuthRequestInfos oAuthRequestInfos = OAuthData.GetOAuthRequestInfos();

            oAuthRequestInfos.UserKey    = credentials.get_Token();
            oAuthRequestInfos.UserSecret = credentials.get_TokenSecret();
            CgApiGlobalOAuthData.set_OAuthRequestInfos(oAuthRequestInfos);
            if (ObjectHolder.UserNotAuthorizedErrorHandler != null)
            {
                CgApiGlobalOAuthData.get_OAuthRequestInfos().UserNotAuthorizedErrorHandler = ObjectHolder.UserNotAuthorizedErrorHandler;
            }
            if (ObjectHolder.ServiceNotAvailablErrorHandler != null)
            {
                OAuthRequestInfos expr_84 = CgApiGlobalOAuthData.get_OAuthRequestInfos();
                expr_84.ServiceNotAvailablErrorHandler = (JsonOAuthRestClient.OnHttpErrorHandler)Delegate.Combine(expr_84.ServiceNotAvailablErrorHandler, ObjectHolder.ServiceNotAvailablErrorHandler);
            }
            CgApiUser cgApiUser = new CgApiUser(oAuthRequestInfos);
            CgApiUser result;

            try
            {
                await cgApiUser.Fetch();

                new CgApiUserCertificateManager().Fetch(cgApiUser.get_Token(), Constants.get_UserDataPath(), Constants.get_OpenVpnBinPath()).ConfigureAwait(false);
            }
            catch (WebException var_4_13F)
            {
                HelperFunctions.DebugLine("UNKNOWN WEBEXCEPTION IN GetUserByCredentials: " + var_4_13F.Message);
                result = null;
                return(result);
            }
            result = cgApiUser;
            return(result);
        }