コード例 #1
0
        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);
        }
コード例 #2
0
 public bool Process(OpenAssetInfo info)
 {
     for (int i = 0; i < mAssetEditors.Count; ++i)
     {
         if (mAssetEditors[i].ProcessAssetOpen(info))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 public abstract bool ProcessAssetOpen(OpenAssetInfo info);