Exemple #1
0
 /// <summary>
 /// Get a node by OID.
 /// </summary>
 /// <param name="oid">OID string.</param>
 /// <returns>Asn1Node or null.</returns>
 public Asn1Node GetNodeByOid(string oid)
 {
     foreach (var rootNode in rootNodes)
     {
         Asn1Node r = Asn1Node.GetDecendantNodeByOid(oid, rootNode);
         if (r != null)
         {
             return(r);
         }
     }
     return(null);
 }
        public static Asn1Node GetDecendantNodeByOid(string oid, Asn1Node startNode)
        {
            Asn1Node asn1Node = (Asn1Node)null;
            Oid      oid1     = new Oid();

            for (int index = 0; (long)index < startNode.ChildNodeCount; ++index)
            {
                Asn1Node childNode = startNode.GetChildNode(index);
                if (((int)childNode.tag & 31) == 6 && oid == oid1.Decode(childNode.Data))
                {
                    asn1Node = childNode;
                    break;
                }
                asn1Node = Asn1Node.GetDecendantNodeByOid(oid, childNode);
                if (asn1Node != null)
                {
                    break;
                }
            }
            return(asn1Node);
        }
 public Asn1Node GetNodeByOid(string oid)
 {
     return(Asn1Node.GetDecendantNodeByOid(oid, this.rootNode));
 }