private static void writeMinecraftString(FileOutput f, string str) { byte[] d = Encoding.Unicode.GetBytes(str); f.writeInt(d.Length / 2); f.writeBytes(endianReverseUnicode(d)); f.writeInt(0); }
public byte[] Rebuild() { FileOutput f = new FileOutput(); f.Endian = Endianness.Big; f.writeInt(2); f.writeInt(langs.Count); f.writeByte(0); f.writeBytes(ids.Rebuild()); foreach (Language l in langs) { f.writeShort(l.name.Length); f.writeString(l.name); f.writeInt(7 + l.name.Length + l.Rebuild().Length); } foreach (Language l in langs) { f.writeInt(2); f.writeByte(0); f.writeShort(l.name.Length); f.writeString(l.name); f.writeBytes(l.Rebuild()); } return(f.getBytes()); }
public byte[] Rebuild() { FileOutput f = new FileOutput(); f.Endian = Endianness.Big; f.writeInt(names.Count); foreach (string name in names) { f.writeShort(name.Length); f.writeString(name); } return(f.getBytes()); }
public byte[] Rebuild() { FileOutput f = new FileOutput(); f.Endian = Endianness.Big; f.writeInt(3); f.writeInt(types.Count); foreach (int type in types.Keys) { f.writeInt(type); writeMinecraftString(f, types[type]); } f.writeInt(mineFiles.Count); foreach (MineFile mf in mineFiles) { f.writeInt(mf.data.Length); f.writeInt(mf.type); writeMinecraftString(f, mf.name); } foreach (MineFile mf in mineFiles) { f.writeInt(mf.entries.Count); foreach (object[] entry in mf.entries) { f.writeInt(typeCodes[(string)entry[0]]); writeMinecraftString(f, (string)entry[1]); } f.writeBytes(mf.data); } return(f.getBytes()); }