/// <summary> /// Moves the pattern at the specified old index to the new index. /// </summary> /// <param name="p_intOldIndex">The index of the pattern to move.</param> /// <param name="p_intNewIndex">The new index to which to move the pattern.</param> public void MovePattern(Int32 p_intOldIndex, Int32 p_intNewIndex) { ConditionallyInstalledFileSet ifsSetToMove = ConditionallyInstalledFileSets[p_intOldIndex]; ConditionallyInstalledFileSets.RemoveAt(p_intOldIndex); ConditionallyInstalledFileSets.Insert(p_intNewIndex, ifsSetToMove); }
/// <summary> /// A simple constructor that initializes the view model with its dependencies. /// </summary> /// <param name="p_vmlConditionEditor">The <see cref="ConditionEditorVM"/> that encapsulates the data /// and operations for diaplying the <see cref="ICondition"/> editor.</param> /// <param name="p_vmlFileList">The <see cref="FileListEditorVM"/> that encapsulates the data /// and operations for diaplying the file list editor.</param> /// <param name="p_cisConditionallyInstalledFileSet">The <see cref="ConditionallyInstalledFileSet"/> being edited.</param> public ConditionallyInstalledFileSetEditorVM(ConditionEditorVM p_vmlConditionEditor, FileListEditorVM p_vmlFileList, ConditionallyInstalledFileSet p_cisConditionallyInstalledFileSet) { ConditionEditorVM = p_vmlConditionEditor; FileListEditorVM = p_vmlFileList; ConditionallyInstalledFileSet = p_cisConditionallyInstalledFileSet; ConditionEditorVM.ConditionSaved += new EventHandler(ConditionSaved); }
/// <summary> /// Deletes the given <see cref="ConditionallyInstalledFileSet"/> from the script. /// </summary> /// <param name="p_cisFileSet">The <see cref="ConditionallyInstalledFileSet"/> to delete.</param> protected void DeleteConditionallyInstalledFileSet(ConditionallyInstalledFileSet p_cisFileSet) { if (p_cisFileSet == null) { return; } Script.ConditionallyInstalledFileSets.Remove(p_cisFileSet); }
/// <summary> /// The editor to use to edit a <see cref="ConditionallyInstalledFileSet"/>. /// </summary> /// <param name="p_cisFileSet">The <see cref="ConditionallyInstalledFileSet"/> to edit.</param> /// <param name="p_lstModFiles">The list of files in the mod to which the <see cref="XmlScript"/> /// being edited belongs.</param> /// <returns>The editor to use to edit an <see cref="ConditionallyInstalledFileSet"/>. <c>null</c> is returned if the /// current <see cref="XmlScript"/> does not support editing <see cref="ConditionallyInstalledFileSet"/>s.</returns> public virtual NodeEditor GetConditionallyInstalledFileSetEditor(ConditionallyInstalledFileSet p_cipPattern, IList <VirtualFileSystemItem> p_lstModFiles) { CPLConverter cvtConverter = new CPLConverter(ScriptType.GetCplParserFactory()); ConditionEditorVM vmlConditionEditor = CreateConditionEditorVM(p_lstModFiles, cvtConverter); InstallableFileEditorVM vmlInstallableFile = new InstallableFileEditorVM(null, p_lstModFiles); FileListEditorVM vmlFileList = new FileListEditorVM(vmlInstallableFile, p_cipPattern.Files); ConditionallyInstalledFileSetEditorVM vmlFileInstall = new ConditionallyInstalledFileSetEditorVM(vmlConditionEditor, vmlFileList, p_cipPattern); return(new ConditionallyInstalledFileSetEditor(vmlFileInstall)); }
/// <summary> /// Unparses the given <see cref="ConditionallyInstalledFileSet"/>. /// </summary> /// <remarks> /// This method can be overidden to provide game-specific or newer-version unparsing. /// </remarks> /// <param name="p_cifFileSet">The <see cref="ConditionallyInstalledFileSet"/> for which to generate XML.</param> /// <returns>The XML representation of the given <see cref="ConditionallyInstalledFileSet"/>.</returns> protected virtual XElement UnparseConditionallyInstalledFileSet(ConditionallyInstalledFileSet p_cifFileSet) { XElement xelFileSet = new XElement("pattern"); if (p_cifFileSet.Condition is CompositeCondition) { xelFileSet.Add(UnparseCondition(p_cifFileSet.Condition)); } else { XElement xelCompositeCondition = new XElement("dependencies", UnparseCondition(p_cifFileSet.Condition)); xelFileSet.Add(xelCompositeCondition); } XElement xelFiles = new XElement("files"); xelFileSet.Add(xelFiles); foreach (InstallableFile iflFile in p_cifFileSet.Files) { xelFiles.Add(UnparseInstallableFile(iflFile)); } return(xelFileSet); }
protected void FormatConditionallyInstalledFileSet(XmlScriptTreeNode p_stnNode, ConditionallyInstalledFileSet p_cipPatterns) { p_stnNode.Text = String.Format("Conditionnally Installed File Set ({0})", p_cipPatterns.Files.Count); }
/// <summary> /// Unparses the given <see cref="ConditionallyInstalledFileSet"/>. /// </summary> /// <remarks> /// This method can be overidden to provide game-specific or newer-version unparsing. /// </remarks> /// <param name="p_cifFileSet">The <see cref="ConditionallyInstalledFileSet"/> for which to generate XML.</param> /// <returns>The XML representation of the given <see cref="ConditionallyInstalledFileSet"/>.</returns> protected virtual XElement UnparseConditionallyInstalledFileSet(ConditionallyInstalledFileSet p_cifFileSet) { XElement xelFileSet = new XElement("pattern"); if (p_cifFileSet.Condition is CompositeCondition) xelFileSet.Add(UnparseCondition(p_cifFileSet.Condition)); else { XElement xelCompositeCondition = new XElement("dependencies", UnparseCondition(p_cifFileSet.Condition)); xelFileSet.Add(xelCompositeCondition); } XElement xelFiles = new XElement("files"); xelFileSet.Add(xelFiles); foreach (InstallableFile iflFile in p_cifFileSet.Files) xelFiles.Add(UnparseInstallableFile(iflFile)); return xelFileSet; }
/// <summary> /// The editor to use to edit a <see cref="ConditionallyInstalledFileSet"/>. /// </summary> /// <param name="p_cisFileSet">The <see cref="ConditionallyInstalledFileSet"/> to edit.</param> /// <param name="p_lstModFiles">The list of files in the mod to which the <see cref="XmlScript"/> /// being edited belongs.</param> /// <returns>The editor to use to edit an <see cref="ConditionallyInstalledFileSet"/>. <c>null</c> is returned if the /// current <see cref="XmlScript"/> does not support editing <see cref="ConditionallyInstalledFileSet"/>s.</returns> public virtual NodeEditor GetConditionallyInstalledFileSetEditor(ConditionallyInstalledFileSet p_cipPattern, IList<VirtualFileSystemItem> p_lstModFiles) { CPLConverter cvtConverter = new CPLConverter(ScriptType.GetCplParserFactory()); ConditionEditorVM vmlConditionEditor = CreateConditionEditorVM(p_lstModFiles, cvtConverter); InstallableFileEditorVM vmlInstallableFile = new InstallableFileEditorVM(null, p_lstModFiles); FileListEditorVM vmlFileList = new FileListEditorVM(vmlInstallableFile, p_cipPattern.Files); ConditionallyInstalledFileSetEditorVM vmlFileInstall = new ConditionallyInstalledFileSetEditorVM(vmlConditionEditor, vmlFileList, p_cipPattern); return new ConditionallyInstalledFileSetEditor(vmlFileInstall); }
/// <summary> /// Deletes the given <see cref="ConditionallyInstalledFileSet"/> from the script. /// </summary> /// <param name="p_cisFileSet">The <see cref="ConditionallyInstalledFileSet"/> to delete.</param> protected void DeleteConditionallyInstalledFileSet(ConditionallyInstalledFileSet p_cisFileSet) { if (p_cisFileSet == null) return; Script.ConditionallyInstalledFileSets.Remove(p_cisFileSet); }
/// <summary> /// The editor to use to edit a <see cref="ConditionallyInstalledFileSet"/>. /// </summary> /// <param name="p_cipPattern">The <see cref="ConditionallyInstalledFileSet"/> to edit.</param> /// <param name="p_lstModFiles">The list of files in the mod to which the <see cref="XmlScript"/> /// being edited belongs.</param> /// <returns>The editor to use to edit an <see cref="ConditionallyInstalledFileSet"/>. <c>null</c> is returned if the /// current <see cref="XmlScript"/> does not support editing <see cref="ConditionallyInstalledFileSet"/>s.</returns> public virtual NodeEditor GetConditionallyInstalledFileSetEditor(ConditionallyInstalledFileSet p_cipPattern, IList <VirtualFileSystemItem> p_lstModFiles) { return(null); }