Ejemplo n.º 1
0
        public options(options newOptions)
        {
            useEncryption = newOptions.useEncryption;
            portname = newOptions.portname;
            myKey = newOptions.myKey;
            rulesPath = newOptions.rulesPath;
            Uri path;
            if (Uri.TryCreate(rulesPath, UriKind.RelativeOrAbsolute, out path))
            {
                if (path.Scheme == Uri.UriSchemeHttp || path.Scheme == Uri.UriSchemeHttps)
                    RuleRepository = new serviceRuleRepository(rulesPath);
                else
                    RuleRepository = new ruleRepository(rulesPath);

            }
        }
Ejemplo n.º 2
0
        public options()
        {
            if (!bool.TryParse(Properties.Settings.Default["useEncryption"] as string, out useEncryption))
                useEncryption = false;
            portname = Properties.Settings.Default["portName"] as string;
            try
            {
                myKey.setKey(Properties.Settings.Default["key"] as string);
            }
            catch (FormatException)
            {
                myKey.setKey("00112233445566778899aabbccddeeff");
            }
            rulesPath = Properties.Settings.Default["rulesPath"] as string;
            Uri path;
            if (Uri.TryCreate(rulesPath, UriKind.RelativeOrAbsolute,out path))
            {
                if (path.Scheme == Uri.UriSchemeHttp || path.Scheme ==  Uri.UriSchemeHttps)
                    RuleRepository = new serviceRuleRepository(rulesPath);
                else
                    RuleRepository = new ruleRepository(rulesPath);

            }
        }