internal static IEnumerable <NodeReference> GetEntitiesNodes(NodeReference node, DataContext context)
        {
            var result = new List <NodeReference>();

            node.AppendSubscript("");

            var subscript = node.NextSubscript();

            while (!subscript.Equals(""))
            {
                if (!string.Equals(subscript, IdentityValueSubscriptName))
                {
                    var entityNode = context.CreateNodeReference(node.GetName());
                    entityNode.AppendSubscript(subscript);
                    result.Add(entityNode);
                }
                node.SetSubscript(node.GetSubscriptCount(), subscript);
                subscript = node.NextSubscript();
            }

            return(result);
        }
Пример #2
0
        internal NodeReference CopyReference(NodeReference reference)
        {
            var result = CreateNodeReference();

            result.SetName(reference.GetName());

            var subscriptCount = reference.GetSubscriptCount();

            if (subscriptCount <= 0)
            {
                return(result);
            }

            for (var position = 1; position <= subscriptCount; position++)
            {
                var subscript = reference.GetObjectSubscript(position);

                if (subscript is int)
                {
                    result.AppendSubscript((int)subscript);
                }
                else if (subscript is long)
                {
                    result.AppendSubscript((long)subscript);
                }
                else if (subscript is double)
                {
                    result.AppendSubscript((double)subscript);
                }
                else
                {
                    result.AppendSubscript((string)subscript);
                }
            }

            return(result);
        }
Пример #3
0
        public void DisplayForSubscripts(params object[] working_subscripts)
        {
            string prefix = Environment.NewLine + working_noderef.GetName();

            if (working_subscripts.Length > 0)
            {
                for (int ix = 0; ix < working_subscripts.Length; ix++)
                {
                    prefix += "[" + working_subscripts[ix].ToString() + "]";
                }
            }
            prefix += " = ";


            try
            {
                string current_val = working_noderef.GetString(working_subscripts);
                if (current_val != null)
                {
                    if (current_val != "")
                    {
                        textDocContents.AppendText(prefix + current_val);
                    }
                }
            }
            catch
            { }

            try
            {
                if (working_noderef.HasSubnodes(working_subscripts))
                {
                    int      count      = 0;
                    object[] sub_params = new object[working_subscripts.Length + 1];
                    for (int loop_index = 0; loop_index < working_subscripts.Length; loop_index++)
                    {
                        sub_params[loop_index] = working_subscripts[loop_index];
                    }

                    sub_params[working_subscripts.Length] = "";

                    string loop_sub = working_noderef.NextSubscript(sub_params);

                    while (loop_sub != "")
                    {
                        count++;
                        if (count > 10)
                        {
                            textDocContents.AppendText(Environment.NewLine + "...");
                            break;
                        }
                        sub_params[working_subscripts.Length] = loop_sub;
                        DisplayForSubscripts(sub_params);

                        loop_sub = working_noderef.NextSubscript(sub_params);
                    }
                }
            }
            catch //(Exception e)
            {
                MessageBox.Show("Error displaying data");
                return;
            }
        }