public Updater()
 {
     InitializeComponent();
     webDownloader.DownloadFileCompleted   += webDownloader_DownloadFileCompleted;
     webDownloader.DownloadProgressChanged += webDownloader_DownloadProgressChanged;
     var mainINI = new Utilities.INIFile(AppDomain.CurrentDomain.BaseDirectory + @"\config.ini");
 }
Exemple #2
0
 private void WriteV(Utilities.INIFile inf, String section, String key, String value)
 {
     try
     {
         inf.IniWriteValue(section, key, value);
     }
     catch (Exception)
     {
     }
 }
Exemple #3
0
 private string ReadV(Utilities.INIFile inf, String section, String key)
 {
     try
     {
         return(inf.IniReadValue(section, key));
     }
     catch (Exception)
     {
     }
     return(null);
 }
Exemple #4
0
        public StartWindow()
        {
            logFile.WriteLine("START SCREEN - START");
            InitializeComponent();
            logFile.WriteLine("START SCREEN - Loading Configs");
            cfgFile = new Utilities.INIFile(AppDomain.CurrentDomain.BaseDirectory + @"\config.ini");

            if (cfgFile.IniReadValue("Main", "CheckForUpdates").ToLower() == "true")
            {
                try
                {
                    logFile.WriteLine("CHECKING FOR UPDATES - START");
                    var fvi      = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
                    var version  = Version.Parse(fvi.FileVersion);
                    var response = Updater.CheckForUpdates(version);
                    if (response != null)
                    {
                        if (MessageBox.Show(this,
                                            "A new version is available for download (" + response + ")\nDo you wish to update CELO?",
                                            "Update Available", MessageBoxButton.YesNo, MessageBoxImage.Information) ==
                            MessageBoxResult.Yes)
                        {
                            var dp = new Updater();
                            dp.ShowDialog();
                        }
                    }
                }
                catch (Exception ex)
                {
                    logFile.WriteLine("EXCEPTION: " + ex);
                }

                logFile.WriteLine("CHECKING FOR UPDATES - ENDED");
            }

            if (cfgFile.IniReadValue("Main", "ShowStartScreen").ToLower() == "false")
            {
                logFile.WriteLine("START SCREEN - Bypassed (Config)");
                var mn = new MainWindow();
                mn.Show();
                Close();
            }
            else
            {
                logFile.WriteLine("START SCREEN - Loading sounds");
                sp = new SoundPlayer(Properties.Resources.btnStart);
                sp.Load();
                logFile.WriteLine("START SCREEN - Loading sounds FINISHED");
            }
        }
Exemple #5
0
        private void btnBrowseOutput_Click(object sender, RoutedEventArgs e)
        {
            var fd = new FolderBrowserDialog();

            using (fd)
            {
                if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    tBoxOutput.Text = fd.SelectedPath;
                    var inif = new Utilities.INIFile(MainWindow._AssemblyDir + @"\config.ini");
                    inif.IniWriteValue("HotKey", "Output", tBoxOutput.Text);
                }
            }
        }
Exemple #6
0
        public Replay_Uploader(string docPath, string filename, int game = 0)
        {
            mainINI          = new Utilities.INIFile(AppDomain.CurrentDomain.BaseDirectory + @"\config.ini");
            bgWorker.DoWork += BgWorker_DoWork;
            var feature = FEATURE_DISABLE_NAVIGATION_SOUNDS;

            CoInternetSetFeatureEnabled(feature, SET_FEATURE_ON_PROCESS, true);
            replayPath = docPath + @"\playback\" + filename;
            InitializeComponent();
            if (game == 0)
            {
                Utilities.showError(this, "This feature is only available on Company of Heroes 2.");
                Close();
            }
            Console.WriteLine(replayPath);
        }
Exemple #7
0
        private void HotKey_Generator_Loaded(object sender, RoutedEventArgs e)
        {
            if (!CheckAutoHotKey())
            {
                if (MessageBox.Show(this,
                                    "CELO will now download AutoHotkey Script compiler. Do you want to continue?",
                                    "AutoHotkey Script Compiler", MessageBoxButton.YesNo, MessageBoxImage.Warning) ==
                    MessageBoxResult.Yes)
                {
                    try
                    {
                        var wb = new WebClient();
                        wb.DownloadFileCompleted += wb_DownloadFileCompleted;
                        using (wb)
                        {
                            wb.DownloadFileAsync(
                                new Uri("http://www.neffware.com/downloads/celo/data/AHK_Compiler.zip"), filename);
                        }
                        var ls = new LoadingScreen(this, "Downloading & Installing AutoHotkey Script Compiler...",
                                                   CheckAutoHotKey);
                        ls.ShowDialog();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                        Utilities.showError(this,
                                            "Could not download or install script compiler. Please try again later");
                    }
                }
                else
                {
                    Close();
                }
            }
            FillKeys();
            FillHelpers();
            FillComboBoxes_1();
            FillComboBoxes_2();
            FillDefaults();
            ApplyDefaults();
            FillConnections();

            var inif = new Utilities.INIFile(MainWindow._AssemblyDir + @"\config.ini");

            tBoxOutput.Text = inif.IniReadValue("HotKey", "Output");
        }
Exemple #8
0
        private void MatchHistoryWindow_Loaded(object sender, RoutedEventArgs e)
        {
            var cfg2 = new Utilities.INIFile(AppDomain.CurrentDomain.BaseDirectory + @"\config.ini");

            if (cfg2.IniReadValue("Match_History_Viewer", "Enabled").ToLower() == "false")
            {
                if (MessageBox.Show(this,
                                    "Match History Viewer feature is currently disabled.\nDo you want to enable it?",
                                    "Match History Viewer", MessageBoxButton.YesNo, MessageBoxImage.Information) ==
                    MessageBoxResult.Yes)
                {
                    cfg2.IniWriteValue("Match_History_Viewer", "Enabled", "true");
                }
                else
                {
                    Close();
                }
            }
            LoadMatches();
            MatchList.ItemsSource = _matches;
        }
        private void repMainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            if (game == 1)
            {
                mainINI = new Utilities.INIFile(AppDomain.CurrentDomain.BaseDirectory + @"\config.ini");
                tabPlayers.IsEnabled = true;
                if (mainINI.IniReadValue("ReplayManager", "ShowChat").ToLower() == "true")
                {
                    isChatEnabled     = true;
                    tabChat.IsEnabled = true;
                }
                else
                {
                    isChatEnabled     = false;
                    tabChat.IsEnabled = false;
                }
            }

            CleanInfo();

            LoadList();
            InitializeFileSystemWatcher();
        }
        public App()
        {
            AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException;
            Current.DispatcherUnhandledException         += Current_DispatcherUnhandledException;
            AppDomain.CurrentDomain.UnhandledException   += CurrentDomain_UnhandledException;
            TaskScheduler.UnobservedTaskException        += TaskScheduler_UnobservedTaskException;
            Current.Exit += Current_Exit;
            cfgFile       = new Utilities.INIFile(AppDomain.CurrentDomain.BaseDirectory + @"\config.ini");
            logFile.CreateNew();


            logFile.WriteLine("CELO - STARTED");
            logFile.WriteLine("CELO VERSION: " + Assembly.GetExecutingAssembly().GetName().Version);
            if (cfgFile.IniReadValue("Main", "HardwareAcceleration").ToLower() == "false")
            {
                RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
                logFile.WriteLine("CELO - WPF Hardware Acceleration: FALSE");
            }
            else
            {
                logFile.WriteLine("CELO - WPF Hardware Acceleration: TRUE");
            }
        }
Exemple #11
0
        private void rpl_MouseDown(object sender, MouseButtonEventArgs e)
        {
            var _cfgDocPath = "";
            var vImg        = sender as Image;
            var mc          = vImg.DataContext as Match;

            var cfg = new Utilities.INIFile(AppDomain.CurrentDomain.BaseDirectory + @"\config.ini");

            if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\config.ini"))
            {
                _cfgDocPath = cfg.IniReadValue("Essencial", "CoH" + (_gameSelected + 1) + "_DocPath");
            }

            if (MessageBox.Show(this, "Do you want to copy this replay to playback folder?", "Copy Replay",
                                MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                var inp = new InputBox("Write a name for the replay:", "Replay name",
                                       mc.MapName + "_" + DateTime.Now.ToString("M"));
                inp.ShowDialog();
                try
                {
                    logFile.WriteLine("MATCH HISTORY VIEWER - START COPYING REPLAY");
                    var value = inp.val.Replace(".rec", "");

                    File.Copy(MainWindow._AssemblyDir + @"\data\history\coh" + (_gameSelected + 1) + @"\replays\" +
                              mc.ReplayFileName, _cfgDocPath + @"\playback\" + value + ".rec", true);
                    Utilities.showMessage(this, "Replay saved.\nLocation:" + _cfgDocPath + @"\playback\" + value + ".rec",
                                          "Saved");
                }
                catch (Exception ex)
                {
                    logFile.WriteLine("EXCEPTION Copying replay (MHV): " + ex);
                }
                logFile.WriteLine("MATCH HISTORY VIEWER - ENDED COPYING REPLAY");
            }
        }
        private void DisplayerWindow_Loaded(object sender, RoutedEventArgs e)
        {
            cfg  = new Utilities.INIFile(AppDomain.CurrentDomain.BaseDirectory + @"\lsd.ini");
            cfg2 = new Utilities.INIFile(AppDomain.CurrentDomain.BaseDirectory + @"\config.ini");
            if (cfg2.IniReadValue("Livestream_Displayer", "Enabled").ToLower() == "false")
            {
                if (MessageBox.Show(this,
                                    "Livestream Displayer feature is currently disabled.\nDo you want to enable it?",
                                    "Livestream Displayer", MessageBoxButton.YesNo, MessageBoxImage.Information) ==
                    MessageBoxResult.Yes)
                {
                    cfg2.IniWriteValue("Livestream_Displayer", "Enabled", "true");
                }
                else
                {
                    Close();
                }
            }
            if (!String.IsNullOrEmpty(cfg2.IniReadValue("Livestream_Displayer", "OutputFolder")))
            {
                OutputFolder = cfg2.IniReadValue("Livestream_Displayer", "OutputFolder");
            }
            else
            {
                OutputFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
                               @"\CELO\Livestream Displayer";
            }
            Directory.CreateDirectory(OutputFolder);

            if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\lsd.ini"))
            {
                for (var p = 0; p < PlayersContent.Length; p++)
                {
                    PlayersContent[p] = cfg.IniReadValue("Players", "P" + (p + 1));
                }
            }
            else
            {
                for (var p = 0; p < PlayersContent.Length; p++)
                {
                    PlayersContent[p] = "%NICK% Ladder rank is %RANK% with a total of %HOURS% hours played";
                }
                tBox_FileContent.Text = "%NICK% Ladder rank is %RANK% with a total of %HOURS% hours played";

                FixText();
                for (var i = 0; i < PlayersContent.Length; i++)
                {
                    cfg.IniWriteValue("Players", "P" + (i + 1), tBox_FileContent.Text);
                }
                for (var p = 0; p < PlayersContent.Length; p++)
                {
                    File.WriteAllText(OutputFolder + @"\player_" + (p + 1) + ".txt", "", Encoding.UTF8);
                }
            }

            for (var p = 0; p < PlayersContent.Length; p++)
            {
                PlayersContent[p] = cfg.IniReadValue("Players", "P" + (p + 1));
            }
            tBox_FileContent.Text = PlayersContent[playerListBox.SelectedIndex];
            Last           = PlayersContent[playerListBox.SelectedIndex];
            tBox_path.Text = OutputFolder;
            cfg2.IniWriteValue("Livestream_Displayer", "OutputFolder", tBox_path.Text);
        }
Exemple #13
0
 public Preferences(bool first = false)
 {
     InitializeComponent();
     isFirstTime = first;
     mainINI     = new Utilities.INIFile(AppDomain.CurrentDomain.BaseDirectory + @"\config.ini");
 }