<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Unity 檢查文件命名是否規(guī)范

      Unity 檢查文件命名是否規(guī)范

      問題由來

      • 非程序人員經(jīng)常上傳一些命名不規(guī)范的文件到Unity中

      解決方式

      • 命名不規(guī)范文件不能上傳到庫中(以后做)
      • Unity加載到命名不規(guī)范文件的時候彈框提示(以后做)
      • 定期掃描項目中所有文件

      如果掃描項目中所有文件

      • 技術(shù)點
        • 如何獲取Unity Asset 中所有文件命名
          • Application.dataPath API可獲取本地Asset目錄
          • DirectoryInfo 目錄信息類 可獲取該目錄下所有目錄DirectoryInfo、文件FileSystemInfo
          • 使用迭代方式獲取Asset目錄所有文件
        • 如何判斷命名是否規(guī)范
          • 規(guī)范定義
            • 只包含小寫字母和大寫字母
            • 是否包含空格看項目情況
          • 遍歷文件命名字符串每個char是否符合規(guī)范

      使用方式

      • 把源碼放入工程
      • 在Unity頂部的菜單欄點擊 Tool->文件命名是否規(guī)范
      • 查看Console面版日志

      源碼

      using System.Collections.Generic;
      using System.IO;
      using UnityEditor;
      using UnityEngine;
      
      /// <summary>
      /// 文件夾
      /// </summary>
      public class Folders
      {
          [MenuItem("Tools/文件命名是否規(guī)范")]
          static void CheckFolderName()
          {
              Folders folder = new Folders(Application.dataPath);
      
              List<string> paths = new List<string>();
      
              CheckFolderName(folder, paths);
      
              foreach (var item in paths)
              {
                  Debug.LogError(item);
              }
      
              Debug.Log("檢查完成");
          }
      
          static void CheckFolderName(Folders folder, List<string> paths)
          {
              foreach (var item in folder.dicFileSystemInfo)
              {
                  string name = item.Key;
                  FileSystemInfo fileSystemInfo = item.Value;
      
                  if (fileSystemInfo.Extension == ".meta" || fileSystemInfo.Extension == ".DS_Store")
                  {
                      continue;
                  }
      
                  bool isIllegal = IsIllegal(name, true, false);
                  if (isIllegal == false)
                  {
                      paths.Add(fileSystemInfo.FullName);
                  }
              }
      
              foreach (var item in folder.listFolder)
              {
                  CheckFolderName(item, paths);
              }
          }
      
          static bool IsIllegal(string str, bool isDigit = true, bool isSpace = true)
          {
              for (int i = 0; i < str.Length; i++)
              {
                  char c = str[i];
      
                  if (char.IsLower(c) || char.IsUpper(c))
                  {
                      return true;
                  }
                  if (char.IsDigit(c) && isDigit == true)
                  {
                      return true;
                  }
                  if (char.IsWhiteSpace(c) && isSpace == true)
                  {
                      return true;
                  }
              }
              return false;
          }
      
      
          /// <summary>
          /// 當前目錄信息
          /// </summary>
          public DirectoryInfo currentDirectoryInfo;
          /// <summary>
          /// 當前文件夾中的文件夾
          /// </summary>
          public List<Folders> listFolder;
          /// <summary>
          /// 當前文件夾的文件
          /// </summary>
          public List<FileInfo> listFileInfo;
          /// <summary>
          /// 當前文件夾中所有文件
          /// </summary>
          public Dictionary<string, FileSystemInfo> dicFileSystemInfo;
      
          public Folders(string path)
          {
              currentDirectoryInfo = new DirectoryInfo(path);
      
              Init();
          }
      
          Folders(DirectoryInfo directoryInfo)
          {
              currentDirectoryInfo = directoryInfo;
      
              Init();
          }
      
          void Init()
          {
              listFileInfo = new List<FileInfo>();
              foreach (var item in currentDirectoryInfo.GetFiles())
              {
                  listFileInfo.Add(item);
              }
              listFolder = new List<Folders>();
              foreach (var item in currentDirectoryInfo.GetDirectories())
              {
                  listFolder.Add(new Folders(item));
              }
      
              dicFileSystemInfo = new Dictionary<string, FileSystemInfo>();
              foreach (var item in listFileInfo)
              {
                  dicFileSystemInfo.Add(item.Name, item);
              }
              foreach (var item in listFolder)
              {
                  dicFileSystemInfo.Add(item.currentDirectoryInfo.Name, item.currentDirectoryInfo);
              }
          }
      }
      
      
      posted @ 2020-04-16 20:57  鄒強  閱讀(764)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 久久久成人毛片无码| 精品国产成人a在线观看| 在线视频一区二区三区色| 国产三级精品三级在线区| 嫩草院一区二区乱码| 国产成人av综合色| 黄色大全免费看国产精品| 国产成人午夜福利在线观看| 精品国产一区二区三区2021| 久久国产精品无码网站| 少妇精品视频一码二码三| 亚洲一区二区三区在线激情| 久久久久久久一线毛片| 99久久精品费精品国产一区二 | 四虎www永久在线精品| 日韩中文字幕亚洲精品| 又污又黄又无遮挡的网站| 一卡二卡三卡四卡视频区| 国产三级精品三级在线观看| 国内精品久久人妻无码不卡 | 国产成人精品三上悠亚久久| 久久天天躁夜夜躁狠狠| 国产午夜亚洲精品国产成人| 欧美性潮喷xxxxx免费视频看| 国产av无码专区亚洲av软件| 国产二区三区不卡免费| 在线观看美女网站大全免费| 三级黄色片一区二区三区| 国产 另类 在线 欧美日韩| 国产人妇三级视频在线观看| 一区二区精品久久蜜精品| 久爱无码精品免费视频在线观看| 欧美乱妇高清无乱码免费| 亚洲AV日韩精品久久久久| 黄色A级国产免费大片视频| 免费的很黄很污的视频| 亚洲中文欧美在线视频| 国产精品久久露脸蜜臀| 亚洲AV乱码毛片在线播放| 边添小泬边狠狠躁视频| 国产精品国产三级国产专i|