public static thumb ToThumb(byte[] value, int startindex) { if (value.Length < 10) { throw new IndexOutOfRangeException(); } thumb res = new thumb(); res.d = BitProcessor.ToInt32(value, 0 + startindex); res.u = BitProcessor.ToInt32(value, 4 + startindex); res.c = value[8 + startindex]; res.n = value[9 + startindex]; return(res); }
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); }