Updated functions in Discord Bot
This commit is contained in:
@@ -51,16 +51,11 @@ public class Config
|
||||
private readonly string _file = "";
|
||||
private readonly IDictionary<TKey, TValue>? _dictionary;
|
||||
|
||||
/// <summary>
|
||||
/// Empty constructor
|
||||
/// </summary>
|
||||
public Json()
|
||||
{
|
||||
_dictionary = new Dictionary<TKey, TValue>();
|
||||
}
|
||||
|
||||
public Json(string file)
|
||||
{
|
||||
if (file is null) throw new FileLoadException("The file can not be null");
|
||||
if(!File.Exists(file))
|
||||
File.Create(file).Close();
|
||||
_dictionary = PrivateReadConfig(file).GetAwaiter().GetResult();
|
||||
_file = file;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ public static class Functions
|
||||
{
|
||||
/// <summary>
|
||||
/// The location for the Resources folder
|
||||
/// String: ./Data/Resources/
|
||||
/// </summary>
|
||||
public static readonly string dataFolder = @"./Data/Resources/";
|
||||
|
||||
@@ -125,4 +126,9 @@ public static class Functions
|
||||
Random random = new();
|
||||
return values[random.Next(values.Length)];
|
||||
}
|
||||
|
||||
public static string ToResourcesPath(this string path)
|
||||
{
|
||||
return Path.Combine(dataFolder, path);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user