Exemplo n.º 1
0
        public static BreakPointRequest Parse(JObject args, DebugStore store)
        {
            // Events can potentially come out of order, so DebugStore may not be initialized
            // The BP being set in these cases are JS ones, which we can safely ignore
            if (args == null || store == null)
            {
                return(null);
            }

            var url = args? ["url"]?.Value <string> ();

            if (url == null)
            {
                var urlRegex   = args?["urlRegex"].Value <string>();
                var sourceFile = store?.GetFileByUrlRegex(urlRegex);

                url = sourceFile?.DotNetUrl;
            }

            if (url != null && !url.StartsWith("dotnet://", StringComparison.InvariantCulture))
            {
                var sourceFile = store.GetFileByUrl(url);
                url = sourceFile?.DotNetUrl;
            }

            if (url == null)
            {
                return(null);
            }

            var parts = ParseDocumentUrl(url);

            if (parts.Assembly == null)
            {
                return(null);
            }

            var line   = args? ["lineNumber"]?.Value <int> ();
            var column = args? ["columnNumber"]?.Value <int> ();

            if (line == null || column == null)
            {
                return(null);
            }

            return(new BreakPointRequest()
            {
                Assembly = parts.Assembly,
                File = parts.DocumentPath,
                Line = line.Value,
                Column = column.Value
            });
        }
Exemplo n.º 2
0
        public static BreakPointRequest Parse(JObject args, DebugStore store)
        {
            if (args == null)
            {
                return(null);
            }

            var url = args? ["url"]?.Value <string> ();

            if (url == null)
            {
                var urlRegex   = args?["urlRegex"].Value <string>();
                var sourceFile = store.GetFileByUrlRegex(urlRegex);

                url = sourceFile?.DotNetUrl;
            }

            if (url != null && !url.StartsWith("dotnet://", StringComparison.InvariantCulture))
            {
                var sourceFile = store.GetFileByUrl(url);
                url = sourceFile?.DotNetUrl;
            }

            if (url == null)
            {
                return(null);
            }

            var parts = ParseDocumentUrl(url);

            if (parts.Assembly == null)
            {
                return(null);
            }

            var line   = args? ["lineNumber"]?.Value <int> ();
            var column = args? ["columnNumber"]?.Value <int> ();

            if (line == null || column == null)
            {
                return(null);
            }

            return(new BreakPointRequest()
            {
                Assembly = parts.Assembly,
                File = parts.DocumentPath,
                Line = line.Value,
                Column = column.Value
            });
        }