private static async void TranslateAndSend(string text) { if (text.Length > 1) { bool all = false; var test = new TestPerAll(text); if (test.ContainsPerAll) { text = test.Output; all = true; } string from = toArray[Config.Item("OutFrom").GetValue <StringList>().SelectedIndex]; string to = toArray[Config.Item("OutTo").GetValue <StringList>().SelectedIndex]; string x = ""; x += await TranslateYandex(text, from, to, false); Debug(x); x = setEncodingDefault(x); if (all) { Game.Say("/all " + x); } else { Game.Say(x); } } }
private static async void TranslateAndSend(string text) { if (text.Length > 1) { var all = false; var test = new TestPerAll(text); if (test.ContainsPerAll) { text = test.Output; all = true; } var from = ToArray[OutgoingText["OutFrom"].Cast <Slider>().CurrentValue]; var to = ToArray[OutgoingText["OutTo"].Cast <Slider>().CurrentValue]; var x = ""; x += await TranslateYandex(text, from, to, false); x = SetEncodingDefault(x); if (all) { Chat.Say("/all " + x); } else { Chat.Say(x); } } }
private static async void addMessage(string message, Obj_AI_Hero sender, bool shouldTranslate = true) { string from = fromArray[Config.Item("From").GetValue <StringList>().SelectedIndex]; string to = toArray[Config.Item("To").GetValue <StringList>().SelectedIndex]; string translated = message; if (shouldTranslate) { translated = await TranslateYandex(message, from, to, true); } if (from != to && !sender.IsMe && !translated.Contains(message)) { translate = true; Utility.DelayAction.Add(500, () => translate = false); lastMessages.Add(new Message(translated, sender, message)); if (Config.Item("ShowInChat").GetValue <bool>()) { Game.PrintChat(translated); } Debug(translated); } else { var last = new TestPerAll(lastInput); if (from != to && sender.IsMe && last.Output != message) { lastMessages.Add( new Message(String.Format("({0} => {1}) {2}", from, to, message), sender, last.Output)); if (Config.Item("ShowInChat").GetValue <bool>() && translated != message) { Game.PrintChat(translated); } } else { lastMessages.Add(new Message(message, sender, message)); if (Config.Item("ShowInChat").GetValue <bool>() && translated != message) { Game.PrintChat(translated); } } } if (lastMessages.Count > 8) { lastMessages.RemoveAt(0); } }
private static async void AddMessage(string message, Obj_AI_Base sender, bool shouldTranslate = true) { var from = FromArray[IncomingText["From"].Cast <Slider>().CurrentValue]; var to = ToArray[IncomingText["To"].Cast <Slider>().CurrentValue]; var translated = message; if (shouldTranslate) { translated = await TranslateYandex(message, from, to, true); } if (from != to && !sender.IsMe && translated != message) { Translate = true; Core.DelayAction(() => Translate = false, 500); LastMessages.Add(new Message(translated, sender, message)); if (IncomingText["ShowInChat"].Cast <CheckBox>().CurrentValue) { Chat.Print(translated); } } else { var last = new TestPerAll(LastInput); if (from != to && sender.IsMe && last.Output != message) { LastMessages.Add( new Message(String.Format("({0} => {1}) {2}", from, to, message), sender, last.Output)); if (IncomingText["ShowInChat"].Cast <CheckBox>().CurrentValue&& translated != message) { Chat.Print(translated); } } else { LastMessages.Add(new Message(message, sender, message)); if (IncomingText["ShowInChat"].Cast <CheckBox>().CurrentValue&& translated != message) { Chat.Print(translated); } } } if (LastMessages.Count > 8) { LastMessages.RemoveAt(0); } }
private static async void TranslateAndSend(string text) { if (text.Length > 1) { var all = false; var test = new TestPerAll(text); if (test.ContainsPerAll) { text = test.Output; all = true; } var from = ToArray[OutgoingText["OutFrom"].Cast<Slider>().CurrentValue]; var to = ToArray[OutgoingText["OutTo"].Cast<Slider>().CurrentValue]; var x = ""; x += await TranslateYandex(text, from, to, false); x = SetEncodingDefault(x); if (all) { Chat.Say("/all " + x); } else { Chat.Say(x); } } }
private static async void AddMessage(string message, Obj_AI_Base sender, bool shouldTranslate = true) { var from = FromArray[IncomingText["From"].Cast<Slider>().CurrentValue]; var to = ToArray[IncomingText["To"].Cast<Slider>().CurrentValue]; var translated = message; if (shouldTranslate) { translated = await TranslateYandex(message, from, to, true); } if (from != to && !sender.IsMe && translated != message) { Translate = true; Core.DelayAction(() => Translate = false, 500); LastMessages.Add(new Message(translated, sender, message)); if (IncomingText["ShowInChat"].Cast<CheckBox>().CurrentValue) { Chat.Print(translated); } } else { var last = new TestPerAll(LastInput); if (from != to && sender.IsMe && last.Output != message) { LastMessages.Add( new Message(String.Format("({0} => {1}) {2}", from, to, message), sender, last.Output)); if (IncomingText["ShowInChat"].Cast<CheckBox>().CurrentValue && translated != message) { Chat.Print(translated); } } else { LastMessages.Add(new Message(message, sender, message)); if (IncomingText["ShowInChat"].Cast<CheckBox>().CurrentValue && translated != message) { Chat.Print(translated); } } } if (LastMessages.Count > 8) { LastMessages.RemoveAt(0); } }
private static async void TranslateAndSend(string text) { if (text.Length > 1) { bool all = false; var test = new TestPerAll(text); if (test.ContainsPerAll) { text = test.Output; all = true; } string from = toArray[Config.Item("OutFrom").GetValue<StringList>().SelectedIndex]; string to = toArray[Config.Item("OutTo").GetValue<StringList>().SelectedIndex]; string x = ""; x += await TranslateYandex(text, from, to, false); x = setEncodingDefault(x); if (all) { Game.Say("/all " + x); } else { Game.Say(x); } } }
private static async void addMessage(string message, Obj_AI_Hero sender, bool shouldTranslate = true) { string from = fromArray[Config.Item("From").GetValue<StringList>().SelectedIndex]; string to = toArray[Config.Item("To").GetValue<StringList>().SelectedIndex]; string translated = message; if (shouldTranslate) { translated = await TranslateYandex(message, from, to, true); } if (from != to && !sender.IsMe && translated != message) { translate = true; Utility.DelayAction.Add(500, () => translate = false); lastMessages.Add(new Message(translated, sender, message)); if (Config.Item("ShowInChat").GetValue<bool>()) { Game.PrintChat(translated); } } else { var last = new TestPerAll(lastInput); if (from != to && sender.IsMe && last.Output != message) { lastMessages.Add( new Message(String.Format("({0} => {1}) {2}", from, to, message), sender, last.Output)); if (Config.Item("ShowInChat").GetValue<bool>() && translated != message) { Game.PrintChat(translated); } } else { lastMessages.Add(new Message(message, sender, message)); if (Config.Item("ShowInChat").GetValue<bool>() && translated != message) { Game.PrintChat(translated); } } } if (lastMessages.Count > 8) { lastMessages.RemoveAt(0); } }