Exemplo n.º 1
0
        public static void Run()
        {
            StopWatchUtils.WatchStopInit();
            // 取得Assets目录.
            string strCheckFilesPath = @"D:\gitWorks\triplewin_ios\Assets";

            string[]      checkFiles        = Directory.GetFiles(strCheckFilesPath, "*.*", SearchOption.AllDirectories);
            List <string> totalLst          = checkFiles.ToList();                 // Check文件列表
            string        strDepFilesPath   = @"D:\gitWorks\triplewin_ios\Assets"; // Dep文件查找目录.
            string        strUnityAssetPath = @"D:\gitWorks\triplewin_ios\Assets"; // Unity Assets固定目录.
            string        strOutputFilePath = @"D:\check_standard.json";           // 输出文件名字
            int           nThreadNum        = 100;


            FindRefWithMulti findRefWithMulti = new FindRefWithMulti(
                strDepFilesPath,
                totalLst,
                strOutputFilePath,
                strUnityAssetPath,
                nThreadNum);

            findRefWithMulti.Run();
            StopWatchUtils.WatchStopOnceEnd("FindRefWithMulti Handle Done!");



            // AnalyzeTools.CheckFileExts(strApplicationDataPath);
            Console.ReadKey();
        }
Exemplo n.º 2
0
        public void Run()
        {
            Console.WriteLine("Check Check");
            StopWatchUtils.WatchStopInit();

            List <MetaFileInfo> lstMetaFileInfo = new List <MetaFileInfo>();


            // 读取Unity目录.
            string strUnityAssetData = @"C:\svnWorks\android151_cjp";

            DirectoryInfo diAssetData = new DirectoryInfo(strUnityAssetData);

            FileInfo[] metaFiles = diAssetData.GetFiles("*.meta", SearchOption.AllDirectories);

            foreach (var eachMetaFile in metaFiles)
            {
                // eachMetaFile.FullName
                string[] fileLines = File.ReadAllLines(eachMetaFile.FullName);

                // 再次遍历每个文件的每一行.
                foreach (var eachFileLine in fileLines)
                {
                    if (eachFileLine.Contains("assetBundleName:"))
                    {
                        string handleEachLine = eachFileLine.Trim();

                        // 分开:
                        string[] parts         = handleEachLine.Split(':');
                        string   strBundleName = parts[1].Trim();
                        if (!string.IsNullOrEmpty(strBundleName))
                        {
                            // 这里输出文件名和Bundle名.

                            string strSaveFileName = CommonUtils.GetAssetNameFromPath(eachMetaFile.FullName, strUnityAssetData);

                            MetaFileInfo metaFile = new MetaFileInfo();
                            metaFile.fileName   = strSaveFileName;
                            metaFile.bundleName = strBundleName;
                            lstMetaFileInfo.Add(metaFile);
                            //
                            // Console.WriteLine(eachMetaFile.FullName);
                            // Console.WriteLine(strBundleName);
                        }
                    }
                }
            }


            string strResult = JsonConvert.SerializeObject(lstMetaFileInfo, Formatting.Indented);

            CommonUtils.WriteFile(@"D:\AnalyzeABInMeta.json", strResult);

            StopWatchUtils.WatchStopOnceEnd("AnalyzeABInMeta");


            Console.WriteLine("1");
        }
Exemplo n.º 3
0
        public void Run()
        {
            // 字典保存文件名和对应的文件字符串内容.
            Dictionary <string, string> dicFileContent = new Dictionary <string, string>();



            List <string> withExtensions = new List <string>()
            {
                ".prefab", ".unity", ".mat", ".asset", ".anim", ".controller"
            };

            string[] findFiles = Directory.GetFiles(m_assetPath, "*.*", SearchOption.AllDirectories)
                                 .Where(s => withExtensions.Contains(Path.GetExtension(s).ToLower())).ToArray();

            // 读取文件从硬盘到内存.
            foreach (var eachFindFile in findFiles)
            {
                dicFileContent.Add(eachFindFile, File.ReadAllText(eachFindFile));
            }

            StopWatchUtils.RecordWatchStop("ReadAllFiles from Disk");


            // 获得某个文件的guid.
            string strTestFile = m_filePath;
            string strGuid     = CommonUtils.GetGuidFromFile(strTestFile);


            // 遍历所有files 针对某个文件进行搜索.
            foreach (var eachFindFile in findFiles)
            {
                // 时间应该是消耗在硬盘读取上了.
                if (Regex.IsMatch(dicFileContent[eachFindFile], strGuid))
                {
                    Console.WriteLine("Find File = " + eachFindFile);
                }
            }

            // 搜索一个文件还是用了1秒.
            StopWatchUtils.WatchStopOnceEnd("FindGuid");
        }
Exemplo n.º 4
0
        public static void Run()
        {
            StopWatchUtils.WatchStopInit();
            // 取得Assets目录.
            string strCheckFilesPath = @"C:\svnWorks\android142_cjp_pack\Assets";

            string[]      checkFiles = Directory.GetFiles(strCheckFilesPath, "*.unity", SearchOption.AllDirectories);
            List <string> totalLst   = checkFiles.ToList();                          // Check文件列表

            // 筛选出特定Prefab.
            // List<string> lstUseCheckFiles = new List<string>();
            // foreach (var eachPrefabFile in totalLst)
            // {
            //     if (eachPrefabFile.ToLower().Contains("shoppanel"))
            //     {
            //         lstUseCheckFiles.Add(eachPrefabFile);
            //     }
            // }



            string strDepFilesPath   = @"C:\svnWorks\android142_cjp_pack\Assets"; // Dep文件查找目录.
            string strUnityAssetPath = @"C:\svnWorks\android142_cjp_pack\Assets"; // Unity Assets固定目录.
            string strOutputFilePath = @"D:\checkText_cjp.json";                  // 输出文件名字
            int    nThreadNum        = 200;


            SetTextContent setTextContent = new SetTextContent(
                strDepFilesPath,
                totalLst,
                strOutputFilePath,
                strUnityAssetPath,
                nThreadNum);


            // setTextContent.FindPrefabWithText();
            setTextContent.SetTextOverflow();

            StopWatchUtils.WatchStopOnceEnd("SetTextContent Handle Done!");
        }