Exemple #1
0
        public override void ReadData(Stream stream)
        {
            if (this.Length == 0)
            {
                throw new Exception("length尚未初始化");
            }

            // 读入m_lKeyBytes
            byte[] bytesbuffer = new byte[4];
            stream.Read(bytesbuffer, 0, 4);
            int nKeyBytes = BitConverter.ToInt32(bytesbuffer, 0);

            // 读入m_strLineKey
            byte [] keybuffer = new byte[nKeyBytes];
            stream.Read(keybuffer, 0, keybuffer.Length);

            this.m_strLineKey = Encoding.UTF8.GetString(keybuffer);

            // 读入Length个bytes的内容
            byte[] buffer = new byte[this.Length - 4 - keybuffer.Length];
            stream.Read(buffer, 0, buffer.Length);

            // 还原内存对象
            using (MemoryStream s = new MemoryStream(buffer))
            {
                BinaryFormatter formatter = new BinaryFormatter();

                m_line = (FileLine)formatter.Deserialize(s);
            }
        }
Exemple #2
0
        public override void ReadCompareData(Stream stream)
        {
            if (this.Length == 0)
            {
                throw new Exception("length尚未初始化");
            }

            // 读入m_nKeyBytes
            byte[] bytesbuffer = new byte[4];
            stream.Read(bytesbuffer, 0, bytesbuffer.Length);
            int nKeyBytes = BitConverter.ToInt32(bytesbuffer, 0);

            // 读入m_strLineKey
            byte[] keybuffer = new byte[nKeyBytes];
            stream.Read(keybuffer, 0, keybuffer.Length);
            this.m_strLineKey = Encoding.UTF8.GetString(keybuffer);

            m_line = null;      // 表示line对象不可用
        }
Exemple #3
0
        public override void ReadData(Stream stream)
        {
            if (this.Length == 0)
                throw new Exception("length尚未初始化");

            // 读入m_lKeyBytes
            byte[] bytesbuffer = new byte[4];
            stream.Read(bytesbuffer, 0, 4);
            int nKeyBytes = BitConverter.ToInt32(bytesbuffer, 0);

            // 读入m_strLineKey
            byte [] keybuffer = new byte[nKeyBytes];
            stream.Read(keybuffer, 0, keybuffer.Length);

            this.m_strLineKey = Encoding.UTF8.GetString(keybuffer);

            // 读入Length个bytes的内容
            byte[] buffer = new byte[this.Length - 4 - keybuffer.Length];
            stream.Read(buffer, 0, buffer.Length);

            // 还原内存对象
            using (MemoryStream s = new MemoryStream(buffer))
            {
                BinaryFormatter formatter = new BinaryFormatter();

                m_line = (FileLine)formatter.Deserialize(s);
            }
        }
Exemple #4
0
        public override void ReadCompareData(Stream stream)
        {
            if (this.Length == 0)
                throw new Exception("length尚未初始化");

            // 读入m_nKeyBytes
            byte[] bytesbuffer = new byte[4];
            stream.Read(bytesbuffer, 0, bytesbuffer.Length);
            int nKeyBytes = BitConverter.ToInt32(bytesbuffer, 0);

            // 读入m_strLineKey
            byte[] keybuffer = new byte[nKeyBytes];
            stream.Read(keybuffer, 0, keybuffer.Length);
            this.m_strLineKey = Encoding.UTF8.GetString(keybuffer);

            m_line = null;	// 表示line对象不可用
        }