-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from C1rdec/us/24
Us/24
- Loading branch information
Showing
7 changed files
with
96 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//----------------------------------------------------------------------- | ||
// <copyright file="TokenHelper.cs" company="Wohs"> | ||
// Missing Copyright information from a valid stylecop.json file. | ||
// </copyright> | ||
//----------------------------------------------------------------------- | ||
|
||
namespace Lurker.UI.Helpers | ||
{ | ||
using Lurker.UI.ViewModels; | ||
using System.Text.RegularExpressions; | ||
|
||
public static class TokenHelper | ||
{ | ||
#region Fields | ||
|
||
public static readonly string ItemName = "{ItemName}"; | ||
public static readonly string BuyerName = "{BuyerName}"; | ||
public static readonly string Price = "{Price}"; | ||
|
||
#endregion | ||
|
||
#region Methods | ||
|
||
/// <summary> | ||
/// Replaces the token. | ||
/// </summary> | ||
/// <param name="message">The message.</param> | ||
/// <param name="offer">The offer.</param> | ||
/// <returns>The string with token replaced</returns> | ||
public static string ReplaceToken(string message, OfferViewModel offer) | ||
{ | ||
message = Regex.Replace(message, ItemName, offer.ItemName, RegexOptions.IgnoreCase); | ||
message = Regex.Replace(message, BuyerName, offer.PlayerName, RegexOptions.IgnoreCase); | ||
message = Regex.Replace(message, Price, offer.Price.ToString(), RegexOptions.IgnoreCase); | ||
return message; | ||
} | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters