MessageWindowManagerSerializer.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. using System.IO;
  2. namespace COM3D2.MeidoPhotoStudio.Plugin
  3. {
  4. public class MessageWindowManagerSerializer : Serializer<MessageWindowManager>
  5. {
  6. private const short version = 1;
  7. public override void Serialize(MessageWindowManager manager, BinaryWriter writer)
  8. {
  9. writer.Write(MessageWindowManager.header);
  10. writer.WriteVersion(version);
  11. writer.Write(manager.ShowingMessage);
  12. writer.Write(manager.FontSize);
  13. writer.Write(manager.MessageName);
  14. writer.Write(manager.MessageText);
  15. }
  16. public override void Deserialize(MessageWindowManager manager, BinaryReader reader, SceneMetadata metadata)
  17. {
  18. manager.CloseMessagePanel();
  19. _ = reader.ReadVersion();
  20. var showingMessage = reader.ReadBoolean();
  21. manager.FontSize = reader.ReadInt32();
  22. var messageName = reader.ReadString();
  23. var messageText = reader.ReadString();
  24. if (showingMessage) manager.ShowMessage(messageName, messageText);
  25. }
  26. }
  27. }