Example #1
0
        public void AddPackets(PacketDumpProcessor pdp)
        {
            var sw = Stopwatch.StartNew();

            const int batchSize      = 100;
            var       processedCount = 0;

            var x = AddPacketsInternal(pdp, batchSize).GetEnumerator();

            Idle.Add(() =>
            {
                if (!x.MoveNext() || !x.Current)
                {
                    x.Dispose();

                    sw.Stop();
                    Console.WriteLine($"AddPackets: {sw.ElapsedMilliseconds}ms");

                    _buttonOpenFolder.Sensitive = true;
                    _buttonOpenReplay.Sensitive = true;
                }
                else
                {
                    processedCount += batchSize;
                    SetStatus($"Added {processedCount}/{pdp.Packets.Count} packets", processedCount, pdp.Packets.Count);
                }

                return(x.Current);
            });
        }
Example #2
0
        public void LoadPacketDump(PacketDumpType type, string path)
        {
            _buttonOpenFolder.Sensitive = false;
            _buttonOpenReplay.Sensitive = false;

            Reset();

            PacketProvider provider;

            switch (type)
            {
            case PacketDumpType.ReplayFile:
                provider = new ReplayPacketProvider(path);
                break;

            case PacketDumpType.PacketDirectory:
                provider = new DirectoryPacketProvider(path);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }

            var pdp = new PacketDumpProcessor(provider);

            pdp.Process();

            AddNetObjects(pdp);
            AddPackets(pdp);
        }