internal static PkixPolicyNode RemovePolicyNode( PkixPolicyNode validPolicyTree, IList[] policyNodes, PkixPolicyNode _node) { PkixPolicyNode _parent = (PkixPolicyNode)_node.Parent; if (validPolicyTree == null) { return(null); } if (_parent == null) { for (int j = 0; j < policyNodes.Length; j++) { policyNodes[j] = Platform.CreateArrayList(); } return(null); } else { _parent.RemoveChild(_node); RemovePolicyNodeRecurse(policyNodes, _node); return(validPolicyTree); } }
internal static PkixPolicyNode PrepareNextCertB2( int i, IList[] policyNodes, string id_p, PkixPolicyNode validPolicyTree) { int pos = 0; // Copy to avoid RemoveAt calls interfering with enumeration foreach (PkixPolicyNode node in Platform.CreateArrayList(policyNodes[i])) { if (node.ValidPolicy.Equals(id_p)) { PkixPolicyNode p_node = (PkixPolicyNode)node.Parent; p_node.RemoveChild(node); // Removal of element at current iterator position not supported in C# //nodes_i.remove(); policyNodes[i].RemoveAt(pos); for (int k = (i - 1); k >= 0; k--) { IList nodes = policyNodes[k]; for (int l = 0; l < nodes.Count; l++) { PkixPolicyNode node2 = (PkixPolicyNode)nodes[l]; if (!node2.HasChildren) { validPolicyTree = RemovePolicyNode(validPolicyTree, policyNodes, node2); if (validPolicyTree == null) { break; } } } } } else { ++pos; } } return(validPolicyTree); }