Skip to content

Commit

Permalink
Fix incorrect Regex.Match return value usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
samhocevar committed Jan 28, 2016
1 parent 0b60100 commit 12f684e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/MonoTorrent.Tests/Client/TestWebSeed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ private void GotContext(IAsyncResult result)
Match match = null;
string range = c.Request.Headers["range"];

if (!(range != null && (match = rangeMatcher.Match(range)) != null))
if (!(range != null && (match = rangeMatcher.Match(range)).Success))
Assert.Fail("No valid range specified");

int start = int.Parse(match.Groups[1].Captures[0].Value);
Expand Down
22 changes: 11 additions & 11 deletions src/MonoTorrent/MonoTorrent.Common/PeerID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ internal Software(string peerId)
}

#region Standard style peers
if ((m = standard.Match(peerId)) !=null)
if ((m = standard.Match(peerId)).Success)
{
this.shortId = m.Groups[1].Value;
switch (m.Groups[2].Value)
Expand Down Expand Up @@ -320,7 +320,7 @@ internal Software(string peerId)
#endregion

#region Shadows Style
if ((m = shadows.Match(peerId)) != null)
if ((m = shadows.Match(peerId)).Success)
{
this.shortId = m.Groups[1].Value;
switch (m.Groups[2].Value)
Expand Down Expand Up @@ -359,7 +359,7 @@ internal Software(string peerId)
#endregion

#region Brams Client
if ((m = brahms.Match(peerId)) != null)
if ((m = brahms.Match(peerId)).Success)
{
this.shortId = "M";
this.client = Client.BitTorrent;
Expand All @@ -368,7 +368,7 @@ internal Software(string peerId)
#endregion

#region BitLord
if ((m = bitlord.Match(peerId)) != null)
if ((m = bitlord.Match(peerId)).Success)
{
this.client = Client.BitLord;
this.shortId = "lord";
Expand All @@ -377,7 +377,7 @@ internal Software(string peerId)
#endregion

#region BitComet
if ((m = bitcomet.Match(peerId)) != null)
if ((m = bitcomet.Match(peerId)).Success)
{
this.client = Client.BitComet;
this.shortId = "BC";
Expand All @@ -386,7 +386,7 @@ internal Software(string peerId)
#endregion

#region XBT
if ((m = xbt.Match(peerId)) != null)
if ((m = xbt.Match(peerId)).Success)
{
this.client = Client.XBTClient;
this.shortId = "XBT";
Expand All @@ -395,15 +395,15 @@ internal Software(string peerId)
#endregion

#region Opera
if ((m = opera.Match(peerId)) != null)
if ((m = opera.Match(peerId)).Success)
{
this.client = Client.Opera;
this.shortId = "OP";
}
#endregion

#region MLDonkey
if ((m = mldonkey .Match(peerId)) != null)
if ((m = mldonkey .Match(peerId)).Success)
{
this.client = Client.MLDonkey;
this.shortId = "ML";
Expand All @@ -412,7 +412,7 @@ internal Software(string peerId)
#endregion

#region Bits on wheels
if ((m = bow.Match(peerId)) != null)
if ((m = bow.Match(peerId)).Success)
{
this.client = Client.BitsOnWheels;
this.shortId = "BOW";
Expand All @@ -421,7 +421,7 @@ internal Software(string peerId)
#endregion

#region Queen Bee
if ((m = queenbee.Match(peerId)) != null)
if ((m = queenbee.Match(peerId)).Success)
{
this.client = Client.QueenBee;
this.shortId = "Q";
Expand All @@ -430,7 +430,7 @@ internal Software(string peerId)
#endregion

#region BitTornado special style
if((m = bittornado.Match(peerId)) != null)
if((m = bittornado.Match(peerId)).Success)
{
this.shortId = m.Groups[1].Value;
this.client = Client.BitTornado;
Expand Down

0 comments on commit 12f684e

Please sign in to comment.