Exemplo n.º 1
0
        public ReplayInfo(string fn)
        {
            var rep = new ReplayFile(fn);

            FilePath = fn;
            FileName = Path.GetFileName(fn);

            FileSize_KB = rep.FileSize / 1024;
            Time        = new TimeSpan((long)(rep.InputData.Length / 3 / 60.0f * TimeSpan.TicksPerSecond));
            Messages    = rep.ChatMessages.Length;

            ushort p0 = 0, p1 = 0, p2 = 0;

            for (int i = 0; i < rep.InputData.Length; i += 3)
            {
                p0 |= rep.InputData[i];
                p1 |= rep.InputData[i + 1];
                p2 |= rep.InputData[i + 2];
            }
            Players = (p0 == 0 ? 0 : 1) + (p1 == 0 ? 0 : 1) + (p2 == 0 ? 0 : 1);

            var s = new ReplaySimulator(rep);

            try
            {
                s.Simulate();
                Lap    = s.SelectedLap;
                Actors = s.SelectedActorName;
            }
            catch
            {
                Lap    = 0;
                Actors = "-";
            }
        }
        public static string GetDefaultDescription(string filename)
        {
            ReplaySimulator s;

            try
            {
                var rep = new ReplayFile(filename);
                s = new ReplaySimulator(rep);
                s.Simulate();
            }
            catch
            {
                return(null);
            }

            var lap                = s.SelectedLap;
            var actors             = s.SelectedActor;
            var selectedActorNames = actors.Where(a => a != -1).Select(a => actorNames[a]);

            return(string.Join("", selectedActorNames) + lap + "周目");
        }