예제 #1
0
파일: PCH.cs 프로젝트: djey47/tdumt
        /// <summary>
        /// Adds or replace an instruction. If instruction order already exists, corresponding instruction is replaced; else specified instruction is added to the list.
        /// </summary>
        /// <param name="instruction">Instruction to set</param>
        public void SetInstruction(PatchInstruction instruction)
        {
            if (instruction == null || instruction.Order < 1)
            {
                return;
            }

            // Unsupported parameters are removed
            instruction.RemoveUnsupportedParameters();

            if (instruction.Order > PatchInstructions.Count)
            {
                // Add mode
                PatchInstructions.Add(instruction);
            }
            else
            {
                // Replace mode
                for (int i = 0; i < PatchInstructions.Count; i++)
                {
                    PatchInstruction currentInstruction = PatchInstructions[i];

                    if (currentInstruction.Order == instruction.Order)
                    {
                        PatchInstructions[i] = instruction;
                        break;
                    }
                }
            }
        }
예제 #2
0
파일: PCH.cs 프로젝트: djey47/tdumt
        /// <summary>
        /// Import specified instruction to current patch
        /// </summary>
        /// <param name="anotherInstruction"></param>
        public void ImportInstruction(PatchInstruction anotherInstruction)
        {
            if (anotherInstruction != null)
            {
                anotherInstruction.Order = PatchInstructions.Count + 1;

                PatchInstructions.Add(anotherInstruction);
            }
        }