示例#1
0
        public CRunActs GetActs(int iItem)
        {
            CMnuItem pMnuItem = this.mnuItems[iItem];
            CRunActs result   = new CRunActs();

            this.LoadActs(pMnuItem, ref result);
            return(result);
        }
示例#2
0
        private CMnuItem GetMnuItem(string pItemId)
        {
            CMnuItem result = null;

            foreach (CMnuItem current in this.mnuItems)
            {
                if (current.id.Length > 0 && current.id == pItemId)
                {
                    result = current;
                    break;
                }
            }
            return(result);
        }
示例#3
0
        private void LoadActs(CMnuItem pMnuItem, ref CRunActs pRunActs)
        {
            int num  = 0;
            int num2 = 0;
            List <CScriptDef> list = new List <CScriptDef>();

            foreach (CScriptDef current in pMnuItem.ScriptDefs)
            {
                if (current.scrptfile.Length > 0)
                {
                    CScript script = this.GetScript(current.scrptfile);
                    int     start  = this.GetStart(current.start, list);
                    script.UpdateStart(start);
                    foreach (CAct current2 in script.acts)
                    {
                        pRunActs.actions.Add(current2);
                    }
                    current.StartTickCount = script.StartTickCount;
                    current.StopTickCount  = script.StopTickCount;
                    if (current.StartTickCount < num)
                    {
                        num = current.StartTickCount;
                    }
                    if (current.StopTickCount > num2)
                    {
                        num2 = current.StopTickCount;
                    }
                    if (num < pRunActs.StartTickCount)
                    {
                        pRunActs.StartTickCount = num;
                    }
                    if (num2 > pRunActs.StopTickCount)
                    {
                        pRunActs.StopTickCount = num2;
                    }
                    list.Add(current);
                }
                else if (current.mnuItemRef.Length > 0)
                {
                    CRunActs cRunActs = new CRunActs();
                    CMnuItem mnuItem  = this.GetMnuItem(current.mnuItemRef);
                    if (mnuItem != null)
                    {
                        this.LoadActs(mnuItem, ref cRunActs);
                    }
                    int start2 = this.GetStart(current.start, list);
                    cRunActs.UpdateStart(start2);
                    foreach (CAct current3 in cRunActs.actions)
                    {
                        pRunActs.actions.Add(current3);
                    }
                    current.StartTickCount = cRunActs.StartTickCount;
                    current.StopTickCount  = cRunActs.StopTickCount;
                    if (current.StartTickCount < num)
                    {
                        num = current.StartTickCount;
                    }
                    if (current.StopTickCount > num2)
                    {
                        num2 = current.StopTickCount;
                    }
                    if (num < pRunActs.StartTickCount)
                    {
                        pRunActs.StartTickCount = num;
                    }
                    if (num2 > pRunActs.StopTickCount)
                    {
                        pRunActs.StopTickCount = num2;
                    }
                    list.Add(current);
                }
            }
        }
示例#4
0
        private static List <CMnuItem> XML2Items(XmlTextReader rr)
        {
            List <CMnuItem>   list    = new List <CMnuItem>();
            string            pid     = "";
            string            pName   = "";
            string            pTitle  = "";
            int               pPosX   = 0;
            int               pPosY   = 0;
            int               pWidth  = 40;
            int               pHeight = 20;
            List <CScriptDef> list2   = new List <CScriptDef>();

            try
            {
                while (rr.Read())
                {
                    XmlNodeType nodeType    = rr.NodeType;
                    XmlNodeType xmlNodeType = nodeType;
                    string      name2;
                    if (xmlNodeType != XmlNodeType.Element)
                    {
                        if (xmlNodeType == XmlNodeType.EndElement)
                        {
                            string name;
                            if ((name = rr.Name) != null && !(name == "Script") && !(name == "Scripts"))
                            {
                                if (!(name == "MnuItem"))
                                {
                                    if (!(name == "Mnu"))
                                    {
                                    }
                                }
                                else
                                {
                                    CMnuItem item = new CMnuItem(pid, pName, pTitle, pPosX, pPosY, pWidth, pHeight, list2);
                                    list.Add(item);
                                }
                            }
                        }
                    }
                    else if ((name2 = rr.Name) != null && !(name2 == "Mnu"))
                    {
                        if (!(name2 == "MnuItem"))
                        {
                            if (!(name2 == "Scripts"))
                            {
                                if (name2 == "Script")
                                {
                                    string pid2        = "";
                                    string pscrptfile  = "";
                                    string pmnuItemRef = "";
                                    string pstart      = "0";
                                    if (rr.AttributeCount > 0)
                                    {
                                        while (rr.MoveToNextAttribute())
                                        {
                                            string name3;
                                            if ((name3 = rr.Name) != null)
                                            {
                                                if (!(name3 == "ID"))
                                                {
                                                    if (!(name3 == "ScrptFile"))
                                                    {
                                                        if (!(name3 == "MnuItemRef"))
                                                        {
                                                            if (name3 == "Start")
                                                            {
                                                                pstart = rr.Value;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            pmnuItemRef = rr.Value;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        pscrptfile = rr.Value;
                                                    }
                                                }
                                                else
                                                {
                                                    pid2 = rr.Value;
                                                }
                                            }
                                        }
                                        CScriptDef item2 = new CScriptDef(pid2, pscrptfile, pmnuItemRef, pstart);
                                        list2.Add(item2);
                                    }
                                }
                            }
                        }
                        else
                        {
                            pid     = "";
                            pName   = "";
                            pTitle  = "";
                            pPosX   = 0;
                            pPosY   = 0;
                            pWidth  = 40;
                            pHeight = 20;
                            list2   = new List <CScriptDef>();
                            if (rr.AttributeCount > 0)
                            {
                                while (rr.MoveToNextAttribute())
                                {
                                    string name4;
                                    switch (name4 = rr.Name)
                                    {
                                    case "ID":
                                        pid = rr.Value;
                                        break;

                                    case "Name":
                                        pName = rr.Value;
                                        break;

                                    case "Title":
                                        pTitle = rr.Value;
                                        break;

                                    case "PosX":
                                        pPosX = Convert.ToInt32(rr.Value);
                                        break;

                                    case "PosY":
                                        pPosY = Convert.ToInt32(rr.Value);
                                        break;

                                    case "Width":
                                        pWidth = Convert.ToInt32(rr.Value);
                                        break;

                                    case "Height":
                                        pHeight = Convert.ToInt32(rr.Value);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(list);
        }