File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed
Flow.Launcher.Infrastructure/Storage Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 2
2
using System . Threading . Tasks ;
3
3
using Flow . Launcher . Infrastructure . Logger ;
4
4
using Flow . Launcher . Infrastructure . UserSettings ;
5
+ using Flow . Launcher . Plugin ;
5
6
using Flow . Launcher . Plugin . SharedCommands ;
6
7
using MemoryPack ;
7
8
@@ -16,7 +17,7 @@ namespace Flow.Launcher.Infrastructure.Storage
16
17
/// <remarks>
17
18
/// It utilize MemoryPack, which means the object must be MemoryPackSerializable <see href="https://github.com/Cysharp/MemoryPack"/>
18
19
/// </remarks>
19
- public class BinaryStorage < T >
20
+ public class BinaryStorage < T > : ISavable
20
21
{
21
22
protected T ? Data ;
22
23
Original file line number Diff line number Diff line change 1
- #nullable enable
2
- using System ;
1
+ using System ;
3
2
using System . Globalization ;
4
3
using System . IO ;
5
4
using System . Text . Json ;
6
5
using System . Threading . Tasks ;
7
6
using Flow . Launcher . Infrastructure . Logger ;
7
+ using Flow . Launcher . Plugin ;
8
8
using Flow . Launcher . Plugin . SharedCommands ;
9
9
10
+ #nullable enable
11
+
10
12
namespace Flow . Launcher . Infrastructure . Storage
11
13
{
12
14
/// <summary>
13
15
/// Serialize object using json format.
14
16
/// </summary>
15
- public class JsonStorage < T > where T : new ( )
17
+ public class JsonStorage < T > : ISavable where T : new ( )
16
18
{
17
19
protected T ? Data ;
18
20
Original file line number Diff line number Diff line change @@ -225,8 +225,8 @@ public void SavePluginSettings()
225
225
{
226
226
foreach ( var value in _pluginJsonStorages . Values )
227
227
{
228
- var method = value . GetType ( ) . GetMethod ( "Save" ) ;
229
- method ? . Invoke ( value , null ) ;
228
+ var savable = value as ISavable ;
229
+ savable ? . Save ( ) ;
230
230
}
231
231
}
232
232
@@ -368,8 +368,8 @@ public void SavePluginCaches()
368
368
{
369
369
foreach ( var value in _pluginBinaryStorages . Values )
370
370
{
371
- var method = value . GetType ( ) . GetMethod ( "Save" ) ;
372
- method ? . Invoke ( value , null ) ;
371
+ var savable = value as ISavable ;
372
+ savable ? . Save ( ) ;
373
373
}
374
374
}
375
375
You can’t perform that action at this time.
0 commit comments