Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
 public Cdn.Variable Variable(string name)
 {
     return(d_object.Variable(name));
 }