protected void AnalyzeYAMLResource(ResourceUnit res) { string fullName = res.GetPathName() + "/" + res.GetFileName(); YamlEmittor emittor = new YamlEmittor(); bool success = emittor.AnalyzeYAMLFile(fullName); if (success) { { // foreach(var guid in emittor.mGuidList) var __enumerator1 = (emittor.mGuidList).GetEnumerator(); while (__enumerator1.MoveNext()) { var guid = (string)__enumerator1.Current; { string name = AssetDatabase.GUIDToAssetPath(guid); string extName = Path.GetExtension(name).ToLower(); int analyzeType = ResourceUnit.GetAnalyzeType(extName); mResourceRedundanceMgr.ProcessResource(analyzeType, name, res); } } } } else { Debug.LogError("Failed to parse " + fullName); } }
private void GetFiles(DirectoryInfo dir) { FileInfo[] allFiles = dir.GetFiles(); foreach (FileInfo fi in allFiles) { string extName = Path.GetExtension(fi.Name).ToLower(); if (string.IsNullOrEmpty(extName) || ".meta" == extName) { continue; } int analyzeType = ResourceUnit.GetAnalyzeType(extName); if (!mTypeFileDictionary.ContainsKey(analyzeType)) { mTypeFileDictionary.Add(analyzeType, new Dictionary <string, ResourceUnit>()); } Dictionary <string, ResourceUnit> fileDictionary = mTypeFileDictionary[analyzeType] as Dictionary <string, ResourceUnit>; string dirName = fi.DirectoryName.Replace('\\', '/'); dirName = dirName.Remove(0, mAssetPathStartIndex); ResourceUnit resUnit = new ResourceUnit(fi.Name, dirName); string fullName = dirName + "/" + fi.Name; fileDictionary.Add(fullName, resUnit); } DirectoryInfo[] allDirs = dir.GetDirectories(); foreach (DirectoryInfo d in allDirs) { GetFiles(d); } }
private void GetFiles(DirectoryInfo dir) { FileInfo[] allFiles = dir.GetFiles(); { var __array1 = allFiles; var __arrayLength1 = __array1.Length; for (int __i1 = 0; __i1 < __arrayLength1; ++__i1) { var fi = (FileInfo)__array1[__i1]; { string extName = Path.GetExtension(fi.Name).ToLower(); if (string.IsNullOrEmpty(extName) || ".meta" == extName) { continue; } int analyzeType = ResourceUnit.GetAnalyzeType(extName); if (!mTypeFileDictionary.ContainsKey(analyzeType)) { mTypeFileDictionary.Add(analyzeType, new Dictionary <string, ResourceUnit>()); } Dictionary <string, ResourceUnit> fileDictionary = mTypeFileDictionary[analyzeType] as Dictionary <string, ResourceUnit>; string dirName = fi.DirectoryName.Replace('\\', '/'); dirName = dirName.Remove(0, mAssetPathStartIndex); ResourceUnit resUnit = new ResourceUnit(fi.Name, dirName); string fullName = dirName + "/" + fi.Name; fileDictionary.Add(fullName, resUnit); } } } DirectoryInfo[] allDirs = dir.GetDirectories(); { var __array2 = allDirs; var __arrayLength2 = __array2.Length; for (int __i2 = 0; __i2 < __arrayLength2; ++__i2) { var d = (DirectoryInfo)__array2[__i2]; { GetFiles(d); } } } }
public void DeleteSingleResourceFile(ResourceUnit resUnit) { int type = ResourceUnit.GetAnalyzeType(Path.GetExtension(resUnit.GetFileName()).ToLower()); if (mTypeFileDictionary.ContainsKey(type)) { Dictionary <string, ResourceUnit> fileDictionary = mTypeFileDictionary[type]; string fullName = resUnit.GetPathName() + "/" + resUnit.GetFileName(); if (fileDictionary.ContainsKey(fullName)) { fileDictionary.Remove(fullName); File.Delete(fullName); } } }