fixed a bug
This commit is contained in:
@@ -13,11 +13,14 @@ namespace Reader
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
private static readonly HttpClient http = new HttpClient();
|
||||
private static readonly string ServerUrl = System.IO.File.ReadAllText("appsettings.json")
|
||||
.Replace("\"", "")
|
||||
.Split(':')[1]
|
||||
.Replace("/", "")
|
||||
.Trim();
|
||||
private static readonly string ServerUrl;
|
||||
|
||||
static MainForm()
|
||||
{
|
||||
var configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "appsettings.json");
|
||||
var jsonContent = System.IO.File.ReadAllText(configPath);
|
||||
ServerUrl = jsonContent.Replace("\"", "").Split(':')[1].Replace("/", "").Trim();
|
||||
}
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
|
||||
@@ -6,4 +6,9 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user