示例#1
0
文件: Params.cs 项目: TW2002/twxp
        /// <summary>
        /// Creates a new Param.
        /// </summary>
        /// <param name="value">The iniial value to be asigned to the paramater.</param>
//        public Param(TWS TWS, string value, bool isVarable = false)
        public Param(TWS TWS, string value, bool isVarable = false)
        {
            // Store the TWS for use in UpdateVars.
            this.TWS = TWS;

            // Set the IsVarable flag.
            IsVarable = isVarable;

            //try
            //{
            //    // Look for any vars matching the value.
            //    var vars = TWS.Vars.Where(v => v.VarName.ToLower() == value.ToLower());

            //    if (vars.Count() > 0)
            //    {
            //        Update(vars.Single().Value, true);
            //    }
            //    else
            //    {
            if (isVarable)
            {
                // Set the Variable name
                VarName = value;
            }
            else
            {
                // Update the value
                Update(value, true);
            }
            //    }
            //}
            //catch { }
        }
示例#2
0
文件: Scripts.cs 项目: TW2002/twxp
        public Script(string filename, Proxy proxy)
        {
            FileName = filename;
            Name     = Path.GetFileName(filename).Replace(Path.GetExtension(filename), "");
            Proxy    = proxy;
            Active   = false;

            switch (Path.GetExtension(filename))
            {
            case ".ts":
            case ".tws":
            case ".cts":
                type = ScriptType.TWS;
                tws  = new TWS(FileName, Proxy);
                break;

            case ".cs":
                type = ScriptType.CS;
                break;

            case ".vb":
                type = ScriptType.VB;
                break;
            }
        }
示例#3
0
文件: Extractor.cs 项目: TW2002/twxp
            public EventTrigger(TWS script, string name, string label, TriggerEvents eventtype)
            {
                Script = script;
                Name   = name;
                Label  = label;

                this.type      = TriggerType.Event;
                this.priority  = TriggerPriorityType.Normal;
                this.eventtype = eventtype;
            }
示例#4
0
文件: TWScript.cs 项目: TW2002/twxp
            public CommandLine(TWS script, BinaryReader stream)
            {
                this.script = script;

                ScriptID = stream.ReadByte();
                CodeLine = stream.ReadUInt16();
                CmdIndex = stream.ReadUInt16();

                Param = new List <Param>();

                CmdRef = cmd.Commands[(int)CmdIndex];
                Name   = CmdRef.Name;


                Debug.Write($"Command: {ScriptID}:{CodeLine}:{CmdIndex}:{Name}\n");

                while (true)
                {
                    var pt = stream.ReadByte();
                    switch (pt)
                    {
                    case (byte)ParamType.CMD:
                        return;

                    case (byte)ParamType.VAR:
                        Param.Add(new Param(script, ReadVar(stream), true));
                        break;

                    case (byte)ParamType.CONST:
                        Param.Add(new Param(script, ReadConst(stream)));
                        break;

                    case (byte)ParamType.SYSCONST:
                        break;

                    case (byte)ParamType.PROGVAR:
                        break;

                    case (byte)ParamType.CHAR:
                        break;
                    }
                }
            }
示例#5
0
文件: Extractor.cs 项目: TW2002/twxp
            public EventTrigger(TWS script, string name, string label, string eventname)
            {
                Script = script;
                Name   = name;
                Label  = label;

                this.type     = TriggerType.Event;
                this.priority = TriggerPriorityType.Normal;

                switch (eventname.ToUpper())
                {
                case "CONNECTION ACCEPTED":
                    eventtype = TriggerEvents.Connect;
                    break;

                case "CONNECTION LOST":
                    eventtype = TriggerEvents.Disconnect;
                    break;

                default:
                    break;
                }
            }
示例#6
0
文件: Extractor.cs 项目: TW2002/twxp
 public static void AddEventTrigger(TWS script, string name, string label, string eventname)
 {
     eventtriggers.Add(new Extractor.EventTrigger(script, name, label, eventname));
 }