TryGetLocation() публичный Метод

public TryGetLocation ( string methodName, string methodParams, int ilOffset, Location &location ) : bool
methodName string
methodParams string
ilOffset int
location Location
Результат bool
Пример #1
0
        static string SymbolicateLine(string line, LocationProvider locProvider)
        {
            var match = regex.Match(line);

            if (!match.Success)
            {
                return(line);
            }

            var methodName   = match.Groups ["MethodName"].Value;
            var methodParams = ParseParametersTypes(match.Groups ["MethodParams"].Value);

            var isOffsetIL    = !string.IsNullOrEmpty(match.Groups ["IL"].Value);
            var offsetVarName = (isOffsetIL)? "IL" : "NativeOffset";
            var offset        = int.Parse(match.Groups [offsetVarName].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);

            Location location;

            if (!locProvider.TryGetLocation(methodName, methodParams, offset, isOffsetIL, out location))
            {
                return(line);
            }

            return(line.Replace("<filename unknown>:0", string.Format("{0}:{1}", location.FileName, location.Line)));
        }
Пример #2
0
		static string SymbolicateLine (string line, LocationProvider locProvider)
		{
			var match = regex.Match (line);
			if (!match.Success)
				return line;

			string typeFullName, methodSignature;
			var methodStr = match.Groups ["Method"].Value.Trim ();
			if (!ExtractSignatures (methodStr, out typeFullName, out methodSignature))
				return line;

			var isOffsetIL = !string.IsNullOrEmpty (match.Groups ["IL"].Value);
			var offsetVarName = (isOffsetIL)? "IL" : "NativeOffset";
			var offset = int.Parse (match.Groups [offsetVarName].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);

			uint methodIndex = 0xffffff;
			if (!string.IsNullOrEmpty (match.Groups ["MethodIndex"].Value))
				methodIndex = uint.Parse (match.Groups ["MethodIndex"].Value, CultureInfo.InvariantCulture);

			var loc = locProvider.TryGetLocation (typeFullName, methodSignature, offset, isOffsetIL, methodIndex);
			if (loc == null)
				return line;

			return line.Replace ("<filename unknown>:0", string.Format ("{0}:{1}", loc.Document.Url, loc.StartLine));
		}
Пример #3
0
		static string SymbolicateLine (string line, LocationProvider locProvider)
		{
			var match = regex.Match (line);
			if (!match.Success)
				return line;

			string typeFullName;
			var methodStr = match.Groups ["Method"].Value.Trim ();
			if (!TryParseMethodType (methodStr, out typeFullName))
				return line;

			var isOffsetIL = !string.IsNullOrEmpty (match.Groups ["IL"].Value);
			var offsetVarName = (isOffsetIL)? "IL" : "NativeOffset";
			var offset = int.Parse (match.Groups [offsetVarName].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);

			uint methodIndex = 0xffffff;
			if (!string.IsNullOrEmpty (match.Groups ["MethodIndex"].Value))
				methodIndex = uint.Parse (match.Groups ["MethodIndex"].Value, CultureInfo.InvariantCulture);

			Location location;
			if (!locProvider.TryGetLocation (methodStr, typeFullName, offset, isOffsetIL, methodIndex, out location))
				return line;

			return line.Replace ("<filename unknown>:0", string.Format ("{0}:{1}", location.FileName, location.Line));
		}
Пример #4
0
		static string SymbolicateLine (string line, LocationProvider locProvider)
		{
			var match = regex.Match (line);
			if (!match.Success)
				return line;

			var methodName = match.Groups ["MethodName"].Value;
			var methodParams = ParseParametersTypes (match.Groups ["MethodParams"].Value);
			var ilOffset = int.Parse (match.Groups ["IL"].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);

			Location location;
			if (!locProvider.TryGetLocation (methodName, methodParams, ilOffset, out location))
				return line;

			return line.Replace ("<filename unknown>:0", string.Format ("{0}:{1}", location.FileName, location.Line));
		}
Пример #5
0
        static string SymbolicateLine(string line, LocationProvider locProvider)
        {
            var match = regex.Match(line);

            if (!match.Success)
            {
                return(line);
            }

            string typeFullName;
            var    methodStr = match.Groups ["Method"].Value.Trim();

            if (!TryParseMethodType(methodStr, out typeFullName))
            {
                return(line);
            }

            var isOffsetIL    = !string.IsNullOrEmpty(match.Groups ["IL"].Value);
            var offsetVarName = (isOffsetIL)? "IL" : "NativeOffset";
            var offset        = int.Parse(match.Groups [offsetVarName].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);

            uint methodIndex = 0xffffff;

            if (!string.IsNullOrEmpty(match.Groups ["MethodIndex"].Value))
            {
                methodIndex = uint.Parse(match.Groups ["MethodIndex"].Value, CultureInfo.InvariantCulture);
            }

            Location location;

            if (!locProvider.TryGetLocation(methodStr, typeFullName, offset, isOffsetIL, methodIndex, out location))
            {
                return(line);
            }

            return(line.Replace("<filename unknown>:0", string.Format("{0}:{1}", location.FileName, location.Line)));
        }
Пример #6
0
        static string SymbolicateLine(string line, LocationProvider locProvider)
        {
            var match = regex.Match(line);

            if (!match.Success)
            {
                return(line);
            }

            string typeFullName, methodSignature;
            var    methodStr = match.Groups ["Method"].Value.Trim();

            if (!ExtractSignatures(methodStr, out typeFullName, out methodSignature))
            {
                return(line);
            }

            var isOffsetIL    = !string.IsNullOrEmpty(match.Groups ["IL"].Value);
            var offsetVarName = (isOffsetIL)? "IL" : "NativeOffset";
            var offset        = int.Parse(match.Groups [offsetVarName].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);

            uint methodIndex = 0xffffff;

            if (!string.IsNullOrEmpty(match.Groups ["MethodIndex"].Value))
            {
                methodIndex = uint.Parse(match.Groups ["MethodIndex"].Value, CultureInfo.InvariantCulture);
            }

            var loc = locProvider.TryGetLocation(typeFullName, methodSignature, offset, isOffsetIL, methodIndex);

            if (loc == null)
            {
                return(line);
            }

            return(line.Replace("<filename unknown>:0", string.Format("{0}:{1}", loc.Document.Url, loc.StartLine)));
        }