コード例 #1
0
ファイル: AssetSyncConfiger.cs プロジェクト: cnscj/THSTG
        //相对与版本库下层路径
        public string GetCheckFolderRelativePath(string fullPath)
        {
            if (string.IsNullOrEmpty(repositoryRootPath))
            {
                return("");
            }
            if (string.IsNullOrEmpty(fullPath))
            {
                return("");
            }
            if (fullPath.IndexOf(repositoryRootPath) < 0)
            {
                return("");
            }

            fullPath = XPathTools.NormalizePath(fullPath);
            string relaPath = fullPath.Replace(repositoryRootPath, "");

            if (relaPath.StartsWith("/"))
            {
                relaPath = relaPath.Remove(0, 1);
            }

            int startPos = relaPath.IndexOf("/");

            if (startPos > 0)
            {
                relaPath = relaPath.Remove(0, startPos + 1);
            }

            return(relaPath);
        }
コード例 #2
0
ファイル: AssetBuildConfiger.cs プロジェクト: cnscj/THSTG
        public string GetExportFolderPath()
        {
            string newExportFolder = string.IsNullOrEmpty(exportFolder) ? DEFAULT_EXPORT_PATH : exportFolder;
            string retExportPath   = newExportFolder;

            if (isCombinePlatformName)
            {
                if (targetType == BuildPlatform.Auto)
                {
                    var    buildPlatform    = GetBuildPlatform();
                    string buildPlatformStr = Enum.GetName(typeof(BuildPlatform), buildPlatform);
                    retExportPath = XPathTools.Combine(newExportFolder, buildPlatformStr);
                }
                else
                {
                    string buildPlatformStr = Enum.GetName(typeof(BuildPlatform), targetType);
                    retExportPath = XPathTools.Combine(newExportFolder, buildPlatformStr);
                }
            }
            string normalRetExportPath = XPathTools.NormalizePath(retExportPath);

            return(normalRetExportPath.ToLower());
        }
コード例 #3
0
        private void DoAssets()
        {
            string[] assetFiles = OnFiles();
            if (assetFiles == null || assetFiles.Length < 0)
            {
                return;
            }

            List <FileInfo> procressList = new List <FileInfo>();

            foreach (var file in assetFiles)
            {
                if (string.IsNullOrEmpty(file))
                {
                    continue;
                }

                string realPath = XPathTools.GetRelativePath(file); //路径做Key,有的资源可能名字相同
                realPath = XPathTools.NormalizePath(realPath);

                if (_assetMap.ContainsKey(realPath))
                {
                    continue;
                }

                string checkKey1 = Path.GetFileNameWithoutExtension(realPath);
                string checkKey2 = XStringTools.SplitPathKey(realPath);
                if (!_processPath2srcAssetPath.ContainsKey(checkKey1))
                {
                    _processPath2srcAssetPath.Add(checkKey1, realPath);
                }
                if (!_processPath2srcAssetPath.ContainsKey(checkKey2))
                {
                    _processPath2srcAssetPath.Add(checkKey2, realPath);
                }


                string checkFilePath = GetCheckfilePath(realPath);

                if (!_checkfilePath2srcAssetPath.ContainsKey(checkFilePath))
                {
                    _checkfilePath2srcAssetPath.Add(checkFilePath, realPath);
                }

                AssetProcessCheckfile checkfile = LoadCheckfile(realPath);
                if (!OnCheck(realPath, checkfile))   //如果生成的文件没了,也应该重新生成
                {
                    continue;
                }

                FileInfo fileInfo = new FileInfo();
                fileInfo.path      = realPath;
                fileInfo.checkfile = checkfile;

                _assetMap.Add(realPath, fileInfo);
                procressList.Add(fileInfo);
            }

            foreach (var doFileInfo in procressList)
            {
                var realPath     = doFileInfo.path;
                var processFiles = OnOnce(realPath);
                if (processFiles != null && processFiles.Length > 0)
                {
                    foreach (var processPath in processFiles)
                    {
                        if (!_processPath2srcAssetPath.ContainsKey(processPath))
                        {
                            _processPath2srcAssetPath.Add(processPath, realPath);
                        }
                    }
                }

                //保存Checkfile
                if (_assetMap.TryGetValue(realPath, out var fileInfo))
                {
                    var newCheckfile = OnUpdate(fileInfo.path, fileInfo.checkfile);
                    SaveCheckfile(fileInfo.path, newCheckfile);
                }
            }
        }
コード例 #4
0
ファイル: AssetBuildConfiger.cs プロジェクト: cnscj/THSTG
        public string GetBuildFolderPath(string builderName)
        {
            string newExportFolderPath = XPathTools.Combine("", builderName);

            return(XPathTools.NormalizePath(newExportFolderPath).ToLower());
        }