AttachPointInfoSerializer.cs 784 B

123456789101112131415161718192021222324252627
  1. using System.IO;
  2. namespace COM3D2.MeidoPhotoStudio.Plugin
  3. {
  4. public class AttachPointInfoSerializer : SimpleSerializer<AttachPointInfo>
  5. {
  6. private const short version = 1;
  7. public override void Serialize(AttachPointInfo info, BinaryWriter writer)
  8. {
  9. writer.WriteVersion(version);
  10. writer.Write((int) info.AttachPoint);
  11. writer.Write(info.MaidIndex);
  12. }
  13. public override AttachPointInfo Deserialize(BinaryReader reader, SceneMetadata metadata)
  14. {
  15. _ = reader.ReadVersion();
  16. var attachPoint = (AttachPoint) reader.ReadInt32();
  17. var maidIndex = reader.ReadInt32();
  18. return new AttachPointInfo(attachPoint, string.Empty, maidIndex);
  19. }
  20. }
  21. }