public void AddFrameworkOrLibrary(string path, AddMethod addMethod, LinkType linkType) { path = ProjectUtil.MakePathRelativeToProject(path); if (_entries.FindIndex(o => o.Path == path) < 0) { BaseFileEntry entry = null; var fileType = PBXFileTypeHelper.FileTypeFromFileName(path); if (PBXFileTypeHelper.IsFrameworkOrLibrary(fileType)) { entry = FileAndFolderEntryFactory.CreateFrameworkEntry(path, addMethod, linkType, false); } else { Debug.LogWarning("EgoXproject: File is not a known Framework or library file type. Adding as a regular file: " + path); entry = FileAndFolderEntryFactory.Create(path, addMethod); } if (entry == null) { Debug.LogError("EgoXproject: Could not add file. Either it does not exist or is on Ignore List: " + path); } else { _entries.Add(entry); } } }
public FilesAndFolderChanges(PListDictionary dic) { if (dic == null) { return; } var entries = dic.ArrayValue(ENTRIES_KEY); if (entries == null) { return; } for (int ii = 0; ii < entries.Count; ++ii) { var entryDic = entries.DictionaryValue(ii); if (entryDic == null) { continue; } var entry = FileAndFolderEntryFactory.Create(entryDic); if (entry != null) { _entries.Add(entry); } } }
public void AddEmbeddedFramework(string path) { path = ProjectUtil.MakePathRelativeToProject(path); if (_entries.FindIndex(o => o.Path == path) < 0) { BaseFileEntry entry = null; var fileType = PBXFileTypeHelper.FileTypeFromFileName(path); if (PBXFileTypeHelper.IsFramework(fileType)) { entry = FileAndFolderEntryFactory.CreateFrameworkEntry(path, AddMethod.Copy, LinkType.Required, true); if (entry == null) { Debug.LogError("EgoXproject: Could not add file. Either it does not exist or is on Ignore List: " + path); } else { _entries.Add(entry); } } else { Debug.LogWarning("EgoXproject: File is not a Framework type. Skipping: " + path); } } }
void UpgradeFolders(PList plist, XcodeChangeFile changeFile) { var filesFolders = plist.Root.DictionaryValue("FilesAndFolders"); if (filesFolders == null) { return; } var folders = filesFolders.ArrayValue("Folders"); if (folders == null) { return; } for (int ii = 0; ii < folders.Count; ii++) { var folderDic = folders.DictionaryValue(ii); if (folderDic == null) { continue; } var entry = FileAndFolderEntryFactory.CreateFromObsolete(folderDic); if (entry == null) { continue; } changeFile.FilesAndFolders.Upgrader_AddEntry(entry); } }
public void AddSourceFile(string path, AddMethod addMethod, string compilerFlags = "") { path = ProjectUtil.MakePathRelativeToProject(path); if (_entries.FindIndex(o => o.Path == path) < 0) { BaseFileEntry entry = null; var fileType = PBXFileTypeHelper.FileTypeFromFileName(path); if (PBXFileTypeHelper.IsSourceCodeFile(fileType)) { entry = FileAndFolderEntryFactory.CreateSourceEntry(path, addMethod, compilerFlags); } else { Debug.LogWarning("EgoXproject: File is not a known source file type. Adding as a regular file: " + path); entry = FileAndFolderEntryFactory.Create(path, addMethod); } if (entry == null) { Debug.LogError("EgoXproject: Could not add file. Either it does not exist or is on Ignore List: " + path); } else { _entries.Add(entry); } } }
void UpgradeCustomFrameworks(PList plist, XcodeChangeFile changeFile) { var frameworks = plist.Root.DictionaryValue("Frameworks"); if (frameworks == null) { return; } var customFrameworks = frameworks.ArrayValue("Custom"); if (customFrameworks == null) { return; } for (int ii = 0; ii < customFrameworks.Count; ii++) { var customFrameworkDic = customFrameworks.DictionaryValue(ii); if (customFrameworkDic == null) { continue; } var entry = FileAndFolderEntryFactory.CreateFromObsolete(customFrameworkDic); if (entry == null) { continue; } changeFile.FilesAndFolders.Upgrader_AddEntry(entry); } }
void AddEntry(string path, AddMethod addMethod = AddMethod.Link) { path = ProjectUtil.MakePathRelativeToProject(path); if (_entries.FindIndex(o => o.Path == path) > -1) { return; } var entry = FileAndFolderEntryFactory.Create(path, addMethod); if (entry != null) { _entries.Add(entry); } }
public FolderEntry(PListDictionary dic) : base(dic) { var entryDics = dic.ArrayValue(ENTRIES_KEY); if (entryDics != null) { foreach (var entryDic in entryDics) { var entry = FileAndFolderEntryFactory.Create(entryDic as PListDictionary); AddEntry(entry); } } else { //Try and load old keys var files = dic.ArrayValue("Files"); if (files != null) { for (int ii = 0; ii < files.Count; ii++) { var entry = FileAndFolderEntryFactory.CreateFromObsolete(files.DictionaryValue(ii)); if (entry != null) { AddEntry(entry); } } } var folders = dic.ArrayValue("Folders"); if (folders != null) { for (int ii = 0; ii < folders.Count; ii++) { var entry = FileAndFolderEntryFactory.CreateFromObsolete(folders.DictionaryValue(ii)); if (entry != null) { AddEntry(entry); } } } } }
public void AddFileOrFolder(string path, AddMethod addMethod = AddMethod.Link) { path = ProjectUtil.MakePathRelativeToProject(path); if (_entries.FindIndex(o => o.Path == path) < 0) { var entry = FileAndFolderEntryFactory.Create(path, addMethod); if (entry == null) { Debug.LogError("EgoXproject: Could not add file. Either does not exist or is on Ignore List: " + path); } else { _entries.Add(entry); } } }
void Populate() { bool populated = _entries.Count > 0; var files = Directory.GetFiles(Path); foreach (var f in files) { if (!FileAndFolderEntryFactory.IsValidFileOrFolder(f)) { continue; } var rel = ProjectUtil.MakePathRelativeToProject(f); AddEntry(FileAndFolderEntryFactory.Create(rel, Add)); } var folders = Directory.GetDirectories(Path); foreach (var f in folders) { if (!FileAndFolderEntryFactory.IsValidFileOrFolder(f)) { continue; } var rel = ProjectUtil.MakePathRelativeToProject(f); int index = -1; if (populated) { index = _entries.FindIndex(o => o.Path == rel); } if (index < 0) { AddEntry(FileAndFolderEntryFactory.Create(rel, Add)); } else if (_entries[index] is FolderEntry) { var subfe = _entries[index] as FolderEntry; subfe.Populate(); } } }
public void RemoveMissingEntries() { List <BaseFileEntry> removeFiles = new List <BaseFileEntry>(); foreach (var e in _entries) { if (!FileAndFolderEntryFactory.Exists(Path)) { removeFiles.Add(e); } else if (e is FolderEntry) { var fe = e as FolderEntry; fe.RemoveMissingEntries(); } } foreach (var r in removeFiles) { _entries.Remove(r); } }