Ejemplo n.º 1
0
        /// <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 { }
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
            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;
            }
Ejemplo n.º 4
0
            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;
                    }
                }
            }
Ejemplo n.º 5
0
            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;
                }
            }
Ejemplo n.º 6
0
 public static void AddEventTrigger(TWS script, string name, string label, string eventname)
 {
     eventtriggers.Add(new Extractor.EventTrigger(script, name, label, eventname));
 }