simplified json serialization (changed Method to m and Value to v, to safe space for more valuable text)
This commit is contained in:
parent
42c0edf8cb
commit
cbd162fd3b
@ -121,9 +121,7 @@ Below we have 3 options.
|
||||
|
||||
|
||||
```
|
||||
String APIKey = "";
|
||||
|
||||
BotBase<Start> bb = new BotBase<Start>(APIKey);
|
||||
BotBase<Start> bb = new BotBase<Start>("{YOUR API KEY}");
|
||||
|
||||
bb.SystemCalls.Add("/start");
|
||||
bb.SystemCalls.Add("/form1");
|
||||
|
||||
@ -3,6 +3,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace TelegramBotBase.Form
|
||||
{
|
||||
@ -11,8 +13,10 @@ namespace TelegramBotBase.Form
|
||||
/// </summary>
|
||||
public class CallbackData
|
||||
{
|
||||
[JsonProperty("m")]
|
||||
public String Method { get; set; }
|
||||
|
||||
[JsonProperty("v")]
|
||||
public String Value { get; set; }
|
||||
|
||||
|
||||
@ -32,6 +36,10 @@ namespace TelegramBotBase.Form
|
||||
return new CallbackData(method, value).Serialize();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializes data to json string
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public String Serialize()
|
||||
{
|
||||
String s = "";
|
||||
@ -48,6 +56,11 @@ namespace TelegramBotBase.Form
|
||||
return s;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes data from json string
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static CallbackData Deserialize(String data)
|
||||
{
|
||||
CallbackData cd = null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user