diff options
author | TrueDoctor <d-kobert@web.de> | 2018-06-19 14:25:14 +0200 |
---|---|---|
committer | TrueDoctor <d-kobert@web.de> | 2018-06-19 14:25:14 +0200 |
commit | 1ef4aa027b6c77a45e7d895f4efcd074e3afaf88 (patch) | |
tree | c396a6ff5b67ffeba3108cb0b219e9978db2e63a /DiscoBot/DSA_Game/Save/Session.cs | |
parent | de22a0719079c5ba23e6ae9a39c921940c4bebed (diff) |
Implemented session saves
Diffstat (limited to 'DiscoBot/DSA_Game/Save/Session.cs')
-rw-r--r-- | DiscoBot/DSA_Game/Save/Session.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/DiscoBot/DSA_Game/Save/Session.cs b/DiscoBot/DSA_Game/Save/Session.cs index ed9c18d..0358b22 100644 --- a/DiscoBot/DSA_Game/Save/Session.cs +++ b/DiscoBot/DSA_Game/Save/Session.cs @@ -10,12 +10,15 @@ namespace DiscoBot.DSA_Game.Save using DiscoBot.DSA_Game.Characters; + using Discord; using Discord.Commands; using Newtonsoft.Json; public class Session { + public static string DirectoryPath { get; set; } = @"..\..\sessions"; + public ICommandContext GeneralContext { get; set; } public Dictionary<string, string> Relation { get; set; } = new Dictionary<string, string>(); // dictionary to match the char @@ -23,7 +26,7 @@ namespace DiscoBot.DSA_Game.Save public List<SaveChar> Chars { get; set; } = new List<SaveChar>(); // list of all characters public string SessionName { get; set; } - + public static Session Load(string path = @"..\..\session.json") { try @@ -33,6 +36,8 @@ namespace DiscoBot.DSA_Game.Save catch (Exception e) { // ignored + var log = new LogMessage(LogSeverity.Warning, "Properties", $"Laden von Save-File {path} fehlgeschlagen.", e); + Console.WriteLine(log); return null; } } @@ -45,6 +50,8 @@ namespace DiscoBot.DSA_Game.Save } catch (Exception e) { + var log = new LogMessage(LogSeverity.Warning, "Properties", $"Speichern von Save-File {path} fehlgeschlagen.", e); + Console.WriteLine(log); // ignored } } |