private void SetValues() { Player pl = _players.GetPlayer(_dm.GetPlayerID); if (new string[] { "0", "1", "2", "3" }.Contains(pl.PreviousFile)) { OldDossier.EditValue = pl.PreviousFile; } else { OldDossier.EditValue = "4"; oldSelection.Text = pl.PreviousFile.Insert(4, "-").Insert(7, "-"); } if (new string[] { "0", "1", "2", "3" }.Contains(pl.CurrentFile)) { NewDossier.EditValue = pl.CurrentFile; } else { NewDossier.EditValue = "4"; newSelection.Text = pl.CurrentFile.Insert(4, "-").Insert(7, "-"); } helpProvider1.HelpNamespace = Path.Combine(WOTHelper.GetEXEPath(), "Help", "WoT_Stats.chm"); helpProvider1.SetHelpNavigator(this, HelpNavigator.TopicId); helpProvider1.SetHelpKeyword(this, "420"); }
private void simpleButton1_Click(object sender, EventArgs e) { Player player = pl.GetPlayer(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PlayerID").ToString()); using (frmAddEditPlayer frm = new frmAddEditPlayer(player)) { frm.ShowDialog(); } pl.Refresh(); FillTable(); ControllButtons(); }
void CreateTitle() { this.Text = _title + " (Version : " + Application.ProductVersion + ")"; DossierManager dm; dictPlayers.TryGetValue(_currentPlayer.Replace("_", "*"), out dm); barButtonItem1.Enabled = new FTPDetails().AllowFTP; if (UserSettings.AllowvBAddictUpload || UserSettings.AllowvBAddictUploadDossier || UserSettings.AllowvBAddictUploadDossierBattleResult || UserSettings.AllowvBAddictUploadDossierBattleResultReplay) { STR_ONLINEANALYZER.Enabled = true; PlayerListing pl = new PlayerListing(_message); if (pl.GetPlayer(_currentPlayer).OnlineURL == "#") STR_ONLINEANALYZER.Enabled = false; } else STR_ONLINEANALYZER.Enabled = false; string caption = _currentPlayer + " ("; if (dm != null) { if (dm.GetFileA() != 0 && dm.GetFileB() != 0) { caption += String.Format("{0} To {1}", DateTime.Parse(dm.GetPlayerFileName(dm.GetFileA())).ToString(UserSettings.DateFormat), DateTime.Parse(dm.GetPlayerFileName(dm.GetFileB())).ToString(UserSettings.DateFormat)); } else { if (dm.GetFileA() != 0 && dm.GetFileB() == 0) { caption += String.Format("{0} To {1}", DateTime.Parse(dm.GetPlayerFileName(dm.GetFileA())).ToString(UserSettings.DateFormat), DateTime.Parse(dm.GetPlayerFileName(dm.GetFileA())).ToString(UserSettings.DateFormat)); } else if (dm.GetFileB() != 0 && dm.GetFileA() == 0) { caption += String.Format("{0} To {1}", DateTime.Parse(dm.GetPlayerFileName(dm.GetFileB())).ToString(UserSettings.DateFormat), DateTime.Parse(dm.GetPlayerFileName(dm.GetFileB())).ToString(UserSettings.DateFormat)); } else caption += "No Data"; } barCurrentView.Caption = caption + ")"; Graphics graphics = this.CreateGraphics(); SizeF textSize = graphics.MeasureString(barCurrentView.Caption, barCurrentView.Font); barCurrentView.LeftIndent = int.Parse(Math.Round((Width / 2) - (textSize.Width / 2), 0).ToString()); } }
private void barButtonItem1_ItemClick_1(object sender, ItemClickEventArgs e) { using (PlayerListing pl = new PlayerListing(_message)) { try { Player p = pl.GetPlayer(_currentPlayer); System.Diagnostics.Process.Start(p.OnlineURL); } catch { } } }
private void PlayerRefresh() { try { splashScreenManagerWaitForm.ShowWaitForm(); } catch { } using (PlayerListing pl = new PlayerListing(_message)) { if (pl.Count() == dictPlayers.Count) { foreach (DossierManager item in dictPlayers.Values) { Player player = pl.GetPlayer(item.GetPlayerName); if (item.WatchPath != player.WatchFile || item.FTPFileFetch != (player.Monitor.ToUpper() == "YES" ? true : false)) { item.SetValues(player.WatchFile, player.Monitor.ToUpper() == "YES" ? true : false); _currentStatsFile[player.PlayerID.Replace("_", "*")] = new WOTCompare(new Dossier(item.GetFileB(), item.GetPlayerName, _message).GetStats(), new Dossier(item.GetFileA(), item.GetPlayerName, _message).GetStats()); item.RefreshDossier(); } } } else { if (pl.Count() > dictPlayers.Count) { foreach (KeyValuePair<string, Player> player in pl) { if (!dictPlayers.ContainsKey(player.Value.PlayerID.Replace("_", "*"))) { DossierManager dm = new DossierManager(player.Value.PlayerID, player.Value.WatchFile, player.Value.Monitor, _message, this); dm.CurrentFileChange += new DossierManager_CurrentFileChanged(DossierFileChanged); dm.StartDossierWatch(); dictPlayers.Add(player.Value.PlayerID.Replace("_", "*"), dm); _currentStatsFile.Add(player.Value.PlayerID.Replace("_", "*"), new WOTCompare(new Dossier(dm.GetFileB(), dm.GetPlayerName, _message).GetStats(), new Dossier(dm.GetFileA(), dm.GetPlayerName, _message).GetStats())); dm.RefreshDossier(); CreatePlayerMenu(player.Value.PlayerID); } } } else { List<string> keysToRemove = new List<string>(); foreach (KeyValuePair<string, DossierManager> item in dictPlayers) { if (pl.GetPlayer(item.Value.GetPlayerName).PlayerID == "Unknown") { keysToRemove.Add(item.Key); _currentStatsFile.Remove(item.Key); navBarControl1.Groups.Remove(navBarControl1.Groups[item.Value.GetPlayerName]); } } foreach (string key in keysToRemove) { dictPlayers.Remove(key); } _currentPlayer = ""; _currentPage = ""; } } } if (_currentPlayer == "") { try { navBarControl1.Groups[0].Expanded = true; navBarControl1.Groups[0].ItemLinks[0].PerformClick(); navBarControl1.Groups[0].SelectedLink = navBarControl1.Groups[0].ItemLinks[0]; } catch { if (panelControl1.Controls.Contains(_chart)) { panelControl1.Controls.Remove(_chart); panelControl1.Controls.Add(_browser); _browser.Dock = DockStyle.Fill; } bar3.Visible = false; bar3.Offset = 0; dockPanel2.Visible = false; bar5.Visible = false; bar5.Offset = 0; dockPanelGraph.Visible = false; barLastPlayedGames.Visible = false; barLastPlayedGames.Offset = 0; _browser.DocumentText = new WOTHtml(_message).Blank(); } } else { if (_currentPage != "Compare") CreateWebPage(_currentPage, _currentPlayer); } try { if (splashScreenManagerWaitForm.IsSplashFormVisible) { splashScreenManagerWaitForm.CloseWaitForm(); } } catch { } }
public void UploadToVBAddict(string filePath, string playerID, MessageQueue message) { try { FileInfo toUpload = new FileInfo(filePath); byte[] data = File.ReadAllBytes(filePath); HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.vbaddict.net/xxx.php"); request.Proxy.Credentials = CredentialCache.DefaultCredentials; request.Method = "PUT"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = data.Length; request.Headers.Clear(); request.Referer = toUpload.Name; request.UserAgent = "WOTStatistics 2.1.0.0"; request.ServicePoint.Expect100Continue = false; using (Stream stream = request.GetRequestStream()) { stream.Write(data, 0, data.Length); } var response = request.GetResponse(); Stream outStream = response.GetResponseStream(); StreamReader reader = new StreamReader(outStream); // Read the content. string responseFromServer = reader.ReadToEnd(); if (responseFromServer.Contains("SUCCESS")) { using (PlayerListing pl = new PlayerListing(new MessageQueue())) { if (pl.GetPlayer(playerID).OnlineURL == "#") { pl.SetPlayerOnlineURL(playerID, responseFromServer.Substring(responseFromServer.IndexOf("Link: ") + 6).Replace("SUCCESS", "")); try { pl.Save(); } catch { } } } } response.Close(); } catch (Exception ex) { message.Add(ex.Message); } }