Inheritance: Capture
Esempio n. 1
0
        static public DvCodedText ParseString(string codedTextString)
        {
            DesignByContract.Check.Require(!string.IsNullOrEmpty(codedTextString), "codedTextString must not be null or empty");

            Match match = Regex.Match(codedTextString, stringRegExValue, RegexOptions.Compiled | RegexOptions.Singleline);

            if (!match.Success)
            {
                throw new ApplicationException("Invalid DV_CODED_TEXT string");
            }

            System.Text.RegularExpressions.Group value         = match.Groups["value"];
            System.Text.RegularExpressions.Group codeString    = match.Groups["code_string"];
            System.Text.RegularExpressions.Group terminologyId = match.Groups["terminology_id"];

            if (value == null)
            {
                throw new ApplicationException("value must not be null");
            }
            if (codeString == null)
            {
                throw new ApplicationException("codeString must not be null");
            }
            if (terminologyId == null)
            {
                throw new ApplicationException("terminologyId must not be null");
            }

            return(new DvCodedText(value.Value, codeString.Value, terminologyId.Value));
        }
 void ReplaceUrlWithAbsoluteUrl(StringBuilder builder, Group matchedUrlGroup, string currentDirectory)
 {
     var relativeUrl = matchedUrlGroup.Value.Trim('"', '\'');
     var absoluteUrl = CreateAbsoluteUrl(relativeUrl, currentDirectory);
     builder.Remove(matchedUrlGroup.Index, matchedUrlGroup.Length);
     builder.Insert(matchedUrlGroup.Index, absoluteUrl);
 }
Esempio n. 3
0
        private double[] regXb(String line)
        {
            CultureInfo culture = new CultureInfo("en-US");

            double[] xb = new double[6];

            Regex regExXb = new Regex(@"XB\s*=\s*(\-*\d*\.{0,1}\d*)\s*,\s*(\-*\d*\.{0,1}\d*)\s*,\s*(\-*\d*\.{0,1}\d*)\s*,\s*(\-*\d*\.{0,1}\d*)\s*,\s*(\-*\d*\.{0,1}\d*)\s*,\s*(\-*\d*\.{0,1}\d*)", RegexOptions.IgnoreCase);
            Match xbMatch = regExXb.Match(line);

            if (xbMatch.Success)
            {
                System.Text.RegularExpressions.Group x1G = xbMatch.Groups[1];
                System.Text.RegularExpressions.Group x2G = xbMatch.Groups[2];
                System.Text.RegularExpressions.Group y1G = xbMatch.Groups[3];
                System.Text.RegularExpressions.Group y2G = xbMatch.Groups[4];
                System.Text.RegularExpressions.Group z1G = xbMatch.Groups[5];
                System.Text.RegularExpressions.Group z2G = xbMatch.Groups[6];
                xb[0] = Convert.ToDouble(x1G.Value, culture);
                xb[1] = Convert.ToDouble(x2G.Value, culture);
                xb[2] = Convert.ToDouble(y1G.Value, culture);
                xb[3] = Convert.ToDouble(y2G.Value, culture);
                xb[4] = Convert.ToDouble(z1G.Value, culture);
                xb[5] = Convert.ToDouble(z2G.Value, culture);
            }
            else
            {
                xb = null;
            }
            return(xb);
        }
////////////////////// Group ///////////////////////////////////////
// constructors

// fields

// properties
    static void Group_Captures(JSVCall vc)
    {
        System.Text.RegularExpressions.Group _this = (System.Text.RegularExpressions.Group)vc.csObj;
        var result = _this.Captures;

        JSMgr.datax.setObject((int)JSApi.SetType.Rval, result);
    }
Esempio n. 5
0
        void ApplyUrlToBlock(Gtk.TextIter start, Gtk.TextIter end)
        {
            NoteBuffer.GetBlockExtents(ref start,
                                       ref end,
                                       256 /* max url length */,
                                       Note.TagTable.UrlTag);

            Buffer.RemoveTag(Note.TagTable.UrlTag, start, end);

            Gtk.TextIter searchiter = start;
            for (Match match = regex.Match(start.GetSlice(end));
                 match.Success;
                 match = match.NextMatch())
            {
                System.Text.RegularExpressions.Group group = match.Groups [1];

                /*
                 * Logger.Log ("Highlighting url: '{0}' at offset {1}",
                 *   group,
                 *   group.Index);
                 */

                // Use the ForwardSearch instead of group's Index to account for multibyte chars in the text.
                // We'll search using the exact match value within provided boundaries.
                Gtk.TextIter startiter, enditer;
                searchiter.ForwardSearch(group.Value, Gtk.TextSearchFlags.VisibleOnly, out startiter, out enditer, end);
                searchiter = enditer;

                Buffer.ApplyTag(Note.TagTable.UrlTag, startiter, enditer);
            }
        }
    public static Group Synchronized(Group inner)
    {
      Contract.Requires(inner != null);
      Contract.Ensures(Contract.Result<Group>() != null);

      return default(Group);
    }
    public static Group Synchronized(Group inner)
    {
      Contract.Ensures(Contract.Result<System.Text.RegularExpressions.Group>() != null);
      Contract.Ensures(Contract.Result<System.Text.RegularExpressions.Group>() == inner);

      return default(Group);
    }
 private string GetPathThroughLastSlash(SourceText text, int position, Group quotedPathGroup)
 {
     return PathCompletionUtilities.GetPathThroughLastSlash(
         quotedPath: quotedPathGroup.Value,
         quotedPathStart: GetQuotedPathStart(text, position, quotedPathGroup),
         position: position);
 }
 private TextSpan GetTextChangeSpan(SourceText text, int position, Group quotedPathGroup)
 {
     return PathCompletionUtilities.GetTextChangeSpan(
         quotedPath: quotedPathGroup.Value,
         quotedPathStart: GetQuotedPathStart(text, position, quotedPathGroup),
         position: position);
 }
Esempio n. 10
0
        public static string FormatWith(this string format, IFormatProvider provider, object source)
        {
            if (format == null)
            {
                throw new ArgumentNullException("format");
            }

            Regex r = new Regex(@"(?<start>\{)+(?<property>[\w\.\[\]]+)(?<format>:[^}]+)?(?<end>\})+",
                                RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);

            List <object> values          = new List <object>();
            string        rewrittenFormat = r.Replace(format, delegate(Match m)
            {
                System.Text.RegularExpressions.Group startGroup    = m.Groups["start"];
                System.Text.RegularExpressions.Group propertyGroup = m.Groups["property"];
                System.Text.RegularExpressions.Group formatGroup   = m.Groups["format"];
                System.Text.RegularExpressions.Group endGroup      = m.Groups["end"];

                values.Add((propertyGroup.Value == "0")
                  ? source
                  : System.Web.UI.DataBinder.Eval(source, propertyGroup.Value));

                return(new string('{', startGroup.Captures.Count) + (values.Count - 1) + formatGroup.Value
                       + new string('}', endGroup.Captures.Count));
            });

            return(string.Format(provider, rewrittenFormat, values.ToArray()));
        }
Esempio n. 11
0
 private IEnumerable<Frame> CreateFrames(
     Group framesGroup)
 {
     return 
         from Capture capture in framesGroup.Captures
         select CreateFrame(capture.Value);
 }
Esempio n. 12
0
        void ApplyWikiwordToBlock(Gtk.TextIter start, Gtk.TextIter end)
        {
            NoteBuffer.GetBlockExtents(ref start,
                                       ref end,
                                       80 /* max wiki name */,
                                       broken_link_tag);

            Buffer.RemoveTag(broken_link_tag, start, end);

            for (Match match = regex.Match(start.GetText(end));
                 match.Success;
                 match = match.NextMatch())
            {
                System.Text.RegularExpressions.Group group = match.Groups [1];

                Logger.Debug("Highlighting wikiword: '{0}' at offset {1}",
                             group,
                             group.Index);

                Gtk.TextIter start_cpy = start;
                start_cpy.ForwardChars(group.Index);

                end = start_cpy;
                end.ForwardChars(group.Length);

                if (Manager.Find(group.ToString()) == null)
                {
                    Buffer.ApplyTag(broken_link_tag, start_cpy, end);
                }
            }
        }
    static void Group_Success(JSVCall vc)
    {
        System.Text.RegularExpressions.Group _this = (System.Text.RegularExpressions.Group)vc.csObj;
        var result = _this.Success;

        JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result));
    }
Esempio n. 14
0
        void ApplyUrlToBlock(Gtk.TextIter start, Gtk.TextIter end)
        {
            NoteBuffer.GetBlockExtents(ref start,
                                       ref end,
                                       256 /* max url length */,
                                       Note.TagTable.UrlTag);

            Buffer.RemoveTag(Note.TagTable.UrlTag, start, end);

            for (Match match = regex.Match(start.GetSlice(end));
                 match.Success;
                 match = match.NextMatch())
            {
                System.Text.RegularExpressions.Group group = match.Groups [1];

                /*
                 * Logger.Log ("Highlighting url: '{0}' at offset {1}",
                 *   group,
                 *   group.Index);
                 */

                Gtk.TextIter start_cpy = start;
                start_cpy.ForwardChars(group.Index);

                end = start_cpy;
                end.ForwardChars(group.Length);

                Buffer.ApplyTag(Note.TagTable.UrlTag, start_cpy, end);
            }
        }
Esempio n. 15
0
 /// <summary>
 /// Concatenates the captures of <paramref name="group" /> to a string.
 /// </summary>
 /// <param name="group"><see cref="Group" /> containing the captures.</param>
 /// <returns>
 /// <see cref="string" /> containg the concatenated captures.
 /// </returns>
 /// <remarks>
 /// A named-group can captured multiple times, when the regular
 /// expression has a quantifier, e.g. (// (?'Text'.*) )* will match
 /// multiline comments with group <i>Text</i> having a capture for
 /// every line.
 /// </remarks>
 private string ConcatenateCaptures(Group group) {
     StringBuilder sb = new StringBuilder();
     foreach (Capture capture in group.Captures) {
         sb.Append(capture.Value);
     }
     return sb.ToString();
 }
        private void AddSubNode(int parentNodeIndex, string caption, Group captureGroup, int groupIndex)
        {
            TreeNode newNode = makeCaptureNode(caption);

            Nodes[parentNodeIndex].Nodes.Add(newNode);
            Nodes[parentNodeIndex].Nodes[groupIndex - 1].Tag = captureGroup;
            Nodes[parentNodeIndex].Expand();
        }
Esempio n. 17
0
        public static string UpdateSpecLayer(ObjectId objectId, string webLayer)
        {
            // TODO: trzeba zalozyc filtr po webLayer i zmieniac wszystkie warstwy w petli poniwaz moze byc kilka tych samych warstw na roznych pietrach
            Editor   ed      = acApp.DocumentManager.MdiActiveDocument.Editor;
            Document acDoc   = Application.DocumentManager.MdiActiveDocument;
            Database acCurDb = acDoc.Database;

            // Start a transaction
            using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
            {
                // This example returns the layer table for the current database
                LayerTable acLyrTbl;
                acLyrTbl = acTrans.GetObject(acCurDb.LayerTableId, OpenMode.ForRead) as LayerTable;
                string layerName    = "";
                string oldLayerName = "";

                // Pobierz starą nazwę warstwy
                LayerTableRecord acLyrTblRecOld;
                acLyrTblRecOld = acTrans.GetObject(objectId, OpenMode.ForRead) as LayerTableRecord;

                Regex regEx = new Regex(@"\[(.+)\]", RegexOptions.IgnoreCase);
                Match match = regEx.Match(acLyrTblRecOld.Name);
                ed.WriteMessage("Match success: " + match.Success.ToString());
                if (match.Success)
                {
                    System.Text.RegularExpressions.Group group = match.Groups[1];
                    oldLayerName = group.ToString();
                }
                ed.WriteMessage("Old layer: " + oldLayerName);

                // Step through the Layer table and print each layer name
                foreach (ObjectId acObjId in acLyrTbl)
                {
                    LayerTableRecord acLyrTblRec;
                    acLyrTblRec = acTrans.GetObject(acObjId, OpenMode.ForRead) as LayerTableRecord;

                    if (acLyrTblRec.Name.Contains(oldLayerName))
                    {
                        regEx = new Regex(@"\((.)\)", RegexOptions.IgnoreCase);
                        match = regEx.Match(acLyrTblRec.Name);
                        if (match.Success)
                        {
                            System.Text.RegularExpressions.Group group = match.Groups[1];
                            Int32.TryParse(group.ToString(), out currentFloor);
                            layerName = "!FDS_SPEC[" + webLayer + "](" + currentFloor + ")";
                        }
                        acLyrTblRec.UpgradeOpen();
                        acLyrTblRec.Name = layerName;
                        Random r = new Random();
                        acLyrTblRec.Color = Color.FromColorIndex(ColorMethod.ByAci, (Int16)(r.Next(225)));

                        ed.WriteMessage("\n" + acLyrTblRec.Name);
                    }
                }
                acTrans.Commit();
                return("");
            }
        }
Esempio n. 18
0
        private static IReadOnlyList<UriParameter> ParseParameterGroup(Group group)
        {
            if (!group.Success)
                return new UriParameter[] { };

            var parameters = group.Value;
            var splitByAmpersand = parameters.Split('&');
            return splitByAmpersand.Select(ParseParameterPart).ToArray();
        }
Esempio n. 19
0
        // returns a length, not a position
        private static int LineBreak(string text, int where, int max)
        {
            Regex regex = new Regex(RegexPattern);
            Match match = null;

            int end = text.Substring(where).IndexOf('\n');

            if (end < 0)
            {
                end = text.Substring(where).Length;
            }
            int    i           = 0;                          // stores current position (relative)
            int    i_sub       = 0;                          // stores the total size of the tags
            int    pos         = 0;                          // stores current position (absolute)
            bool   valid_found = false;
            int    valid       = 1;                          //stores the last valid cutting point
            string with        = "";                         // the text with the tags
            string without     = "";                         // the text without the tags
            string temp        = "";                         // temporary string for holding values

            System.Text.RegularExpressions.Group tag = null; // a temporary value to store matches from the regex

            for (i = 0; i <= end;)
            {
                if (where + i >= text.Length - 1 || without.Length > max)
                {
                    break;
                }
                pos   = where + i;
                temp  = text.Substring(pos);
                match = regex.Match(temp);
                if (match.Success)
                {
                    tag = match.Groups["tag"];
                    if (tag != null && temp.StartsWith(tag.Value))
                    {
                        temp        = tag.Value;
                        i_sub      += temp.Length;
                        i          += temp.Length;
                        with       += temp;
                        valid       = i;
                        valid_found = true;
                        continue;
                    }
                }
                char chr = text[pos];
                if (char.IsWhiteSpace(chr))
                {
                    valid       = i + 1;
                    valid_found = true;
                }
                with    += chr;
                without += chr;
                i++;
            }
            return(without.Length < max ? with.Length + 1 : valid_found?valid : max + i_sub);
        }
Esempio n. 20
0
        private static void DisplayCaptures(Group group, TreeNode groupRoot)
        {
            foreach (Capture capture in group.Captures)
            {
                TreeNode captureRoot = new TreeNode(capture.Value);
                groupRoot.Nodes.Add(captureRoot);

            }
        }
Esempio n. 21
0
        public static double ParseDouble(Group @group)
        {
            if (@group.Captures.Count != 1)
            {
                throw new ArgumentException("Expected single capture");
            }

            return ParseDouble(@group.Value);
        }
 string GetImageFilename(Group matchedUrlGroup, string currentDirectory)
 {
     var originalUrl = matchedUrlGroup.Value.Trim('"', '\'');
     if (originalUrl.StartsWith("/"))
     {
         return PathUtilities.NormalizePath("~" + originalUrl);
     }
     return PathUtilities.NormalizePath(PathUtilities.CombineWithForwardSlashes(currentDirectory, originalUrl));
 }
Esempio n. 23
0
 private static int GroupToInt(Group g)
 {
     int value;
     if (int.TryParse(g.ToString(), out value))
     {
         return value;
     }
     return -1;
 }
Esempio n. 24
0
        public EditUserForm()
        {
            InitializeComponent();

            _userName = string.Empty;
            _password = string.Empty;
            GroupId = -1;
            Groups = new Group[0];
        }
Esempio n. 25
0
 private static string GetDistinctCount(string @select, Group g, string @from)
 {
     var columns = g.ToString().Trim();
     if(columns == "DISTINCT")
     {
         throw new ArgumentException("Malformed SQL; DISTINCT queries must specify at least one column");
     }
     var distinct = string.Concat(@select, "COUNT(", columns,  ") ", @from);
     return distinct;
 }
Esempio n. 26
0
 private IEnumerable<Ball> CreateBonusBalls(
     Group bonusBallsGroup)
 {
     return 
         from Capture capture in bonusBallsGroup.Captures
         let value = capture.Value[0]
         select value == 'X'
             ? Ball.CreateStrike()
             : CreateBall(capture.Value[0]);
 }
Esempio n. 27
0
        private static uint?getuintFomGroup(System.Text.RegularExpressions.Group grp)
        {
            int value;

            if (grp.Success && int.TryParse(grp.Value, out value))
            {
                return((uint)value);
            }
            return(null);
        }
Esempio n. 28
0
        void OnMenuItemActivated(object sender, EventArgs args)
        {
            NoteTag broken_link_tag = Note.TagTable.BrokenLinkTag;

            Gtk.TextIter note_start, note_end;

            // We get the whole note as a range
            // and then just remove the "broken link" tag from it
            Note.Buffer.GetBounds(out note_start, out note_end);

            // Sweep 'em & recreate WikiWord broken links (depending on Preferences),
            Buffer.RemoveTag(broken_link_tag, note_start, note_end);

            // HACK: The below is copied from Watchers.cs->ApplyWikiwordToBlock()
            // It turns WikiWords back into broken links after sweeping all broken links,
            // but only in case WikiWords are enabled.
            // Most probably there's more elegant way of doing this.

            if ((bool)Preferences.Get(Preferences.ENABLE_WIKIWORDS))
            {
                const string WIKIWORD_REGEX = @"\b((\p{Lu}+[\p{Ll}0-9]+){2}([\p{Lu}\p{Ll}0-9])*)\b";

                Regex regex = new Regex(WIKIWORD_REGEX, RegexOptions.Compiled);

                NoteBuffer.GetBlockExtents(ref note_start,
                                           ref note_end,
                                           80 /* max wiki name */,
                                           broken_link_tag);

                //Buffer.RemoveTag (broken_link_tag, start, end);

                for (Match match = regex.Match(note_start.GetText(note_end));
                     match.Success;
                     match = match.NextMatch())
                {
                    System.Text.RegularExpressions.Group group = match.Groups [1];

                    Logger.Debug("Highlighting back wikiword: '{0}' at offset {1}",
                                 group,
                                 group.Index);

                    Gtk.TextIter start_cpy = note_start;
                    start_cpy.ForwardChars(group.Index);

                    note_end = start_cpy;
                    note_end.ForwardChars(group.Length);

                    if (Manager.Find(group.ToString()) == null)
                    {
                        Buffer.ApplyTag(broken_link_tag, start_cpy, note_end);
                    }
                }
            }
            /// End of hack
        }
        void ExpandUrl(StringBuilder builder, Group matchedUrlGroup, string relativeFilename)
        {
            relativeFilename = RemoveFragment(relativeFilename);
            var file = application.RootDirectory.GetFile(relativeFilename.Substring(2));
            if (!file.Exists) return;

            var hash = HashFileContents(file);
            var absoluteUrl = application.UrlGenerator.CreateRawFileUrl(relativeFilename, hash);
            builder.Remove(matchedUrlGroup.Index, matchedUrlGroup.Length);
            builder.Insert(matchedUrlGroup.Index, absoluteUrl);
        }
Esempio n. 30
0
 public RegexGroup(Group group, string name)
 {
     foreach (Capture c in group.Captures)
     {
         _Captures.Add(new RegexCapture(c));
     }
     this._Name = name;
     this._Value = group.Value;
     this._Index = group.Index;
     this._Length = group.Length;
 }
        void ExpandUrl(StringBuilder builder, Group matchedUrlGroup, string relativeFilename)
        {
            relativeFilename = RemoveFragment(relativeFilename);
            var file = sourceDirectory.GetFile(relativeFilename.TrimStart('~', '/'));
            if (!file.Exists) return;

            var hash = HashFileContents(file);
            var absoluteUrl = urlGenerator.CreateRawFileUrl(relativeFilename, hash);
            builder.Remove(matchedUrlGroup.Index, matchedUrlGroup.Length);
            builder.Insert(matchedUrlGroup.Index, absoluteUrl);
        }
Esempio n. 32
0
        /// <summary>
        /// Helper to retrieve URL parameters from the REST server match data.
        ///
        /// Returns a value from the matches or null if not found. Unescapes the URL
        /// data. Throws RESTArgumentException if the parameter is not found or invalid.
        /// </summary>
        public static string GetValue(this Match match, string name)
        {
            System.Text.RegularExpressions.Group group = match.Groups[name];
            if (!group.Success)
            {
                throw new RESTArgumentException("URL parameter not found", name);
            }

            // Currently, the url is raw, so we manually decode the partz.
            return(Uri.UnescapeDataString(group.Value));
        }
 static public int get_Captures(IntPtr l)
 {
     try {
         System.Text.RegularExpressions.Group self = (System.Text.RegularExpressions.Group)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.Captures);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 34
0
		public void Deny_Unrestricted ()
		{
			Assert.AreEqual (1, coll.Count, "Count");
			Assert.IsTrue (coll.IsReadOnly, "IsReadOnly");
			Assert.IsFalse (coll.IsSynchronized, "IsSynchronized");
			Assert.IsNotNull (coll.SyncRoot, "SyncRoot");
			Assert.IsNotNull (coll[0], "this[int]");

			Assert.IsNotNull (coll.GetEnumerator (), "GetEnumerator");
			Group[] groups = new Group[1];
			coll.CopyTo (groups, 0);
		}
// methods

    static bool Group_Synchronized__Group(JSVCall vc, int argc)
    {
        int len = argc;

        if (len == 1)
        {
            System.Text.RegularExpressions.Group arg0 = (System.Text.RegularExpressions.Group)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
            JSMgr.datax.setObject((int)JSApi.SetType.Rval, System.Text.RegularExpressions.Group.Synchronized(arg0));
        }

        return(true);
    }
Esempio n. 36
0
        public static MessageSummary Parse(byte[] content)
        {
            try
            {
                if (content == null || content.Length == 0)
                {
                    return(null);
                }

                MessageSummary ret  = null;
                String         body = Encoding.UTF8.GetString(content, 0, content.Length);

                Match messageMatch = MESSAGE_SUMMARY_EXPR.Match(body);
                if (messageMatch != null && messageMatch.Success)
                {
                    String status  = messageMatch.Groups["msg_status"].Success ? messageMatch.Groups["msg_status"].Value : String.Empty;
                    String account = messageMatch.Groups["account_uri"].Success ? messageMatch.Groups["account_uri"].Value : String.Empty;

                    if (!String.IsNullOrEmpty(status) && !String.IsNullOrEmpty(account))
                    {
                        bool waitingMessages = (String.Equals(status, "yes", StringComparison.InvariantCultureIgnoreCase));

                        ret = new MessageSummary(account, waitingMessages);
                        if (waitingMessages)
                        {
                            System.Text.RegularExpressions.Group lines = messageMatch.Groups["msg_summary_line"];
                            foreach (Capture capture in lines.Captures)
                            {
                                String line      = capture.Value;
                                Match  lineMatch = SUMMARY_LINE_EXPR.Match(line);
                                if (lineMatch != null && lineMatch.Success)
                                {
                                    String messageClass      = lineMatch.Groups["message_context_class"].Value;
                                    int    newMessages       = Convert.ToInt32(lineMatch.Groups["newmsgs"].Success ? lineMatch.Groups["newmsgs"].Value : "0");
                                    int    oldMessages       = Convert.ToInt32(lineMatch.Groups["oldmsgs"].Success ? lineMatch.Groups["oldmsgs"].Value : "0");
                                    int    newUrgentMessages = Convert.ToInt32(lineMatch.Groups["new_urgentmsgs"].Success ? lineMatch.Groups["new_urgentmsgs"].Value : "0");
                                    int    oldUrgentMessages = Convert.ToInt32(lineMatch.Groups["old_urgentmsgs"].Success ? lineMatch.Groups["old_urgentmsgs"].Value : "0");

                                    ret.SetMessageCount(messageClass, newMessages, oldMessages, newUrgentMessages, oldUrgentMessages);
                                }
                            }
                        }
                    }
                }
                return(ret);
            }
            catch (Exception e)
            {
                LOG.Error(e);
                return(null);
            }
        }
        string GetImageFilename(Group matchedUrlGroup, string currentDirectory, 
            out string queryString, out string fragment)
        {
            var originalUrl = matchedUrlGroup.Value.Trim('"', '\'');
            originalUrl = SplitOnLastOccurence(originalUrl, '#', out fragment);
            originalUrl = SplitOnLastOccurence(originalUrl, '?', out queryString);

            if (originalUrl.StartsWith("/"))
            {
                return PathUtilities.NormalizePath("~" + originalUrl);
            }
            return PathUtilities.NormalizePath(PathUtilities.CombineWithForwardSlashes(currentDirectory, originalUrl));
        }
Esempio n. 38
0
        public void Parse(XmlElement configElement)
        {
            this.Enabled = configElement.GetAttribute("enabled").EqualsAnyOf("yes", "true", "1");
            this.Directory = configElement.GetString("p:directory", XmlNamespaces.Manager);

            var groups = configElement.SelectNodes("p:groups/p:group", XmlNamespaces.Manager);
            this.Groups = new Dictionary<string, Group>();
            foreach (XmlElement node in groups)
            {
                var group = new Group(node);
                this.Groups.Add(group.Name, group);
            }
        }
Esempio n. 39
0
 public MatchItem(Group group)
 {
     Children = new ObservableCollection<MatchItem>();
     Content = group.Value;
     if (group.Captures.Count < 2)
     {
         return;
     }
     foreach (Capture item in group.Captures)
     {
         Children.Add(new MatchItem(item));
     }
 }
        private static string GetDefaultValue(Group defaultValueGroup)
        {
            if (defaultValueGroup.Success)
            {
                var defaultValueMatch = defaultValueGroup.Value;

                // Strip out the equal sign at the beginning
                Debug.Assert(defaultValueMatch.StartsWith("=", StringComparison.Ordinal));
                return defaultValueMatch.Substring(1);
            }

            return null;
        }
Esempio n. 41
0
 public static Group Synchronized(Group inner)
 {
     if (inner == null)
     {
         throw new ArgumentNullException();
     }
     CaptureCollection captures = inner.Captures;
     if (inner._capcount > 0)
     {
         Capture capture1 = captures[0];
     }
     return inner;
 }
Esempio n. 42
0
        private static string ProcessIncludes(string str)
        {
            MatchCollection matches = g_regInclude.Matches(str);

            if (matches.Count == 0)
            {
                Utilities.LogSubError("Invalid %= in: " + str);
            }
            foreach (Match match in matches)
            {
                System.Text.RegularExpressions.Group g = match.Groups["num"];
                if (g.Success)
                {
                    foreach (Capture objCapture in g.Captures)                     //objMatch.Captures
                    {
                        string ID = objCapture.Value;
                        if (!g_Strings.ContainsKey(ID))
                        {
                            Utilities.LogSubError("Invalid reference: %=" + ID + "% in " + str);
                            if (!IsTranslationMode)
                            {
                                str = str.Replace("%=" + ID + "%", "???");
                            }
                            // else just leaves the %=xxx% in
                        }
                        else
                        {
                            if (IsTranslationMode)
                            {
                                string sub = g_Strings[ID];
                                sub = sub.Replace("[", "{");
                                sub = sub.Replace("]", "}").Replace("&", "");
                                str = str.Replace("%=" + ID + "%", sub);
                            }
                            else
                            {
                                string insert = g_Strings[ID];
                                if (insert.EndsWith("..."))
                                {
                                    insert = insert.Substring(0, insert.Length - 3);
                                }
                                insert = insert.Replace("&", "");                                 // remove accelerator keys.  When eg a menu name is referenced in explanatory text the & would probably be displayed - explanations, prompts etc. often don't support accelerators
                                str    = str.Replace("%=" + ID + "%", insert);
                            }
                        }
                    }
                }
            }
            return(str);
        }
Esempio n. 43
0
    	private static void DetermineScriptingLanguage(AspViewFile file, Group languageName)
		{
			switch (languageName.Value.ToLower())
			{
				case "c#":
					file.Language = ScriptingLanguage.CSharp;
					break;
				case "vb":
					file.Language = ScriptingLanguage.VbNet;
					break;
				default:
					throw new AspViewException("Unsupported view language [{0}] in view [{1}]", languageName, file.ViewName);
			}
		}
Esempio n. 44
0
        /// <summary>
        /// Removes the invalid HTML tags.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <returns></returns>
        public static string RemoveInvalidHtmlTags(this string text)
        {
            return(HtmlTagExpression.Replace(text, new MatchEvaluator((Match m) =>
            {
                if (!ValidHtmlTags.ContainsKey(m.Groups["tag"].Value))
                {
                    return String.Empty;
                }

                StringBuilder generatedTag = new StringBuilder(m.Length);

                System.Text.RegularExpressions.Group tagStart = m.Groups["tag_start"];
                System.Text.RegularExpressions.Group tagEnd = m.Groups["tag_end"];
                System.Text.RegularExpressions.Group tag = m.Groups["tag"];
                System.Text.RegularExpressions.Group tagAttributes = m.Groups["attr"];

                generatedTag.Append(tagStart.Success ? tagStart.Value : "<");
                generatedTag.Append(tag.Value);

                foreach (Capture attr in tagAttributes.Captures)
                {
                    int indexOfEquals = attr.Value.IndexOf('=');

                    // don't proceed any futurer if there is no equal sign or just an equal sign
                    if (indexOfEquals < 1)
                    {
                        continue;
                    }

                    string attrName = attr.Value.Substring(0, indexOfEquals);

                    // check to see if the attribute name is allowed and write attribute if it is
                    if (ValidHtmlTags[tag.Value].Contains(attrName))
                    {
                        generatedTag.Append(' ');
                        generatedTag.Append(attr.Value);
                    }
                }

                // add nofollow to all hyperlinks
                if (tagStart.Success && tagStart.Value == "<" && tag.Value.Equals("a", StringComparison.OrdinalIgnoreCase))
                {
                    generatedTag.Append(" rel=\"nofollow\"");
                }

                generatedTag.Append(tagEnd.Success ? tagEnd.Value : ">");

                return generatedTag.ToString();
            })));
        }
Esempio n. 45
0
        public static void AbortBuild(string title, string message, CommandInvokationFailure ex = null)
        {
            string str = null;

            if ((ex != null) && message.StartsWith("Gradle"))
            {
                string input = string.Join("\n", ex.StdErr);
                foreach (GradleError error in gradleErrors)
                {
                    Match match = error.regex.Match(input);
                    if (match.Success)
                    {
                        System.Text.RegularExpressions.Group[] array = new System.Text.RegularExpressions.Group[match.Groups.Count];
                        match.Groups.CopyTo(array, 0);
                        title   = "Gradle Error: " + error.id;
                        message = string.Format(error.message, (object[])array);
                        str     = error.id.ToLower().Replace(' ', '-');
                        break;
                    }
                }
            }
            if (str != null)
            {
                bool flag;
                Debug.Log($"GRADLE ERROR : {str}");
                message = message + "\n(See the Console for details)";
                if (Application.platform == RuntimePlatform.WindowsEditor)
                {
                    flag = EditorUtility.DisplayDialog(title, message, "Troubleshoot", "Ok");
                }
                else
                {
                    flag = EditorUtility.DisplayDialogComplex(title, message, "Ok", "", "Troubleshoot") == 2;
                }
                if (flag)
                {
                    Help.ShowHelpPage($"file:///unity/Manual/android-gradle-troubleshooting.html#{str}");
                }
            }
            else
            {
                EditorUtility.DisplayDialog(title, message, "Ok");
            }
            if (ex == null)
            {
                throw new UnityException(title + "\n" + message);
            }
            throw ex;
        }
Esempio n. 46
0
        public static AdminInfoObject TryParse(string Text)
        {
            Regex           regex;
            MatchCollection matches;
            uint            id;
            string          className;

            AdminInfoProperty[] props;

            // 1) Check if this is an object response

            regex   = new Regex(@":< OBJECT (?<id>\d*) is CLASS (?<classname>.*)");
            matches = regex.Matches(Text);

            // must have exactly one occurence if it is what we're looking for
            if (matches.Count != 1)
            {
                return(null);
            }

            // get values for id and classname
            System.Text.RegularExpressions.Group gID        = matches[0].Groups["id"];
            System.Text.RegularExpressions.Group gClassName = matches[0].Groups["classname"];

            if (!UInt32.TryParse(gID.ToString(), out id))
            {
                id = 0;
            }

            className = gClassName.ToString();

            // 2) Parse out properties

            regex   = new Regex(@": (?<propname>\w*)\s*=\s(?<proptype>[\w$]*)\s(?<propvalue>\w*)");
            matches = regex.Matches(Text);

            props = new AdminInfoProperty[matches.Count];
            for (int i = 0; i < matches.Count; i++)
            {
                props[i] = new AdminInfoProperty(
                    matches[i].Groups["propname"].ToString(),
                    matches[i].Groups["proptype"].ToString(),
                    matches[i].Groups["propvalue"].ToString());
            }

            // 3) Return instance
            return(new AdminInfoObject(id, className, props));
        }
Esempio n. 47
0
        private FilterExpression(string text, int group, int level)
        {
            if (string.IsNullOrWhiteSpace(text))
            {
                throw new ArgumentNullException(nameof(text));
            }

            this.Text = text.Trim();

            this.Level = level;
            this.Group = group;

            MatchCollection matches = FilterExpression.Expression.Value.Matches(this.Text);

            foreach (Match match in matches)
            {
                System.Text.RegularExpressions.Group levelUpGroup = match.Groups[FilterExpression.PatternGroupLevelUp];
                if (levelUpGroup.Success && levelUpGroup.Value.Any())
                {
                    this.Level += levelUpGroup.Value.Length;
                    this.Group += 1;
                }
                System.Text.RegularExpressions.Group operatorGroup = match.Groups[FilterExpression.PatternGroupOperator];
                if (operatorGroup.Success)
                {
                    System.Text.RegularExpressions.Group leftGroup  = match.Groups[FilterExpression.PatternGroupLeft];
                    System.Text.RegularExpressions.Group rightGroup = match.Groups[FilterExpression.PatternGroupRight];
                    this.Initialize(leftGroup, operatorGroup, rightGroup);
                }
                else
                {
                    string remainder = match.Value.Trim();
                    if (string.IsNullOrWhiteSpace(remainder))
                    {
                        continue;
                    }
                    else if (1 == remainder.Length && FilterExpression.BracketClose == remainder[0])
                    {
                        continue;
                    }
                    else
                    {
                        throw new ArgumentException(remainder, nameof(text));
                    }
                }
            }
        }
Esempio n. 48
0
        internal AssignedVoice PreAssigned(string avName)
        {
            // Need an assignment.
            string namedef = configVoices[avName].AsString();

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

            // Parse the voice assignment options.
            MatchCollection mc = voicePattern.Matches(namedef);

            if (mc.Count > 0)
            {
                Match m = mc[0];
                System.Text.RegularExpressions.Group g1 = m.Groups[1];
                string vname = g1.Value;

                // Default to no rate or pitch shift
                int vrate  = 0;
                int vpitch = 0;

                // Look for modifiers.
                for (int i = 2; i < m.Groups.Count; i++)
                {
                    System.Text.RegularExpressions.Group g = m.Groups[i];

                    switch (g.Value)
                    {
                    case "slow": vrate = -1; break;

                    case "fast": vrate = +1; break;

                    case "high": vpitch = +1; break;

                    case "low": vpitch = -1; break;
                    }
                }

                // Save all that as one bundle.
                return(GetNamedVoice(vname, vrate, vpitch));
            }

            return(null);
        }
Esempio n. 49
0
 private void ParseAttributes()
 {
     if (m_attributesAsString != null)
     {
         MatchCollection matchCollection = m_AttributeRegEx.Matches(m_attributesAsString.Trim());
         if (matchCollection.Count > 0)
         {
             m_parsedAttributes = new Dictionary <string, string>(matchCollection.Count, StringEqualityComparer.Instance);
             for (int i = 0; i < matchCollection.Count; i++)
             {
                 Match  match = matchCollection[i];
                 string text  = null;
                 string html  = null;
                 System.Text.RegularExpressions.Group group = match.Groups["name"];
                 if (group.Length <= 0)
                 {
                     continue;
                 }
                 text  = group.Value;
                 group = match.Groups["quotedvalue"];
                 if (group.Length > 0)
                 {
                     html = group.Value;
                 }
                 else
                 {
                     group = match.Groups["singlequotedvalue"];
                     if (group.Length > 0)
                     {
                         html = group.Value;
                     }
                     else
                     {
                         group = match.Groups["value"];
                         if (group.Length > 0)
                         {
                             html = group.Value;
                         }
                     }
                 }
                 m_parsedAttributes[text.ToLowerInvariant()] = HtmlEntityResolver.ResolveEntities(html);
             }
         }
     }
     m_attributesAsString = null;
 }
Esempio n. 50
0
        public Summand Parse(string summandString)
        {
            // Arggh, I NEVER write a parser on Regexps again

            var match = Regex.Match(summandString, Pattern);

            _varsGroup = match.Groups["vars"];
            _coefGroup = match.Groups["coef"];

            if (_varsGroup.Value == String.Empty && _coefGroup.Value == String.Empty)
                throw new ParsingException("Некорректный формат слагаемого.");

            var coef = ParseCoef();
            var variables = ParseVariables();

            return variables == null ? new Summand(coef) : new Summand(coef, variables);
        }
Esempio n. 51
0
        static internal Group Synchronized(Group inner) {
#endif
            if (inner == null)
                throw new ArgumentNullException("inner");

            // force Captures to be computed.

            CaptureCollection capcoll;
            Capture dummy;

            capcoll = inner.Captures;

            if (inner._capcount > 0)
                dummy = capcoll[0];

            return inner;
        }
Esempio n. 52
0
        public void HighlightWikiWords(Note note)
        {
            NoteTag broken_link_tag = note.TagTable.BrokenLinkTag;

            Gtk.TextIter note_start, note_end;

            note.Buffer.GetBounds(out note_start, out note_end);

            // HACK: The below is copied from Watchers.cs->ApplyWikiwordToBlock()
            // It turns WikiWords back into broken links after sweeping all broken links,
            // but only in case WikiWords are enabled.
            // Most probably there's more elegant way of doing this.

            const string WIKIWORD_REGEX = @"\b((\p{Lu}+[\p{Ll}0-9]+){2}([\p{Lu}\p{Ll}0-9])*)\b";

            Regex regex = new Regex(WIKIWORD_REGEX, RegexOptions.Compiled);

            NoteBuffer.GetBlockExtents(ref note_start,
                                       ref note_end,
                                       80 /* max wiki name */,
                                       broken_link_tag);

            for (Match match = regex.Match(note_start.GetText(note_end));
                 match.Success;
                 match = match.NextMatch())
            {
                System.Text.RegularExpressions.Group group = match.Groups [1];

                Logger.Debug("Highlighting back wikiword: '{0}' at offset {1}",
                             group,
                             group.Index);

                Gtk.TextIter start_cpy = note_start;
                start_cpy.ForwardChars(group.Index);

                note_end = start_cpy;
                note_end.ForwardChars(group.Length);

                if (note.Manager.Find(group.ToString()) == null)
                {
                    note.Buffer.ApplyTag(broken_link_tag, start_cpy, note_end);
                }
            }
            /// End of hack
        }
Esempio n. 53
0
        public Card(string s)
            : this()
        {
            if (s == null) throw new ArgumentNullException("s");

            Match match = CardName.Match(s.ToLower());
            if (match.Success)
            {
                Group[] groups = new Group[match.Groups.Count];
                match.Groups.CopyTo(groups, 0);
                Rank = (CardRank)Enum.Parse(typeof(CardRank), groups[1].Value, true);
                Suit = (CardSuit)Enum.Parse(typeof(CardSuit), groups[2].Value, true);
            }
            else
            {
                throw new ArgumentException("The given string does not represent a valid playing card: " + s);
            }
        }
		private static string replaceMatch(
			Group match,
			string text)
		{
			if (string.IsNullOrEmpty(text) || !text.Contains(@"$"))
			{
				return text;
			}
			else
			{
				// Count down, not up.
				for (var index = match.Captures.Count - 1; index >= 0; index--)
				{
					var c = match.Captures[index];
					text = text.Replace(string.Format(@"${0}", index), c.Value);
				}

				return text;
			}
		}
Esempio n. 55
0
    /// <summary>
    /// 查找
    /// </summary>
    private void Match()
    {
        if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(pattern))
        {
            return;
        }

        StringBuilder builder = new StringBuilder();

        try {
            Match match = Regex.Match(text, pattern);
            while (match.Success)
            {
                System.Console.WriteLine("Match=[" + match + "]");
                CaptureCollection cc = match.Captures;
                foreach (Capture c in cc)
                {
                    builder.Append("Capture=[" + c + "]");
                }
                builder.Append("\n");
                for (int i = 0; i < match.Groups.Count; i++)
                {
                    System.Text.RegularExpressions.Group group = match.Groups[i];
                    System.Console.WriteLine("\tGroups[{0}]=[{1}]", i, group);
                    builder.Append("\n");
                    for (int j = 0; j < group.Captures.Count; j++)
                    {
                        Capture capture = group.Captures[j];
                        builder.AppendFormat("\t\tCaptures[{0}]=[{1}]", j, capture);
                    }
                }

                builder.Append("\n");

                match = match.NextMatch();
            }
            matchResult = builder.ToString();
        } catch (Exception e) {
            matchResult = e.Message;
        }
    }
Esempio n. 56
0
        /// <summary>
        /// 说明:除img标签外,去掉所有html标签
        /// 作者:李天文
        /// 日期:2010-11-8
        /// </summary>
        /// <param name="html">要过滤的字符串</param>
        /// <returns></returns>
        public static StringBuilder RetainImg(string html)
        {
            StringBuilder str    = new StringBuilder();
            string        pat    = @"<img\s.*?\s?src\s*=\s*['|""]?([^\s'""]+).*?>";
            Regex         r      = new Regex(pat, RegexOptions.Compiled);
            Match         m      = r.Match(html.ToLower());
            string        result = string.Empty;

            while (m.Success)
            {
                System.Text.RegularExpressions.Group g = m.Groups[1];

                if (g.ToString().IndexOf("/xheditor/xheditor_emot") < 0)
                {
                    str.Append(g).Append(",");
                }

                m = m.NextMatch();
            }
            return(str);
        }
Esempio n. 57
0
        public static void CreateLayerForCurrentFloor(string layer)
        {
            Editor ed = acApp.DocumentManager.MdiActiveDocument.Editor;
            // Get current floor from current layer name
            Regex regEx = new Regex(@"\((.+)\)", RegexOptions.IgnoreCase);
            Match match = regEx.Match(CurrentLayer());

            if (match.Success)
            {
                System.Text.RegularExpressions.Group group = match.Groups[1];
                Int32.TryParse(group.ToString(), out currentFloor);
                try
                {
                    CreateLayer(layer + "(" + currentFloor + ")");
                    return;
                }
                catch (System.Exception e)
                {
                    CreateLayer(layer + "(0)");
                    ed.WriteMessage("\nProgram exception: " + e.ToString());
                    return;
                }
            }
            else
            {
                try
                {
                    CreateLayer(layer + "(0)");
                }
                catch (System.Exception)
                {
                    CreateLayer("0");
                    ed.WriteMessage("\nWarrning! Layer set to 0. There is no layer " + layer);
                    return;
                }
            }
            return;
        }
Esempio n. 58
0
        protected override void ExtraVideoMatch(VideoInfo video, GroupCollection matchGroups)
        {
            TrackingInfo ti = new TrackingInfo();

            // for southpark world
            System.Text.RegularExpressions.Group epGroup = matchGroups["Episode"];
            if (epGroup.Success)
            {
                ti.Regex = Regex.Match(epGroup.Value, @"(?<Season>\d\d)(?<Episode>\d\d)");
            }

            // for nl and de
            if (ti.Season == 0)
            {
                ti.Regex = Regex.Match(video.VideoUrl, @"\/S(?<Season>\d{1,3})E(?<Episode>\d{1,3})-", RegexOptions.IgnoreCase);
            }

            if (ti.Season != 0)
            {
                ti.Title     = "South Park";
                ti.VideoKind = VideoKind.TvSeries;
                video.Other  = new VideoInfoOtherHelper()
                {
                    TI = ti
                };
            }
            else
            {
                video.Other = new VideoInfoOtherHelper();
            }
            int time;

            if (Int32.TryParse(video.Airdate, out time))
            {
                video.Airdate = epoch.AddSeconds(time).ToString();
            }
        }
Esempio n. 59
0
        /// <summary>Gets the components from a URI.</summary>
        /// <returns>A string that contains the components.</returns>
        /// <param name="uri">The URI to parse.</param>
        /// <param name="components">The <see cref="T:System.UriComponents" /> to retrieve from <paramref name="uri" />.</param>
        /// <param name="format">One of the <see cref="T:System.UriFormat" /> values that controls how special characters are escaped.</param>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="uriFormat" /> is invalid.- or -<paramref name="uriComponents" /> is not a combination of valid <see cref="T:System.UriComponents" /> values. </exception>
        /// <exception cref="T:System.InvalidOperationException">
        ///   <paramref name="uri" /> requires user-driven parsing- or -<paramref name="uri" /> is not an absolute URI. Relative URIs cannot be used with this method.</exception>
        protected internal virtual string GetComponents(System.Uri uri, System.UriComponents components, System.UriFormat format)
        {
            if (format < System.UriFormat.UriEscaped || format > System.UriFormat.SafeUnescaped)
            {
                throw new ArgumentOutOfRangeException("format");
            }
            System.Text.RegularExpressions.Match match = System.UriParser.uri_regex.Match(uri.OriginalString);
            string value       = this.scheme_name;
            int    defaultPort = this.default_port;

            if (value == null || value == "*")
            {
                value       = match.Groups[2].Value;
                defaultPort = System.Uri.GetDefaultPort(value);
            }
            else if (string.Compare(value, match.Groups[2].Value, true) != 0)
            {
                throw new SystemException("URI Parser: scheme mismatch: " + value + " vs. " + match.Groups[2].Value);
            }
            System.UriComponents uriComponents = components;
            switch (uriComponents)
            {
            case System.UriComponents.Scheme:
                return(value);

            case System.UriComponents.UserInfo:
                return(System.UriParser.ParseAuthority(match.Groups[4]).Groups[2].Value);

            default:
            {
                if (uriComponents == System.UriComponents.Path)
                {
                    return(this.Format(this.IgnoreFirstCharIf(match.Groups[5].Value, '/'), format));
                }
                if (uriComponents == System.UriComponents.Query)
                {
                    return(this.Format(match.Groups[7].Value, format));
                }
                if (uriComponents == System.UriComponents.Fragment)
                {
                    return(this.Format(match.Groups[9].Value, format));
                }
                if (uriComponents != System.UriComponents.StrongPort)
                {
                    if (uriComponents == System.UriComponents.SerializationInfoString)
                    {
                        components = System.UriComponents.AbsoluteUri;
                    }
                    System.Text.RegularExpressions.Match match2 = System.UriParser.ParseAuthority(match.Groups[4]);
                    StringBuilder stringBuilder = new StringBuilder();
                    if ((components & System.UriComponents.Scheme) != (System.UriComponents) 0)
                    {
                        stringBuilder.Append(value);
                        stringBuilder.Append(System.Uri.GetSchemeDelimiter(value));
                    }
                    if ((components & System.UriComponents.UserInfo) != (System.UriComponents) 0)
                    {
                        stringBuilder.Append(match2.Groups[1].Value);
                    }
                    if ((components & System.UriComponents.Host) != (System.UriComponents) 0)
                    {
                        stringBuilder.Append(match2.Groups[3].Value);
                    }
                    if ((components & System.UriComponents.StrongPort) != (System.UriComponents) 0)
                    {
                        System.Text.RegularExpressions.Group group = match2.Groups[4];
                        stringBuilder.Append((!group.Success) ? (":" + defaultPort) : group.Value);
                    }
                    if ((components & System.UriComponents.Port) != (System.UriComponents) 0)
                    {
                        string value2 = match2.Groups[5].Value;
                        if (value2 != null && value2 != string.Empty && value2 != defaultPort.ToString())
                        {
                            stringBuilder.Append(match2.Groups[4].Value);
                        }
                    }
                    if ((components & System.UriComponents.Path) != (System.UriComponents) 0)
                    {
                        stringBuilder.Append(match.Groups[5]);
                    }
                    if ((components & System.UriComponents.Query) != (System.UriComponents) 0)
                    {
                        stringBuilder.Append(match.Groups[6]);
                    }
                    if ((components & System.UriComponents.Fragment) != (System.UriComponents) 0)
                    {
                        stringBuilder.Append(match.Groups[8]);
                    }
                    return(this.Format(stringBuilder.ToString(), format));
                }
                System.Text.RegularExpressions.Group group2 = System.UriParser.ParseAuthority(match.Groups[4]).Groups[5];
                return((!group2.Success) ? defaultPort.ToString() : group2.Value);
            }

            case System.UriComponents.Host:
                return(System.UriParser.ParseAuthority(match.Groups[4]).Groups[3].Value);

            case System.UriComponents.Port:
            {
                string value3 = System.UriParser.ParseAuthority(match.Groups[4]).Groups[5].Value;
                if (value3 != null && value3 != string.Empty && value3 != defaultPort.ToString())
                {
                    return(value3);
                }
                return(string.Empty);
            }
            }
        }
Esempio n. 60
0
 private static System.Text.RegularExpressions.Match ParseAuthority(System.Text.RegularExpressions.Group g)
 {
     return(System.UriParser.auth_regex.Match(g.Value));
 }