コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        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);
                }
            }
        }
コード例 #3
0
        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);
                }
            }
        }
コード例 #4
0
        //only used for upgrading from version 1 to 2
        public static BaseFileEntry CreateFromObsolete(PListDictionary dic)
        {
            string path     = dic.StringValue("Path");
            var    fileType = PBXFileTypeHelper.FileTypeFromFileName(path);

            if (PBXFileTypeHelper.IsSourceCodeFile(fileType))
            {
                var entry = CreateSourceEntry(dic);
                return(entry);
            }
            else if (PBXFileTypeHelper.IsFramework(fileType))
            {
                return(CreateFrameworkEntry(dic));
            }
            else if (PBXFileTypeHelper.IsLibrary(fileType))
            {
                return(CreateStaticLibraryEntry(dic));
            }
            else if (PBXFileTypeHelper.IsContainer(fileType))
            {
                return(CreateFileEntry(dic));
            }
            else if (dic.ContainsKey("Files") || dic.ContainsKey("Folders"))
            {
                return(CreateFolderEntry(dic));
            }
            else
            {
                return(CreateFileEntry(dic));
            }
        }
コード例 #5
0
        public static BaseFileEntry Create(string path, AddMethod addMethod)
        {
            var fileType = PBXFileTypeHelper.FileTypeFromFileName(path);

            if (!IsValidFileOrFolder(path))
            {
                return(null);
            }

            if (PBXFileTypeHelper.IsSourceCodeFile(fileType))
            {
                return(CreateSourceEntry(path, addMethod, ""));
            }
            else if (PBXFileTypeHelper.IsFramework(fileType))
            {
                return(CreateFrameworkEntry(path, addMethod, LinkType.Required, false));
            }
            else if (PBXFileTypeHelper.IsLibrary(fileType))
            {
                return(CreateStaticLibraryEntry(path, addMethod, LinkType.Required));
            }
            else if (Directory.Exists(path) && !PBXFileTypeHelper.IsContainer(fileType))
            {
                return(CreateFolderEntry(path, addMethod));
            }
            else
            {
                return(CreateFileEntry(path, addMethod));
            }
        }
コード例 #6
0
        //TODO can XCVersion Groups have a name?
        public static XCVersionGroup Create(string uid, string path, PBXGroup parentGroup)
        {
            if (string.IsNullOrEmpty(uid))
            {
                throw new System.ArgumentNullException(nameof(uid), "uid cannot be null or empty");
            }

            var dic = CommonCreate(uid, PBXTypes.XCVersionGroup);

            dic = AddPathAndName(dic, path);
            var xcVersionGroup = new XCVersionGroup(uid, dic);

            xcVersionGroup.VersionGroupType = PBXFileTypeHelper.FileTypeFromFileName(path).GetXcodeDataValue();
            xcVersionGroup.ParentGroup      = parentGroup;
            return(xcVersionGroup);
        }
コード例 #7
0
        bool IsFrameworkOrLibrary(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return(false);
            }

            var type = PBXFileTypeHelper.FileTypeFromFileName(path);

            if (!PBXFileTypeHelper.IsFrameworkOrLibrary(type))
            {
                return(false);
            }

            return(true);
        }
コード例 #8
0
        static PBXFileReference CommonCreate(string uid, string path, string sourceTree, PBXGroup group)
        {
            NullCheck(uid, path, group);
            PBXProjDictionary emptyDic = new PBXProjDictionary();

            //isa
            emptyDic.Add(isaKey, PBXTypes.PBXFileReference.ToString());
            //path
            //TODO check that path will never have quotes or be a literal when entered
            //string unquotedPath = path.FromLiteral();
            string unquotedPath = path;

            emptyDic.Add(PATH_KEY, unquotedPath.ToLiteralIfRequired());
            //file type
            var fileType = PBXFileTypeHelper.FileTypeFromFileName(unquotedPath);

            if (sourceTree == SourceTreeLocation.BUILT_PRODUCTS_DIR)
            {
                emptyDic.Add(EXPLICIT_FILE_TYPE_KEY, fileType.GetXcodeDataValue());
                emptyDic.Add(INCLUDE_IN_INDEX_KEY, 0);
            }
            else
            {
                emptyDic.Add(LAST_KNOWN_FILE_TYPE_KEY, fileType.GetXcodeDataValue());
            }

            //source tree
            emptyDic.Add(SOURCE_TREE_KEY, sourceTree);
            //filename
            var fileName = System.IO.Path.GetFileName(unquotedPath);

            if (fileName != unquotedPath)
            {
                emptyDic.Add(NAME_KEY, fileName.ToLiteralIfRequired());
            }

            //TODO ignore file encoding for now
            var fileRef = new PBXFileReference(uid, emptyDic);

            fileRef.ParentGroup = group;
            return(fileRef);
        }