public AlibFile Create(string filePath, string mainModule, params string[] dependencies) { if (File.Exists(filePath)) { File.Delete(filePath); } if (!File.Exists(mainModule)) { return(null); } var map = new AlibMap(); var list = new List <AlibMapItem>(); list.Add(new AlibMapItem(mainModule).MapToNewPath(MAIN_PATH)); foreach (var dp in dependencies) { if (File.Exists(dp)) { list.Add(new AlibMapItem(dp).MapToNewPath(REF_PATH)); } } map.Map = list.ToArray(); var alibFile = new AlibFile(filePath); foreach (var item in map.Map) { alibFile.Set(item.Path, item.Data); } using (var ms = new MemoryStream()) { var serializer = new XmlSerializer(typeof(AlibMap)); serializer.Serialize(ms, map); alibFile.Set(MAP_FILE, ms.ToArray()); } return(alibFile); }
public IEnumerable <string> GetReferencedFiles(AlibFile alib) => alib.Files.Where(x => x.StartsWith(REF_PATH));
public IEnumerable <string> GetMainFiles(AlibFile alib) => alib.Files.Where(x => x.StartsWith(MAIN_PATH));