private void GameBtn_Click(object sender, EventArgs e) { if (Name == "Decks") { LauncherHelper.GenerateConfig(); LauncherHelper.RunGame("-d"); } else { if (FileList.SelectedItem == null) { MessageBox.Show("Choose a replay first!"); return; } string replayDir = Program.Config.LauncherDir + m_fileLocation; if (!Directory.Exists(replayDir)) { MessageBox.Show("Replay directory doesn't exist!"); return; } string fileName = replayDir + FileList.SelectedItem + ".yrp"; if (!File.Exists(fileName)) { MessageBox.Show("Selected file does not exist!"); return; } LauncherHelper.GenerateConfig(true, FileList.SelectedItem + ".yrp"); LauncherHelper.RunGame("-r"); } }
public MainFrm() { InitializeComponent(); var version = Program.Version.ToCharArray(); Text = "DevPro" + " v" + version[0] + "." + version[1] + "." + version[2] + " r" + Program.Version[3]; LauncherHelper.LoadBanlist(); var loginTab = new TabPage("Login"); m_loginWindow = new LoginFrm(); loginTab.Controls.Add(m_loginWindow); mainTabs.TabPages.Add(loginTab); m_wcsBrowser = new Browser_frm(); m_wcsBrowser.FormBorderStyle = FormBorderStyle.None; m_chatWindow = new ChatFrm(); GameWindow = new HubGameList_frm(); m_rankingWindow = new RankingFrm(); m_devpointWindow = new SupportFrm(); m_filemanagerWindow = new FileManagerFrm(); m_customizerWindow = new CustomizeFrm(); m_faqBrowser = new Browser_frm(); m_faqBrowser.FormBorderStyle = FormBorderStyle.None; Program.ChatServer.ServerMessage += ServerMessage; mainTabs.SelectedIndexChanged += TabChange; ApplyTranslation(); }
/// <summary> /// Launches the Bing Maps application with the specified position in driving/navigation mode. /// </summary> /// <param name="position"> /// The position to drive to. /// </param> /// <param name="locationName"> /// The name to give the location. /// </param> /// <returns> /// Returns an await-able task. /// </returns> public static async Task DriveToAsync(this BasicGeoposition position, string locationName) { var uri = new Uri( $"ms-drive-to:?destination.latitude={position.Latitude}&destination.longitude={position.Longitude}&destination.name={locationName}"); await LauncherHelper.LaunchAsync(uri, LaunchableApplications.BingMaps, false); }
private void HostGame() { var form = new Host(false); if (form.ShowDialog() == DialogResult.OK) { if (m_rooms.ContainsKey(form.PasswordInput.Text)) { MessageBox.Show(Program.LanguageManager.Translation.GamePasswordExsists); return; } ServerInfo server = form.CardRules.Text == "2099" ? GetServer(Program.Config.Server2099) : GetServer(false); if (server != null) { LauncherHelper.GenerateConfig(server, form.GenerateURI(false)); LauncherHelper.RunGame("-j"); Program.ChatServer.SendPacket(DevServerPackets.HostDuel); } else { MessageBox.Show(Program.LanguageManager.Translation.GameNoServers); return; } } }
private void submitBtn_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(usernameInput.Text)) { MessageBox.Show(Program.LanguageManager.Translation.ValidateMsbUsername); return; } if (string.IsNullOrEmpty(emailInput.Text)) { MessageBox.Show(Program.LanguageManager.Translation.ValidateMsbEmail); return; } if (string.IsNullOrEmpty(codeInput.Text)) { MessageBox.Show(Program.LanguageManager.Translation.ValidateMsbCode); return; } Program.ChatServer.SendPacket(DevServerPackets.Validate, JsonSerializer.SerializeToString( new ValidateRequest { Username = usernameInput.Text, Email = emailInput.Text, Code = codeInput.Text, UID = LauncherHelper.GetUID(), Version = Convert.ToInt32(Program.Version), HID = HardwareIdEditor.GetId() })); submitBtn.Enabled = false; }
private void CheckmateBtn_Click(object sender, EventArgs e) { ServerInfo server = new ServerInfo("Checkmate", "45.33.106.116", 21001); LauncherHelper.GenerateConfig(server, ""); LauncherHelper.RunGame("-j"); }
public MainFrm() { InitializeComponent(); var version = Program.Version.ToCharArray(); Text = "DevPro" + " v" + version[0] + "." + version[1] + "." + version[2] + " r" + Program.Version[3]; LauncherHelper.LoadBanlist(); var loginTab = new TabPage("Login"); m_loginWindow = new LoginFrm(); loginTab.Controls.Add(m_loginWindow); mainTabs.TabPages.Add(loginTab); m_chatWindow = new ChatFrm(); GameWindow = new HubGameList_frm(); m_devpointWindow = new SupportFrm(); m_filemanagerWindow = new FileManagerFrm(); m_customizerWindow = new CustomizeFrm(); LauncherHelper.CardManager.Init(); Program.ChatServer.Banned += ServerMessage; Program.ChatServer.Kicked += ServerMessage; Program.ChatServer.ServerMessage += ServerMessage; ApplyTranslation(); }
public MainFrm() { InitializeComponent(); var version = Program.Version.ToCharArray(); Text = "DevPro" + " v" + version[0] + "." + version[1] + "." + version[2] + " r" + Program.Version[3]; LauncherHelper.LoadBanlist(); var loginTab = new TabPage("Login"); m_loginWindow = new LoginFrm(); loginTab.Controls.Add(m_loginWindow); mainTabs.TabPages.Add(loginTab); m_chatWindow = new ChatFrm(); m_gameWindow = new GameListFrm("DevPro"); m_devpointWindow = new SupportFrm(); m_filemanagerWindow = new FileManagerFrm(); m_customizerWindow = new CustomizeFrm(); LauncherHelper.CardManager.Init(); var connectThread = new Thread(Loaded); connectThread.Start(); }
public MainFrm() { InitializeComponent(); Text = GetVersionString(); LauncherHelper.LoadBanlist(); var loginTab = new TabPage("Login"); m_loginWindow = new LoginFrm(); loginTab.Controls.Add(m_loginWindow); mainTabs.TabPages.Add(loginTab); m_chatWindow = new ChatFrm(); GameWindow = new HubGameList_frm(); m_rankingWindow = new RankingFrm(); m_devpointWindow = new SupportFrm(); m_filemanagerWindow = new FileManagerFrm(); m_customizerWindow = new CustomizeFrm(); Program.ChatServer.ServerMessage += ServerMessage; mainTabs.SelectedIndexChanged += TabChange; ApplyTranslation(); }
private void BackUpBtn_Click(object sender, EventArgs e) { if (MessageBox.Show("Do you want to back up the current game Textures?", "Backup Textures", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (!ThemeExists("Backup Theme")) { AddTheme("Backup Theme"); } SelectedTheme = "Backup Theme"; ThemeSelect.SelectedItem = "Backup Theme"; foreach (ContentType type in ItemKeys()) { if (type != ContentType.Music && type != ContentType.SoundEffects) { try { var generatedString = LauncherHelper.GenerateString(); File.Copy(Data[type].GameItem, Data[type].AssetPath + generatedString + Data[type].FileType); AddThemeItem(type, Data[type].AssetPath + generatedString + Data[type].FileType, generatedString); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } RefreshList(); RefreshInstalledThemeItems(); SaveTheme("Backup Theme"); ThemeSelect.Items.Add("Backup Theme"); ThemeSelect.SelectedItem = "Backup Theme"; } }
public HubGameList_frm() { InitializeComponent(); TopLevel = false; Dock = DockStyle.Fill; Visible = true; Format.SelectedIndex = 0; GameType.SelectedIndex = 0; BanList.SelectedIndex = 0; TimeLimit.SelectedIndex = 0; BanList.Items.AddRange(LauncherHelper.GetBanListArray()); Program.ChatServer.AddRooms += OnRoomsList; Program.ChatServer.CreateRoom += OnRoomCreate; Program.ChatServer.RemoveRoom += OnRoomRemoved; Program.ChatServer.UpdateRoomStatus += OnRoomStarted; Program.ChatServer.UpdateRoomPlayers += OnRoomPlayersUpdate; Program.ChatServer.AddGameServer += AddServer; Program.ChatServer.RemoveGameServer += RemoveServer; RankedList.DrawItem += GameListBox_DrawItem; UnrankedList.DrawItem += GameListBox_DrawItem; UnrankedList.DoubleClick += LoadRoom; RankedList.DoubleClick += LoadRoom; SearchReset.Tick += ResetSearch; GameListUpdateTimer.Tick += UpdateGameListTimer; RefreshDeckList(); LauncherHelper.DeckEditClosed += RefreshDeckList; DeckSelect.SelectedIndexChanged += DeckSelect_SelectedValueChanged; ApplyTranslation(); }
public Host() { InitializeComponent(); TimeLimit.SelectedItem = Program.Config.chtTimeLimit; BanList.SelectedItem = Program.Config.chtBanList; Mode.SelectedItem = Program.Config.chtMode; GameName = LauncherHelper.GenerateString().Substring(0, 5); CardRules.SelectedItem = Program.Config.chtCardRules; Priority.Checked = Program.Config.chtEnablePrority; ShuffleDeck.Checked = Program.Config.chtDisableShuffleDeck; CheckDeck.Checked = Program.Config.chtDisableCheckDeck; BanList.Items.AddRange(LauncherHelper.GetBanListArray()); if (BanList.Items.Count > 0) { if (BanList.Items.Contains(Program.Config.chtBanList)) { BanList.SelectedItem = Program.Config.chtBanList; } } Mode.SelectedIndexChanged += DuelModeChanged; ApplyTranslation(); }
private static void Main() { LoadConfig(ConfigurationFilename); #if !DEBUG AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; #endif //new update server - Forced change to prevent reseting a users config Config.UpdaterAddress = "/launcher/version.php"; Config.ServerInfoAddress = "/launcher/server.php"; LanguageManager = new LanguageManager(); LanguageManager.Load(Config.Language); if (PicsManager.CheckPics()) { return; } #if !DEBUG if (LauncherHelper.CheckInstance()) { if (MessageBox.Show(LanguageManager.Translation.pmsbProgRun) == DialogResult.OK) { return; } } #endif ChatServer = new ChatClient(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CheckmateServerList.Add("Checkmate USA+CN", new ServerInfo("Checkmate USA+CN", "173.224.211.158", 21001)); CheckmateServerList.Add("Checkmate EU", new ServerInfo("Checkmate EU", "94.247.40.146", 7980)); if (LauncherHelper.TestConnection()) { #if !DEBUG if (NewUpdateCheck()) { return; } if (!CheckServerInfo("http://158.69.116.140")) { CheckServerInfo("http://en.ygodevpro.com/"); } #endif } else { MessageBox.Show("An internet connection is required to play online."); } #if DEBUG //Config.ServerAddress = "158.69.116.140"; //Config.ChatPort = 9933; Server = new ServerInfo("DevPro", "127.0.0.1", 3333); #endif MainForm = new MainFrm(); Application.Run(MainForm); }
private void RegisterBtn_Click(object sender, EventArgs e) { if (ConfirmInput.Text != PasswordInput.Text) { MessageBox.Show(Program.LanguageManager.Translation.RegistPassError); return; } if (EmailInput.Text != ConfirmEmailInput.Text) { MessageBox.Show(Program.LanguageManager.Translation.RegistMailError); return; } if (string.IsNullOrEmpty(ConfirmInput.Text)) { MessageBox.Show(Program.LanguageManager.Translation.RegistMsb1); return; } if (string.IsNullOrEmpty(PasswordInput.Text)) { MessageBox.Show(Program.LanguageManager.Translation.RegistMsb2); return; } if (string.IsNullOrEmpty(UsernameInput.Text)) { MessageBox.Show(Program.LanguageManager.Translation.RegistMsb3); return; } if (string.IsNullOrEmpty(EmailInput.Text)) { MessageBox.Show(Program.LanguageManager.Translation.RegistMsb7); return; } if (!Regex.IsMatch(UsernameInput.Text, "^[a-zA-Z0-9_]*$")) { MessageBox.Show(Program.LanguageManager.Translation.RegistMsb6); return; } if (!Regex.IsMatch(EmailInput.Text, @"\A(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)\Z")) { MessageBox.Show(Program.LanguageManager.Translation.RegistMsb8); return; } Program.ChatServer.SendPacket(DevServerPackets.Register, JsonSerializer.SerializeToString( new RegisterRequest { Username = UsernameInput.Text, Password = LauncherHelper.EncodePassword(PasswordInput.Text), UID = LauncherHelper.GetUID(), Version = Convert.ToInt32(Program.Version), Email = EmailInput.Text, HID = HardwareIdEditor.GetId() })); RegisterBtn.Enabled = false; }
private void LoginResponse(DevClientPackets type, LoginData data) { if (InvokeRequired) { Invoke(new Action <DevClientPackets, LoginData>(LoginResponse), type, data); return; } if (type == DevClientPackets.Banned) { MessageBox.Show("You are banned."); } else if (type == DevClientPackets.LoginFailed) { loginBtn.Enabled = true; MessageBox.Show("Incorrect Password or Username."); } else { if (Program.UserInfo == null) { Program.UserInfo = new UserData { rank = data.UserRank, username = data.Username, team = data.Team, teamRank = data.TeamRank }; Program.LoginKey = data.LoginKey; Program.MainForm.Login(); if (savePassCheckBox.Checked) { if (!Program.Config.SavePassword || Program.Config.SavedUsername != usernameInput.Text) { Program.Config.SavePassword = true; Program.Config.SavedUsername = usernameInput.Text; Program.Config.EncodedPassword = LauncherHelper.EncodePassword(passwordInput.Text); Program.SaveConfig(Program.ConfigurationFilename, Program.Config); } } else { if (Program.Config.SavePassword) { Program.Config.SavePassword = false; Program.Config.EncodedPassword = string.Empty; Program.SaveConfig(Program.ConfigurationFilename, Program.Config); } } } } }
private void QuickHost(string mode, bool isranked) { var ran = new Random(); var form = new Host(false, false) { CardRules = { Text = Program.Config.CardRules }, Mode = { Text = mode }, Priority = { Checked = Program.Config.EnablePrority }, CheckDeck = { Checked = Program.Config.DisableCheckDeck }, ShuffleDeck = { Checked = Program.Config.DisableShuffleDeck }, LifePoints = { Text = Program.Config.Lifepoints }, GameName = LauncherHelper.GenerateString().Substring(0, 5), BanList = { SelectedItem = Program.Config.BanList }, TimeLimit = { SelectedItem = Program.Config.TimeLimit } }; ListBox list = (isranked) ? RankedList : UnrankedList; if (isranked) { form.BanList.SelectedIndex = 0; form.CheckDeck.Checked = false; form.ShuffleDeck.Checked = false; form.Priority.Checked = false; form.CardRules.SelectedIndex = 2; form.LifePoints.Text = form.Mode.Text == "Tag" ? "16000" : "8000"; } else { if (Program.Config.Lifepoints != ((mode == "Tag") ? "16000":"8000")) { if (MessageBox.Show(Program.LanguageManager.Translation.GameLPChange, Program.LanguageManager.Translation.hostLifep, MessageBoxButtons.YesNo) == DialogResult.Yes) { form.LifePoints.Text = mode == "Tag" ? "16000" : "8000"; } } } RoomInfos userinfo = RoomInfos.FromName(form.GenerateURI(isranked)); var matchedRooms = (from object room in list.Items where m_rooms.ContainsKey(room.ToString()) select m_rooms[room.ToString()] into info where RoomInfos.CompareRoomInfo(userinfo, info) select info).ToList(); if (matchedRooms.Count > 0) { var selectroom = ran.Next(matchedRooms.Count); form.GameName = matchedRooms[selectroom].roomName; } LauncherHelper.GenerateConfig(Program.Server, form.GenerateURI(isranked)); LauncherHelper.RunGame("-j"); }
private async Task OnLinkNews() { if (IsNotBusy && SelectedNews != null) { IsBusy = true; await Task.Delay(TimeSpan.FromMilliseconds(500)); await LauncherHelper.OpenLinkAsync(SelectedNews.Url); IsBusy = false; } SelectedNews = null; }
public void LoadRoom(object sender, EventArgs e) { var rooms = (ListBox)sender; if (rooms.SelectedIndex == -1) { return; } if (!m_rooms.ContainsKey(rooms.SelectedItem.ToString())) { return; } RoomInfos item = m_rooms[rooms.SelectedItem.ToString()]; if (item.isRanked && !item.hasStarted) { MessageBox.Show("Cannot manually join a ranked game."); return; } if (item.isLocked) { var form = new InputFrm(string.Empty, Program.LanguageManager.Translation.GameEnterPassword, Program.LanguageManager.Translation.QuickHostBtn, Program.LanguageManager.Translation.optionBtnCancel) { InputBox = { MaxLength = 4 } }; if (!item.hasStarted) { if (form.ShowDialog() == DialogResult.OK) { if (form.InputBox.Text != item.roomName) { MessageBox.Show(Program.LanguageManager.Translation.GameWrongPassword); return; } } else { return; } } } if (Program.ServerList.ContainsKey(item.server)) { LauncherHelper.GenerateConfig(Program.ServerList[item.server], item.ToName()); LauncherHelper.RunGame("-j"); } }
static void Main() { Config = new Configuration(); LoadConfig(ConfigurationFilename); #if !DEBUG AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; #endif //new update server - Forced change to prevent resting a users config Config.UpdaterAddress = "http://ygopro.de/launcher/version.php"; Config.ServerInfoAddress = "http://ygopro.de/launcher/server.php"; LanguageManager = new LanguageManager(); //LanguageManager.Save("English"); LanguageManager.Load(Config.Language); if (LauncherHelper.CheckInstance()) { if (MessageBox.Show(LanguageManager.Translation.pmsbProgRun) == DialogResult.OK) { return; } } ChatServer = new ChatClient(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (LauncherHelper.TestConnection()) { if (CheckUpdates()) { return; } CheckServerInfo(); } else { MessageBox.Show("An internet connection is required to play online."); } #if DEBUG Config.ServerAddress = "86.0.24.143"; Config.ChatPort = 8933; //Config.GamePort = 6666; Server = new ServerInfo("DevPro", "86.0.24.143", 3333); #endif MainForm = new MainFrm(); Application.Run(MainForm); }
public void OnMatchStart(DuelRequest request) { ServerInfo server = null; if (Program.ServerList.ContainsKey(request.server)) { server = Program.ServerList[request.server]; } if (server != null) { LauncherHelper.GenerateConfig(server, request.duelformatstring, 1); LauncherHelper.RunGame("-f"); } ResetQueue(); }
private void UpdatePassword_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(currentPassword.Text) || string.IsNullOrEmpty(newPassword.Text) && string.IsNullOrEmpty(emailInput.Text)) { MessageBox.Show(Program.LanguageManager.Translation.optionEmptyMsg); return; } if (!string.IsNullOrEmpty(newPassword.Text)) { if (newPassword.Text != confirmPassword.Text) { MessageBox.Show("New password does not match the confirm password."); return; } Program.ChatServer.SendPacket(DevServerPackets.UpdatePassword, JsonSerializer.SerializeToString( new LoginRequest() { Username = Program.UserInfo.username, Password = LauncherHelper.EncodePassword(currentPassword.Text), UID = LauncherHelper.EncodePassword(newPassword.Text) })); } if (!string.IsNullOrEmpty(emailInput.Text)) { if (emailInput.Text != confirmEmailInput.Text) { MessageBox.Show("New email does not match the confirm email."); return; } Program.ChatServer.SendPacket(DevServerPackets.UpdateEmail, JsonSerializer.SerializeToString( new EmailRequest() { Username = Program.UserInfo.username, Password = LauncherHelper.EncodePassword(currentPassword.Text), Email = emailInput.Text, UID = LauncherHelper.GetUID() })); } UpdateBtn.Enabled = false; }
private void HostBtn_Click(object sender, EventArgs e) { var button = (Button)sender; var form = new Host(false, (button.Name == "RankedHostBtn")); if (button.Name == "RankedHostBtn") { form.Mode.Items.Clear(); form.Mode.Items.AddRange(new object[] { "Single", "Match", "Tag" }); form.Mode.SelectedItem = "Match"; if (form.BanList.Items.Count > 0) { form.BanList.SelectedIndex = 0; } form.BanList.Enabled = false; form.TimeLimit.Items.Clear(); form.TimeLimit.Items.Add("Server Defualt"); form.TimeLimit.SelectedItem = "Server Defualt"; form.TimeLimit.Enabled = false; form.Priority.Enabled = false; form.ShuffleDeck.Enabled = false; form.CheckDeck.Enabled = false; form.LifePoints.Enabled = false; form.CardRules.Items.Clear(); form.CardRules.Items.AddRange(new object[] { "TCG", "OCG" }); form.CardRules.SelectedItem = "TCG"; } if (form.ShowDialog() == DialogResult.OK) { if (m_rooms.ContainsKey(form.PasswordInput.Text)) { MessageBox.Show(Program.LanguageManager.Translation.GamePasswordExsists); return; } if (Program.ServerList.Count == 0) { MessageBox.Show("No Servers are Available."); return; } LauncherHelper.GenerateConfig(GetServer(), form.GenerateURI((button.Name == "RankedHostBtn"))); LauncherHelper.RunGame("-j"); } }
public MainFrm() { InitializeComponent(); var version = Program.Version.ToCharArray(); Text = "DevPro" + " v" + version[0] + "." + version[1] + "." + version[2] + " r" + Program.Version[3]; LauncherHelper.LoadBanlist(); var loginTab = new TabPage("Login"); m_loginWindow = new LoginFrm(); loginTab.Controls.Add(m_loginWindow); mainTabs.TabPages.Add(loginTab); m_wcsBrowser = new Browser_frm(); m_wcsBrowser.FormBorderStyle = FormBorderStyle.None; m_chatWindow = new ChatFrm(); GameWindow = new HubGameList_frm(); m_devpointWindow = new SupportFrm(); m_filemanagerWindow = new FileManagerFrm(); m_customizerWindow = new CustomizeFrm(); m_faqBrowser = new Browser_frm(); m_faqBrowser.FormBorderStyle = FormBorderStyle.None; Program.ChatServer.ServerMessage += ServerMessage; mainTabs.SelectedIndexChanged += TabChange; ApplyTranslation(); //if (!String.IsNullOrEmpty(Properties.Settings.Default.DropBoxUserToken) && !String.IsNullOrEmpty(Properties.Settings.Default.DropBoxUserSecret)) //{ // DropNetClient dbctrl = new DropNetClient(Program.Config.AppKey, Program.Config.AppSecret); // dbctrl.UserLogin = new DropNet.Models.UserLogin(); // dbctrl.UserLogin.Token = Properties.Settings.Default.DropBoxUserToken; // dbctrl.UserLogin.Secret = Properties.Settings.Default.DropBoxUserSecret; // DropBoxController.filesyncAsync(); //} }
public Host(bool options, bool isranked) { InitializeComponent(); if (options) { TimeLimit.SelectedItem = Program.Config.TimeLimit; BanList.SelectedItem = Program.Config.BanList; Mode.SelectedItem = Program.Config.Mode; GameName = LauncherHelper.GenerateString().Substring(0, 5); CardRules.SelectedItem = Program.Config.CardRules; Priority.Checked = Program.Config.EnablePrority; ShuffleDeck.Checked = Program.Config.DisableShuffleDeck; CheckDeck.Checked = Program.Config.DisableCheckDeck; // ReSharper disable CoVariantArrayConversion BanList.Items.AddRange(LauncherHelper.GetBanListArray()); // ReSharper restore CoVariantArrayConversion BanList.SelectedItem = Program.Config.BanList; if (BanList.SelectedItem == null && BanList.Items.Count > 0) { BanList.SelectedIndex = 0; } } else { TimeLimit.SelectedIndex = 0; CardRules.SelectedIndex = 0; Mode.SelectedIndex = 0; GameName = LauncherHelper.GenerateString().Substring(0, 5); // ReSharper disable CoVariantArrayConversion BanList.Items.AddRange(LauncherHelper.GetBanListArray()); // ReSharper restore CoVariantArrayConversion if (BanList.Items.Count > 0) { BanList.SelectedIndex = 0; } } Mode.SelectedIndexChanged += DuelModeChanged; if (!isranked) { CardRules.SelectedIndexChanged += CardRulesChanged; } ApplyTranslation(); }
private void HostGame(object sender, EventArgs e) { var button = (ToolStripMenuItem)sender; var form = new Host(false, (button.Name == "Ranked")); if (button.Name == "Ranked") { form.Mode.Items.Clear(); form.Mode.Items.AddRange(new object[] { "Single", "Match", "Tag" }); form.Mode.SelectedItem = "Match"; if (form.BanList.Items.Count > 0) { form.BanList.SelectedIndex = 0; } form.CardRules.SelectedIndexChanged += form.FormatChanged; form.BanList.Enabled = false; form.Priority.Enabled = false; form.ShuffleDeck.Enabled = false; form.CheckDeck.Enabled = false; form.LifePoints.Enabled = false; form.CardRules.Items.Clear(); form.CardRules.Items.AddRange(new object[] { "TCG", "OCG" }); form.CardRules.SelectedItem = "TCG"; } if (form.ShowDialog() == DialogResult.OK) { if (m_rooms.ContainsKey(form.PasswordInput.Text)) { MessageBox.Show(Program.LanguageManager.Translation.GamePasswordExsists); return; } if (Program.ServerList.Count == 0) { MessageBox.Show(Program.LanguageManager.Translation.GameNoServers); return; } LauncherHelper.GenerateConfig(GetServer(), form.GenerateURI((button.Name == "Ranked"))); LauncherHelper.RunGame("-j"); Program.ChatServer.SendPacket(DevServerPackets.HostDuel); } }
private void ImportBtn_Click(object sender, EventArgs e) { string[] importfiles = LauncherHelper.OpenFileWindow("Import " + Text, "", "(*" + m_fileType + ")|*" + m_fileType + ";", true); if (importfiles != null) { foreach (string file in importfiles) { try { File.Copy(file, Program.Config.LauncherDir + m_fileLocation + Path.GetFileNameWithoutExtension(file) + m_fileType); } catch (Exception ex) { MessageBox.Show(ex.Message); } } RefreshFileList(); } }
private void loginBtn_Click(object sender, EventArgs e) { loginBtn.Enabled = false; m_loginTimeOut.Enabled = true; if (usernameInput.Text == "") { MessageBox.Show(Program.LanguageManager.Translation.LoginMsb2); return; } if (passwordInput.Text == "") { MessageBox.Show(Program.LanguageManager.Translation.LoginMsb3); return; } Program.ChatServer.SendPacket(DevServerPackets.Login, JsonSerializer.SerializeToString( new LoginRequest { Username = usernameInput.Text, Password = LauncherHelper.EncodePassword(passwordInput.Text), UID = LauncherHelper.GetUID() })); Program.Config.Password = LauncherHelper.EncodePassword(passwordInput.Text); }
protected override void OnNavigatedTo(NavigationEventArgs e) { // ignore args in case of a back navigation // this fix a problem where the app starts with an arg to display for example a view // then user navigates to another page and hit back // in that case we don't want to handle args if (e.NavigationMode != NavigationMode.Back && e.NavigationMode != NavigationMode.New) { LauncherHelper.TryHandleArgs(e.Parameter); } if (this.viewModel != null && this.viewModel.SelectedMenuItem == null) { this.SetSelectedMenuItem(); } if (this.viewModel != null && !string.IsNullOrEmpty(this.viewModel.SearchText)) { this.NavBarAutoSuggestBox.Text = this.viewModel.SearchText; this.HeaderBarAutoSuggestBox.Text = this.viewModel.SearchText; } }
public Host(bool isranked) { InitializeComponent(); ApplyTranslation(); TimeLimit.SelectedItem = Program.Config.TimeLimit; BanList.SelectedItem = Program.Config.BanList; Mode.SelectedItem = Program.Config.Mode; GameName = LauncherHelper.GenerateString().Substring(0, 5); CardRules.SelectedItem = Program.Config.CardRules; Prerelease.Checked = Program.Config.EnablePrerelease; Priority.Checked = Program.Config.EnablePrority; ShuffleDeck.Checked = Program.Config.DisableShuffleDeck; CheckDeck.Checked = Program.Config.DisableCheckDeck; BanList.Items.AddRange(LauncherHelper.GetBanListArray()); BanList.SelectedItem = Program.Config.BanList; if (BanList.SelectedItem == null && BanList.Items.Count > 0) { BanList.SelectedIndex = 0; } Mode.SelectedIndexChanged += DuelModeChanged; LifePoints.Text = (Mode.SelectedItem.ToString() == "Tag") ? "16000" : "8000"; if (isranked) { Prerelease.Enabled = false; BanList.Enabled = false; Priority.Enabled = false; ShuffleDeck.Enabled = false; CheckDeck.Enabled = false; LifePoints.Enabled = false; TimeLimit.Enabled = false; PasswordInput.Enabled = false; } //CardRules.SelectedIndexChanged += CardRulesChanged; }
private void UpdatePassword_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(currentPassword.Text) || string.IsNullOrEmpty(newPassword.Text) || string.IsNullOrEmpty(confirmPassword.Text)) { MessageBox.Show("Cannot have empty values"); return; } if (newPassword.Text != confirmPassword.Text) { MessageBox.Show("New password does not match the confirm password."); return; } Program.ChatServer.SendPacket(DevServerPackets.UpdatePassword, JsonSerializer.SerializeToString( new LoginRequest() { Username = Program.UserInfo.username, Password = LauncherHelper.EncodePassword(currentPassword.Text), UID = LauncherHelper.EncodePassword(newPassword.Text) })); }