/* * private static double StringCompare(string a, string b) * { * if (a == b) * { * return 100; * } * if ((a.Length == 0) || (b.Length == 0)) * { * return 0; * } * double maxLen = a.Length > b.Length ? a.Length : b.Length; * var minLen = a.Length < b.Length ? a.Length : b.Length; * var sameCharAtIndex = 0; * for (var i = 0; i < minLen; i++) * { * if (a[i] == b[i]) * { * sameCharAtIndex++; * } * } * return sameCharAtIndex/maxLen*100; * } */ private static void CreateMenu() { Config = MainMenu.AddMenu("Chat Translator", "Config"); TranslatorMenu = Config.AddSubMenu("Translator", "Translator"); IncomingText = Config.AddSubMenu("IncomingText", "IncomingText"); OutgoingText = Config.AddSubMenu("OutgoingText", "OutgoingText"); Position = Config.AddSubMenu("Position", "Position"); Logger = Config.AddSubMenu("Logger", "Logger"); CopyPaste = Config.AddSubMenu("Paste", "Paste"); #region Translator Menu TranslatorMenu.Add("Check", new KeyBind("Check", true, KeyBind.BindTypes.HoldActive, 32)); #endregion #region Incoming Text Menu IncomingText.AddLabel("From: "); var incomingFrom = IncomingText.Add("From", new Slider("From: ", 0, 0, 63)); incomingFrom.DisplayName = FromArrayMenu[incomingFrom.CurrentValue]; incomingFrom.OnValueChange += delegate(ValueBase <int> sender, ValueBase <int> .ValueChangeArgs changeArgs) { sender.DisplayName = FromArrayMenu[changeArgs.NewValue]; }; IncomingText.AddLabel("To: "); var incomingTo = IncomingText.Add("To", new Slider("To: ", 0, 0, 62)); incomingTo.DisplayName = ToArrayMenu[incomingFrom.CurrentValue]; incomingTo.OnValueChange += delegate(ValueBase <int> sender, ValueBase <int> .ValueChangeArgs changeArgs) { sender.DisplayName = ToArrayMenu[changeArgs.NewValue]; }; IncomingText.Add("ShowInChat", new CheckBox("Show in chat", false)); IncomingText.Add("Enabled", new CheckBox("Enabled")); #endregion #region Outgoing Text Menu OutgoingText.AddLabel("From: "); var outgoingFrom = OutgoingText.Add("OutFrom", new Slider("From: ", 0, 0, 63)); outgoingFrom.DisplayName = FromArrayMenu[outgoingFrom.CurrentValue]; outgoingFrom.OnValueChange += delegate(ValueBase <int> sender, ValueBase <int> .ValueChangeArgs changeArgs) { sender.DisplayName = FromArrayMenu[changeArgs.NewValue]; }; OutgoingText.AddLabel("To: "); var outgoingTo = OutgoingText.Add("OutTo", new Slider("To: ", 0, 0, 62)); outgoingTo.DisplayName = ToArrayMenu[outgoingTo.CurrentValue]; outgoingTo.OnValueChange += delegate(ValueBase <int> sender, ValueBase <int> .ValueChangeArgs changeArgs) { sender.DisplayName = ToArrayMenu[changeArgs.NewValue]; }; OutgoingText.Add("EnabledOut", new CheckBox("Enabled", false)); #endregion #region Position Position.Add("Horizontal", new Slider("Horizontal", 15, 1, 2000)); Position.Add("Vertical", new Slider("Vertical", 500, 1, 2000)); Position.Add("AutoShow", new CheckBox("Show on message")); Position.Add("Duration", new Slider("Duration", 3000, 1000, 8000)); #endregion #region Logger Logger.Add("EnabledLog", new CheckBox("Enable")); #endregion #region Copy Paste CopyPaste.Add("Paste", new KeyBind("Paste", false, KeyBind.BindTypes.PressToggle, 'P')); CopyPaste.Add("PasteForAll", new KeyBind("Paste for all", false, KeyBind.BindTypes.PressToggle, 'O')); CopyPaste.Add("Delay", new Slider("Spam delay", 2000, 0, 2000)); CopyPaste.Add("DisablePaste", new CheckBox("Disable this section")); Config.AddLabel("You can use your own API key"); Config.AddLabel( "AppData\\Roaming\\EloBuddy\\yandexApiKey.txt, copy into the first line \"trnsl.1.1.201...\""); #endregion }