Exemplo n.º 1
0
        void Init(string path, G2Protocol protocol, ProcessTagsHandler processTags)
        {
            Seek(-8, SeekOrigin.End);

            byte[] sizeBytes = new byte[8];
            Read(sizeBytes, 0, sizeBytes.Length);
            long fileSize = BitConverter.ToInt64(sizeBytes, 0);

            if (processTags != null)
            {
                // read public packets
                Seek(fileSize, SeekOrigin.Begin);

                PacketStream stream = new PacketStream(this, protocol, FileAccess.Read);

                // dont need to close packetStream
                processTags.Invoke(stream);
            }

            // set public size down here so reading packet stream works without mixing up true file lenght
            InternalSize = fileSize;

            // set back to the beginning of the file
            Seek(0, SeekOrigin.Begin);
        }
Exemplo n.º 2
0
        void Init(string path, G2Protocol protocol, ProcessTagsHandler processTags)
        {
            Seek(-8, SeekOrigin.End);

            byte[] sizeBytes = new byte[8];
            Read(sizeBytes, 0, sizeBytes.Length);
            long fileSize = BitConverter.ToInt64(sizeBytes, 0);

            if (processTags != null)
            {
                // read public packets
                Seek(fileSize, SeekOrigin.Begin);

                PacketStream stream = new PacketStream(this, protocol, FileAccess.Read);

                // dont need to close packetStream
                processTags.Invoke(stream);
            }

            // set public size down here so reading packet stream works without mixing up true file lenght
            InternalSize = fileSize;

            // set back to the beginning of the file
            Seek(0, SeekOrigin.Begin);
        }
Exemplo n.º 3
0
 public TaggedStream(string path, G2Protocol protocol, ProcessTagsHandler processTags)
     : base(path, FileMode.Open, FileAccess.Read, FileShare.Read)
 {
     Init(path, protocol, processTags);
 }
Exemplo n.º 4
0
 public TaggedStream(string path, G2Protocol protocol, ProcessTagsHandler processTags)
     : base(path, FileMode.Open, FileAccess.Read, FileShare.Read)
 {
     Init(path, protocol, processTags);
 }