public void SearchAll() { var resDirs = new List <DirectoryInfo>(); for (var index = 0; index < SearchPaths.Count; index++) { var path = SearchPaths[index]; resDirs.Add(new DirectoryInfo(path)); } for (var index = 0; index < resDirs.Count; index++) { var e = resDirs[index]; var files = e.GetFiles("*", SearchOption.AllDirectories).Where(file => !file.Name.EndsWith(".meta")); foreach (var f in files) { for (var i = 0; i < autoGens.Count; ++i) { if (autoGens[i].Belong(f.FullName)) { try { autoGens[i].AddRes(f.FullName); } catch (Exception ex) { Debug.LogErrorFormat(AutoGenHelper.LoadAssetAtFullPath <Object>(f.FullName), "{0}\nAuto generate class R failed in: {1}.", ex.Message, f.FullName); } } } } } }
public bool DelRes(string path) { var name = AutoGenHelper.GetAssetNameFromPath(path); if (content.ContainsKey(name)) { content.Remove(name); return(true); } return(false); }
public bool AddRes(string path) { var key = AutoGenHelper.GetAssetNameFromPath(path); if (content.ContainsKey(key)) { throw new ArgumentException("Duplicate Named Resources:" + key); } var type = AssetTypeToGen(); var resPath = AutoGenHelper.RelativeResourcesPath(path); var assetPath = AutoGenHelper.RelativeAssetsPath(path); var bundleName = AutoGenHelper.GetAssetBundleNameAtPath(assetPath); var value = AssetInfo.Create(type, resPath, bundleName, assetPath); content.Add(key, value); return(true); }
public bool DelRes(string path) { var list = File.ReadAllLines(path).Where(line => !(line.Trim().Length == 0 || string.IsNullOrEmpty(line))).Select(line => line.Split(new[] { '=' }, 2, 0)).ToList(); for (var i = 0; i < list.Count; ++i) { if (list[i].Length != 2) { continue; } var key = AutoGenHelper.GetAssetNameFromPath(list[i][0]); if (content.ContainsKey(key)) { content.Remove(key); } } return(true); }
public bool AddRes(string path) { var key = AutoGenHelper.GetAssetNameFromPath(path); if (content.ContainsKey(key)) { throw new ArgumentException("Duplicate Named Resources:" + key); } else { Shader s = AutoGenHelper.LoadAssetAtFullPath <Shader>(path); if (s) { content.Add(key, s.name); } } return(true); }
public override bool AddRes(string path) { var list = GetIniData(path); for (var i = 0; i < list.Count; ++i) { if (list[i].Length == 2) { var key = AutoGenHelper.GetAssetNameFromPath(list[i][0]); //string value = list[i][1].Trim(); if (content.ContainsKey(key)) { throw new ArgumentException("Duplicate Named Resources:" + key); } content.Add(key, key); } } return(true); }