Exemple #1
0
        public CConfiguration(ArtType type)
        {
            GConfClient            = new GConf.Client();
            systemProxy            = new ProxyAttrStruct();
            gangProxy              = new ProxyAttrStruct();
            systemProxy.Ip         = "";   //TODO:Why is it important to initialize it...an error occurs otherwise.
            gangProxy.Ip           = "";   //TODO:Why is it important to initialize it...an error occurs otherwise.
            artType                = type;
            dirSep                 = Path.DirectorySeparatorChar.ToString();
            homePath               = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + dirSep;
            settingsPath           = Path.Combine(homePath, ".gnome2" + dirSep + "gnome-art-ng");
            splashInstallPath      = homePath + ".local/share/pixmaps/splash" + dirSep;
            applicationInstallPath = homePath + "." + themesDir + dirSep;
            decorationInstallPath  = homePath + "." + themesDir + dirSep;
            iconInstallPath        = homePath + iconDir + dirSep;
            tarIsAvailable         = CUtility.TestIfProgIsInstalled("tar", "--version", "gnu tar");
            grepIsAvailable        = CUtility.TestIfProgIsInstalled("grep", "--version", "gnu grep");
            sedIsAvailable         = CUtility.TestIfProgIsInstalled("sed", "--version", "gnu sed");
            setDistributionDependendSettings();
            CreateDownloadDirectories();

            //Create GConf listeners
            GConf.NotifyEventHandler changed_handler = new GConf.NotifyEventHandler(onSettingsChanged);
            GConfClient.AddNotify(sProxyGconfPath, changed_handler);
            //Load Configurations
            settingsLoadOk = LoadProgramSettings();
        }
        //Apply all settings (eventually refresh critical things)
        private void OnOkButtonClicked(object sender, EventArgs a)
        {
            config.ThemesDownloadPath = SettingsLocationFc.CurrentFolder;
            config.XmlRefreshInterval = SettingsXmlCb.Active;
            ProxyAttrStruct proxy = config.Proxy;

            proxy.Ip = SettingsProxyAddress.Text;
            try{
                proxy.Port = Int32.Parse(SettingsProxyPort.Text);
            }catch {
                proxy.Port = 0;
            }

            if (SettingsProxyActiveRb.Active)
            {
                config.ProxyKind = CConfiguration.ProxyType.Gang;
            }
            else if (SettingsProxySystemActiveRb.Active)
            {
                config.ProxyKind = CConfiguration.ProxyType.System;
            }
            else
            {
                config.ProxyKind = CConfiguration.ProxyType.None;
            }

            config.DontBotherForUpdates = !(SettingsUpdateCb.Active);
            OnCancelButtonClicked(sender, a);
        }
Exemple #3
0
        public CFileDownloader(CConfiguration config)
        {
            ProxyAttrStruct ProxyAttr = config.Proxy;

            if (config.ProxyKind != CConfiguration.ProxyType.None)
            {
                proxy = new WebProxy(ProxyAttr.Ip, ProxyAttr.Port);
                if ((ProxyAttr.BypassList != null) && (ProxyAttr.BypassList.Length > 0))
                {
                    for (int i = 0; i < ProxyAttr.BypassList.Length; i++)
                    {
                        ProxyAttr.BypassList[i] = "http://" + ProxyAttr.BypassList[i];
                    }
                    proxy.BypassList = ProxyAttr.BypassList;
                }
                proxy.Credentials = new NetworkCredential(ProxyAttr.User, ProxyAttr.Password);
            }
        }
        public CConfiguration(ArtType type)
        {
            GConfClient = new GConf.Client();
            systemProxy = new ProxyAttrStruct();
            gangProxy = new ProxyAttrStruct();
            systemProxy.Ip = ""; //TODO:Why is it important to initialize it...an error occurs otherwise.
            gangProxy.Ip = ""; //TODO:Why is it important to initialize it...an error occurs otherwise.
            artType=type;
            dirSep=Path.DirectorySeparatorChar.ToString();
            homePath = Environment.GetFolderPath(Environment.SpecialFolder.Personal)+dirSep;
            settingsPath = Path.Combine(homePath,".gnome2"+dirSep+"gnome-art-ng");
            splashInstallPath = homePath+".local/share/pixmaps/splash"+dirSep;
            applicationInstallPath = homePath+"."+themesDir+dirSep;
            decorationInstallPath = homePath+"."+themesDir+dirSep;
            iconInstallPath = homePath+iconDir+dirSep;
            tarIsAvailable = CUtility.TestIfProgIsInstalled("tar","--version","gnu tar");
            grepIsAvailable = CUtility.TestIfProgIsInstalled("grep","--version","gnu grep");
            sedIsAvailable = CUtility.TestIfProgIsInstalled("sed","--version","gnu sed");
            setDistributionDependendSettings();
            CreateDownloadDirectories();

            //Create GConf listeners
            GConf.NotifyEventHandler changed_handler = new GConf.NotifyEventHandler(onSettingsChanged);
            GConfClient.AddNotify(sProxyGconfPath,changed_handler);
            //Load Configurations
            settingsLoadOk = LoadProgramSettings();
        }