public void Read(BinaryReader reader) { version = reader.ReadInt32(); modid = reader.ReadString(); byteLength = reader.ReadInt64(); if (!(SRModLoader.GetMod(modid) is SRMod mod)) { throw new Exception($"Unrecognized mod id: {modid}"); } var saveInfo = SaveRegistry.GetSaveInfo(mod); identifiableData.Clear(); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { var e = new IdentifiedData(); e.Read(reader, saveInfo); identifiableData.Add(e); } extendedData.Clear(); count = reader.ReadInt32(); for (int i = 0; i < count; i++) { var e = new ExtendedDataTree(); e.Read(reader); extendedData.Add(e); } if (version >= 1) { playerData.Read(reader); pediaData.Read(reader); enumTranslator = new EnumTranslator(); enumTranslator.Read(reader); BinaryUtils.ReadDictionary(reader, customAmmo, (x) => AmmoIdentifier.Read(x), (x) => { var list = new List <VanillaAmmoData>(); int ammoCount = x.ReadInt32(); for (int i = 0; i < ammoCount; i++) { if (x.ReadBoolean()) { var newData = new VanillaAmmoData(); newData.Load(x.BaseStream); list.Add(newData); } else { list.Add(null); } } return(list); }); } }
public void Read(BinaryReader reader) { identifier = AmmoIdentifier.Read(reader); model.Read(reader); }