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