private IEnumerable<ctp.IFileType> getFiles(ctp.PolicyAssembly a) { var files = new List<ctp.IFileType>(); //add the assembly if (!String.IsNullOrEmpty(a.Src)) { files.Add(a); } // files.Add(a); //files.AddRange(a.Items); if (a.CatFile != null) files.Add(a.CatFile); if (a.Manifest != null) files.Add(a.Manifest); return files; }
private IEnumerable<ctp.IFileType> getFiles(ctp.Assembly a) { var files = new List<ctp.IFileType>(); //add the assembly files.Add(a); files.AddRange(a.Items); if (a.CatFile != null) files.Add(a.CatFile); if (a.Manifest != null) files.Add(a.Manifest); return files; }
private void calcFolderCompIds(ctp.FileSysItem item, string parentId) { var output = parentId + "___" + item.GetType().Name; //it's a file type /* if (item.GetType().IsSubclassOf(typeof(ctp.FileType))) { var f = (ctp.FileType) item; output += "_{0}_{1}".format(f.name, f.ext); }*/ if (item.GetType() == typeof(ctp.Folder)) { var f = (ctp.Folder) item; output += "_{0}".format(f.Name); f.folder_id = output.MakeSafeDirectoryId(); foreach (var ch in f.Items) { calcFolderCompIds(ch, f.folder_id); } } /* else if (item.GetType() == typeof(ctp.Headers)) { var f = (ctp.Headers) item; }*/ }
private IEnumerable<ctp.IFileType> getFiles(ctp.Folder f) { //create the folder list in a god awful way folders.Add(f); var files = new List<ctp.IFileType>(); foreach (var i in f.Items) { if (i.GetType() == typeof(ctp.File)) files.Add((ctp.File)i); else if (i.GetType() == typeof(ctp.Folder)) files.AddRange(getFiles((ctp.Folder)i)); } return files; }
/* /// <summary> /// Folders need Msi Ids so we give each of them one. /// </summary> private void addFolderIds() { //also do the Headers include directory foreach (XmlElement e in SelectNodes(doc, "//in:Folder|//in:Headers")) { var folderId = getComponentId(e); addAttrib("folder_id", getComponentId(e), e); } } */ /* private XmlNodeList getRoles() { return SelectNodes(doc, roleXPath); }*/ /* private string getComponentId(Folder f) { if () }*/ /* private string getComponentId(XmlElement e) { if (getRoles().Cast<XmlElement>().Contains(e)) { var flavor = ""; if (e.HasAttribute("Flavor")) flavor = e.Attributes["Flavor"].Value; return e.LocalName + flavor; } var output = getComponentId((XmlElement)e.ParentNode) + "___" + e.LocalName; switch (e.LocalName) { case "Assembly": case "LibFile": case "ExeFile": case "File": output += "_" + e.Attributes["name"].Value + "_" + e.Attributes["ext"].Value; break; case "Folder": output += "_" + e.Attributes["Name"].Value; break; case "Headers": output += "__h_"; break; } return output.MakeSafeDirectoryId() ; }*/ //private string getComponentId(Role r) private void calcFolderCompIds(ctp.Role r) { var flavor = ""; if (r.Flavor != null) flavor = r.Flavor; var parentId = r.GetType().Name + flavor; if (r.GetType() == typeof(ctp.SharedLib)) { var s = (SharedLib) r; foreach (var f in s.Files.Items) { calcFolderCompIds(f, parentId); } } else if (r.GetType() == typeof(ctp.AppRole)) { var a = (AppRole) r; foreach (var f in a.Files.Items) { calcFolderCompIds(f, parentId); } } else { Console.WriteLine("Those roles aren't supported!"); } }