/// <summary> /// Creates a copy of the supported file list /// </summary> /// <param name="source">ISupportedFileCollection to be copied from</param> /// <returns>ISupportedFileCollection of the new copy</returns> public static ISupportedFilesSet CopyFileCollection(ISupportedFilesSet source) { if (source == null) return null; return CreateFileCollection(source.SupportedFiles(), source.UnsupportedFiles()); }
public static void AddSupportedFileCollection(XmlNode actionClassNode, string capabilitiesOrSettings, ISupportedFilesSet supportedFileCollection) { XmlDocument xmlDocument = actionClassNode.OwnerDocument; XmlNode supportedFileTypesNode = xmlDocument.CreateElement(capabilitiesOrSettings); XmlNode includedFiles = xmlDocument.CreateElement("Included"); XmlNode excludedFiles = xmlDocument.CreateElement("Excluded"); foreach (string supportedFileType in supportedFileCollection.SupportedFiles()) { XmlNode fileTypeNode = xmlDocument.CreateElement("FileType"); fileTypeNode.InnerText = supportedFileType; includedFiles.AppendChild(fileTypeNode); } foreach (string unsupportedFileType in supportedFileCollection.UnsupportedFiles()) { XmlNode fileTypeNode = xmlDocument.CreateElement("FileType"); fileTypeNode.InnerText = unsupportedFileType; excludedFiles.AppendChild(fileTypeNode); } supportedFileTypesNode.AppendChild(excludedFiles); supportedFileTypesNode.AppendChild(includedFiles); actionClassNode.AppendChild(supportedFileTypesNode); }
private static bool CompareFileList(ISupportedFilesSet left, ISupportedFilesSet right) { if (left.SupportedFiles().Length != right.SupportedFiles().Length) return false; if (left.UnsupportedFiles().Length != right.UnsupportedFiles().Length) return false; List<string> leftSupported = new List<string>(left.SupportedFiles()); List<string> rightSupported = new List<string>(right.SupportedFiles()); foreach (string leftItem in leftSupported) { if (!rightSupported.Contains(leftItem)) return false; } List<string> leftUnsupported = new List<string>(left.UnsupportedFiles()); List<string> rightUnsupported = new List<string>(right.UnsupportedFiles()); foreach (string leftItem in leftUnsupported) { if (!rightUnsupported.Contains(leftItem)) return false; } return true; }