///<summary> /// /// Creates a new object that is a copy of the current instance. /// ///</summary> /// ///<returns> /// /// A new object that is a copy of this instance. /// ///</returns> ///<filterpriority>2</filterpriority> public object Clone() { PatchInstruction clonePi = MakeInstruction(_Type.ToString()); clonePi._Enabled = _Enabled; clonePi._FailOnError = _FailOnError; clonePi._Order = _Order; clonePi._Parameters = _CloneParameters(); clonePi._Comment = _Comment.Clone() as string; clonePi._Group = _Group; return(clonePi); }
/// <summary> /// Utility method allowing to return an instruction with different type, but keeping all compatible parameters /// </summary> /// <param name="instruction"></param> /// <param name="newInstructionName"></param> /// <returns></returns> public static PatchInstruction ChangeInstruction(PatchInstruction instruction, InstructionName newInstructionName) { PatchInstruction changedInstruction = null; if (instruction != null) { changedInstruction = MakeInstruction(newInstructionName.ToString()); changedInstruction._Order = instruction._Order; changedInstruction._Parameters = instruction._CloneParameters(); changedInstruction._Comment = instruction._Comment; changedInstruction._Group = instruction._Group; changedInstruction.RemoveUnsupportedParameters(); } return(changedInstruction); }
private byte MakeScriptOp() { return((byte)(OpCode)Enum.Parse(typeof(OpCode), Name.ToString())); }