public static IdBlock Deserialize(ByteReader data) { IdBlock block = new IdBlock(data.ReadInt32(), data.ReadInt32(), data.ReadInt32()); block.currentWithinBlock = data.ReadInt32(); return(block); }
public override void read(BinaryReader reader) { reader.BaseStream.Seek(0, SeekOrigin.Begin); header = new Header(); header.read(reader); screenshot = new Screenshot(header.screenshotWidth, header.screenshotHeight); screenshot.read(reader); applicationInfo = new ApplicationInfo(); applicationInfo.read(reader); index = new Index(); index.read(reader); idBlocks = new Dictionary<uint, IdBlock>(); reader.BaseStream.Seek(index.offset3, SeekOrigin.Begin); for(var i = 0; i < index.blockCount1; i++) { var idBlock = new IdBlock(); idBlock.read(reader); idBlocks.Add(idBlock.id, idBlock); } reader.BaseStream.Seek(index.offset4, SeekOrigin.Begin); for (var i = 0; i < index.blockCount2; i++) { var idBlock = new IdBlock(); idBlock.read(reader); idBlocks.Add(idBlock.id, idBlock); } reader.BaseStream.Seek(index.offset6, SeekOrigin.Begin); for (var i = 0; i < index.blockCount3; i++) { var idBlock = new IdBlock(); idBlock.read(reader); idBlocks.Add(idBlock.id, idBlock); } formBlocks = new Dictionary<uint, FormBlock>(); reader.BaseStream.Seek(index.offset5, SeekOrigin.Begin); for(var i = 0; i < index.blockCount4; i++) { var formBlock = new FormBlock(); formBlock.read(reader); formBlocks.Add(formBlock.id, formBlock); } }
public static void LookIdBlock(ref IdBlock block, string label) { if (Scribe.mode == LoadSaveMode.Saving && block != null) { string base64 = Convert.ToBase64String(block.Serialize()); Scribe_Values.Look(ref base64, label); } if (Scribe.mode == LoadSaveMode.LoadingVars) { string base64 = null; Scribe_Values.Look(ref base64, label); if (base64 != null) { block = IdBlock.Deserialize(new ByteReader(Convert.FromBase64String(base64))); } else { block = null; } } }