static Level ReadFormat1(Level lvl, DatReader r) { r.ReadUtf8(); // level name r.ReadUtf8(); // level author r.ReadInt64(); // created timestamp (currentTimeMillis) lvl.Width = r.ReadUInt16(); lvl.Length = r.ReadUInt16(); lvl.Height = r.ReadUInt16(); lvl.blocks = r.ReadBytes(lvl.Width * lvl.Height * lvl.Length); // TODO readfully SetupClassic013(lvl); return(lvl); }
static string NewString(DatReader r) { string value = r.ReadUtf8(); r.handles.Add(value); return(value); }
static JFieldDesc FieldDesc(DatReader r) { JFieldDesc desc = new JFieldDesc(); byte type = r.ReadUInt8(); desc.Type = (char)type; if (type == 'B' || type == 'C' || type == 'D' || type == 'F' || type == 'I' || type == 'J' || type == 'S' || type == 'Z') { desc.Name = r.ReadUtf8(); } else if (type == '[' || type == 'L') { desc.Name = r.ReadUtf8(); desc.ClassName = (string)ReadObject(r); } else { throw new InvalidDataException("Invalid field type: " + type); } return(desc); }
static JClassDesc NewClassDesc(DatReader r) { JClassDesc desc = new JClassDesc(); desc.Name = r.ReadUtf8(); r.ReadInt64(); // serial UID r.handles.Add(desc); // read class desc info desc.Flags = r.ReadUInt8(); desc.Fields = new JFieldDesc[r.ReadUInt16()]; for (int i = 0; i < desc.Fields.Length; i++) { desc.Fields[i] = FieldDesc(r); } SkipAnnotation(r); desc.SuperClass = ClassDesc(r); return(desc); }