private static bool OpenFile(OpenAssetInfo info, List <string> flterStrings, List <string> excludeFiles) { string stackTrace = GetConsoleStackTrace(); if (!string.IsNullOrEmpty(stackTrace) && stackTrace.ContainsAny(flterStrings)) { System.Text.RegularExpressions.Match matches = System.Text.RegularExpressions.Regex.Match(stackTrace, @"\(at (.+)\)", System.Text.RegularExpressions.RegexOptions.IgnoreCase); while (matches.Success) { string pathLine = matches.Groups[1].Value; bool containsAny = pathLine.ContainsAny(excludeFiles); if (!containsAny) { int splitIndex = pathLine.LastIndexOf(":"); string path = pathLine.Substring(0, splitIndex); int line = System.Convert.ToInt32(pathLine.Substring(splitIndex + 1)); Object fileObject = AssetDatabase.LoadAssetAtPath <Object>(path); if (fileObject != null && AssetDatabase.OpenAsset(fileObject, line)) { return(true); } else { //string fullPath = FPlatformFileSystem.GetFullPath(path).ToPlatformStyle(); //return FEditorUtility.OpenFileAtLineExternal(path, line); } } matches = matches.NextMatch(); } } return(false); }
public bool Process(OpenAssetInfo info) { for (int i = 0; i < mAssetEditors.Count; ++i) { if (mAssetEditors[i].ProcessAssetOpen(info)) { return(true); } } return(false); }
public override bool ProcessAssetOpen(OpenAssetInfo info) { if (info.assetPath.ContainsAny(msBlacklist)) { if (isOpenningFile) { return(true); } isOpenningFile = true; bool result = OpenFile(info, msFilterStrings, msBlacklist); isOpenningFile = false; return(result); } return(false); }
public abstract bool ProcessAssetOpen(OpenAssetInfo info);