Exemplo n.º 1
0
            public void Close()
            {
                lock (locker)
                {
                    Serializer.Reset();

                    if (Stream == null)
                    {
                        return;
                    }

                    Stream.Close();
                    Stream = null;
                }
            }
Exemplo n.º 2
0
            public void Write()
            {
                lock (locker)
                {
                    if (Tick == null)
                    {
                        return;
                    }

                    if (Stream == null)
                    {
                        Stream = File.Open(FullPath, FileMode.Append, FileAccess.Write, FileShare.Read);
                        // 换天时,必须重置记录器,不然记录的数据是差分后数据,导致新文件无法解读
                        Serializer.Reset();
                    }

                    Serializer.Write(Tick, Stream);
                    Tick = null;

                    FlushInWriter();
                }
            }