/// <summary> /// Patch instruction /// </summary> /// <param name="opCode">GTA3Script operation code</param> /// <param name="keywords">Keywords</param> /// <param name="onCall">GTA3Script instruction on call event</param> /// <param name="argumentTypes">GTA3Script instruction argument types</param> /// <exception cref="ArgumentException">Invalid argument</exception> public void Patch(ushort opCode, string[] keywords, GTA3ScriptOpCodeCallDelegate onCall, params Type[] argumentTypes) { Type[] argument_types = ((argumentTypes == null) ? (new Type[0]) : argumentTypes); if (IsPatchable && (opCode >= 0)) { if (opCode > InstructionSet.Length) { ResizeInstructionSet((ushort)(opCode + 1)); } for (int i = 0; i < argument_types.Length; i++) { if (argument_types[i] == null) { throw new ArgumentException("argTypes[" + i + "] is null", "argTypes"); } } InstructionSet[opCode] = new GTA3ScriptInstruction(argument_types, onCall); AddKeywords(opCode, keywords); } }
/// <summary> /// Constructor /// </summary> /// <param name="argumentTypes">GTA3Script operation instruction types</param> /// <param name="onCall">GTA3Script instruction on call event</param> public GTA3ScriptInstruction(Type[] argumentTypes, GTA3ScriptOpCodeCallDelegate onCall) { this.argumentTypes = argumentTypes; OnCall = onCall; }
/// <summary> /// Patch instruction /// </summary> /// <param name="opCode">GTA3Script operation code</param> /// <param name="keyword">Keyword</param> /// <param name="onCall">GTA3Script instruction on call event</param> /// <param name="argumentTypes">GTA3Script instruction argument types</param> /// <exception cref="ArgumentException">Invalid argument</exception> public void Patch(ushort opCode, string keyword, GTA3ScriptOpCodeCallDelegate onCall, params Type[] argumentTypes) { Patch(opCode, new string[] { keyword }, onCall, argumentTypes); }