コード例 #1
0
        public static void SaveParam()
        {
            //ConfigReaderWriter.SetXmlValue("Password", RSACSP.EnCrypt(VarGlobal.Password));
            ConfigReaderWriter.SetXmlValue("Password", AddEncryption(VarGlobal.Password));
            ConfigReaderWriter.SetXmlValue("PrefixUserName", VarGlobal.PrefixUserName);
            ConfigReaderWriter.SetXmlValue("User", VarGlobal.User);
            ConfigReaderWriter.SetXmlValue("OpenSuseApiUrl", VarGlobal.OpenSuseApiUrl);
            string SubPrjStr = string.Empty;

            foreach (string item in SubProject)
            {
                SubPrjStr += item + "|";
            }
            if (SubPrjStr.Length > 2)
            {
                SubPrjStr = SubPrjStr.Remove(SubPrjStr.Length - 1, 1);
            }
            ConfigReaderWriter.SetXmlValue("SubProject", SubPrjStr);
            ConfigReaderWriter.SetXmlValue("RpmSpecMPath", RpmSpecMPath);
            ConfigReaderWriter.SetXmlValue("ConfirmWarn", ConfirmWarn.ToString());
            ConfigReaderWriter.SetXmlValue("ConfirmWarn", ConfirmWarn.ToString());

            //Manage Proxy
            ConfigReaderWriter.SetXmlValue("ProxyEnable", ProxyEnable.ToString());
            if (ProxyEnable == true)
            {
                //ConfigReaderWriter.SetXmlValue("ProxyPassword", RSACSP.EnCrypt(ProxyPassword));
                ConfigReaderWriter.SetXmlValue("ProxyPassword", AddEncryption(ProxyPassword));
                ConfigReaderWriter.SetXmlValue("ProxyUserName", ProxyUserName);
                ConfigReaderWriter.SetXmlValue("ProxyURL", ProxyURL);
                ConfigReaderWriter.SetXmlValue("ProxyPort", ProxyPort.ToString());
            }

            ConfigReaderWriter.SetXmlValue("AutoCheckUpdate", AutoCheckUpdate.ToString());
            ConfigReaderWriter.SetXmlValue("FirstUse", false.ToString());
            ConfigReaderWriter.SetXmlValue("GlobalLogFs", VarGlobal.GlobalLogFs);
            ConfigReaderWriter.SetXmlValue("LessVerbose", VarGlobal.LessVerbose.ToString());
        }
コード例 #2
0
        public static void LoadParam()
        {
            AutoCheckUpdate = Convert.ToBoolean(ConfigReaderWriter.GetXmlValue("AutoCheckUpdate", true.ToString()));
            //RSACSP.CreateKey = FirstRun;

            //VarGlobal.Password = RSACSP.DeCrypt(ConfigReaderWriter.GetXmlValue("Password", "123456789"));
            VarGlobal.Password       = RemoveEncryption(ConfigReaderWriter.GetXmlValue("Password", "123456789"));
            VarGlobal.PrefixUserName = ConfigReaderWriter.GetXmlValue("PrefixUserName", "home:UserName");
            VarGlobal.User           = ConfigReaderWriter.GetXmlValue("User", "Your OBS Username");
            VarGlobal.OpenSuseApiUrl = ConfigReaderWriter.GetXmlValue("OpenSuseApiUrl", VarGlobal.OpenSuseApiUrl);
            string[] SubPrjStr = ConfigReaderWriter.GetXmlValue("SubProject", VarGlobal.PrefixUserName).Split("|".ToCharArray());
            RpmSpecMPath = ConfigReaderWriter.GetXmlValue("RpmSpecMPath", RpmSpecMPath);
            string ConfirmWarnStr = ConfigReaderWriter.GetXmlValue("ConfirmWarn", ConfirmWarn.ToString());

            if (string.IsNullOrEmpty(ConfirmWarnStr) == false)
            {
                ConfirmWarn = Convert.ToBoolean(ConfirmWarnStr);
            }
            SubProject.Clear();
            SubProject.AddRange(SubPrjStr);

            //Manage a proxy
            //ProxyPassword = RSACSP.DeCrypt(ConfigReaderWriter.GetXmlValue("ProxyPassword", "123456789"));
            ProxyEnable   = Convert.ToBoolean(ConfigReaderWriter.GetXmlValue("ProxyEnable", false.ToString()));
            ProxyPassword = RemoveEncryption(ConfigReaderWriter.GetXmlValue("ProxyPassword", "123456789"));
            ProxyUserName = ConfigReaderWriter.GetXmlValue("ProxyUserName", "UserName");
            ProxyURL      = ConfigReaderWriter.GetXmlValue("ProxyURL", "127.0.0.1");
            ProxyPort     = Convert.ToInt32(ConfigReaderWriter.GetXmlValue("ProxyPort", 8080.ToString()));
            if (ProxyEnable == true)
            {
                VarGlobal.DefineProxy(ProxyURL, ProxyPort, true, ProxyUserName, ProxyPassword);
            }
            FirstUse = Convert.ToBoolean(ConfigReaderWriter.GetXmlValue("FirstUse", true.ToString()));
            VarGlobal.GlobalLogFs = ConfigReaderWriter.GetXmlValue("GlobalLogFs", PrefPath + "MonoOSC.log");
            VarGlobal.LessVerbose = Convert.ToBoolean(ConfigReaderWriter.GetXmlValue("LessVerbose", true.ToString()));
        }