fix Config.json
This commit is contained in:
@@ -13,4 +13,11 @@
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ContentWithTargetPath Include="../Config.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<TargetPath>Config.json</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -51,8 +51,14 @@ namespace Discord_Bot
|
||||
|
||||
public static JObject GetConfig()
|
||||
{
|
||||
using StreamReader configJson = new StreamReader(Directory.GetCurrentDirectory() + @"/Config.json");
|
||||
return (JObject)JsonConvert.DeserializeObject(configJson.ReadToEnd());
|
||||
string path = Directory.GetCurrentDirectory() + @"/Config.json";
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
throw new FileNotFoundException("gde config?");
|
||||
}
|
||||
|
||||
using StreamReader configJson = new StreamReader(path);
|
||||
return (JObject)JsonConvert.DeserializeObject(configJson.ReadToEnd());
|
||||
}
|
||||
|
||||
public static void SaveConfig(JObject config)
|
||||
|
||||
Reference in New Issue
Block a user