Skip to content

Commit e6d3d0f

Browse files
committed
Improve code quality
1 parent 56536d0 commit e6d3d0f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Flow.Launcher.Infrastructure/Storage/BinaryStorage.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,27 +81,27 @@ private static async ValueTask<T> DeserializeAsync(Stream stream, T defaultData)
8181
}
8282
}
8383

84-
public async ValueTask SaveAsync()
85-
{
86-
await using var stream = new FileStream(FilePath, FileMode.Create);
87-
await MemoryPackSerializer.SerializeAsync(stream, Data);
88-
}
89-
90-
// For SavePluginSettings function
9184
public void Save()
9285
{
9386
var serialized = MemoryPackSerializer.Serialize(Data);
9487

9588
File.WriteAllBytes(FilePath, serialized);
9689
}
9790

98-
// ImageCache need to be converted into concurrent dictionary, so it does not need to cache loading results into Data
91+
public async ValueTask SaveAsync()
92+
{
93+
await SaveAsync(Data.NonNull());
94+
}
95+
96+
// ImageCache need to convert data into concurrent dictionary for usage,
97+
// so we would better to clear the data
9998
public void ClearData()
10099
{
101100
Data = default;
102101
}
103102

104-
// ImageCache storages data in its class, so it needs to pass it to SaveAsync
103+
// ImageCache storages data in its class,
104+
// so we need to pass it to SaveAsync
105105
public async ValueTask SaveAsync(T data)
106106
{
107107
await using var stream = new FileStream(FilePath, FileMode.Create);

0 commit comments

Comments
 (0)