Beispiel #1
0
        public override KScriptObject GenerateKScriptObject(KScriptObject parentObject, XmlNode node)
        {
            var collection = new ArrayCollection();

            if (!string.IsNullOrEmpty(node.InnerXml))
            {
                collection = MultiArrayParser.ParseNode(node, KScript());
            }

            KScript().GetMultidimensionalArrays().AddArray(
                node.Attributes["id"].Value,
                new ArrayBase(collection)
                );

            return(parentObject);
        }
        /**
         * Inserts a value at the parent key, with the unique ID
         */
        public void Add(string at_parent_key, KScriptObject script_obj, string uid, List <IKScriptDocumentNode> values)
        {
            if (Value.ContainsKey(at_parent_key))
            {
                Value[at_parent_key].Add(uid, values);
            }

            if (!Value.ContainsKey(at_parent_key))
            {
                Dictionary <string, List <IKScriptDocumentNode> > obj = new Dictionary <string, List <IKScriptDocumentNode> >
                {
                    { uid, values }
                };
                Value.Add(at_parent_key, obj);
            }

            ObjectStorage.Add(uid, script_obj);
        }
Beispiel #3
0
        /**
         *
         * <menu to="variable_id">
         *  <option>Example</option>
         *  <option>Example 2</option>
         * </menu>
         */
        public override KScriptObject GenerateKScriptObject(KScriptObject parentObject, XmlNode node)
        {
            //var menuOptions = from m in node.ChildNodes.Cast<XmlNode>()
            //                  where m.Name == "option"
            //                  select m;

            //var availableOptions = from menuOption in menuOptions
            //                       where menuOption.Attributes["value"] != null
            //                       select menuOption.Attributes["value"].Value;


            //while (!availableOptions.Contains(input))
            //{
            //    Ask for input again.
            //}

            return(parentObject);
        }
Beispiel #4
0
        internal void HandleException(Exception ex, KScriptObject obj = null)
        {
            if (ParentContainer != null)
            {
                if (ParentContainer.Properties.ThrowAllExceptions)
                {
                    throw ex;
                }

                if (obj != null)
                {
                    ParentContainer.HandleException(obj, ex);
                    return;
                }

                ParentContainer.HandleException(ex);
            }
        }
        public override void Execute(KScriptObject obj, List <IKScriptDocumentNode> Nodes, KScriptContainer Container)
        {
            KScriptObjectLoop obj_x = obj as KScriptObjectLoop;

            var def = Container.GetDef(obj_x.to, "0");

            obj_x.@default = def.Contents;

            do
            {
                foreach (IKScriptDocumentNode node in Nodes)
                {
                    if (node.GetValue().GetType().IsAssignableFrom(typeof(@break)))
                    {
                        Container.StopConditionalLoops();
                        break;
                    }

                    if (!Container.GetConditionalLoops())
                    {
                        node.Run(Container, null, obj);
                    }
                }

                if (Container.GetConditionalLoops())
                {
                    Container.AllowConditionalLoops();
                    break;
                }

                string val = obj.HandleCommands(obj_x.math);
                Container[obj_x.to].Contents = val;
            } while (obj.ToBool(obj.HandleCommands(obj_x.@while)));

            Container[obj_x.to].Contents = obj_x.@default;
        }
Beispiel #6
0
 /// <summary>
 /// Determines if the given KScriptObject is accepted by this parse handler.
 /// </summary>
 /// <param name="obj">Given KScriptObject</param>
 /// <returns>True or false based on the given KScriptObject</returns>
 public abstract bool IsAcceptedObject(KScriptObject obj);
Beispiel #7
0
 public abstract bool CanRun(KScriptObject obj);
Beispiel #8
0
 public abstract void Execute(KScriptObject obj, List <IKScriptDocumentNode> Nodes, KScriptContainer Container);
Beispiel #9
0
 public KScriptDocumentNode(KScriptObject obj) => Value = obj;
        public override void Execute(KScriptObject obj, List <IKScriptDocumentNode> Nodes, KScriptContainer Container)
        {
            KScriptMethodWrapper objX = obj as KScriptMethodWrapper;

            Container.GetObjectStorageContainer().Add(Global.GlobalIdentifiers.CALLS, objX, objX.name, Nodes);
        }
        public override void Execute(KScriptObject obj, List <IKScriptDocumentNode> Nodes, KScriptContainer Container)
        {
            KScriptExceptionWrapper objX = obj as KScriptExceptionWrapper;

            Container.GetObjectStorageContainer().Add(Global.GlobalIdentifiers.EXCEPTIONS, objX, objX.type, Nodes);
        }
 public override bool CanRun(KScriptObject obj)
 {
     return(typeof(KScriptExceptionWrapper).IsAssignableFrom(obj.GetType()));
 }
Beispiel #13
0
 /// <summary>
 /// Accepts the given XMLNode and KScriptObject If the KScript Object is of the type loadHtml
 /// </summary>
 /// <param name="obj">KScript object created using innerXML</param>
 /// <returns>If the HTMLObjectParser accepts the given KScriptObject</returns>
 public override bool IsAcceptedObject(KScriptObject obj) => false; //obj.GetType().IsAssignableFrom(typeof(loadHtml)) || obj.GetType().IsAssignableFrom(typeof(updateContent));
Beispiel #14
0
 public override bool IsAcceptedObject(KScriptObject obj) => obj.GetType().IsAssignableFrom(typeof(menu));
Beispiel #15
0
 /// <summary>
 /// Used to generate the specified KScriptObject using given XML Node
 /// </summary>
 /// <returns></returns>
 public abstract KScriptObject GenerateKScriptObject(KScriptObject parentObject, XmlNode node);
Beispiel #16
0
 public KScriptDocumentCollectionNode(KScriptObject Val) : this() => Value = Val;
 public override bool CanRun(KScriptObject obj)
 {
     return(typeof(KScriptObjectLoop).IsAssignableFrom(obj.GetType()));
 }