Exemplo n.º 1
0
        public CommandQueue(string TaskScript, WebBrowser wb, FrmShowImage objShowImg, Control ctrl)
        {
            control = ctrl;
            //Commands.Clear();
            ProceQueue.Clear();
            string BodyText = TaskScript;

            string[] CL = BodyText.Split(';');
            foreach (string LineText in CL)
            {
                IEvent e = new Event();
                Regex  r = new Regex(@"[a-z]*\(", RegexOptions.IgnoreCase);
                Match  m = r.Match(LineText.Trim());
                if (m.Success)
                {
                    e.Webbrowser    = wb;
                    e.Detail        = LineText.Trim();
                    e.ShowImageForm = objShowImg;
                    e.Command       = CommandHelper.GetCommandByName(m.Value.Remove(m.Value.Length - 1, 1));
                    r = new Regex(@"\([\s\S]*\)", RegexOptions.IgnoreCase);
                    m = r.Match(LineText.Trim());
                    if (m.Success)
                    {
                        string ts = m.Value.Remove(m.Value.Length - 1, 1);
                        ts = ts.Remove(0, 1);
                        string[] sl = ts.Split(',');
                        foreach (string s in sl)
                        {
                            e.Data.Add(s);
                        }
                        //Commands.Add(e);
                        ProceQueue.Add(e, CommandHelper.GetHandleByCommand(e.Command));
                    }
                }
            }
        }
Exemplo n.º 2
0
        private static void ProtocolReaderLine()
        {
            if (LineText == "")
            {
                return;
            }
            if (LineText[0] == '$')
            {
                if (LineText.Length >= 2)
                {
                    if (LineText[1] == '$')
                    {
                        MMode2 = LineText.TrimStart('$');
                    }
                    else
                    {
                        MMode1 = LineText.TrimStart('$');
                    }
                }
                return;
            }
            if (LineText[0] == '@')
            {
                ClassDesc = LineText.TrimStart('@');
                return;
            }
            LineText.Trim();
            ProtocolReaderLineAnalyze();

            if (LineContect.Count <= 0)
            {
                return;
            }
            if (LineContect[0] == "enums")
            {
                BodyType    = EBodyType.eBodyTypeEnum;
                EnumCurrent = new CEnum(LineContect[1], ClassDesc);
                CEnumId     = 0;
            }
            else if (LineContect[0] == "enume")
            {
                DictEnum.Add(EnumCurrent.Name, EnumCurrent);
            }
            else if (LineContect[0] == "msgs")
            {
                BodyType = EBodyType.eBodyTypeClass;
                if (LineContect.Count > 2)
                {
                    ClassCurrent = new CClass(0, LineContect[1], ClassDesc, S2I(LineContect[2]));
                }
                else
                {
                    ClassCurrent = new CClass(0, LineContect[1], ClassDesc);
                }
            }
            else if (LineContect[0] == "msge")
            {
                DictClass.Add(ClassCurrent.Name, ClassCurrent);
            }
            else if (LineContect[0] == "pubs")
            {
                BodyType = EBodyType.eBodyTypeClass;
                if (LineContect.Count > 2)
                {
                    ClassCurrent = new CClass(1, LineContect[1], ClassDesc, S2I(LineContect[2]));
                }
                else
                {
                    ClassCurrent = new CClass(1, LineContect[1], ClassDesc);
                }
            }
            else if (LineContect[0] == "pube")
            {
                DictClass.Add(ClassCurrent.Name, ClassCurrent);
            }
            else
            {
                if (BodyType == EBodyType.eBodyTypeEnum)
                {
                    var node = new CEnum.Node()
                    {
                        Line = LineCount,
                        Body = LineContect[0],
                    };
                    if (LineContect.Count > 1)
                    {
                        CEnumId    = S2I(LineContect[1]);
                        node.Value = CEnumId;
                    }
                    else
                    {
                        CEnumId++;
                        node.Value = CEnumId;
                    }
                    node.Desc = LineDesc;
                    EnumCurrent.DictBody.Add(LineCount, node);
                }
                else if (BodyType == EBodyType.eBodyTypeClass)
                {
                    var node = new CClassNode();
                    GetNodeFromLine(ref node);
                    ClassCurrent.DictBody.Add(LineCount, node);
                }
            }
        }