Example #1
0
        private void btnDone_Click(object sender, EventArgs e)
        {
            try { eventEvent = MParams.UnHex(txtEventId.Text); }
            catch { eventEvent = 0; }
            if (eventEvent == 0)
            {
                MessageBox.Show("Invalid event Id.", "Invalid Id");
                return;
            }

            status = DialogResult.OK;
            this.Close();
        }
Example #2
0
        //Return the string result from the passed keyword and its parameters.
        public string ResolveKeyword(string keyword, string[] Params, Event eventData)
        {
            switch (keyword)
            {
            case "\\value":
                try { return(ResolveParamTypes(eventData)[int.Parse(Params[0])]); }
                catch { return("Value-" + Params[0]); }

            case "\\type":
                try { return(eventData.parameters[int.Parse(Params[0])]._type.ToString()); }
                catch { return("Type-" + Params[0]); }

            case "\\if":
                bool compare = false;
                try
                {
                    switch (Params[1])
                    {
                    case "==": compare = int.Parse(Params[0]) == int.Parse(Params[2]); break;

                    case "!=": compare = int.Parse(Params[0]) != int.Parse(Params[2]); break;

                    case ">=": compare = int.Parse(Params[0]) >= int.Parse(Params[2]); break;

                    case "<=": compare = int.Parse(Params[0]) <= int.Parse(Params[2]); break;

                    case ">": compare = int.Parse(Params[0]) > int.Parse(Params[2]); break;

                    case "<": compare = int.Parse(Params[0]) < int.Parse(Params[2]); break;
                    }
                }
                finally { }
                if (compare)
                {
                    return(Params[3]);
                }
                else
                {
                    return(Params[4]);
                }

            case "\\bone":
                try
                {
                    int id = MParams.UnHex(Params[0]);
                    if (id >= 400)
                    {
                        id -= 400;
                    }
                    if (_targetNode.Model != null && _targetNode.Model._linker.BoneCache != null && _targetNode.Model._linker.BoneCache.Length > id && id >= 0)
                    {
                        return(_targetNode.Model._linker.BoneCache[id].Name);
                    }
                    else
                    {
                        return(id.ToString());
                    }
                }
                catch { return(int.Parse(Params[0]).ToString()); }

            case "\\unhex":
                try { return(MParams.UnHex(Params[0]).ToString()); }
                catch { return(Params[0]); }

            case "\\hex":
                try { return(MParams.Hex(int.Parse(Params[0]))); }
                catch { return(Params[0]); }

            case "\\hex8":
                try { return(MParams.Hex8(int.Parse(Params[0]))); }
                catch { return(Params[0]); }

            case "\\half1":
                return(MParams.WordH(Params[0], 0));

            case "\\half2":
                return(MParams.WordH(Params[0], 1));

            case "\\byte1":
                return(MParams.WordB(Params[0], 0));

            case "\\byte2":
                return(MParams.WordB(Params[0], 1));

            case "\\byte3":
                return(MParams.WordB(Params[0], 2));

            case "\\byte4":
                return(MParams.WordB(Params[0], 3));

            case "\\collision":
                try { return(GetCollisionStatus(MParams.UnHex(Params[0]))); }
                catch { return(Params[0]); }

            case "\\airground":
                try { return(GetAirGroundStatus(MParams.UnHex(Params[0]))); }
                catch { return(Params[0]); }

            case "\\enum":
                try { return(GetEnum(int.Parse(Params[1]), MParams.UnHex(Params[0]), eventData)); }
                catch { return("Undefined(" + Params[1] + ")"); }

            case "\\cmpsign":
                try { return(MParams.GetComparisonSign(MParams.UnHex(Params[0]))); }
                catch { return(Params[0]); }

            case "\\name":
                return(GetEventInfo(eventData.eventEvent)._name);

            case "\\white":
                return(" ");

            default:
                return("");
            }
        }