コード例 #1
0
ファイル: CCheckUVCount.cs プロジェクト: yuka800/lop-lib
        public static void CheckSelectedUVCount()
        {
            CCheckTools.ClearLogList();
            int curIndex = 0;
            int fileCount;

            string[] filePath    = null;
            string   defaultPath = "";

            CCheckTools.GetSelectedFilePath(ref filePath, ref defaultPath);
            if (filePath != null && filePath.Length > 0)
            {
                fileCount = filePath.Length;
                foreach (string s in filePath)
                {
                    curIndex++;
                    CCheckTools.DisplayProgressBar("检查中", s, curIndex / (float)fileCount);
                    CheckUVByPath(s);
                }
                CCheckTools.ClearProgressBar();
            }
            else if (!string.IsNullOrEmpty(defaultPath))
            {
                CheckUVByPath(defaultPath);
            }
            else
            {
                Debug.LogError("未选择任何文件");
            }
            CCheckTools.LogAll();
            CCheckTools.WriteAllInfoToFile(fileName, notice2);
        }
コード例 #2
0
ファイル: CCheckAccessRights.cs プロジェクト: yuka800/lop-lib
 public static void CheckModelFiles(bool bmodify)
 {
     foreach (string type in modelFilter)
     {
         string[] files      = Directory.GetFiles(CPath.Assets, "*." + type, SearchOption.AllDirectories);
         int      index      = 0;
         int      totalCount = files.Length;
         foreach (string f in files)
         {
             CCheckTools.DisplayProgressBar("检查所有" + type + "文件读写权限", f, index / (float)totalCount);
             string        path = f.Replace('\\', '/');
             ModelImporter imp  = AssetImporter.GetAtPath(path) as ModelImporter;
             if (imp != null && imp.isReadable == true)
             {
                 Debug.LogError(path);
                 if (bmodify)
                 {
                     imp.isReadable = false;
                     AssetDatabase.ImportAsset(path);
                 }
             }
             index++;
         }
         CCheckTools.ClearProgressBar();
     }
 }
コード例 #3
0
        private static void CheckSelectedFileByType(string searchOption)
        {
            CCheckTools.ClearLogList();
            int index = 0;

            string[] filePath    = null;
            string   defaultPath = "";

            CCheckTools.GetSelectedFilePath(ref filePath, ref defaultPath, searchOption);
            if (filePath != null && filePath.Length > 0)
            {
                int fileCount = filePath.Length;
                foreach (string s in filePath)
                {
                    index++;
                    CCheckTools.DisplayProgressBar("检查中", index + "/" + fileCount + " " + s, index / (float)fileCount);
                    //CheckFile(s);
                    CheckChineseCharOrSpaceInFlieName(s);
                }
                CCheckTools.ClearProgressBar();
            }
            else if (!string.IsNullOrEmpty(defaultPath))
            {
                CheckFile(defaultPath);
            }
            else
            {
                Debug.LogError("未选择任何文件");
            }
            CCheckTools.LogAll();
            CCheckTools.WriteAllInfoToFile(fileName, "选中目录下,所有类型为" + searchOption + "且文件名包含空格的文件:");
        }
コード例 #4
0
        public static void CheckAllMaterials()
        {
            CCheckTools.ClearLogList();
            countStr.Clear();
            repeatStr.Clear();
            string[] files     = Directory.GetFiles(CPath.AssetsApp, "*.*", SearchOption.AllDirectories);
            int      fileCount = files.Length;
            int      curIndex  = 0;

            foreach (string f in files)
            {
                CCheckTools.DisplayProgressBar("处理中", f, curIndex / (float)fileCount);
                curIndex++;
                CheckMaterials(f);
            }
            foreach (string s in countStr)
            {
                CCheckTools.AddErrorInfo(s);
            }
            foreach (string s in repeatStr)
            {
                CCheckTools.AddErrorInfo(s);
            }
            CCheckTools.ClearProgressBar();
            CCheckTools.LogAll();
            CCheckTools.WriteAllInfoToFile(fileName, notice1);
        }
コード例 #5
0
ファイル: CCheckSceneLights.cs プロジェクト: yuka800/lop-lib
        public static void CheckSelectedScenesLights()
        {
            bShowDetail = true;
            CCheckTools.ClearLogList();
            int curIndex = 0;

            string[] files       = null;
            string   defaultPath = "";

            CCheckTools.GetSelectedFilePath(ref files, ref defaultPath, "*.unity");
            if (files != null && files.Length > 0)
            {
                int fileCount = files.Length;
                foreach (string s in files)
                {
                    curIndex++;
                    CCheckTools.DisplayProgressBar("检查中", s, curIndex / (float)fileCount);
                    CheckSceneLights(s);
                }
                CCheckTools.ClearProgressBar();
            }
            else if (!string.IsNullOrEmpty(defaultPath))
            {
                CheckSceneLights(defaultPath);
            }
            else
            {
                Debug.LogError("未选择任何文件");
            }
            CCheckTools.LogAll();
            CCheckTools.WriteAllInfoToFile(fileName, notice2);
        }
コード例 #6
0
ファイル: CCheckRenameFile.cs プロジェクト: yuka800/lop-lib
        public static void CheckRenameFile()
        {
            Debug.Log(notice1);
            string[] filePath    = null;
            string   defaultPath = "";
            int      curIndex    = 0;

            CCheckTools.GetSelectedFilePath(ref filePath, ref defaultPath);
            if (filePath != null && filePath.Length > 0)
            {
                fileCount = filePath.Length;
                string[] objArray = new string[filePath.Length]; //筛选文件并获取文件路径
                int      count    = 0;                           //待检查文件总数
                for (int i = 0; i < filePath.Length; i++)
                {
                    if (IsCheck(filePath[i]))
                    {
                        objArray[count++] = filePath[i];
                    }
                }
                fileCount = count * 2;
                curIndex  = count;

                CCheckTools.DisplayProgressBar("检查中", "快速排序...", 1 / 2.0f);
                //先排序,再找重名
                QuickSort(ref objArray, 0, count - 1);
                for (int i = 0; i < count; i++)
                {
                    curIndex++;
                    CCheckTools.DisplayProgressBar("检查中", objArray[i], curIndex / (float)fileCount);
                    if (i + 1 < count && GetObjLowerFileName(objArray[i]).Equals(GetObjLowerFileName(objArray[i + 1])))
                    {
                        string log = objArray[i];
                        while (i + 1 < count && GetObjLowerFileName(objArray[i]).Equals(GetObjLowerFileName(objArray[i + 1])))
                        {
                            log = log + "==" + objArray[i + 1];
                            i++;
                            curIndex++;
                        }
                        Debug.LogError(log);
                    }
                }
                CCheckTools.ClearProgressBar();
            }
            else
            {
                Debug.LogError("你没有选择文件夹或只选择了一个文件");
            }
        }
コード例 #7
0
ファイル: CCheckUVCount.cs プロジェクト: yuka800/lop-lib
        public static void CheckALLUVCount()
        {
            CCheckTools.ClearLogList();
            string[] files     = Directory.GetFiles(CPath.AssetsApp, "*.*", SearchOption.AllDirectories);
            int      fileCount = files.Length;
            int      curIndex  = 0;

            foreach (string f in files)
            {
                CCheckTools.DisplayProgressBar("处理中", f, curIndex / (float)fileCount);
                curIndex++;
                CheckUVByPath(f);
            }
            CCheckTools.ClearProgressBar();
            CCheckTools.LogAll();
            CCheckTools.WriteAllInfoToFile(fileName, notice1);
        }
コード例 #8
0
        //[MenuItem("Assets/检查工具/检查所有场景的同名物体", false, 340)]
        //[MenuItem("检查工具/检查所有场景的同名物体", false, 340)]
        public static void CheckRenameComponentInAllScenes()
        {
            int fileCount;
            int index = 0;

            string[] files = Directory.GetFiles(CPath.AssetsAppArtScenes, "*.unity", SearchOption.AllDirectories);
            fileCount = files.Length;
            list      = new List <GameObject>();

            foreach (string f in files)
            {
                CCheckTools.DisplayProgressBar("处理中", f, index / (float)fileCount);
                index++;
                CheckRenameComponent(f);
            }
            CCheckTools.ClearProgressBar();
        }
コード例 #9
0
        public static void CheckAllCharacterBones()
        {
            CCheckTools.ClearLogList();

            string[] files     = Directory.GetFiles(CPath.AssetsAppArtCharacter, "*.FBX", SearchOption.AllDirectories);
            int      fileCount = files.Length;
            int      index     = 0;

            foreach (string f in files)
            {
                CCheckTools.DisplayProgressBar("处理中", f, index / (float)fileCount);
                index++;
                CheckCharacterBones(f);
            }
            CCheckTools.ClearProgressBar();
            CCheckTools.LogAll();
            CCheckTools.WriteAllInfoToFile(fileName, notice1);
        }
コード例 #10
0
        private static void CheckAllFileByType(string searchOption)
        {
            CCheckTools.ClearLogList();
            string[] files     = Directory.GetFiles(defaultPathRoot, searchOption, SearchOption.AllDirectories);
            int      fileCount = files.Length;
            int      index     = 0;

            foreach (string f in files)
            {
                CCheckTools.DisplayProgressBar("检查中", index + "/" + fileCount + " " + f, index / (float)fileCount);
                index++;
                //CheckFile(f);
                CheckChineseCharOrSpaceInFlieName(f);
            }
            CCheckTools.ClearProgressBar();
            CCheckTools.LogAll();
            CCheckTools.WriteAllInfoToFile(fileName, "所有类型为" + searchOption + "且文件名包含空格或汉字的文件:");
        }
コード例 #11
0
ファイル: CCheckFileType.cs プロジェクト: yuka800/lop-lib
        // 工具基本不使用,先注释掉菜单
        //[MenuItem("Assets/程序/检查工具/检查选中目录下包含的文件类型", false, 02010041)]
        //[MenuItem("程序/检查工具/检查选中目录下包含的文件类型", false, 02010041)]
        public static void CheckFileType()
        {
            CCheckTools.ClearLogList();
            int fileCount;
            int curIndex = 0;

            object[] objArray = Selection.GetFiltered(typeof(DefaultAsset), SelectionMode.Assets);
            if (null == objArray || objArray.Length == 0)
            {
                Debug.LogError("没有选中任何文件夹");
                return;
            }
            string path = AssetDatabase.GetAssetPath(objArray[0] as Object);

            string[] files = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories);
            fileCount = files.Length;
            List <string> typeList = new List <string>();

            foreach (string fp in files)
            {
                CCheckTools.DisplayProgressBar("检查中", fp, curIndex / (float)fileCount);
                curIndex++;
                if (fp.IndexOf('.') < 0)
                {
                    continue;
                }
                string type = fp.Split('.')[fp.Split('.').Length - 1];
                if (type.IndexOf('/') >= 0 || type.IndexOf('\\') >= 0)
                {
                    continue;       //排除xxx.xxx/yyy文件
                }
                if (!typeList.Exists(s => s.Equals(type)))
                {
                    typeList.Add(type);
                }
            }
            foreach (string s in typeList)
            {
                CCheckTools.AddLogInfo(s);
            }
            CCheckTools.LogAll();
            CCheckTools.WriteAllInfoToFile("文件类型", "", CCheckTools.EFileType.txt);
            CCheckTools.ClearProgressBar();
        }
コード例 #12
0
ファイル: CCheckImageSize.cs プロジェクト: yuka800/lop-lib
        public static void CheckAllImageSize()
        {
            mImageList.Clear();
            CCheckTools.ClearLogList();
            string[] files     = Directory.GetFiles(CPath.AssetsApp, "*.*", SearchOption.AllDirectories);
            int      fileCount = files.Length;
            int      curIndex  = 0;

            foreach (string f in files)
            {
                CCheckTools.DisplayProgressBar("处理中", f, curIndex / (float)fileCount);
                curIndex++;
                CheckImageSize(f);
            }
            CCheckTools.ClearProgressBar();
            CCheckTools.LogAll();
            CCheckTools.WriteAllInfoToFile(fileName, notice1);
            //savaInExcel(mImageList, CPath.OutPutPath, csvName);
            savaInExcel(mImageList, Application.dataPath + "/ToolsOutput/", mCsvName);
        }
コード例 #13
0
ファイル: CCheckSceneLights.cs プロジェクト: yuka800/lop-lib
        public static void CheckAllScenesLights()
        {
            Debug.Log(notice1);
            bShowDetail = false;
            CCheckTools.ClearLogList();
            int fileCount;

            string[] files = Directory.GetFiles(CPath.AssetsAppArtScenes, "*.unity", SearchOption.AllDirectories);
            fileCount = files.Length;
            int index = 0;

            foreach (string f in files)
            {
                CCheckTools.DisplayProgressBar("处理中", f, index / (float)fileCount);
                index++;
                CheckSceneLights(f);
            }
            CCheckTools.ClearProgressBar();
            CCheckTools.LogAll();
            CCheckTools.WriteAllInfoToFile(fileName, notice1);
        }
コード例 #14
0
        //[MenuItem("Assets/检查工具/检查选中场景的同名物体", false, 340)]
        //[MenuItem("检查工具/检查选中场景的同名物体", false, 340)]
        public static void CheckRenameComponentInSelectedScenes()
        {
            int fileCount;;
            int curIndex = 0;

            list = new List <GameObject>();

            string[] filePath    = null;
            string   defaultPath = "";

            CCheckTools.GetSelectedFilePath(ref filePath, ref defaultPath, "*.unity");
            if (filePath != null && filePath.Length > 0)
            {
                fileCount = filePath.Length;
                foreach (string s in filePath)
                {
                    curIndex++;
                    CCheckTools.DisplayProgressBar("检查中", s, curIndex / (float)fileCount);
                    CheckRenameComponent(s);
                }
                CCheckTools.ClearProgressBar();
            }
        }
コード例 #15
0
ファイル: CCheckImageSize.cs プロジェクト: yuka800/lop-lib
        public static void CheckSelectedImageSize()
        {
            mImageList.Clear();
            CCheckTools.ClearLogList();
            int fileCount = 0;
            int curIndex  = 0;

            string[] filePath    = null;
            string   defaultPath = "";

            CCheckTools.GetSelectedFilePath(ref filePath, ref defaultPath);
            if (filePath != null && filePath.Length > 0)
            {
                fileCount = filePath.Length;
                foreach (string s in filePath)
                {
                    curIndex++;
                    CCheckTools.DisplayProgressBar("检查中", s, curIndex / (float)fileCount);
                    CheckImageSize(s);
                }
                CCheckTools.ClearProgressBar();
            }
            else if (!string.IsNullOrEmpty(defaultPath))
            {
                CheckImageSize(defaultPath);
            }
            else
            {
                Debug.LogError("未选择任何文件");
            }
            CCheckTools.LogAll();
            CCheckTools.WriteAllInfoToFile(fileName, notice1);

            //savaInExcel(mImageList, CPath.OutPutPath, csvName);
            savaInExcel(mImageList, Application.dataPath + "/ToolsOutput/", mCsvName);
        }