public static InstructionSetSave FromFile(string fileName) { InstructionSetSave instructionSet = FileManager.XmlDeserialize <InstructionSetSave>(fileName); instructionSet.mFileName = fileName; return(instructionSet); }
private static void AddSetToSave(InstructionSet instructionSet, InstructionSetSaveList instructionSetSaveList, string targetName) { // This following members be used as a buffer for holding the lists that will be saved. // In the following loop the code will only copy over instructions that set properties // which are included in EditorData.SavedMembers List<InstructionList> temporaryListList = new List<InstructionList>(); InstructionList temporaryList = new InstructionList(); InstructionSetSave instructionSetSave = new InstructionSetSave(); foreach (KeyframeList keyframeList in instructionSet) { temporaryListList = new List<InstructionList>(); foreach (InstructionList instructionList in keyframeList) { temporaryList = new InstructionList(); temporaryList.Name = instructionList.Name; foreach (Instruction instruction in instructionList) { // Assume that all instructions are GenericInstructions GenericInstruction asGenericInstruction = instruction as GenericInstruction; bool toAdd = false; if (asGenericInstruction.Target is PositionedModel) { toAdd = EditorData.CurrentPositionedModelMembersWatching.Contains(asGenericInstruction.Member); } else if (asGenericInstruction.Target is Sprite) { toAdd = EditorData.CurrentSpriteMembersWatching.Contains(asGenericInstruction.Member); } else if (asGenericInstruction.Target is SpriteFrame) { toAdd = EditorData.CurrentSpriteFrameMembersWatching.Contains(asGenericInstruction.Member); } else if (asGenericInstruction.Target is Text) { toAdd = EditorData.CurrentTextMembersWatching.Contains(asGenericInstruction.Member); } if (toAdd) { // this instruction is one we want to save temporaryList.Add(instruction); } } if (temporaryList.Count != 0) { temporaryListList.Add(temporaryList); } } if (temporaryListList.Count != 0) { instructionSetSave.AddInstructions(temporaryListList, keyframeList.Name); } } if (instructionSetSave.Instructions.Count != 0) { instructionSetSave.Target = targetName; instructionSetSaveList.InstructionSetSaves.Add(instructionSetSave); } }