示例#1
0
        public void Save(BinaryStateSaver bs)
        {
            var nheader      = new IndexedStateLump(BinaryStateLump.BranchHeader);
            var ncore        = new IndexedStateLump(BinaryStateLump.BranchCoreData);
            var ninput       = new IndexedStateLump(BinaryStateLump.BranchInputLog);
            var nframebuffer = new IndexedStateLump(BinaryStateLump.BranchFrameBuffer);
            var nlaglog      = new IndexedStateLump(BinaryStateLump.BranchLagLog);

            foreach (var b in this)
            {
                bs.PutLump(nheader, delegate(TextWriter tw)
                {
                    // if this header needs more stuff in it, handle it sensibly
                    tw.WriteLine(JsonConvert.SerializeObject(new
                    {
                        Frame     = b.Frame,
                        TimeStamp = b.TimeStamp
                    }));
                });
                bs.PutLump(ncore, delegate(Stream s)
                {
                    s.Write(b.CoreData, 0, b.CoreData.Length);
                });
                bs.PutLump(ninput, delegate(TextWriter tw)
                {
                    foreach (var line in b.InputLog)
                    {
                        tw.WriteLine(line);
                    }
                });
                bs.PutLump(nframebuffer, delegate(Stream s)
                {
                    var vp = new BitmapBufferVideoProvider(b.OSDFrameBuffer);
                    QuickBmpFile.Save(vp, s, b.OSDFrameBuffer.Width, b.OSDFrameBuffer.Height);
                });
                bs.PutLump(nlaglog, delegate(BinaryWriter bw)
                {
                    b.LagLog.Save(bw);
                });

                nheader.Increment();
                ncore.Increment();
                ninput.Increment();
                nframebuffer.Increment();
                nlaglog.Increment();
            }
        }
示例#2
0
        public void Save(BinaryStateSaver bs)
        {
            var nheader          = new IndexedStateLump(BinaryStateLump.BranchHeader);
            var ncore            = new IndexedStateLump(BinaryStateLump.BranchCoreData);
            var ninput           = new IndexedStateLump(BinaryStateLump.BranchInputLog);
            var nframebuffer     = new IndexedStateLump(BinaryStateLump.BranchFrameBuffer);
            var ncoreframebuffer = new IndexedStateLump(BinaryStateLump.BranchCoreFrameBuffer);
            var nmarkers         = new IndexedStateLump(BinaryStateLump.BranchMarkers);
            var nusertext        = new IndexedStateLump(BinaryStateLump.BranchUserText);

            foreach (var b in this)
            {
                bs.PutLump(nheader, delegate(TextWriter tw)
                {
                    // if this header needs more stuff in it, handle it sensibly
                    tw.WriteLine(JsonConvert.SerializeObject(new
                    {
                        b.Frame,
                        b.TimeStamp,
                        b.UniqueIdentifier
                    }));
                });

                bs.PutLump(ncore, delegate(Stream s)
                {
                    s.Write(b.CoreData, 0, b.CoreData.Length);
                });

                bs.PutLump(ninput, delegate(TextWriter tw)
                {
                    int todo = b.InputLog.Count;
                    for (int i = 0; i < todo; i++)
                    {
                        tw.WriteLine(b.InputLog[i]);
                    }
                });

                bs.PutLump(nframebuffer, delegate(Stream s)
                {
                    var vp = new BitmapBufferVideoProvider(b.OSDFrameBuffer);
                    QuickBmpFile.Save(vp, s, b.OSDFrameBuffer.Width, b.OSDFrameBuffer.Height);
                });

                bs.PutLump(ncoreframebuffer, delegate(Stream s)
                {
                    var vp = new BitmapBufferVideoProvider(b.CoreFrameBuffer);
                    QuickBmpFile.Save(vp, s, b.CoreFrameBuffer.Width, b.CoreFrameBuffer.Height);
                });

                bs.PutLump(nmarkers, delegate(TextWriter tw)
                {
                    tw.WriteLine(b.Markers.ToString());
                });

                bs.PutLump(nusertext, delegate(TextWriter tw)
                {
                    tw.WriteLine(b.UserText);
                });

                nheader.Increment();
                ncore.Increment();
                ninput.Increment();
                nframebuffer.Increment();
                ncoreframebuffer.Increment();
                nmarkers.Increment();
                nusertext.Increment();
            }
        }