private TwChatLog(DateTime timeStamp, TwLogKind kind, string message, int value) { this.TimeStamp = timeStamp; this.TimeStampString = timeStamp.ToString("yyyy/MM/dd hh:mm:ss"); this.Kind = kind; this.Message = message; this.Value = value; }
private static (TwLogKind kind, int value) toDetailLog(TwLogKind kind, string message) { if (kind == TwLogKind.SYSTEM) { Match ExpMatch = ExpRegex.Match(message); if (ExpMatch.Success) { return(TwLogKind.EXP, int.Parse(ExpMatch.Groups["exp"].Value)); } Match RuneExpMatch = RuneExpRegex.Match(message); if (RuneExpMatch.Success) { return(TwLogKind.RUNE_EXP, int.Parse(RuneExpMatch.Groups["rune_exp"].Value)); } } return(kind, 0); }
public static TwChatLog createChatLog(string date, string line) { Match match = Regex.Match(line); if (!match.Success) { return(null); } DateTime timeStamp = DateTime.Parse(String.Format("{0} {1}:{2}:{3}", date, match.Groups["hour"].Value, match.Groups["min"].Value, match.Groups["sec"].Value )); string message = match.Groups["message"].Value; TwLogKind kind = ColorToLogKind(match.Groups["color"].Value); var detail = toDetailLog(kind, message); return(new TwChatLog(timeStamp, detail.kind, message, detail.value)); }