Skip to content

Commit b62c19e

Browse files
committed
Move format function position
1 parent a3c18a6 commit b62c19e

File tree

2 files changed

+12
-23
lines changed

2 files changed

+12
-23
lines changed

Flow.Launcher.Core/Updater.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using Flow.Launcher.Plugin;
1818
using System.Text.Json.Serialization;
1919
using System.Threading;
20+
using System.Text.Json;
2021

2122
namespace Flow.Launcher.Core
2223
{
@@ -51,7 +52,7 @@ public async Task UpdateAppAsync(bool silentUpdate = true)
5152
var newReleaseVersion = Version.Parse(newUpdateInfo.FutureReleaseEntry.Version.ToString());
5253
var currentVersion = Version.Parse(Constant.Version);
5354

54-
Log.Info($"|Updater.UpdateApp|Future Release <{newUpdateInfo.FutureReleaseEntry.Formatted()}>");
55+
Log.Info($"|Updater.UpdateApp|Future Release <{Formatted(newUpdateInfo.FutureReleaseEntry)}>");
5556

5657
if (newReleaseVersion <= currentVersion)
5758
{
@@ -151,5 +152,15 @@ public string NewVersionTips(string version)
151152

152153
return tips;
153154
}
155+
156+
private static string Formatted<T>(T t)
157+
{
158+
var formatted = JsonSerializer.Serialize(t, new JsonSerializerOptions
159+
{
160+
WriteIndented = true
161+
});
162+
163+
return formatted;
164+
}
154165
}
155166
}

Flow.Launcher.Infrastructure/Helper.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,11 @@
22

33
using System;
44
using System.IO;
5-
using System.Text.Json;
6-
using System.Text.Json.Serialization;
75

86
namespace Flow.Launcher.Infrastructure
97
{
108
public static class Helper
119
{
12-
static Helper()
13-
{
14-
jsonFormattedSerializerOptions.Converters.Add(new JsonStringEnumConverter());
15-
}
16-
1710
/// <summary>
1811
/// http://www.yinwang.org/blog-cn/2015/11/21/programming-philosophy
1912
/// </summary>
@@ -71,20 +64,5 @@ public static void ValidateDirectory(string path)
7164
Directory.CreateDirectory(path);
7265
}
7366
}
74-
75-
private static readonly JsonSerializerOptions jsonFormattedSerializerOptions = new JsonSerializerOptions
76-
{
77-
WriteIndented = true
78-
};
79-
80-
public static string Formatted<T>(this T t)
81-
{
82-
var formatted = JsonSerializer.Serialize(t, new JsonSerializerOptions
83-
{
84-
WriteIndented = true
85-
});
86-
87-
return formatted;
88-
}
8967
}
9068
}

0 commit comments

Comments
 (0)