public void Initialize() { slickversion = JsonConvert.DeserializeObject <versionfile>(getSlickJson()); if (slickversion == null) { //abort update because of getting a nullvalue from getSlicJson return; } //CheckAvailableUpdates(); }
public MainWindow() { string rawSlickJson = downloader.webRead("http://arma.projectawesome.net/beta/repo/slickupdater/slickversion.json"); slickversion = JsonConvert.DeserializeObject <versionfile>(rawSlickJson); InitializeComponent(); //First launch message! if (Properties.Settings.Default.firstLaunch == true) { MessageBox.Show("Hello! This seems to be the first time you launch SlickUpdater so make sure your arma 3 and ts3 path is set correctly in options. Have a nice day!", "Welcome"); Properties.Settings.Default.firstLaunch = false; } logThread = new logIt(); if (!local) { repoHide(); } FileStream fs = new FileStream("localversion", FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(slickVersion); sw.Close(); #if DEBUG //local debug server for A2 //rawslickServVer = downloader.webRead("http://localhost/repo/slickupdater/slickversion"); #endif MenuItem pa = new MenuItem(); pa.Tag = "http://projectawesomemodhost.com/beta/repo/"; pa.Header = "PA Repo"; items.Add(pa); /* * if (slickversion.version != slickVersion) * { * MessageBoxResult result = MessageBox.Show("There seems to be a new version of slickupdater available, do you wanna update it it?", "New Update", MessageBoxButton.YesNo); * switch (result) * { * case MessageBoxResult.Yes: * System.Diagnostics.Process.Start("SlickAutoUpdate.exe"); * System.Diagnostics.Process.GetCurrentProcess().Kill(); * break; * case MessageBoxResult.No: * * break; * } * } */ initRepos(); // Initialize Update Worker worker = new BackgroundWorker(); worker.DoWork += worker_DoWork; worker.ProgressChanged += worker_ProgressChanged; worker.WorkerReportsProgress = true; worker.RunWorkerCompleted += worker_RunWorkerCompleted; //init checkWorker checkWorker = new BackgroundWorker(); checkWorker.DoWork += checkWorker_DoWork; checkWorker.ProgressChanged += checkWorker_ProgressChanged; checkWorker.WorkerReportsProgress = true; checkWorker.RunWorkerCompleted += checkWorker_RunWorkerCompleted; //reddit worker redditWorker = new BackgroundWorker(); redditWorker.DoWork += redditWorker_DoWork; redditWorker.RunWorkerCompleted += redditworker_Done; WindowManager.SetWnd(this); //Check if the user if a PA user or a TEST user if (repomenu.SelectedIndex != -1) { var gameversion = Properties.Settings.Default.gameversion; if (gameversion == "ArmA3") { a3DirText.Text = regcheck.arma3RegCheck(); ts3DirText.Text = regcheck.ts3RegCheck(); //menuButton.Content = Properties.Settings.Default.A3repo; subreddit = slickversion.repos[repomenu.SelectedIndex].subreddit; //joinButton.Content = slickversion.repos[repomenu.SelectedIndex].joinText; } else if (gameversion == "ArmA2") { var subredd = Properties.Settings.Default.A2repo; if (subredd == "PA ArmA 2 Repo") { subreddit = "/r/ProjectMilSim"; //joinButton.Content = "Join PA ArmA 2 server"; } } } }
public static void UpdateCheck() { //Boolean TFRalert = false; if (isArma2) { armaPath = path("ArmA2"); } else { armaPath = path("ArmA3"); } string mod; int index; string[] mods; string modFolder; string versionFile; string versionString; string version0String; string a3Repourl = Settings.Default.A3repourl; versionfile slickversion = WindowManager.mainWindow.Slickversion; //string slickVersion = downloader.webRead("http://projectawesomemodhost.com/beta/repo/slickupdater/slickversion"); /* #if DEBUG * xmlLine = "http://localhost/repo/"; #endif */ //string[] parsedslickVersion = slickVersion.Split('%'); if (a3Repourl != "") { url = a3Repourl; } else { MessageBox.Show("Your repourl is not set. Go into settings and change it! Setting it to default!"); url = slickversion.repos[0].url; Settings.Default.A3repourl = slickversion.repos[0].url; } var modRed = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Slick Updater Beta;component/Resources/modGreen.png")); var modBlue = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Slick Updater Beta;component/Resources/modBrown.png")); var modYellow = new BitmapImage(new Uri(@"pack://*****:*****@task_force_radio") { TFRalert = true; } } } else { modBrown.Freeze(); a3Items.Add(new Mod { status = modBrown, modName = mod, version = "No file", servVersion = "v. " + version0String }); date = false; //MessageBox.Show(mod + " is missing a version file."); logIt.add(mod + " is missing a version file."); } } else { modBlue.Freeze(); a3Items.Add(new Mod { status = modBlue, modName = mod, version = "No file", servVersion = "v. " + version0String }); //File.Delete(versionFile); date = false; //MessageBox.Show(mod + " doesn't exist on your computer."); logIt.add(mod + " doesn't exist on your computer."); if (mod == "@task_force_radio") { TFRalert = true; } } } } if (date) { WindowManager.mainWindow.CheckWorker.ReportProgress(1, "Launch " + WindowManager.mainWindow.CurrentGame); } else { WindowManager.mainWindow.CheckWorker.ReportProgress(1, "Update " + WindowManager.mainWindow.CurrentGame); } WindowManager.mainWindow.CheckWorker.ReportProgress(2, a3Items); }
public MainWindow() { // Check if another instance is already running Process curProc = Process.GetCurrentProcess(); Process[] procs = Process.GetProcesses(); foreach (Process proc in procs) { if (curProc.Id != proc.Id) { if (curProc.ProcessName == proc.ProcessName) { MessageBox.Show("SlickUpdater is already running!"); Application.Current.Shutdown(); } } } if (util.checkDependencies() == false) { //MessageBoxResult result = MessageBox.Show( "Theres missions .dll's from the slickupdater install folder, please make sure you downloaded the correct version on GitHub and all the required dll's are in the installation folder", "Dun Goofed", MessageBoxButton.OK); Process.GetCurrentProcess().Kill(); } string rawSlickJson = String.Empty; logIt.add("Starting app"); //Check Command Line args var args = Environment.GetCommandLineArgs(); for (int i = 0; i < args.Length; i++) { if (args[i] == "-override") { try { rawSlickJson = downloader.webRead(args[i + 1]); } catch (Exception e) { logIt.add("Could not override masterfile: " + e); } } } if (rawSlickJson == String.Empty) { try { #if DEBUG //local debug server for testing rawSlickJson = downloader.webRead("http://localhost/slickversion.json"); #else //Default master file location hosted on Project Awesome servers rawSlickJson = downloader.webRead("http://arma.projectawesome.net/beta/repo/slickupdater/slickversion.json"); } catch (Exception ex) { logIt.add("Error while downloading slickversion.json trying backup server:\n" + ex.ToString()); } if (String.IsNullOrEmpty(rawSlickJson)) { try { //Backup master file hosted on GitHub servers rawSlickJson = downloader.webRead( "https://gist.githubusercontent.com/wigumen/015cb44774c6320cf901/raw/6a5f22437997c6c120a1b15beaabdb3ade3be06a/slickversion.json"); } catch (Exception ex) { logIt.add("Error while trying to reach backup server going offline mode:\n" + ex.ToString()); } } } if (!String.IsNullOrEmpty(rawSlickJson)) { Slickversion = JsonConvert.DeserializeObject<versionfile>(rawSlickJson); } else { // the Slickversion file couldn't be downloaded, create it ourselves. // Note: this means the data displayed in the app is not correct Slickversion = new versionfile(); } #endif InitializeComponent(); //First launch message! if (Settings.Default.firstLaunch) { MessageBox.Show( "Hello! This seems to be the first time you launch SlickUpdater so make sure your arma 3 and ts3 path is set correctly in options. Have a nice day!", "Welcome"); //Note to myself: I actualy set firstLaunch to false in initProps } LogThread = new logIt(); repoHide(); var fs = new FileStream("localversion", FileMode.Create, FileAccess.Write); var sw = new StreamWriter(fs); sw.WriteLine(SlickVersion); sw.Close(); //Timer callback stuff for clock AutoUpdate Update = new AutoUpdate(); if (Update.exupdate == true) { Update.CheckAvailableUpdates(SlickVersion, Slickversion.version); } else { if (!String.IsNullOrEmpty(Slickversion.version) && !String.IsNullOrEmpty(SlickVersion) && (Slickversion.version != SlickVersion)) { MessageBoxResult result = MessageBox.Show( "There seems to be a new version of slickupdater available, do you wanna update it it?", "New Update", MessageBoxButton.YesNo); switch (result) { case MessageBoxResult.Yes: Process.Start("SlickAutoUpdate.exe"); Process.GetCurrentProcess().Kill(); break; case MessageBoxResult.No: break; } } } initRepos(); // Initialize Update Worker Worker = new BackgroundWorker(); Worker.DoWork += worker_DoWork; Worker.ProgressChanged += worker_ProgressChanged; Worker.WorkerReportsProgress = true; Worker.RunWorkerCompleted += worker_RunWorkerCompleted; //init checkWorker CheckWorker = new BackgroundWorker(); CheckWorker.DoWork += checkWorker_DoWork; CheckWorker.ProgressChanged += checkWorker_ProgressChanged; CheckWorker.WorkerReportsProgress = true; CheckWorker.RunWorkerCompleted += checkWorker_RunWorkerCompleted; //reddit worker RedditWorker = new BackgroundWorker(); RedditWorker.DoWork += redditWorker_DoWork; RedditWorker.RunWorkerCompleted += redditworker_Done; //Init timer timer = new DispatcherTimer(); timer.Tick += updateTime; timer.Interval = new TimeSpan(0, 0, 10); timer.Start(); WindowManager.SetWnd(this); a3DirText.Text = regcheck.arma3RegCheck(); a2DirText.Text = regcheck.arma2RegCheck(); va2DirText.Text = regcheck.varma2RegCheck(); ts3DirText.Text = regcheck.ts3RegCheck(); //Sets modpaths if (Settings.Default.ModPathA3 == "") { A3ModPath.Text = a3DirText.Text; } if (Settings.Default.ModPathA2 == "") { A2ModPath.Text = a2DirText.Text; } Settings.Default.firstLaunch = false; InitProperties(); logocheck(); if (Settings.Default.WindowHeight > 0 || Settings.Default.WindowWidth > 0) { mainWindow.Width = Settings.Default.WindowWidth; mainWindow.Height = Settings.Default.WindowHeight; } }
public MainWindow() { string rawSlickJson = downloader.webRead("http://arma.projectawesome.net/beta/repo/slickupdater/slickversion.json"); slickversion = JsonConvert.DeserializeObject<versionfile>(rawSlickJson); InitializeComponent(); //First launch message! if(Properties.Settings.Default.firstLaunch == true) { MessageBox.Show("Hello! This seems to be the first time you launch SlickUpdater so make sure your arma 3 and ts3 path is set correctly in options. Have a nice day!", "Welcome"); Properties.Settings.Default.firstLaunch = false; } logThread = new logIt(); repoHide(); FileStream fs = new FileStream("localversion", FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(slickVersion); sw.Close(); #if DEBUG //local debug server for A2 rawslickServVer = downloader.webRead("http://localhost/repo/slickupdater/slickversion"); #endif MenuItem pa = new MenuItem(); pa.Tag = "http://projectawesomemodhost.com/beta/repo/"; pa.Header = "PA Repo"; items.Add(pa); if (slickversion.version != slickVersion) { MessageBoxResult result = MessageBox.Show("There seems to be a new version of slickupdater available, do you wanna update it it?", "New Update", MessageBoxButton.YesNo); switch (result) { case MessageBoxResult.Yes: System.Diagnostics.Process.Start("SlickAutoUpdate.exe"); System.Diagnostics.Process.GetCurrentProcess().Kill(); break; case MessageBoxResult.No: break; } } initRepos(); // Initialize Update Worker worker = new BackgroundWorker(); worker.DoWork += worker_DoWork; worker.ProgressChanged += worker_ProgressChanged; worker.WorkerReportsProgress = true; worker.RunWorkerCompleted += worker_RunWorkerCompleted; //init checkWorker checkWorker = new BackgroundWorker(); checkWorker.DoWork += checkWorker_DoWork; checkWorker.ProgressChanged += checkWorker_ProgressChanged; checkWorker.WorkerReportsProgress = true; checkWorker.RunWorkerCompleted += checkWorker_RunWorkerCompleted; //reddit worker redditWorker = new BackgroundWorker(); redditWorker.DoWork += redditWorker_DoWork; redditWorker.RunWorkerCompleted += redditworker_Done; WindowManager.SetWnd(this); //Check if the user if a PA user or a TEST user if (repomenu.SelectedIndex != -1) { var gameversion = Properties.Settings.Default.gameversion; if (gameversion == "ArmA3") { a3DirText.Text = regcheck.arma3RegCheck(); ts3DirText.Text = regcheck.ts3RegCheck(); //menuButton.Content = Properties.Settings.Default.A3repo; subreddit = slickversion.repos[repomenu.SelectedIndex].subreddit; joinButton.Content = slickversion.repos[repomenu.SelectedIndex].joinText; } else if(gameversion == "ArmA2") { var subredd = Properties.Settings.Default.A2repo; if (subredd == "PA ArmA 2 Repo") { subreddit = "/r/ProjectMilSim"; joinButton.Content = "Join PA ArmA 2 server"; } } } }
public void Initialize() { slickversion = JsonConvert.DeserializeObject<versionfile>(getSlickJson()); if (slickversion == null) { //abort update because of getting a nullvalue from getSlicJson return; } //CheckAvailableUpdates(); }