BlurEffectSerializer.cs 790 B

12345678910111213141516171819202122232425262728
  1. using System.IO;
  2. namespace COM3D2.MeidoPhotoStudio.Plugin
  3. {
  4. public class BlurEffectSerializer : Serializer<BlurEffectManager>
  5. {
  6. private const short version = 1;
  7. public override void Serialize(BlurEffectManager effect, BinaryWriter writer)
  8. {
  9. writer.Write(BlurEffectManager.header);
  10. writer.WriteVersion(version);
  11. writer.Write(effect.Active);
  12. writer.Write(effect.BlurSize);
  13. }
  14. public override void Deserialize(BlurEffectManager effect, BinaryReader reader, SceneMetadata metadata)
  15. {
  16. _ = reader.ReadVersion();
  17. var active = reader.ReadBoolean();
  18. effect.BlurSize = reader.ReadSingle();
  19. effect.SetEffectActive(active);
  20. }
  21. }
  22. }