diff --git a/Flow.Launcher.Infrastructure/Storage/BinaryStorage.cs b/Flow.Launcher.Infrastructure/Storage/BinaryStorage.cs
index 208e4bf11..f218c5d8d 100644
--- a/Flow.Launcher.Infrastructure/Storage/BinaryStorage.cs
+++ b/Flow.Launcher.Infrastructure/Storage/BinaryStorage.cs
@@ -2,6 +2,7 @@
using System.Threading.Tasks;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.UserSettings;
+using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedCommands;
using MemoryPack;
@@ -16,7 +17,7 @@ namespace Flow.Launcher.Infrastructure.Storage
///
/// It utilize MemoryPack, which means the object must be MemoryPackSerializable
///
- public class BinaryStorage
+ public class BinaryStorage : ISavable
{
protected T? Data;
diff --git a/Flow.Launcher.Infrastructure/Storage/JsonStorage.cs b/Flow.Launcher.Infrastructure/Storage/JsonStorage.cs
index a3488124b..cdf3ae909 100644
--- a/Flow.Launcher.Infrastructure/Storage/JsonStorage.cs
+++ b/Flow.Launcher.Infrastructure/Storage/JsonStorage.cs
@@ -1,18 +1,20 @@
-#nullable enable
-using System;
+using System;
using System.Globalization;
using System.IO;
using System.Text.Json;
using System.Threading.Tasks;
using Flow.Launcher.Infrastructure.Logger;
+using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedCommands;
+#nullable enable
+
namespace Flow.Launcher.Infrastructure.Storage
{
///
/// Serialize object using json format.
///
- public class JsonStorage where T : new()
+ public class JsonStorage : ISavable where T : new()
{
protected T? Data;
diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs
index 99d4cf233..50052f1c9 100644
--- a/Flow.Launcher/PublicAPIInstance.cs
+++ b/Flow.Launcher/PublicAPIInstance.cs
@@ -225,8 +225,8 @@ namespace Flow.Launcher
{
foreach (var value in _pluginJsonStorages.Values)
{
- var method = value.GetType().GetMethod("Save");
- method?.Invoke(value, null);
+ var savable = value as ISavable;
+ savable?.Save();
}
}
@@ -368,8 +368,8 @@ namespace Flow.Launcher
{
foreach (var value in _pluginBinaryStorages.Values)
{
- var method = value.GetType().GetMethod("Save");
- method?.Invoke(value, null);
+ var savable = value as ISavable;
+ savable?.Save();
}
}