Ejemplo n.º 1
0
        private static void Reparse()
        {
            foreach (var ana in Database.LoadAll <DemoAnalysis>())
            {
                Console.WriteLine("Analysis: " + ana.ID.ToString());
                Console.WriteLine("Opening file " + ana.DemoFile);

                Console.WriteLine("Old progress: " + ana.Progress);

                currentAna = ana;

                if (!ana.IsFinished)
                {
                    //Console.WriteLine("removing...");
                    //Database.RemoveByObjectID<DemoAnalysis>(ana.ID.AsObjectId);
                    continue;
                }

                if (ana.Version == 3)
                {
                    continue;
                }

                Thread t = new Thread(new ThreadStart(ParseDemo));
                t.IsBackground = true;
                t.Start();

                for (int i = 0; i < 30; i++)
                {
                    Console.Write(i + ",");

                    if (!t.IsAlive)
                    {
                        break;
                    }

                    System.Threading.Thread.Sleep(1000);
                }

                Console.Write("done! ");

                if (t.IsAlive)
                {
                    Console.Write("Killing!");
                    t.Abort();
                }

                Console.WriteLine();


                var result = currentAna;

                Console.WriteLine("Saving Analysis: " + result.ID.ToString());

                ana.Version = 3;
                Database.Save <DemoAnalysis>(result);
            }
        }
Ejemplo n.º 2
0
        public Heatmap(IDatastore datastore, Stream demo, Overview overview, DemoAnalysis analysis)
        {
            parser = new DemoParser(demo);

            parser.FlashNadeExploded     += HandleFlashNadeExploded;
            parser.SmokeNadeStarted      += HandleSmokeNadeStarted;
            parser.ExplosiveNadeExploded += HandleExplosiveNadeExploded;
            parser.FireNadeStarted       += HandleFireNadeStarted;
            parser.PlayerKilled          += HandlePlayerKilled;
            parser.TickDone        += HandleTickDone;
            parser.RoundStart      += HandleRoundStart;
            parser.FreezetimeEnded += parser_FreezetimeEnded;

            parser.MatchStarted += HandleMatchStarted;

            this.analysis          = analysis;
            this.analysis.Overview = overview;

            this.Datastore = datastore;
        }
Ejemplo n.º 3
0
        static void ParseDemo()
        {
            var ana = currentAna;

            ana.Participants.Clear();
            ana.Progress   = 0;
            ana.Rounds     = new System.Collections.Generic.List <RoundEventMap>();
            ana.IsFinished = false;

            Heatmap h = new Heatmap(
                Database,
                File.OpenRead(Path.Combine("demo/", ana.DemoFile)),
                ana.Overview,
                ana
                );


            h.ParseHeaderOnly();
            var result = h.ParseTheRest();

            currentAna = result;
        }