Beispiel #1
0
        private static byte[] Unparse(ushort[,] syndrome, int version)
        {
            if (version == 1)
            {
                return(ParityToSyndrome.Syndrome2Bytes(syndrome));
            }

            var output      = ParityToSyndrome.Syndrome2Parity(syndrome);
            var newcontents = new MemoryStream();

            using (DBHDR FTYP = new DBHDR(newcontents, "ftyp"))
                FTYP.Write("CTDB");
            using (DBHDR CTDB = new DBHDR(newcontents, "CTDB"))
            {
                using (DBHDR HEAD = CTDB.HDR("HEAD"))
                {
                    using (DBHDR VERS = HEAD.HDR("VERS")) VERS.Write(0x101);
                }
                using (DBHDR DISC = CTDB.HDR("DISC"))
                {
                    using (DBHDR CONF = DISC.HDR("CONF")) CONF.Write(1);
                    using (DBHDR NPAR = DISC.HDR("NPAR")) NPAR.Write(8);
                    using (DBHDR CRC_ = DISC.HDR("CRC ")) CRC_.Write(0);
                    using (DBHDR PAR_ = DISC.HDR("PAR ")) PAR_.Write(output);
                }
            }
            return(newcontents.ToArray());
        }
Beispiel #2
0
        private static byte[] Unparse(ushort[,] syndrome, int version)
        {
            if (version == 1)
            {
                return ParityToSyndrome.Syndrome2Bytes(syndrome);
            }

            var output = ParityToSyndrome.Syndrome2Parity(syndrome);
            var newcontents = new MemoryStream();
            using (DBHDR FTYP = new DBHDR(newcontents, "ftyp"))
                FTYP.Write("CTDB");
            using (DBHDR CTDB = new DBHDR(newcontents, "CTDB"))
            {
                using (DBHDR HEAD = CTDB.HDR("HEAD"))
                {
                    using (DBHDR VERS = HEAD.HDR("VERS")) VERS.Write(0x101);
                }
                using (DBHDR DISC = CTDB.HDR("DISC"))
                {
                    using (DBHDR CONF = DISC.HDR("CONF")) CONF.Write(1);
                    using (DBHDR NPAR = DISC.HDR("NPAR")) NPAR.Write(8);
                    using (DBHDR CRC_ = DISC.HDR("CRC ")) CRC_.Write(0);
                    using (DBHDR PAR_ = DISC.HDR("PAR ")) PAR_.Write(output);
                }
            }
            return newcontents.ToArray();
        }