internal void _GenericSave(ref PSM_Segment withBlock, ref FileStream PSM, ref BinaryWriter PSM_Writer) { PSM_Writer.Write(withBlock.Key1); PSM_Writer.Write(withBlock.Key2); PSM_Writer.Write(withBlock.Texture.ByteStream.ToArray()); PSM_Writer.Write(withBlock.SomeInt1); PSM_Writer.Write(withBlock.SomeInt2); PSM_Writer.Write(withBlock.SomeInt3); PSM_Writer.Write(Convert.ToUInt32(withBlock.Name.Length)); for (int j = 0; j <= withBlock.Name.Length - 1; j++) { PSM_Writer.Write(Convert.ToChar(withBlock.Name[j])); } PSM_Writer.Write(withBlock.Ending); }
///////////////////////PRIVATE INTERFACE/////////////////////////////////// #region SAVE/LOAD ALGORITHMS internal void _GenericLoad(ref PSM_Segment withBlock, ref FileStream PSM, ref BinaryReader PSM_Reader, bool Demo) { withBlock.Key1 = PSM_Reader.ReadUInt32(); withBlock.Key2 = PSM_Reader.ReadUInt32(); withBlock.Texture = new Texture(); withBlock.Texture.Base = 0; withBlock.Texture.Offset = (uint)PSM.Position; PSM.Position += 1; withBlock.Texture.Size = (uint)PSM_Reader.ReadUInt16() * 256 + 228; withBlock.Texture.Load(ref PSM, ref PSM_Reader); withBlock.SomeInt1 = PSM_Reader.ReadUInt32(); withBlock.SomeInt2 = PSM_Reader.ReadUInt32(); withBlock.SomeInt3 = PSM_Reader.ReadUInt32(); withBlock.Name = PSM_Reader.ReadChars((int)PSM_Reader.ReadUInt32()).ToString(); if (!Demo) { withBlock.Ending = PSM_Reader.ReadBytes(98); } else { withBlock.Ending = PSM_Reader.ReadBytes(96); } }