private string UniqueVariableName(Cdn.Object obj, string name) { if (obj.Variable(name) == null) { return(name); } int i = 0; while (true) { var nm = String.Format("{0}_{1}", name, i); if (obj.Variable(nm) == null) { return(nm); } ++i; } }
private Cdn.Variable FindSame(Cdn.Network nout, Cdn.Variable v) { var parent = v.Object; Stack <Cdn.Object> parents = new Stack <Object>(); while (parent != null && parent.Parent != null) { parents.Push(parent); parent = parent.Parent; } Cdn.Object outParent = nout; while (outParent != null && parents.Count > 0) { parent = parents.Pop(); var node = outParent as Cdn.Node; if (node != null) { outParent = node.GetChild(parent.Id); } else { outParent = null; } } if (outParent != null) { return(outParent.Variable(v.Name)); } else { return(null); } }
public Cdn.Variable Variable(string name) { return(d_object.Variable(name)); }