public void DateTime_Test() { string text = "\"dateTime\": \"30.06.2018 12:23:16\","; string res = collector.DateTime(text); Assert.That(res, Is.EqualTo("30.06.2018 12:23:16")); }
public ReplayData SingleScan(FileInfo file, int lines) { if (file != null) { if (file.Exists) { ReplayData replay = new ReplayData(); DataCollector collector = new DataCollector(); replay.Path = file.DirectoryName; replay.Name = file.Name; replay.FullPath = file.FullName; replay.Size = Convert.ToInt32(file.Length / 1024); string text = String.Empty; if (lines > 0) { text = ReplayReader.ReadReplay(replay.FullPath, lines); } else { text = ReplayReader.ReadReplay(replay.FullPath); } if (String.IsNullOrEmpty(text)) { return(replay); } bool isValidReplay = collector.GetReplayStatus(text); replay.DateTime = collector.DateTime(text); replay.Map = collector.GetMapName(text); replay.Player = collector.GetPlayerName(text); replay.GamePlayId = collector.GetGamePlay(text); replay.Respawn = collector.Respawn(text); replay.Players = collector.Players(text); replay.Status = isValidReplay; replay.Vehicle = collector.PlayerVehicle(text); replay.Version = collector.Version(text); replay.BattleType = collector.BattleType(text); replay.HasMods = collector.HasMods(text); replay.RegionCode = collector.RegionCode(text); replay.ServerName = collector.ServerName(text); replay.PlayerId = collector.PlayerId(text); if (isValidReplay) { replay.Duration = collector.BattleDuration(text); replay.Winner = collector.Winner(text); replay.Status = collector.GetReplayStatus(text); } else { _broken++; } return(replay); } } return(null); }