コード例 #1
0
 public override void Process(DemoParsingInfo infoObj)
 {
     infoObj.PrintOptionMessage("looking for pauses");
     try {
         bool any = false;
         foreach (int pauseTick in GetPauseTicks(infoObj.CurrentDemo))
         {
             any = true;
             Console.Write($"[{pauseTick}] pause");
             if (pauseTick > infoObj.CurrentDemo.EndAdjustmentTick)
             {
                 Console.Write(" (after last adjusted tick)");
             }
             else if (pauseTick < infoObj.CurrentDemo.StartAdjustmentTick)
             {
                 Console.Write(" (before first adjusted tick)");
             }
             Console.WriteLine();
         }
         if (!any)
         {
             Console.WriteLine("no pauses found");
         }
     } catch (Exception) {
         Utils.Warning("Search for pauses failed.\n");
     }
 }
コード例 #2
0
 protected override void Process(DemoParsingInfo infoObj, FilterFlags flags, bool isDefault)
 {
     infoObj.PrintOptionMessage("looking for teleports");
     try {
         bool any = false;
         foreach ((EntityPortalled userMessage, int tick) in FindTeleports(infoObj.CurrentDemo, flags))
         {
             any = true;
             Console.Write($"[{tick}]");
             if ((flags & FilterFlags.VerboseInfo) != 0)
             {
                 Console.Write("\n");
                 Console.WriteLine(userMessage.ToString());
             }
             else
             {
                 Console.Write((flags & FilterFlags.PlayerOnly) != 0
                                                 ? " player"
                                                 : $" entity {userMessage.Portalled}");
                 Console.WriteLine($" went through portal {userMessage.Portal}");
             }
         }
         if (!any)
         {
             Console.WriteLine((flags & FilterFlags.PlayerOnly) != 0
                                         ? "player never teleported"
                                         : "no entities were teleported");
         }
     } catch (Exception) {
         Utils.Warning("Search for teleports failed.\n");
     }
 }
コード例 #3
0
        protected override void Process(DemoParsingInfo infoObj, DataTableDumpMode mode, bool isDefault)
        {
            infoObj.PrintOptionMessage("creating data table dump");
            TextWriter tw = infoObj.StartWritingText("datatables");

            try {
                WriteDataTableDump((StreamWriter)tw, infoObj.CurrentDemo, mode);
            } catch (Exception) {
                Utils.Warning("Data table dump failed.\n");
            }
        }
コード例 #4
0
        public override void Process(DemoParsingInfo infoObj)
        {
            infoObj.PrintOptionMessage("creating string table dump");
            TextWriter tw = infoObj.StartWritingText("stringtables");

            try {
                WriteStringTableDump((StreamWriter)tw, infoObj.CurrentDemo);
            } catch (Exception) {
                Utils.Warning("String table dump failed.\n");
            }
        }
コード例 #5
0
 protected override void Process(DemoParsingInfo infoObj, InputDisplayMode mode, bool isDefault)
 {
     infoObj.PrintOptionMessage("getting user inputs");
     try {
         foreach ((int tick, string repr) in GetUserInputs(infoObj.CurrentDemo, mode))
         {
             Console.WriteLine($"[{tick}] {repr}");
         }
     } catch (Exception) {
         Utils.Warning("Getting user inputs failed.\n");
     }
 }
コード例 #6
0
        protected override void Process(DemoParsingInfo infoObj, int arg, bool isDefault)
        {
            infoObj.PrintOptionMessage("smoothing jumps");
            Stream s = infoObj.StartWritingBytes("smooth-jumps", ".dem");

            try {
                SmoothJumps(infoObj.CurrentDemo, s, arg);
            } catch (Exception) {
                Utils.Warning("Smoothing jumps failed.\n");
                infoObj.CancelOverwrite = true;
            }
        }
コード例 #7
0
        protected override void Process(DemoParsingInfo infoObj, string arg, bool isDefault)
        {
            infoObj.PrintOptionMessage("changing demo dir");
            Stream s = infoObj.StartWritingBytes("new_dir", ".dem");

            try {
                ChangeDemoDir(infoObj.CurrentDemo, s, arg);
            } catch (Exception) {
                Utils.Warning("Changing demo directory failed.\n");
                infoObj.CancelOverwrite = true;
            }
        }
コード例 #8
0
        public override void Process(DemoParsingInfo infoObj)
        {
            infoObj.PrintOptionMessage("removing captions");
            Stream s = infoObj.StartWritingBytes("no-captions", ".dem");

            try {
                RemoveCaptions(infoObj.CurrentDemo, s);
            } catch (Exception) {
                Utils.Warning("Caption removal failed.\n");
                infoObj.CancelOverwrite = true;
            }
        }
コード例 #9
0
        public override void Process(DemoParsingInfo infoObj)
        {
            infoObj.PrintOptionMessage("writing demo dump");
            TextWriter tw = infoObj.StartWritingText("demo-dump");

            try {
                PrettyStreamWriter pw = new PrettyStreamWriter(((StreamWriter)tw).BaseStream);
                infoObj.CurrentDemo.PrettyWrite(pw);
                pw.Flush();                 // see note at PrettyStreamWriter
            } catch (Exception) {
                Utils.Warning("Failed to create demo dump.\n");
            }
        }
コード例 #10
0
        protected override void PostProcess(DemoParsingInfo infoObj, TimeFlags arg, bool isDefault)
        {
            bool showTotal    = _sdt.ValidFlags.HasFlag(SimpleDemoTimer.Flags.TotalTimeValid);
            bool showAdjusted = _sdt.ValidFlags.HasFlag(SimpleDemoTimer.Flags.AdjustedTimeValid);
            bool overwrite    = (arg & TimeFlags.AlwaysShowTotalTime) != 0;

            if (!overwrite && infoObj.NumDemos == 1)
            {
                return;
            }

            // show message if only one is invalid, or if we're overwriting and either is invalid
            if ((showTotal ^ showAdjusted) || (overwrite && (!showTotal || !showAdjusted)))
            {
                string which;
                if (!showTotal && !showAdjusted)
                {
                    which = "Total and adjusted";
                }
                else if (!showTotal)
                {
                    which = "Total";
                }
                else
                {
                    which = "Adjusted";
                }
                Utils.Warning($"{which} time may not be valid.\n\n");
            }
            Utils.PushForegroundColor(ConsoleColor.Green);
            if (showTotal || overwrite)
            {
                Console.WriteLine($"{"Total measured time", FmtIdt}: {Utils.FormatTime(_sdt.TotalTime)}");
                Console.WriteLine($"{"Total measured ticks", FmtIdt}: {_sdt.TotalTicks}");
                showAdjusted &= _sdt.TotalTicks != _sdt.AdjustedTicks;
            }
            if (showAdjusted || overwrite)
            {
                Console.WriteLine($"{"Total adjusted time", FmtIdt}: {Utils.FormatTime(_sdt.AdjustedTime)}");
                Console.WriteLine($"{"Total adjusted ticks", FmtIdt}: {_sdt.AdjustedTicks}");
            }
            Utils.PopForegroundColor();
            if (!showTotal && !showAdjusted && !overwrite)
            {
                Console.WriteLine($"Not showing total time from {DefaultAliases[0]} since it may not be valid. Use '{DefaultAliases[0]} {TimeFlags.AlwaysShowTotalTime}' to show it regardless.");
            }
        }
コード例 #11
0
 public override void Process(DemoParsingInfo infoObj)
 {
     infoObj.PrintOptionMessage("dumping player position");
     try {
         int prevTick = int.MinValue;
         foreach (Packet packet in infoObj.CurrentDemo.FilterForPacket <Packet>())
         {
             if (packet.Tick == prevTick || packet.Tick < 0)
             {
                 continue;
             }
             prevTick = packet.Tick;
             CmdInfo     cmdInfo = packet.PacketInfo[0];
             ref Vector3 pos     = ref cmdInfo.ViewOrigin;
             ref Vector3 ang     = ref cmdInfo.ViewAngles;
             Console.WriteLine($"|{packet.Tick}|~|{pos.X},{pos.Y},{pos.Z}|{ang.X},{ang.Y},{ang.Z}|");
         }
コード例 #12
0
 public override void Process(DemoParsingInfo infoObj)
 {
     infoObj.PrintOptionMessage("searching for cheat commands");
     try {
         bool any = false;
         foreach (ConsoleCmd cmd in GetCheatCommands(infoObj.CurrentDemo))
         {
             any = true;
             Console.WriteLine($"[{cmd.Tick}] {cmd.Command}");
         }
         if (!any)
         {
             Console.WriteLine("no cheat commands found");
         }
     } catch (Exception) {
         Utils.Warning("Search for cheat commands failed.\n");
     }
 }
コード例 #13
0
 // todo: implement legit jump verification and convert cmd num to key
 public override void Process(DemoParsingInfo infoObj)
 {
     infoObj.PrintOptionMessage("searching for jumps");
     try {
         bool any = false;
         foreach ((ConsoleCmd cmd, MatchCollection matches) in infoObj.CurrentDemo.CmdRegexMatches("[+-]jump"))
         {
             any = true;
             Console.WriteLine($"[{cmd.Tick}] {cmd.Command}");
         }
         if (!any)
         {
             Console.WriteLine("no jumps found");
         }
     } catch (Exception) {
         Utils.Warning("Search for jumps failed.\n");
     }
 }
コード例 #14
0
 protected override void Process(DemoParsingInfo infoObj, TimeFlags arg, bool isDefault)
 {
     infoObj.PrintOptionMessage("timing demo");
     try {
         if ((arg & TimeFlags.NoHeader) == 0)
         {
             WriteHeader(infoObj.CurrentDemo, Console.Out, infoObj.SetupInfo.ExecutableOptions != 1);
         }
         _sdt.Consume(infoObj.CurrentDemo);
         if (!infoObj.FailedLastParse)
         {
             WriteAdjustedTime(infoObj.CurrentDemo, Console.Out, (arg & TimeFlags.TimeFirstTick) != 0);
             Console.WriteLine();
         }
     } catch (Exception) {
         Utils.Warning("Timing demo failed.\n");
     }
 }
コード例 #15
0
 protected override void Process(DemoParsingInfo infoObj, Regex r, bool isDefault)
 {
     infoObj.PrintOptionMessage("looking for regex matches");
     try {
         bool any = false;
         foreach ((ConsoleCmd cmd, MatchCollection _) in infoObj.CurrentDemo.CmdRegexMatches(r))
         {
             any = true;
             Console.WriteLine($"[{cmd.Tick}] {cmd.ToString()}");
         }
         if (!any)
         {
             Console.WriteLine("no matches found");
         }
     } catch (Exception) {
         Utils.Warning("Regex match search failed.\n");
     }
 }
コード例 #16
0
        // todo check if portal shots are on cap
        public override void Process(DemoParsingInfo infoObj)
        {
            infoObj.PrintOptionMessage("searching for fired portals");
            try {
                bool any = false;
                foreach ((Rumble userMessage, int tick) in GetPortalsFiredByPlayer(infoObj.CurrentDemo))
                {
                    any = true;
                    switch (userMessage.RumbleType)
                    {
                    case RumbleLookup.PortalgunLeft:
                        Utils.PushForegroundColor(ConsoleColor.Cyan);
                        Console.WriteLine($"[{tick}] BLUE PORTAL fired by player");
                        break;

                    case RumbleLookup.PortalgunRight:
                        Utils.PushForegroundColor(ConsoleColor.Red);                                 // closest we've got is red :/
                        Console.WriteLine($"[{tick}] ORANGE PORTAL fired by player");
                        break;

                    case RumbleLookup.PortalPlacementFailure:
                        Utils.PushForegroundColor(Console.ForegroundColor);                                 // unchanged
                        Console.WriteLine($"[{tick}] portal fired and missed");
                        break;

                    default:
                        throw new ArgProcessProgrammerException($"invalid rumble type: {userMessage.RumbleType}");
                    }
                    Utils.PopForegroundColor();
                }
                if (!any)
                {
                    Console.WriteLine("no portals fired by player");
                }
            } catch (Exception) {
                Utils.Warning("Search for portal shots failed.\n");
            }
        }
コード例 #17
0
 protected override void Process(DemoParsingInfo infoObj, string arg, bool isDefault)
 {
 }
コード例 #18
0
 protected override void PostProcess(DemoParsingInfo infoObj, int arg, bool isDefault)
 {
 }
コード例 #19
0
 protected override void PostProcess(DemoParsingInfo infoObj, FilterFlags flags, bool isDefault)
 {
 }
コード例 #20
0
 public override void PostProcess(DemoParsingInfo infoObj)
 {
 }
コード例 #21
0
 protected override void PostProcess(DemoParsingInfo infoObj, DataTableDumpMode mode, bool isDefault)
 {
 }