예제 #1
0
 private VirtualTextDocument(ITextDocument textDocument)
 {
     _textDocument = textDocument;
     if (CodeStreamDiffUri.TryParse(_textDocument.FilePath, out CodeStreamDiffUri uri))
     {
         Uri             = uri.Uri;
         Id              = uri.Uri.ToLocalPath();
         FileName        = uri.FileName;
         SupportsMarkers = SupportsMargins = false;
     }
     else
     {
         Uri             = _textDocument.FilePath.ToUri();
         Id              = Uri?.ToLocalPath();
         FileName        = Path.GetFileName(_textDocument.FilePath);
         SupportsMarkers = SupportsMargins = true;
     }
 }
예제 #2
0
        public static bool TryParse(string str, out CodeStreamDiffUri csdu)
        {
            if (str.IsNullOrWhiteSpace())
            {
                csdu = null;
                return(false);
            }

            var match = Regex.Match(str);

            if (!match.Success)
            {
                csdu = null;
                return(false);
            }
            csdu = new CodeStreamDiffUri(match.Groups["reviewId"].Value,
                                         match.Groups["checkpoint"].Value,
                                         match.Groups["repoId"].Value,
                                         match.Groups["direction"].Value,
                                         match.Groups["filePath"].Value
                                         );
            return(true);
        }