mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-22 04:35:52 +12:00
Add BBCODE to Horse Descriptions, Player Descriptions and Ranch Descriptions.
This commit is contained in:
parent
bdebe4d84a
commit
72bc81d900
14 changed files with 142 additions and 40 deletions
35
Horse Isle Server/HorseIsleServer/Security/BBCode.cs
Normal file
35
Horse Isle Server/HorseIsleServer/Security/BBCode.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace HISP.Security
|
||||
{
|
||||
public class BBCode
|
||||
{
|
||||
public BBCode(string tag, string meta)
|
||||
{
|
||||
this.Tag = tag;
|
||||
this.MetaTranslation = meta;
|
||||
bbcodeTranslations.Add(this);
|
||||
}
|
||||
private static List<BBCode> bbcodeTranslations = new List<BBCode>();
|
||||
public string Tag;
|
||||
public string MetaTranslation;
|
||||
|
||||
public static string EncodeMetaToBBCode(string message)
|
||||
{
|
||||
foreach (BBCode code in bbcodeTranslations)
|
||||
{
|
||||
message = message.Replace(code.MetaTranslation, code.Tag);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
public static string EncodeBBCodeToMeta(string message)
|
||||
{
|
||||
foreach(BBCode code in bbcodeTranslations)
|
||||
{
|
||||
message = message.Replace(code.Tag, code.MetaTranslation);
|
||||
message = message.Replace(code.Tag.ToUpper(), code.MetaTranslation);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue