示例#1
0
        public void SaveOption(RNCOption optionType, string val)
        {
            if (val == null)
            {
                val = "";
            }
            RegistryKey k = _regKey.CreateSubKey(REGISTRY_PATH);

            switch (optionType)
            {
            case RNCOption.MysqlPath: k.SetValue("mysql", val); break;

            case RNCOption.zip7path: k.SetValue("z7", val); break;

            case RNCOption.RabDump_StartupAtStart:
                k = _regKey.OpenSubKey(SYS_STARTUP, true);
                if (bool.Parse(val))
                {
                    k.SetValue("rabdump", Assembly.GetExecutingAssembly().Location);
                }
                else
                {
                    k.DeleteValue("rabdump", false);
                }
                break;

            case RNCOption.serverUrl:
                k.SetValue("sUrl", val); break;

            case RNCOption.RabDump_Address:
                k.SetValue(RNCOption.RabDump_Address.ToString(), val, RegistryValueKind.String); break;
            }
        }
示例#2
0
        public string GetOption(RNCOption optionType)
        {
            RegistryKey k = _regKey.CreateSubKey(REGISTRY_PATH);

            switch (optionType)
            {
            case RNCOption.MysqlPath:
                string val = (string)k.GetValue("mysql");
                if (String.IsNullOrEmpty(val))
                {
                    val = tryToDetectMysqlPath();
                }
                return(val);

            case RNCOption.zip7path: return((string)k.GetValue("z7"));

            case RNCOption.RabDump_StartupAtStart:
                k = _regKey.OpenSubKey(SYS_STARTUP);
                string runp = (string)k.GetValue("rabdump", "");
                return((runp == Assembly.GetEntryAssembly().Location).ToString());

            case RNCOption.serverUrl:
                return((string)k.GetValue("sUrl", ""));

            case RNCOption.RabDump_Address:
                return((string)k.GetValue(RNCOption.RabDump_Address.ToString(), ""));
            }
            return("");
        }