Ejemplo n.º 1
0
 public GClassWithCVF(string type, string parent, Hashtable xc, Function.New_User_Function new_User_Function, IFunction ctor) : base(type, parent, xc, ctor)
 {
     New_User_Function = new_User_Function;
 }
Ejemplo n.º 2
0
        static void Getfunandvar(XmlDocument codes)
        {
            if (!codes.HasChildNodes)
            {
                Gdebug.WriteLine("bugging");
            }
            XmlNode root = null;

            foreach (XmlNode i in codes.ChildNodes)
            {
                if (i.Name == "code")
                {
                    root = i;
                }
            }
            int minversion = Convert.ToInt32(root.Attributes["minversion"].InnerText);

            if (minversion > GIInfo.GIVersion)
            {
                Gdebug.ThrowWrong("version not support");
            }
            foreach (XmlNode i in root.ChildNodes)
            {
                var    code = i;
                string name = code.Name;
                if (name == "lib")
                {
                    string libname = code.GetAttribute("name");
                    if (!libs.ContainsKey(libname))
                    {
                        libs.Add(libname, new UserLib());
                    }
                    foreach (XmlNode libcontent in code.ChildNodes)
                    {
                        if (libcontent.Name == "get")
                        {
                            libs[libname].waittoadd.Add(libcontent.GetAttribute("value"));
                        }
                        else if (libcontent.Name == "var")
                        {
                            libs[libname].myThing.Add(libcontent.GetAttribute("value"), new Variable(0));
                        }
                        else if (libcontent.Name == "cls")
                        {
                            var            x_cls          = libcontent;
                            GClassTemplate gClassTemplate = new GClassTemplate(x_cls.GetAttribute("name"), libname);
                            var            parent         = x_cls.GetAttribute("parent");
                            var            iscvf          = x_cls.GetAttribute("cvf");

                            gClassTemplate.iscvf = Convert.ToBoolean(iscvf);
                            gClassTemplate.LoadContent(x_cls.ChildNodes);
                            gClassTemplate.parentclassname = parent;
                            libs[libname].myThing.Add(libcontent.GetAttribute("name"), new Variable(gClassTemplate));
                        }
                        else if (libcontent.Name == "deffun")
                        {
                            Function.New_User_Function new_User_Function = new Function.New_User_Function(libcontent, libname);
                            libs[libname].myThing.Add(libcontent.GetAttribute("funname"), new Variable(new_User_Function));
                        }
                        else
                        {
                            throw new Exceptions.RunException(Exceptions.EXID.未知);
                        }
                    }
                }
                else
                {
                    throw new Exceptions.RunException(Exceptions.EXID.未知);
                }
            }
        }