KoogleV4/KoogleCli/Parser/ThrowDataParser.cs

26 lines
806 B
C#

using KoogleCli.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace KoogleCli.Parser
{
public static class ThrowDataParser
{
public static ThrowData Parse(string data)
{
if (string.IsNullOrEmpty(data))
throw new ArgumentNullException("data");
var player = data.Substring(0, 1);
var playerId = int.Parse(player);
var pindata = data.Substring(2, data.Length -2);
return new ThrowData(playerId, Regex.Match(pindata, @"\d+").Value, data.Contains("b"), data.Contains("s"), data.Contains("e"));
}
}
}