-
Notifications
You must be signed in to change notification settings - Fork 0
/
Extension.cs
45 lines (38 loc) · 1.24 KB
/
Extension.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TelegramKeyboard
{
public class KeyboardIputer : Keyboard
{
public int lastUpdate = 0;
public KeyboardIputer(Keyboard Keyboard)
{
this.rows = Keyboard.rows;
this.H = Keyboard.H;
this.W = Keyboard.W;
}
public int CurentW => lastUpdate % W;
public int CurentH => lastUpdate / W % H;
public void Next() => lastUpdate++;
}
public static class Extension
{
public static bool InContain(this Keyboard Keyboard, string Name) => Container.Add(Name, Keyboard);
public static KeyboardIputer Input(this Keyboard Keyboard, string Text)
{
var result = new KeyboardIputer(Keyboard);
result.Add(result.CurentH, result.CurentW, Text);
return result;
}
public static KeyboardIputer Input(this KeyboardIputer Inputer, string Text)
{
Inputer.Next();
Inputer.Add(Inputer.CurentH, Inputer.CurentW, Text);
return Inputer;
}
public static Keyboard ToKeyboard(this KeyboardIputer Inputer) => Inputer;
}
}