diff options
| author | AShifter <[email protected]> | 2017-03-31 12:38:15 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-03-31 12:38:15 -0600 |
| commit | 6c4ae51afd730cfcb6ddb93486c6f0a4d36ea4c0 (patch) | |
| tree | fa9b07821f8bb61e456071ca8f3a35696dda57eb /TimeHACK.Engine/WCMessageParser.cs | |
| parent | e2213726e627553783571fa631dd032f773f8794 (diff) | |
| parent | 19ea483b2ba7974ffcfbe06b73c160a5ca418f45 (diff) | |
| download | histacom2-6c4ae51afd730cfcb6ddb93486c6f0a4d36ea4c0.tar.gz histacom2-6c4ae51afd730cfcb6ddb93486c6f0a4d36ea4c0.tar.bz2 histacom2-6c4ae51afd730cfcb6ddb93486c6f0a4d36ea4c0.zip | |
Merge pull request #18 from lempamo/master
webchat things
Diffstat (limited to 'TimeHACK.Engine/WCMessageParser.cs')
| -rw-r--r-- | TimeHACK.Engine/WCMessageParser.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/TimeHACK.Engine/WCMessageParser.cs b/TimeHACK.Engine/WCMessageParser.cs new file mode 100644 index 0000000..ed16afd --- /dev/null +++ b/TimeHACK.Engine/WCMessageParser.cs @@ -0,0 +1,24 @@ +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TimeHACK.Engine +{ + class WCMessageParser + { + public string ParseMessage(string json, int index, string user) + { + JObject message = JObject.Parse(JObject.Parse(json)["messages"][index].ToString()); + string newmsg = message["message"].ToString().Replace("@user", user); + return message["user"].ToString() + ": " + newmsg; + } + public int GetMessageDelay(string json, int index) + { + JObject message = JObject.Parse(JObject.Parse(json)["messages"][index].ToString()); + return message["delay"].ToObject<int>(); + } + } +} |
