Пример #1
0
        public static date ToDate(byte[] value, int startindex = 0)
        {
            if (value.Length < 4)
            {
                throw new IndexOutOfRangeException();
            }
            date res = new date();

            res.year  = BitProcessor.ToInt16(value, 0 + startindex);
            res.month = value[2 + startindex];
            res.day   = value[3 + startindex];
            return(res);
        }
Пример #2
0
        public static DirEntry ToDirEntry(byte[] value, int startindex = 0)
        {
            if (value.Length < 28)
            {
                throw new IndexOutOfRangeException();
            }
            DirEntry res = new DirEntry();

            res.name        = BitProcessor.ToInt32(value, 0 + startindex);
            res.strName     = BitProcessor.ToString(value, 0 + startindex, 4);
            res.number      = BitProcessor.ToInt32(value, 4 + startindex);
            res.elementtype = BitProcessor.ToInt16(value, 8 + startindex);
            res.elementsize = BitProcessor.ToInt16(value, 10 + startindex);
            res.numelements = BitProcessor.ToInt32(value, 12 + startindex);
            res.datasize    = BitProcessor.ToInt32(value, 16 + startindex);
            res.dataoffset  = BitProcessor.ToInt32(value, 20 + startindex);
            res.datahandle  = BitProcessor.ToInt32(value, 24 + startindex);
            return(res);
        }