Пример #1
0
        void getUrlScheme()
        {
            var    regex  = new Regex(@"([a-z]:\\(?:[^\\:]+\\)*(?:[^:\\]+\.\w+))", RegexOptions.Compiled | RegexOptions.IgnoreCase);
            String regUri = RegURI.ToLower();

            if (regex.IsMatch(regUri))
            {
                UrlScheme = UrlProtocolScheme.Local;
            }
            else if (regUri.Contains("file://") || regUri.Contains(@"\\"))
            {
                UrlScheme = UrlProtocolScheme.UNC;
            }
            else if (regUri.Contains("http://") || regUri.Contains("https://"))
            {
                UrlScheme = UrlProtocolScheme.HTTP;
            }
            else if (regUri.Contains("ldap://"))
            {
                UrlScheme = UrlProtocolScheme.LDAP;
            }
            else if (regUri.Contains("ftp://"))
            {
                UrlScheme = UrlProtocolScheme.FTP;
            }
            else
            {
                UrlScheme = UrlProtocolScheme.Unknown;
            }
        }
Пример #2
0
        void getUrlScheme()
        {
            Regex regex = new Regex(@"([a-z]:\\(?:[^\\:]+\\)*(?:[^:\\]+\.\w+))");

            if (regex.IsMatch(RegURI))
            {
                UrlScheme = UrlProtocolSchemes.Local;
            }
            else if (RegURI.ToLower().Contains("file://") || RegURI.Contains(@"\\"))
            {
                UrlScheme = UrlProtocolSchemes.UNC;
            }
            else if (RegURI.ToLower().Contains("http://"))
            {
                UrlScheme = UrlProtocolSchemes.HTTP;
            }
            else if (RegURI.ToLower().Contains("ldap://"))
            {
                UrlScheme = UrlProtocolSchemes.LDAP;
            }
            else
            {
                UrlScheme = UrlProtocolSchemes.Unknown;
            }
        }
Пример #3
0
        void m_initialize()
        {
            var   regex = new Regex(@"^\d+");
            Match match = regex.Match(RegURI);

            if (match.Success)
            {
                Int16 matches = Convert.ToInt16(match.Value);
                Flags = (AdcsCdpUrlFlag)matches;
            }
            else
            {
                throw new FormatException();
            }
            ConfigURI = RegURI
                        .Replace("%11", "<CAObjectClass>")
                        .Replace("%10", "<CDPObjectClass>")
                        .Replace("%1", "<ServerDNSName>")
                        .Replace("%2", "<ServerShortName>")
                        .Replace("%3", "<CaName>")
                        .Replace("%6", "<ConfigurationContainer>")
                        .Replace("%7", "<CATruncatedName>")
                        .Replace("%8", "<CRLNameSuffix>")
                        .Replace("%9", "<DeltaCRLAllowed>");
            getUrlScheme();
        }
Пример #4
0
        void m_initialize()
        {
            Regex regex = new Regex(@"^\d+");
            Match match = regex.Match(RegURI);

            if (match.Success)
            {
                Int16        matches      = Convert.ToInt16(match.Value);
                Int16[]      options      = { 1, 2, 4, 8, 64, 128 };
                List <Int16> validoptions = options.Where(option => (matches & option) != 0).ToList();
                Flags = validoptions.ToArray();
                foreach (Int16 option in validoptions)
                {
                    switch (option)
                    {
                    case 1: CRLPublish = true; break;

                    case 2: AddToCertCDP = true; break;

                    case 4: AddToFreshestCRL = true; break;

                    case 8: AddToCRLCDP = true; break;

                    case 64: DeltaCRLPublish = true; break;

                    case 128: IDP = true; break;

                    default: throw new Exception("Invalid publishing Flags.");
                    }
                }
            }
            else
            {
                throw new FormatException();
            }
            ConfigURI = RegURI.Replace("%11", "<CAObjectClass>");
            ConfigURI = ConfigURI.Replace("%10", "<CDPObjectClass>");
            ConfigURI = ConfigURI.Replace("%1", "<ServerDNSName>");
            ConfigURI = ConfigURI.Replace("%2", "<ServerShortName>");
            ConfigURI = ConfigURI.Replace("%3", "<CaName>");
            ConfigURI = ConfigURI.Replace("%6", "<ConfigurationContainer>");
            ConfigURI = ConfigURI.Replace("%7", "<CATruncatedName>");
            ConfigURI = ConfigURI.Replace("%8", "<CRLNameSuffix>");
            ConfigURI = ConfigURI.Replace("%9", "<DeltaCRLAllowed>");
            getUrlScheme();
        }
Пример #5
0
        void m_initialize()
        {
            Regex regex = new Regex(@"^\d+");
            Match match = regex.Match(RegURI);

            if (match.Success)
            {
                Int16        matches      = Convert.ToInt16(match.Value);
                Int16[]      options      = { 1, 2, 32 };
                List <Int16> validoptions = options.Where(option => (matches & option) != 0).ToList();
                Flags = validoptions.ToArray();
                foreach (Int16 option in validoptions)
                {
                    switch (option)
                    {
                    case 1: ServerPublish = true; break;

                    case 2: IncludeToExtension = true; break;

                    case 32: OCSP = true; break;

                    default: throw new Exception("Invalid publishing Flags.");
                    }
                }
            }
            else
            {
                throw new FormatException();
            }
            ConfigURI = RegURI.Replace("%11", "<CAObjectClass>");
            ConfigURI = ConfigURI.Replace("%1", "<ServerDNSName>");
            ConfigURI = ConfigURI.Replace("%2", "<ServerShortName>");
            ConfigURI = ConfigURI.Replace("%3", "<CaName>");
            ConfigURI = ConfigURI.Replace("%4", "<CertificateName>");
            ConfigURI = ConfigURI.Replace("%6", "<ConfigurationContainer>");
            ConfigURI = ConfigURI.Replace("%7", "<CATruncatedName>");
        }