fixed a bug

This commit is contained in:
2026-03-29 15:59:58 +08:00
parent 038f65ccc6
commit ca8d1238c4
3 changed files with 7 additions and 3 deletions

View File

@@ -19,7 +19,9 @@ namespace Reader
{
var configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "appsettings.json");
var jsonContent = System.IO.File.ReadAllText(configPath);
ServerUrl = jsonContent.Replace("\"", "").Split(':')[1].Replace("/", "").Trim();
var start = jsonContent.IndexOf('"', jsonContent.IndexOf("ServerUrl") + 10);
var end = jsonContent.IndexOf('"', start + 1);
ServerUrl = jsonContent.Substring(start + 1, end - start - 1).Trim();
}
public MainForm()

View File

@@ -18,7 +18,9 @@ namespace Writer
{
var configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "appsettings.json");
var jsonContent = System.IO.File.ReadAllText(configPath);
ServerUrl = jsonContent.Replace("\"", "").Split(':')[1].Replace("/", "").Trim();
var start = jsonContent.IndexOf('"', jsonContent.IndexOf("ServerUrl") + 10);
var end = jsonContent.IndexOf('"', start + 1);
ServerUrl = jsonContent.Substring(start + 1, end - start - 1).Trim();
}
public MainForm()

View File

@@ -7,7 +7,7 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<None Include="appsettings.json">
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>