diff --git a/TelegramBotBase/Builder/BotBaseBuilder.cs b/TelegramBotBase/Builder/BotBaseBuilder.cs
index dc22976..a936b6e 100644
--- a/TelegramBotBase/Builder/BotBaseBuilder.cs
+++ b/TelegramBotBase/Builder/BotBaseBuilder.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Net.Http;
using Telegram.Bot;
using Telegram.Bot.Types;
@@ -314,19 +315,63 @@ public class BotBaseBuilder : IAPIKeySelectionStage, IMessageLoopSelectionStage,
return this;
}
+ ///
+ /// Uses the application runtime path to load and write a states.json file.
+ ///
+ ///
+ public ILanguageSelectionStage UseJSON()
+ {
+ var path = Path.Combine(Directory.GetCurrentDirectory(), "states.json");
+ _stateMachine = new JsonStateMachine(path);
+ return this;
+ }
+ ///
+ /// Uses the given path to load and write a states.json file.
+ ///
+ ///
public ILanguageSelectionStage UseJSON(string path)
{
_stateMachine = new JsonStateMachine(path);
return this;
}
+ ///
+ /// Uses the application runtime path to load and write a states.json file.
+ ///
+ ///
+ public ILanguageSelectionStage UseSimpleJSON()
+ {
+ var path = Path.Combine(Directory.GetCurrentDirectory(), "states.json");
+ _stateMachine = new SimpleJsonStateMachine(path);
+ return this;
+ }
+
+ ///
+ /// Uses the given path to load and write a states.json file.
+ ///
+ ///
public ILanguageSelectionStage UseSimpleJSON(string path)
{
_stateMachine = new SimpleJsonStateMachine(path);
return this;
}
+ ///
+ /// Uses the application runtime path to load and write a states.xml file.
+ ///
+ ///
+ public ILanguageSelectionStage UseXML()
+ {
+ var path = Path.Combine(Directory.GetCurrentDirectory(), "states.xml");
+ _stateMachine = new XmlStateMachine(path);
+ return this;
+ }
+
+ ///
+ /// Uses the given path to load and write a states.xml file.
+ ///
+ ///
public ILanguageSelectionStage UseXML(string path)
{
_stateMachine = new XmlStateMachine(path);
diff --git a/TelegramBotBase/Builder/Interfaces/ISessionSerializationStage.cs b/TelegramBotBase/Builder/Interfaces/ISessionSerializationStage.cs
index 5ed022b..2a453e4 100644
--- a/TelegramBotBase/Builder/Interfaces/ISessionSerializationStage.cs
+++ b/TelegramBotBase/Builder/Interfaces/ISessionSerializationStage.cs
@@ -18,6 +18,13 @@ public interface ISessionSerializationStage
///
ILanguageSelectionStage UseSerialization(IStateMachine machine);
+ ///
+ /// Using the complex version of .Net JSON, which can serialize all objects.
+ /// Saves in application directory.
+ ///
+ ///
+ ///
+ ILanguageSelectionStage UseJSON();
///
/// Using the complex version of .Net JSON, which can serialize all objects.
@@ -26,6 +33,13 @@ public interface ISessionSerializationStage
///
ILanguageSelectionStage UseJSON(string path);
+ ///
+ /// Use the easy version of .Net JSON, which can serialize basic types, but not generics and others.
+ /// Saves in application directory.
+ ///
+ ///
+ ///
+ ILanguageSelectionStage UseSimpleJSON();
///
/// Use the easy version of .Net JSON, which can serialize basic types, but not generics and others.
@@ -34,6 +48,13 @@ public interface ISessionSerializationStage
///
ILanguageSelectionStage UseSimpleJSON(string path);
+ ///
+ /// Uses the XML serializer for session serialization.
+ /// Saves in application directory.
+ ///
+ ///
+ ///
+ ILanguageSelectionStage UseXML();
///
/// Uses the XML serializer for session serialization.