Files
Magical-Jumping-Bean/Library/metadata/d0/d0138170d24533e47b8e6c250c6d7fbc
T

108 lines
8.9 KiB
Plaintext
Raw Normal View History

2019-09-29 19:40:54 -04:00
í#´2019.2.3f1þÿÿÿÿÿ’3$øÌuñ옲e+ Í=^7€ÿÿÿÿ¦€²Ð¦¦¦€#¦€+H€3ÿÿÿÿ1€1€ÿÿÿÿ@Þ Q€j
H€<ÿÿÿÿ 1€1€ÿÿÿÿ @Þ
Q€jÕ€Iÿÿÿÿ1€1€ÿÿÿÿÀÞH€j€ÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€j€PAssetMetaDataguiddata[0]data[1]data[2]data[3]pathNameoriginalNamelabelsassetStoreRef ÿÿfš†!ë5˜9Ý4QÁóBí7€ÿÿÿÿ¦€²
E Þ€#.€,5a Þ€#.€,€r Þ€# .€,
H€«€ÿÿÿÿ 1€1€ÿÿÿÿ @Þ
Q€jñ€JÿÿÿÿÀ1€1€ÿÿÿÿÞ€j€ÿÿÿÿ\€ÿÿÿÿH€rÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€jH€wÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€jH€€ÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€jy
 Þ€#!.€,"€…ÿÿÿÿ#@1€1€ÿÿÿÿ$Þ%.€j&Õ€“ÿÿÿÿ'1€1€ÿÿÿÿ(ÀÞ)€j€ÿÿÿÿ*H€›€ÿÿÿÿ+1€1€ÿÿÿÿ,@Þ-Q€j.y
 /Þ€#0.€,1 €§2@¾€¶ 3@Þ€#4.€,5H€»ÿÿÿÿ61€1€ÿÿÿÿ7@Þ8Q€j9H€Æÿÿÿÿ:1€1€ÿÿÿÿ;@Þ<Q€j=H€Øÿÿÿÿ>1€1€ÿÿÿÿ?@Þ@Q€jAMonoImporterPPtr<EditorExtension>m_FileIDm_PathIDPPtr<PrefabInstance>m_ExternalObjectsSourceAssetIdentifiertypeassemblynamem_UsedFileIDsm_DefaultReferencesexecutionOrdericonm_UserDatam_AssetBundleNamem_AssetBundleVariantsÿÿ£Gñ×ÜZ56 :!@iÁJ*€7€ÿÿÿÿ¦€²E Þ.(a Þ.€r Þ .
H€«€ÿÿÿÿ 1€1€ÿÿÿÿ @Þ
Q€jH€ê€ÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€jñ€=ÿÿÿÿ1€1€ÿÿÿÿÞ€j€ÿÿÿÿH€›€ÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€jy
 Þ.y€Q Þ. Þ€X!H€iÿÿÿÿ"1€1€ÿÿÿÿ#@Þ$Q€j%H€uÿÿÿÿ&1€1€ÿÿÿÿ'@Þ(Q€j)PPtr<EditorExtension>m_FileIDm_PathIDPPtr<PrefabInstance>m_DefaultReferencesm_Iconm_ExecutionOrderm_ClassNamem_Namespacetx\ày¯ØÌ
1-T3N·èÆRÀÖ÷ËIPackages/com.unity.test-framework/UnityEditor.TestRunner/GUI/GuiHelper.csày¯ GuiHelperBusing System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using UnityEditor.Utils;
using UnityEngine;
namespace UnityEditor.TestTools.TestRunner.GUI
{
internal class GuiHelper : IGuiHelper
{
public GuiHelper(IMonoCecilHelper monoCecilHelper, IAssetsDatabaseHelper assetsDatabaseHelper)
{
MonoCecilHelper = monoCecilHelper;
AssetsDatabaseHelper = assetsDatabaseHelper;
}
protected IMonoCecilHelper MonoCecilHelper { get; private set; }
public IAssetsDatabaseHelper AssetsDatabaseHelper { get; private set; }
public void OpenScriptInExternalEditor(Type type, MethodInfo method)
{
var fileOpenInfo = GetFileOpenInfo(type, method);
if (string.IsNullOrEmpty(fileOpenInfo.FilePath))
{
Debug.LogWarning("Failed to open test method source code in external editor. Inconsistent filename and yield return operator in target method.");
return;
}
if (fileOpenInfo.LineNumber == 1)
{
Debug.LogWarning("Failed to get a line number for unity test method. So please find it in opened file in external editor.");
}
AssetsDatabaseHelper.OpenAssetInItsDefaultExternalEditor(fileOpenInfo.FilePath, fileOpenInfo.LineNumber);
}
public IFileOpenInfo GetFileOpenInfo(Type type, MethodInfo method)
{
const string fileExtension = ".cs";
var fileOpenInfo = MonoCecilHelper.TryGetCecilFileOpenInfo(type, method);
if (string.IsNullOrEmpty(fileOpenInfo.FilePath))
{
var dirPath = Paths.UnifyDirectorySeparator(Application.dataPath);
var allCsFiles = Directory.GetFiles(dirPath, string.Format("*{0}", fileExtension), SearchOption.AllDirectories)
.Select(Paths.UnifyDirectorySeparator);
var fileName = allCsFiles.FirstOrDefault(x =>
x.Split(Path.DirectorySeparatorChar).Last().Equals(string.Concat(type.Name, fileExtension)));
fileOpenInfo.FilePath = fileName ?? string.Empty;
}
fileOpenInfo.FilePath = FilePathToAssetsRelativeAndUnified(fileOpenInfo.FilePath);
return fileOpenInfo;
}
public string FilePathToAssetsRelativeAndUnified(string filePath)
{
if (string.IsNullOrEmpty(filePath))
return string.Empty;
filePath = Paths.UnifyDirectorySeparator(filePath);
var length = Paths.UnifyDirectorySeparator(Application.dataPath).Length - "Assets".Length;
return filePath.Substring(length);
}
public bool OpenScriptInExternalEditor(string stacktrace)
{
if (string.IsNullOrEmpty(stacktrace))
return false;
var regex = new Regex("in (?<path>.*):{1}(?<line>[0-9]+)");
var matchingLines = stacktrace.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).Where(x => regex.IsMatch(x)).ToList();
if (!matchingLines.Any())
return false;
var fileOpenInfo = matchingLines
.Select(x => regex.Match(x))
.Select(x =>
new FileOpenInfo
{
FilePath = x.Groups["path"].Value,
LineNumber = int.Parse(x.Groups["line"].Value)
})
.First(openInfo => !string.IsNullOrEmpty(openInfo.FilePath) && File.Exists(openInfo.FilePath));
var filePath = FilePathToAssetsRelativeAndUnified(fileOpenInfo.FilePath);
AssetsDatabaseHelper.OpenAssetInItsDefaultExternalEditor(filePath, fileOpenInfo.LineNumber);