コード例 #1
0
 private void SetFeaturesInSetting(CgBase profile)
 {
     if (this.Ident == "FeatureMalware")
     {
         profile.set_FeatureMalware(this.Checked && ObjectHolder.CurrentUser.HasUserAccessToFeature(2));
     }
     if (this.Ident == "FeatureAdBlock")
     {
         profile.set_FeatureAdBlock(this.Checked && ObjectHolder.CurrentUser.HasUserAccessToFeature(1));
     }
     if (this.Ident == "FeatureTracking")
     {
         profile.set_FeatureTracking(this.Checked && ObjectHolder.CurrentUser.HasUserAccessToFeature(4));
     }
     if (this.Ident == "FeatureZip")
     {
         profile.set_FeatureZip(this.Checked && ObjectHolder.CurrentUser.HasUserAccessToFeature(3));
     }
     if (this.Ident == "FeatureHttps")
     {
         profile.set_FeatureHttps(this.Checked && ObjectHolder.CurrentUser.HasUserAccessToFeature(8));
     }
     SettingsHolder.get_Settings().SaveSettingsAsync(false);
 }
コード例 #2
0
        public static CgBase SetFeaturesByProfile(CgBase profile, CgApiUser user = null)
        {
            if (profile == null)
            {
                return(null);
            }
            if (user == null)
            {
                user = ObjectHolder.CurrentUser;
            }
            if (user == null)
            {
                return(null);
            }
            string baseName = profile.GetBaseName();
            uint   num      = < PrivateImplementationDetails >.ComputeStringHash(baseName);

            if (num <= 1377339077u)
            {
                if (num != 120087624u)
                {
                    if (num != 542584942u)
                    {
                        if (num == 1377339077u)
                        {
                            if (baseName == "network")
                            {
                                SettingsHelpers.SetDefaultFeaturesNetwork(profile, user);
                            }
                        }
                    }
                    else if (baseName == "custom")
                    {
                        SettingsHelpers.SetDefaultFeaturesCustom(profile, user);
                    }
                }
                else if (baseName == "wifi")
                {
                    SettingsHelpers.SetDefaultFeaturesWifi(profile, user);
                }
            }
            else if (num <= 1879243226u)
            {
                if (num != 1741922751u)
                {
                    if (num == 1879243226u)
                    {
                        if (baseName == "anonymousDownloading")
                        {
                            SettingsHelpers.SetDefaultFeaturesAnonymousDownloading(profile, user);
                        }
                    }
                }
                else if (baseName == "unblock")
                {
                    SettingsHelpers.SetDefaultFeaturesUnblock(profile, user);
                }
            }
            else if (num != 2687971255u)
            {
                if (num == 2889374611u)
                {
                    if (baseName == "antiCensor")
                    {
                        SettingsHelpers.SetDefaultFeaturesAntiCensor(profile, user);
                    }
                }
            }
            else if (baseName == "anonymousBrowsing")
            {
                SettingsHelpers.SetDefaultFeaturesAnonymousBrowsing(profile, user);
            }
            return(profile);
        }
コード例 #3
0
        public void SetFeatureVisibility(CgBase profile)
        {
            if (profile.Equals(SettingsHolder.get_Settings().get_ProfileAnonymousDownloading()))
            {
                GuiHelper.SetRandomHint(this.Hint, "anonDownload");
            }
            if (profile.Equals(SettingsHolder.get_Settings().get_ProfileAnonymousBrowsing()))
            {
                GuiHelper.SetRandomHint(this.Hint, "anonSurfing");
            }
            if (profile.Equals(SettingsHolder.get_Settings().get_ProfileCustom()))
            {
                GuiHelper.SetRandomHint(this.Hint, "custom");
            }
            if (profile.Equals(SettingsHolder.get_Settings().get_ProfileNetwork()))
            {
                GuiHelper.SetRandomHint(this.Hint, "network");
            }
            if (profile.Equals(SettingsHolder.get_Settings().get_ProfileWifi()))
            {
                GuiHelper.SetRandomHint(this.Hint, "wifi");
            }
            this.GridZip.Visibility      = Visibility.Visible;
            this.GridAds.Visibility      = Visibility.Visible;
            this.GridTracking.Visibility = Visibility.Visible;
            this.GridMalware.Visibility  = Visibility.Visible;
            this.GridHttps.Visibility    = Visibility.Visible;
            this.GridSpeed.Visibility    = Visibility.Visible;
            if (!profile.get_FeatureZip())
            {
                this.GridZip.Visibility = Visibility.Collapsed;
            }
            if (!profile.get_FeatureAdBlock())
            {
                this.GridAds.Visibility = Visibility.Collapsed;
            }
            if (!profile.get_FeatureTracking())
            {
                this.GridTracking.Visibility = Visibility.Collapsed;
            }
            if (!profile.get_FeatureMalware())
            {
                this.GridMalware.Visibility = Visibility.Collapsed;
            }
            if (!profile.get_FeatureHttps())
            {
                this.GridHttps.Visibility = Visibility.Collapsed;
            }
            if (ObjectHolder.CurrentUser != null && !ObjectHolder.CurrentUser.HasUserAccessToFeature(9))
            {
                this.GridSpeed.Visibility = Visibility.Collapsed;
            }
            Style style = base.FindResource("FeatureLittleLabelArrow") as Style;

            if (profile is CgProfileAnonymousBrowsing)
            {
                style = (base.FindResource("FeatureLittleLabelArrow") as Style);
            }
            else if (profile is CgProfileAnonymousDownloading)
            {
                style = (base.FindResource("FeatureLittleLabelArrow_Torrent") as Style);
            }
            else if (profile is CgProfileCustom)
            {
                style = (base.FindResource("FeatureLittleLabelArrow_Custom") as Style);
            }
            else if (profile is CgProfileNetwork)
            {
                style = (base.FindResource("FeatureLittleLabelArrow_Network") as Style);
            }
            else if (profile is CgProfileWifi)
            {
                style = (base.FindResource("FeatureLittleLabelArrow_Network") as Style);
            }
            else if (profile is CgProfileUnblock)
            {
                style = (base.FindResource("FeatureLittleLabelArrow_Unblock") as Style);
            }
            else if (profile is CgProfileUncensoring)
            {
                style = (base.FindResource("FeatureLittleLabelArrow_Uncensoring") as Style);
            }
            if (style != null)
            {
                this.CheckAds.Style        = style;
                this.CheckEncryption.Style = style;
                this.CheckHttps.Style      = style;
                this.CheckIp.Style         = style;
                this.CheckIp2.Style        = style;
                this.CheckLogging.Style    = style;
                this.CheckMalware.Style    = style;
                this.CheckSpeed.Style      = style;
                this.CheckTracking.Style   = style;
                this.CheckZip.Style        = style;
            }
        }