using System; using System.IO; using TelegramBotBase.Builder; using TelegramBotBase.Builder.Interfaces; namespace TelegramBotBase.Extensions.Serializer.Legacy.NewtonsoftJson { public static class BotBaseBuilderExtensions { /// /// Using the complex version of .Net JSON, which can serialize all objects. /// Saves in application directory. /// /// /// public static ILanguageSelectionStage UseNewtonsoftJson(this ISessionSerializationStage builder) { var path = Path.Combine(Directory.GetCurrentDirectory(), "states.json"); builder.UseNewtonsoftJson(path); return builder as BotBaseBuilder; } /// /// Using the complex version of .Net JSON, which can serialize all objects. /// Saves in application directory. /// /// /// public static ILanguageSelectionStage UseNewtonsoftJson(this ISessionSerializationStage builder, String path) { var _stateMachine = new NewtonsoftJsonStateMachine(path); builder.UseSerialization(_stateMachine); return builder as BotBaseBuilder; } } }