Parse() public static method

Recursively searches the supplied AD string for all groups.
public static Parse ( string data, string delimiter ) : List
data string The string returned from AD to parse for a group.
delimiter string The string to use as the seperator for the data. ex. ","
return List
コード例 #1
0
        public static ArrayList GetSSLCertificatesAndNames(ref ArrayList certificateNames)
        {
            ArrayList arrayList  = new ArrayList();
            X509Store x509Store1 = new X509Store(StoreName.CertificateAuthority);

            x509Store1.Open(OpenFlags.ReadOnly);
            X509Certificate2Collection certificate2Collection = x509Store1.Certificates.Find(X509FindType.FindByKeyUsage, (object)X509KeyUsageFlags.DigitalSignature, false);
            X509Store x509Store2 = new X509Store(StoreName.AddressBook);

            x509Store2.Open(OpenFlags.ReadOnly);
            X509Certificate2Collection certificates = x509Store2.Certificates.Find(X509FindType.FindByKeyUsage, (object)X509KeyUsageFlags.DigitalSignature, false);

            certificate2Collection.AddRange(certificates);
            foreach (X509Certificate2 x509Certificate2 in certificate2Collection)
            {
                arrayList.Add((object)x509Certificate2);
                certificateNames.Add((object)SEBProtectionController.Parse(x509Certificate2.Subject, "CN").FirstOrDefault <string>());
            }
            x509Store2.Close();
            return(arrayList);
        }
コード例 #2
0
        public static List <string> Parse(string data, string delimiter)
        {
            if (data == null)
            {
                return((List <string>)null);
            }
            if (!delimiter.EndsWith("="))
            {
                delimiter += "=";
            }
            if (!data.Contains(delimiter))
            {
                return((List <string>)null);
            }
            List <string> stringList1 = new List <string>();
            int           startIndex  = data.IndexOf(delimiter) + delimiter.Length;
            int           length      = data.IndexOf(',', startIndex) - startIndex;

            if (length == 0)
            {
                return((List <string>)null);
            }
            if (length > 0)
            {
                stringList1.Add(data.Substring(startIndex, length));
                List <string> stringList2 = SEBProtectionController.Parse(data.Substring(startIndex + length), delimiter);
                if (stringList2 != null)
                {
                    stringList1.AddRange((IEnumerable <string>)stringList2);
                }
            }
            else
            {
                stringList1.Add(data.Substring(startIndex));
            }
            return(stringList1);
        }