public void AddUser(User arg) { this.UCount++; this.UArray = (User[])AnotherMethod.ResizeArray(UArray, new int[1] { this.UCount }); this.UArray[this.UCount - 1] = new User(); this.UArray[this.UCount - 1] = arg; }
public void AddModer(Moder arg) { MCount++; MArray = (Moder[])AnotherMethod.ResizeArray(MArray, new int[1] { MCount }); MArray[MCount - 1] = new Moder(); MArray[MCount - 1] = arg; }
public void AddChat(Chat arg) { ChCount++; ChBot = (Chat[])AnotherMethod.ResizeArray(ChBot, new int[1] { ChCount }); ChBot[ChCount - 1] = new Chat(); ChBot[ChCount - 1] = arg; }
public void AddTrigger(Trigger arg) { this.TCount++; this.TArray = (Trigger[])AnotherMethod.ResizeArray(TArray, new int[1] { this.TCount }); this.TArray[this.TCount - 1] = new Trigger(); this.TArray[this.TCount - 1] = arg; }
public int GetTrigger(string TWord) { for (int i = 0; i < TCount; i++) { if (AnotherMethod.REq(TArray[i].TWord, TWord)) { return(i); } } return(-1); }
public void DeleteChat(int arg) { int i = arg; for (; i < ChCount - 1; i++) { ChBot[i] = ChBot[i + 1]; } ChCount--; ChBot = (Chat[])AnotherMethod.ResizeArray(ChBot, new int[1] { ChCount }); }
public void DeleteTrigger(int arg) { int i = arg; for (; i < TCount - 1; i++) { TArray[i] = TArray[i + 1]; } TCount--; TArray = (Trigger[])AnotherMethod.ResizeArray(TArray, new int[1] { TCount }); }
public void CommandI(string[] parsResult, ParamResponse e, TGUpl a) { string result = ""; if (e.replyMessageText == null) { result += "Айди чата: " + ((e.chatId == null)?e.ChannelID:e.chatId) + '\n'; result += "Время МСК: " + AnotherMethod.UnixTimeStampToDateTime(long.Parse(e.Date)); } else { result += "Юзернейм: " + e.replyMessageUsername + " id: " + e.replyMessageUID + "\n"; result += "Время сообщения по МСК: " + AnotherMethod.UnixTimeStampToDateTime(long.Parse(e.ReplyMessageDate)); } a.SendMessage(result, e.chatId); }
//Загрузить триггеры из файла public static void ReadFromFileTrigger() { try { FileStream file1 = new FileStream("./trigger.data", FileMode.Open); //создаем файловый поток StreamReader reader = new StreamReader(file1); // создаем «потоковый читатель» и связываем его с файловым потоком string toRead = ""; toRead = reader.ReadToEnd(); //считываем все данные с потока и вводим в переменнуб, с которой будем работать reader.Close(); //закрываем поток char[] arr1 = toRead.ToCharArray(); int i = 0; int k = 5; while (i < arr1.Length) { if (k % 5 == 0) { arr = (string[, ])AnotherMethod.ResizeArray(arr, new int[2] { arr.Length / 5 + 1, 5 }); } if (k % 5 != 1) { while (arr1[i] != '\n') { arr[k / 5, k % 5] += arr1[i].ToString(); i++; } } else { while ((arr1[i] != '\n' || arr1[i + 1] != '\t')) { string NewSymbol = arr1[i].ToString(); arr[k / 5, k % 5] += NewSymbol; i++; } i++; } k++; i++; } } catch { return; } }
public void RepairChatData() { for (int i = 0; i < ChCount; i++) { for (int k = i + 1; k < ChCount; k++) { if (ChBot[i].chatId == ChBot[k].chatId) { for (int j = k; j + 1 < ChCount; j++) { ChBot[j] = ChBot[j + 1]; } ChCount--; } } } this.ChBot = (Chat[])AnotherMethod.ResizeArray(this.ChBot, new int[1] { ChCount }); }
public void DelModer(Moder arg) { int i = 0; for (; i < MCount - 1; i++) { if (MArray[i].UId == arg.UId) { break; } } for (; i < MCount - 1; i++) { MArray[i] = MArray[i + 1]; } MCount--; MArray = (Moder[])AnotherMethod.ResizeArray(MArray, new int[1] { MCount }); }
public void DeleteTrigger(Trigger arg) { int i = 0; for (; i < TCount - 1; i++) { if (TArray[i].TWord == arg.TWord) { break; } } for (; i < TCount - 1; i++) { TArray[i] = TArray[i + 1]; } TCount--; TArray = (Trigger[])AnotherMethod.ResizeArray(TArray, new int[1] { TCount }); }
public static string NewPoll(string message, string replyText) { string ret = "{\"inline_keyboard\":["; int paramcounts = 0; int i = message.IndexOf('[') + 1; if (i == 0) { return(""); } int to = message.IndexOf(';', i); string [] options = new string[1]; for (; i < message.Length; i++) { to = message.IndexOf(';', i); if (to == -1) { to = message.IndexOf(']', i); if (to == -1) { return(""); } } if (to != -1) { if (paramcounts > 0 && to - i != 0) { ret += ","; options = (string[])AnotherMethod.ResizeArray(options, new int[1] { (paramcounts + 1) }); } if (to - i == 0) { continue; } options[paramcounts] = message.Substring(i, to - i); ret += "[{\"text\":\"" + message.Substring(i, to - i) + "\",\"callback_data\":\"" + paramcounts.ToString() + "\"}]"; i = to; paramcounts++; } else { break; } } ret += "]}"; if (paramcounts > 0) { if (polls.Length == 1) { polls = new Poll[1]; polls[0] = new Poll(); } else { polls = (Poll[])AnotherMethod.ResizeArray(polls, new int[1] { polls.Length + 1 }); } polls[polls.Length - 1] = new Poll("0", "0", paramcounts); polls[polls.Length - 1].Text = replyText; for (int k = 0; k < paramcounts; k++) { polls[polls.Length - 1].votes[k].votes = 0; polls[polls.Length - 1].votes[k].Text = options[k]; } return(ret); } else { return(""); } }