示例#1
0
        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");
        }
示例#2
0
        private void ctxMiscellaneous_Load(object sender, EventArgs e)
        {
            STR_FONTSIZE.Text     = Translations.TranslationGet("STR_FONTSIZE", "DE", "Font Size");
            STR_HEADING.Text      = Translations.TranslationGet("STR_HEADING", "DE", "HTML Heading :");
            STR_DETAIL.Text       = Translations.TranslationGet("STR_DETAIL", "DE", "HTML Detail :");
            STR_IMAGES.Text       = Translations.TranslationGet("STR_IMAGES", "DE", "Images");
            CHKBOX_SHOWICONS.Text = Translations.TranslationGet("CHKBOX_SHOWICONS", "DE", "Show Thumbs Up/Down Icons");
            STR_FORMATS.Text      = Translations.TranslationGet("STR_FORMATS", "DE", "Date/Time Format");
            STR_DATE.Text         = Translations.TranslationGet("STR_DATE", "DE", "Date :");
            CHKBOX_TIMESTAMP.Text = Translations.TranslationGet("CHKBOX_TIMESTAMP", "DE", "Display Time Stamp (where applicable)");
            STR_TIME.Text         = Translations.TranslationGet("STR_TIME", "DE", "Time :");
            STR_LBLLANG.Text      = Translations.TranslationGet("STR_LBLLANG", "DE", "Language :");
            STR_CAPTRANS.Text     = Translations.TranslationGet("STR_CAPTRANS", "DE", "Translations");
            STR_CAPTOPLIST.Text   = Translations.TranslationGet("STR_CAPTOPLIST", "DE", "Top 5 Lists");
            STR_LBLTOPLIST.Text   = Translations.TranslationGet("STR_LBLTOPLIST", "DE", "Minimum No of Battles : ");
            //STR_RATINGSYSTEM.Text = Translations.TranslationGet("STR_RATINGSYSTEM", "DE", "System : ");
            //STR_GROUPRATINGSYSTEM.Text = Translations.TranslationGet("STR_GROUPRATINGSYSTEM", "DE", "Rating System");

            Form           pForm = ParentForm;
            PropertyFields field;

            ((frmSetup)pForm)._propertyFields.TryGetValue("HTMLHeaderFont", out field);
            txtHTMLHeading.Text = field.NewValue.ToString();

            ((frmSetup)pForm)._propertyFields.TryGetValue("HTMLCellFont", out field);
            txtHTMLDetail.Text = field.NewValue.ToString();

            ((frmSetup)pForm)._propertyFields.TryGetValue("TopMinPlayed", out field);
            textMinNoGames.Text = field.NewValue.ToString();

            ((frmSetup)pForm)._propertyFields.TryGetValue("HTMLShowMovementPics", out field);
            CHKBOX_SHOWICONS.Checked = Convert.ToBoolean(field.NewValue);

            ((frmSetup)pForm)._propertyFields.TryGetValue("DateFormat", out field);
            comboDateFormat.Text = Convert.ToString(field.NewValue);

            ((frmSetup)pForm)._propertyFields.TryGetValue("TimeStamp", out field);
            CHKBOX_TIMESTAMP.Checked = Convert.ToBoolean(field.NewValue);

            ((frmSetup)pForm)._propertyFields.TryGetValue("TimeFormat", out field);
            comboTimeFormat.Text = Convert.ToString(field.NewValue);

            comboTimeFormat.Enabled = CHKBOX_TIMESTAMP.Checked;



            //((frmSetup)pForm)._propertyFields.TryGetValue("RatingSystem", out field);
            //comboRatingSystem.SelectedItem = Convert.ToString(field.NewValue);
            WOTHelper.AddToLog("Adding Languages ");
            foreach (KeyValuePair <string, Languages> lang in Translations.LanguageListGet().OrderBy(x => x.Value.English))
            {
                WOTHelper.AddToLog("Adding Language: " + lang.Value.English);
                comboLangID.Properties.Items.Add(lang.Value.English);
            }

            ((frmSetup)pForm)._propertyFields.TryGetValue("LangID", out field);
            string setLangID = Convert.ToString(field.NewValue);

            comboLangID.SelectedItem = Translations.LanguageGet(setLangID, Language.English);
        }
示例#3
0
 public frmDefineCharts(MessageQueue message)
 {
     InitializeComponent();
     helpProvider1.HelpNamespace = Path.Combine(WOTHelper.GetEXEPath(), "Help", "WoT_Stats.chm");
     helpProvider1.SetHelpNavigator(this, HelpNavigator.TopicId);
     helpProvider1.SetHelpKeyword(this, "520");
 }
示例#4
0
        private void frmController_Load(object sender, EventArgs e)
        {
            Visible = false;

            if (WOTHelper.FindProcess("WOT.Stats"))
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("WOT Statistics is already running", "WOT Statistics", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.Close();
            }
            else
            {
                if (UserSettings.MinimiseonStartup == true)
                {
                    WOTTrayApp sysTray = new WOTTrayApp();
                    sysTray.Show();
                }
                else
                {
                    using (frmMain wotGUI = new frmMain())
                    {
                        wotGUI.ShowDialog();
                    }
                }
            }
        }
示例#5
0
 public frmDefineGroupings()
 {
     InitializeComponent();
     helpProvider1.HelpNamespace = Path.Combine(WOTHelper.GetEXEPath(), "Help", "WoT_Stats.chm");
     helpProvider1.SetHelpNavigator(this, HelpNavigator.TopicId);
     helpProvider1.SetHelpKeyword(this, "500");
 }
示例#6
0
 public frmAddEditPlayer()
 {
     InitializeComponent();
     Text = Translations.TranslationGet("WNDCAPTION_ADDPLAYER", "DE", "Add Player");
     helpProvider1.HelpNamespace = Path.Combine(WOTHelper.GetEXEPath(), "Help", "WoT_Stats.chm");
     helpProvider1.SetHelpNavigator(this, HelpNavigator.TopicId);
     helpProvider1.SetHelpKeyword(this, "120");
 }
示例#7
0
        private void butSave_Click(object sender, EventArgs e)
        {
            if (txtGroupName.Text != "")
            {
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(WOTHelper.GetUserFile());
                XmlElement  root            = xmlDoc.DocumentElement;
                XmlNodeList oldCustomGroups = root.SelectNodes(string.Format(@"CustomGroups/CustomGroup[@Name=""{0}""]", _ID.Replace(" ", "_")));
                XmlNode     customGroups    = root.SelectSingleNode("CustomGroups");
                XmlElement  customGroup     = null;
                if (oldCustomGroups.Count != 0)
                {
                    foreach (XmlNode item in oldCustomGroups)
                    {
                        customGroup = (XmlElement)item;
                    }
                    customGroup.SetAttribute("Caption", txtGroupName.Text);
                }
                else
                {
                    if (_ID == "")
                    {
                        _ID = Guid.NewGuid().ToString();
                    }

                    customGroup = xmlDoc.CreateElement("CustomGroup");
                    customGroup.SetAttribute("Name", _ID);
                    customGroup.SetAttribute("Caption", txtGroupName.Text);
                }

                customGroup.InnerText = "";
                foreach (ListViewItem selected in tankListView.CheckedItems)
                {
                    if (customGroup.InnerText.Length > 0)
                    {
                        customGroup.InnerText += "|";
                    }

                    customGroup.InnerText += selected.Name;
                }

                if (oldCustomGroups.Count == 0)
                {
                    customGroups.AppendChild(customGroup);
                }

                xmlDoc.Save(WOTHelper.GetUserFile());
            }
            else
            {
                DevExpress.XtraEditors.XtraMessageBox.Show(Translations.TranslationGet("STR_CUSTOMGROUPSAVENOTICE", "DE", "Please specify a group name."), "WOT Statistics", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtGroupName.Focus();
                return;
            }

            Close();
        }
示例#8
0
        public void LoadPage(string sURL)
        {
            WOTHelper.AddToLog("Loading Release Notes: " + sURL);

            oWeb.Navigate(sURL);

            WOTHelper.AddToLog("Loaded");

            oWeb.NewWindow  += new System.ComponentModel.CancelEventHandler(this.oWeb_NewWindow);
            oWeb.Navigating += new System.Windows.Forms.WebBrowserNavigatingEventHandler(this.oWeb_Navigating);
        }
示例#9
0
        public frmUpdater()
        {
            InitializeComponent();
            WOTHelper.CreateAppDataFolder();

            if (!File.Exists(WOTHelper.GetUserFile()))
            {
                File.Copy(Path.Combine(WOTHelper.GetEXEPath(), "User.xml"), WOTHelper.GetUserFile());
            }

            prgBarProgress.CustomDisplayText += prgBarProgress_CustomDisplayText;
        }
示例#10
0
        private void oWeb_NewWindow(object sender, CancelEventArgs e)
        {
            try
            {
                System.Diagnostics.Process.Start(oWeb.StatusText.ToString());
            }
            catch (Exception ex)
            {
                WOTHelper.AddToLog("Cannot open Webpage: " + oWeb.StatusText.ToString() + " " + ex.Message);
            }

            e.Cancel = true;
        }
示例#11
0
 private void simpleButton2_Click(object sender, EventArgs e)
 {
     using (PlayerListing pl = new PlayerListing(new MessageQueue()))
     {
         pl.SetPlayer(txtPlayerID.Text, txtPlayerID.Text, txtPlayerRealm.Text, txtWatchFile.Text, checkFTPFile.Checked);
         pl.Save();
         if (!File.Exists(Path.Combine(WOTHelper.GetApplicationData(), "Hist_" + txtPlayerID.Text, "LastBattle", "WOTSStore.db")))
         {
             Directory.CreateDirectory(Path.Combine(WOTHelper.GetApplicationData(), "Hist_" + txtPlayerID.Text, "LastBattle"));
             DatabaseSanityChecker.Create(Path.Combine(WOTHelper.GetApplicationData(), "Hist_" + txtPlayerID.Text, "LastBattle", "WOTSStore.db"));
         }
     }
     Close();
 }
示例#12
0
        public void bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            _done = true;

            Thread.Sleep(1000);

            //###########
            //this.Close();
            //Close();
            //Application.Exit();
            //###########



            this.Hide();
            this.Close();
            if (UserSettings.MinimiseonStartup == true)
            {
                WOTTrayApp sysTray = new WOTTrayApp();
                sysTray.Show();
            }
            else
            {
                if (WOTStatistics.Core.UserSettings.AppVersion != WOTStatistics.Core.UserSettings.LastReleaseNotes)
                {
                    try
                    {
                        WOTStatistics.Core.UserSettings.LastReleaseNotes = WOTStatistics.Core.UserSettings.AppVersion;
                        string       sVersion = "ReleaseNote_" + WOTStatistics.Core.UserSettings.AppVersion.Replace(".", string.Empty) + ".htm";
                        ReleaseNotes oRN      = new ReleaseNotes();
                        oRN.LoadPage(Path.Combine(WOTStatistics.Core.WOTHelper.GetApplicationData(), sVersion));
                        oRN.ShowDialog();
                        oRN.BringToFront();
                    }
                    catch (Exception exrn)
                    {
                        WOTHelper.AddToLog("Release Notes: " + exrn.Message);
                    }
                }


                frmMain frm = new frmMain();
                WOTHelper.AddToLog("Starting Main Form...");
                frm.Show();
                WOTHelper.AddToLog("Starting Main Form DONE");
            }

            _workerThread.Dispose();
            this.Dispose();
        }
示例#13
0
        void ListViewSettings()
        {
            tankListView.View = View.Details;
            tankListView.Columns.Add(Translations.TranslationGet("HTML_HEAD_TANK", "DE", "Tank"));
            tankListView.Columns.Add(Translations.TranslationGet("HTML_HEAD_VEHICLECLASS", "DE", "Vehicle Class"));
            tankListView.Columns.Add(Translations.TranslationGet("HTML_HEAD_VEHICLETIER", "DE", "Vehicle Tier"));


            tankListView.CheckBoxes = true;
            tankListView.ShowGroups = true;
            tankListView.GridLines  = true;

            helpProvider1.HelpNamespace = Path.Combine(WOTHelper.GetEXEPath(), "Help", "WoT_Stats.chm");
            helpProvider1.SetHelpNavigator(this, HelpNavigator.TopicId);
            helpProvider1.SetHelpKeyword(this, "500");
        }
示例#14
0
        public clsController()
        {
            //Visible = false;

            if (WOTHelper.FindProcess("WOT.Stats"))
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("WOT Statistics is already running", "WOT Statistics", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                _error = true;
                Application.Exit();
            }
            else
            {
                using (frmUpdater wotGUI = new frmUpdater())
                {
                    wotGUI.ShowDialog();
                }
            }
        }
示例#15
0
        public GraphSetup(MessageQueue message)
        {
            InitializeComponent();

            _message = message;

            _tDescription    = new TankDescriptions(_message);
            _cDescription    = new CountryDescriptions(_message);
            _typeDescription = new TankTypeDescription(_message);
            _graphSettings   = new GraphsSettings(_message);

            helpProvider1.HelpNamespace = Path.Combine(WOTHelper.GetEXEPath(), "Help", "WoT_Stats.chm");

            helpProvider1.SetHelpNavigator(this, HelpNavigator.TopicId);
            helpProvider1.SetHelpKeyword(this, "520");

            ListViewSettings();
            LoadSettings();
        }
示例#16
0
        public frmAddEditPlayer(Player player)
        {
            InitializeComponent();

            txtWatchFile.Text = player.WatchFile;
            txtPlayerID.Text  = player.PlayerID;
            if (player.Monitor.ToUpper() == "YES")
            {
                checkFTPFile.Checked = true;
            }
            else
            {
                checkFTPFile.Checked = false;
            }

            Text = Translations.TranslationGet("WNDCAPTION_EDITPLAYER", "DE", "Edit Player");
            helpProvider1.HelpNamespace = Path.Combine(WOTHelper.GetEXEPath(), "Help", "WoT_Stats.chm");
            helpProvider1.SetHelpNavigator(this, HelpNavigator.TopicId);
            helpProvider1.SetHelpKeyword(this, "120");
        }
示例#17
0
        public WOTTrayApp()
        {
            //WOTHelper.FindandKillProcess("WOT.Stats");

            // Create a simple tray menu with only one item.
            trayMenu = new ContextMenu();
            trayMenu.MenuItems.Add("WOT Statistics", SetupOnClick);
            trayMenu.MenuItems.Add("Exit", OnExit);

            // Create a tray icon. In this example we use a
            // standard system icon for simplicity, but you
            // can of course use your own custom icon too.
            trayIcon              = new NotifyIcon();
            trayIcon.Text         = "WOT Statistics Monitor";
            trayIcon.Icon         = new Icon(new Icon(WOTHelper.GetEXEPath() + @"\wot_statistics.ico"), 40, 40);
            trayIcon.DoubleClick += trayIcon_DoubleClick;
            // Add menu to tray icon and show it.
            trayIcon.ContextMenu = trayMenu;
            trayIcon.Visible     = true;
        }
示例#18
0
        // Public MemoryStream property containing PDF Data

        private void VerifyImages()
        {
            string      tanksWebPath = "wotstatistics/sync/images/tanks/";
            XmlDocument xmlDoc       = new XmlDocument();

            xmlDoc.Load(WOTHelper.GetSettingsFile());
            XmlElement  root  = xmlDoc.DocumentElement;
            XmlNodeList nodes = root.SelectSingleNode(@"Tanks").ChildNodes;

            foreach (XmlNode node in nodes)
            {
                string tankID        = String.Format("{0}_{1}", node.Attributes["Country"].Value, node.Attributes["Code"].Value);
                bool   updatePicture = false;
                try
                {
                    updatePicture = node.Attributes["Update"] == null ? false : bool.Parse(node.Attributes["Update"].Value);
                }
                catch
                {
                    //silently handle the error
                    updatePicture = false;
                }

                //first check if we should update
                if (updatePicture)
                {
                    DownloadFile(tanksWebPath, Path.Combine(WOTHelper.GetApplicationData(), "Images", "Tanks"), tankID + ".png");
                    DownloadFile(tanksWebPath, Path.Combine(WOTHelper.GetApplicationData(), "Images", "Tanks"), tankID + "_Large.png");
                }
                else
                {
                    //only check the small in appdata it is not there we download both'
                    if (!File.Exists(Path.Combine(WOTHelper.GetApplicationData(), "Images", "Tanks", tankID + ".png")))
                    {
                        //ok now check if it exists in the exe path
                        if (!File.Exists(Path.Combine(WOTHelper.GetEXEPath(), "Images", "Tanks", tankID + ".png")))
                        {
                            //Download both the normal and large file
                            DownloadFile(tanksWebPath, Path.Combine(WOTHelper.GetApplicationData(), "Images", "Tanks"), tankID + ".png");
                            DownloadFile(tanksWebPath, Path.Combine(WOTHelper.GetApplicationData(), "Images", "Tanks"), tankID + "_Large.png");
                        }

                        //ok now check if the large file exists in the appdata path
                        if (!File.Exists(Path.Combine(WOTHelper.GetApplicationData(), "Images", "Tanks", tankID + "_Large.png")))
                        {
                            //ok now check if the large file exists in the exe path
                            if (!File.Exists(Path.Combine(WOTHelper.GetEXEPath(), "Images", "Tanks", tankID + "_Large.png")))
                            {
                                //Download both the large file
                                DownloadFile(tanksWebPath, Path.Combine(WOTHelper.GetApplicationData(), "Images", "Tanks"), tankID + "_Large.png");
                            }
                        }
                    }
                    else
                    {
                        //Okay we found the small one in appdata now check for big one
                        if (!File.Exists(Path.Combine(WOTHelper.GetApplicationData(), "Images", "Tanks", tankID + "_Large.png")))
                        {
                            //download Large file
                            DownloadFile(tanksWebPath, Path.Combine(WOTHelper.GetApplicationData(), "Images", "Tanks"), tankID + "_Large.png");
                        }
                    }
                }
            }
        }
示例#19
0
        private void CustomGroupings_Load(object sender, EventArgs e)
        {
            Text = Translations.TranslationGet("STR_CUSTGROUPINGS", "DE", "Custom Groupings");
            HTML_GROUPNAME.Text = Translations.TranslationGet("HTML_GROUPNAME", "DE", "Group Name");
            BTN_SAVE.Text       = Translations.TranslationGet("BTN_SAVE", "DE", "Save");
            BTN_CLOSE.Text      = Translations.TranslationGet("BTN_CLOSE", "DE", "Close");

            FormHelpers.ResizeLables(this.Controls);

            txtGroupName.Left = HTML_GROUPNAME.Left + HTML_GROUPNAME.Width + 5;
            if (this.ClientRectangle.Width - (HTML_GROUPNAME.Left + HTML_GROUPNAME.Width + 10) < txtGroupName.Width)
            {
                txtGroupName.Width = this.ClientRectangle.Width - (HTML_GROUPNAME.Left + HTML_GROUPNAME.Width + 10);
            }

            imageList1.ColorDepth = ColorDepth.Depth32Bit;
            imageList1.ImageSize  = new Size(50, 24);

            foreach (KeyValuePair <int, string> country in _cDescription)
            {
                tankListView.Groups.Add(new ListViewGroup(country.Key.ToString(), country.Value)
                {
                    HeaderAlignment = HorizontalAlignment.Center
                });
            }


            foreach (KeyValuePair <TankKey, TankValue> tank in _tDescription.OrderBy(x => x.Value.Tier).ThenBy(y => y.Value.TankType).Where(z => z.Value.Active == true))
            {
                ListViewItem newListViewItem = new ListViewItem(tank.Value.Description, 0, tankListView.Groups[tank.Key.CountryID.ToString()]);
                newListViewItem.Name = tank.Key.CountryID + "_" + tank.Key.TankID;
                ListViewItem.ListViewSubItem subItem1 = new ListViewItem.ListViewSubItem(newListViewItem, _typeDescription.Description(tank.Value.TankType));
                ListViewItem.ListViewSubItem subItem2 = new ListViewItem.ListViewSubItem(newListViewItem, tank.Value.Tier.ToString());
                newListViewItem.SubItems.Add(subItem1);
                newListViewItem.SubItems.Add(subItem2);

                try
                {
                    if (!imageList1.Images.ContainsKey(String.Format("{0}_{1}", tank.Key.CountryID, tank.Key.TankID)))
                    {
                        imageList1.Images.Add(String.Format("{0}_{1}", tank.Key.CountryID, tank.Key.TankID), Image.FromFile(String.Format(@"{0}", WOTHelper.GetImagePath(tank.Key.CountryID + "_" + tank.Key.TankID + "_Large.png"))));
                    }

                    newListViewItem.ImageKey = String.Format("{0}_{1}", tank.Key.CountryID, tank.Key.TankID);
                }
                catch { }
                tankListView.Items.Add(newListViewItem);
            }


            if (_ID != "")
            {
                List <string> list = _customGrouping.Values(_ID).Split('|').ToList <string>();

                foreach (string item in list)
                {
                    if (tankListView.Items[item] != null)
                    {
                        tankListView.Items[item].Checked = true;
                    }
                }
            }


            tankListView.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
            tankListView.Columns[1].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
            tankListView.Columns[2].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
        }
示例#20
0
        public frmSetup(string page)
        {
            _propertyFields.Add("StartMonOnStartUp", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.StartMonOnStartUp, NewValue = UserSettings.StartMonOnStartUp
            });
            _propertyFields.Add("LaunchWithWindows", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.LaunchWithWindows, NewValue = UserSettings.LaunchWithWindows
            });
            _propertyFields.Add("MinimiseonStartup", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.MinimiseonStartup, NewValue = UserSettings.MinimiseonStartup
            });
            _propertyFields.Add("MinimiseToTray", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.MinimiseToTray, NewValue = UserSettings.MinimiseToTray
            });
            _propertyFields.Add("LastPlayedCompare", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.LastPlayedCompare, NewValue = UserSettings.LastPlayedCompare
            });
            _propertyFields.Add("AllowVersionCheck", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.AllowVersionCheck, NewValue = UserSettings.AllowVersionCheck
            });
            _propertyFields.Add("VersionCounter", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.VersionCounter, NewValue = UserSettings.VersionCounter
            });
            _propertyFields.Add("SystemFont", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.SystemFont, NewValue = UserSettings.SystemFont
            });
            _propertyFields.Add("HTMLCellFont", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.HTMLCellFont, NewValue = UserSettings.HTMLCellFont
            });
            _propertyFields.Add("HTMLHeaderFont", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.HTMLHeaderFont, NewValue = UserSettings.HTMLHeaderFont
            });
            _propertyFields.Add("HTMLTankInfoHeader", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.HTMLTankInfoHeader, NewValue = UserSettings.HTMLTankInfoHeader
            });
            _propertyFields.Add("HTMLShowMovementPics", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.HTMLShowMovementPics, NewValue = UserSettings.HTMLShowMovementPics
            });
            _propertyFields.Add("KillCountsShowTierTotals", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.KillCountsShowTierTotals, NewValue = UserSettings.KillCountsShowTierTotals
            });
            _propertyFields.Add("KillCountsShowRowTotals", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.KillCountsShowRowTotals, NewValue = UserSettings.KillCountsShowRowTotals
            });
            _propertyFields.Add("KillCountsShowColumnTotals", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.KillCountsShowColumnTotals, NewValue = UserSettings.KillCountsShowColumnTotals
            });
            _propertyFields.Add("DateFormat", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.DateFormat, NewValue = UserSettings.DateFormat
            });
            _propertyFields.Add("TimeStamp", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.TimeStamp, NewValue = UserSettings.TimeStamp
            });
            _propertyFields.Add("TimeFormat", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.TimeFormat, NewValue = UserSettings.TimeFormat
            });
            _propertyFields.Add("GroupLPT", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.GroupLPT, NewValue = UserSettings.GroupLPT
            });
            _propertyFields.Add("AllowvBAddictUpload", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.AllowvBAddictUpload, NewValue = UserSettings.AllowvBAddictUpload
            });
            _propertyFields.Add("AllowvBAddictUploadDossier", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.AllowvBAddictUploadDossier, NewValue = UserSettings.AllowvBAddictUploadDossier
            });
            _propertyFields.Add("AllowvBAddictUploadDossierBattleResult", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.AllowvBAddictUploadDossierBattleResult, NewValue = UserSettings.AllowvBAddictUploadDossierBattleResult
            });
            _propertyFields.Add("AllowvBAddictUploadDossierBattleResultReplay", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.AllowvBAddictUploadDossierBattleResultReplay, NewValue = UserSettings.AllowvBAddictUploadDossierBattleResultReplay
            });
            _propertyFields.Add("LastPlayedCompareQuota", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.LastPlayedCompareQuota, NewValue = UserSettings.LastPlayedCompareQuota
            });
            _propertyFields.Add("ColorPositive", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.ColorPositive, NewValue = UserSettings.ColorPositive
            });
            _propertyFields.Add("ColorNeutral", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.ColorNeutral, NewValue = UserSettings.ColorNeutral
            });
            _propertyFields.Add("ColorNegative", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.ColorNegative, NewValue = UserSettings.ColorNegative
            });
            _propertyFields.Add("ChartAppearance", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.ChartAppearance, NewValue = UserSettings.ChartAppearance
            });
            _propertyFields.Add("ChartPalette", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.ChartPalette, NewValue = UserSettings.ChartPalette
            });
            _propertyFields.Add("colorWNClass1", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.colorWNClass1, NewValue = UserSettings.colorWNClass1
            });
            _propertyFields.Add("colorWNClass2", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.colorWNClass2, NewValue = UserSettings.colorWNClass2
            });
            _propertyFields.Add("colorWNClass3", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.colorWNClass3, NewValue = UserSettings.colorWNClass3
            });
            _propertyFields.Add("colorWNClass4", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.colorWNClass4, NewValue = UserSettings.colorWNClass4
            });
            _propertyFields.Add("colorWNClass5", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.colorWNClass5, NewValue = UserSettings.colorWNClass5
            });
            _propertyFields.Add("colorWNClass6", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.colorWNClass6, NewValue = UserSettings.colorWNClass6
            });
            _propertyFields.Add("colorWNClass7", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.colorWNClass7, NewValue = UserSettings.colorWNClass7
            });
            _propertyFields.Add("colorWNClass8", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.colorWNClass8, NewValue = UserSettings.colorWNClass8
            });
            _propertyFields.Add("colorWNClass9", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.colorWNClass9, NewValue = UserSettings.colorWNClass9
            });
            _propertyFields.Add("Cloud_Allow", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.Cloud_Allow, NewValue = UserSettings.Cloud_Allow
            });
            _propertyFields.Add("Cloud_Path", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.Cloud_Path, NewValue = UserSettings.Cloud_Path
            });
            _propertyFields.Add("TimeAdjustment", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.TimeAdjustment, NewValue = UserSettings.TimeAdjustment
            });
            _propertyFields.Add("TopMinPlayed", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.TopMinPlayed, NewValue = UserSettings.TopMinPlayed
            });
            _propertyFields.Add("LangID", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.LangID, NewValue = UserSettings.LangID
            });
            //_propertyFields.Add("RatingSystem", new PropertyFields() { FieldType = typeof(string), OldValue = UserSettings.RatingSystem, NewValue = UserSettings.RatingSystem });

            _propertyFields.Add("AutoCreateSession", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.AutoCreateSession, NewValue = UserSettings.AutoCreateSession
            });
            _propertyFields.Add("AutoSessionOnStartUp", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.AutoSessionOnStartUp, NewValue = UserSettings.AutoSessionOnStartUp
            });
            _propertyFields.Add("AutoSessionOnStartUpMessage", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.AutoSessionOnStartUpMessage, NewValue = UserSettings.AutoSessionOnStartUpMessage
            });
            _propertyFields.Add("AutoSessionXBattles", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.AutoSessionXBattles, NewValue = UserSettings.AutoSessionXBattles
            });
            _propertyFields.Add("AutoSessionXBattlesMessage", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.AutoSessionXBattlesMessage, NewValue = UserSettings.AutoSessionXBattlesMessage
            });
            _propertyFields.Add("AutoSessionXBattlesValue", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.AutoSessionXBattlesValue, NewValue = UserSettings.AutoSessionXBattlesValue
            });
            _propertyFields.Add("AutoSessionXHours", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.AutoSessionXHours, NewValue = UserSettings.AutoSessionXHours
            });
            _propertyFields.Add("AutoSessionXHoursMessage", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.AutoSessionXHoursMessage, NewValue = UserSettings.AutoSessionXHoursMessage
            });
            _propertyFields.Add("AutoSessionXHoursValue", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = UserSettings.AutoSessionXHoursValue, NewValue = UserSettings.AutoSessionXHoursValue
            });


            FTPDetails ftpDetails = new FTPDetails();

            _propertyFields.Add("FTP_AllowFTP", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = ftpDetails.AllowFTP, NewValue = ftpDetails.AllowFTP
            });
            _propertyFields.Add("FTP_Host", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = ftpDetails.Host, NewValue = ftpDetails.Host
            });
            _propertyFields.Add("FTP_UserID", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = ftpDetails.UserID, NewValue = ftpDetails.UserID
            });
            _propertyFields.Add("FTP_UserPWD", new PropertyFields()
            {
                FieldType = typeof(string), OldValue = ftpDetails.UserPWD, NewValue = ftpDetails.UserPWD
            });



            InitializeComponent();
            treeList1.ExpandAll();
            treeList1.Columns[0].SortOrder = SortOrder.None;

            if (page == "LastPlayedTanks")
            {
                SetNodeFocus(Translations.TranslationGet("STR_RECENTBATTLES", "DE", "Recent Battles"));
            }
            else if (page == "KillCounts")
            {
                SetNodeFocus(Translations.TranslationGet("STR_KILLCOUNTS", "DE", "Kill Counts"));
            }
            else if (page == "CustomGroupings")
            {
                SetNodeFocus("Custom Grouping");
            }
            else if (page == "Players")
            {
                SetNodeFocus(Translations.TranslationGet("STR_PLAYERS", "DE", "Players"));
            }
            else
            {
            }

            helpProvider1.HelpNamespace = Path.Combine(WOTHelper.GetEXEPath(), "Help", "WoT_Stats.chm");
        }
示例#21
0
        public VersionChecker(string productVersion)
        {
            MemoryStream versionMS  = GetWebVersion;
            StreamReader sr         = new StreamReader(versionMS);
            string       versions   = sr.ReadToEnd();
            string       webVersion = versions.Split('|')[0];
            Version      v1         = new Version(webVersion);
            Version      v2         = new Version(productVersion);

            switch (v1.CompareTo(v2))
            {
            case 0:
                UpdateAvailable = false;
                break;

            case 1:
                UpdateAvailable = true;
                break;

            case -1:
                UpdateAvailable = false;
                break;

            default:
                UpdateAvailable = false;
                break;
            }

            SiteVersion = webVersion;

            try
            {
                string settingFileVersion = versions.Split('|')[1];
                if (settingFileVersion != UserSettings.SettingsFileVersion)
                {
                    DownloadFile("wotstatistics/sync/", WOTHelper.GetApplicationData(), "settings.xml");
                    Task.Factory.StartNew(() => VerifyImages());
                    UserSettings.SettingsFileVersion = settingFileVersion;
                }
            }
            catch { }

            try
            {
                string translationFileVersion = versions.Split('|')[2];
                if (translationFileVersion != UserSettings.TranslationFileVersion)
                {
                    DownloadFile("wotstatistics/sync/", WOTHelper.GetApplicationData(), "translations.xml");
                    UserSettings.TranslationFileVersion = translationFileVersion;
                    Translations.Reload();
                }
            }
            catch { }

            try
            {
                string WN8ExpectedVersion = versions.Split('|')[5];
                if (WN8ExpectedVersion != UserSettings.WN8ExpectedVersion)
                {
                    DownloadFile("wotstatistics/sync/", WOTHelper.GetApplicationData(), "expected_wn8.xml");
                    UserSettings.WN8ExpectedVersion = WN8ExpectedVersion;
                }
            }
            catch { }

            try
            {
                string scriptFileVersion = versions.Split('|')[3];
                if (scriptFileVersion != UserSettings.ScriptFileVersion)
                {
                    try
                    {
                        DownloadFile("wotstatistics/sync/", WOTHelper.GetApplicationData() + @"\Scripts", "CustomScript.wss");
                    }
                    catch {}
                    try
                    {
                        DownloadFile("wotstatistics/sync/", WOTHelper.GetApplicationData() + @"\Scripts", "tooltips.js");
                    }
                    catch {}
                    try
                    {
                        DownloadFile("wotstatistics/sync/", WOTHelper.GetApplicationData() + @"\Scripts", "sorttable.js");
                    }
                    catch {}
                    UserSettings.ScriptFileVersion = scriptFileVersion;
                    ScriptWrapper.Initialise(WOTHelper.GetCustomScript());
                }
            }
            catch { ScriptWrapper.Initialise(WOTHelper.GetCustomScript()); }
        }
示例#22
0
        private void ProcessDossierFile(string dossierFilePath, DataTable table, string playerName)
        {
            //System.Diagnostics.Stopwatch digSW = new Stopwatch();
            //digSW.Start();
            string tempFile = Guid.NewGuid().ToString();

            try
            {
                //start dosier decrypt
                Process process = new Process();
                process.StartInfo.CreateNoWindow = false;
                process.StartInfo.WindowStyle    = ProcessWindowStyle.Hidden;
                process.StartInfo.FileName       = _ApplicationPath + "\\python\\wotdc2j.exe";
                process.StartInfo.Arguments      = String.Format(@"""{0}"" ""{1}\\{2}""", dossierFilePath, WOTHelper.GetTempFolder(), tempFile);
                process.Start();
                process.WaitForExit();
                process.Dispose();

                string file = File.ReadAllText(String.Format("{0}\\{1}", WOTHelper.GetTempFolder(), tempFile));
                //File.Delete(String.Format("{0}\\{1}", WOTHelper.GetTempFolder(), tempFile));
                //File.Delete(dossierFilePath);

                var serializer = new JavaScriptSerializer();
                serializer.RegisterConverters(new[] { new DynamicJsonConverter() });
                dynamic obj = serializer.Deserialize(file, typeof(object));

                foreach (var item in obj.tanks)
                {
                    DataRow row = table.NewRow();
                    row.SetField("PlayerName", playerName);
                    row.SetField("Tank", tankDesc.Description((int)item.countryid, (int)item.tankid));
                    row.SetField("LastPlayed", new DateTime(1970, 1, 1, 0, 0, 0).AddSeconds((int)item.updated).AddHours(TimeZoneInfo.Local.BaseUtcOffset.Hours));
                    row.SetField("BattleCount", (int)item.tankdata.battlesCount);
                    row.SetField("Victories", (int)item.tankdata.wins);
                    row.SetField("Defeats", (int)item.tankdata.losses);
                    row.SetField("Draws", (int)item.tankdata.battlesCount - ((int)item.tankdata.wins + (int)item.tankdata.losses));
                    row.SetField("Survived", (int)item.tankdata.survivedBattles);
                    row.SetField("Destroyed", (int)item.tankdata.frags);
                    row.SetField("Detected", (int)item.tankdata.spotted);
                    row.SetField("HitRatio", (double.IsNaN((double)item.tankdata.hits / (double)item.tankdata.shots) ? 0 : (double)item.tankdata.hits / (double)item.tankdata.shots) * 100);
                    row.SetField("Damage", (int)item.tankdata.damageDealt);
                    row.SetField("CapturePoints", (int)item.tankdata.capturePoints);
                    row.SetField("DefencePoints", (int)item.tankdata.droppedCapturePoints);
                    row.SetField("TotalExperience", (int)item.tankdata.xp);
                    row.SetField("AvgExperience", (double)item.tankdata.xp / (double)item.tankdata.battlesCount);
                    row.SetField("AvgDamage", (double)item.tankdata.damageDealt / (double)item.tankdata.battlesCount);
                    row.SetField("AvgDamage", (double)item.tankdata.damageDealt / (double)item.tankdata.battlesCount);
                    row.SetField("Hits", (int)item.tankdata.hits);
                    row.SetField("Shots", (int)item.tankdata.shots);
                    table.Rows.Add(row);
                }

                ((IDisposable)obj).Dispose();
            }
            catch
            {
            }
            finally
            {
                File.Delete(String.Format("{0}\\{1}", WOTHelper.GetTempFolder(), tempFile));
                File.Delete(dossierFilePath);
            }

            // digSW.Stop();
            // _messages.Add("Diagnostics : Dossier Processing Finished in " + digSW.ElapsedMilliseconds + " miliseconds");
        }