From 1ef4aa027b6c77a45e7d895f4efcd074e3afaf88 Mon Sep 17 00:00:00 2001 From: TrueDoctor Date: Tue, 19 Jun 2018 14:25:14 +0200 Subject: Implemented session saves --- DiscoBot/DSA_Game/Save/Session.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'DiscoBot/DSA_Game/Save/Session.cs') 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 Relation { get; set; } = new Dictionary(); // dictionary to match the char @@ -23,7 +26,7 @@ namespace DiscoBot.DSA_Game.Save public List Chars { get; set; } = new List(); // 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 } } -- cgit v1.2.3-54-g00ecf