public MainWindow() { InitializeComponent(); logThread = new logIt(); repoHide(); FileStream fs = new FileStream("localversion", FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(slickVersion); sw.Close(); menuAnimation(140, 0); showRepo = false; rawslickServVer = downloader.webRead("http://projectawesomemodhost.com/beta/repo/slickupdater/slickversion"); slickServVer = rawslickServVer.Split('%'); MenuItem pa = new MenuItem(); pa.Tag = "http://projectawesomemodhost.com/beta/repo/"; pa.Header = "PA Repo"; items.Add(pa); if (slickServVer[0] != slickVersion) { MessageBoxResult result = MessageBox.Show("There seems to be a new version of slickupdater available, do you wanne 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; } } // 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); //Test if config is up to date if(File.Exists("config.xml")){ XDocument testdoc = XDocument.Load("config.xml"); if (testdoc.Element("SlickUpdater").Element("ArmA3").Element("repourl") == null) { File.Delete("config.xml"); } } //Grenerate config xml if (!File.Exists("config.xml")) { 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"); XDocument doc = new XDocument( new XComment("Slick Updater config.xml File!"), new XElement("SlickUpdater", new XElement("ArmA3", new XElement("path", ""), new XElement("window","false"), new XElement("nosplash","true"), new XElement("skipIntro","true"), new XElement("noLogs","false"), new XElement("noPause","true"), new XElement("showScriptErrors","false"), new XElement("world",""), new XElement("customParameters", ""), new XElement("ts3Dir",""), new XElement("repourl", "http://projectawesomemodhost.com/beta/repo/"), new XElement("currentrepo", "PA Repo")), new XElement("ArmA2"), new XElement("repoGen", new XElement("inputDir",""), new XElement("outputDir", "")), new XElement("Client", new XElement("FirstTimeLaunch", "true")))); doc.Save("config.xml"); } //Check if the user if a PA user or a TEST user a3DirText.Text = regcheck.arma3RegCheck(); ts3DirText.Text = regcheck.ts3RegCheck(); menuButton.Content = ConfigManager.fetch("ArmA3", "currentrepo"); var subredd = ConfigManager.fetch("ArmA3", "currentrepo"); if (subredd == "PA Repo") { subreddit = "/r/ProjectMilSim"; joinButton.Content = "Join PA server"; }else if(subredd == "Test Outfit Repo"){ subreddit = "/r/testoutfit"; joinButton.Content = "Join TEST server"; } }
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 MainWindow() { InitializeComponent(); logThread = new logIt(); repoHide(); FileStream fs = new FileStream("localversion", FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(slickVersion); sw.Close(); menuAnimation(140, 0); showRepo = false; rawslickServVer = downloader.webRead("http://projectawesomemodhost.com/beta/repo/slickupdater/slickversion"); slickServVer = rawslickServVer.Split('%'); MenuItem pa = new MenuItem(); pa.Tag = "http://projectawesomemodhost.com/beta/repo/"; pa.Header = "PA Repo"; items.Add(pa); if (slickServVer[0] != slickVersion) { MessageBoxResult result = MessageBox.Show("There seems to be a new version of slickupdater available, do you wanne 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; } } // 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); //Test if config is up to date if (File.Exists("config.xml")) { XDocument testdoc = XDocument.Load("config.xml"); if (testdoc.Element("SlickUpdater").Element("ArmA3").Element("repourl") == null) { File.Delete("config.xml"); } } //Grenerate config xml if (!File.Exists("config.xml")) { 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"); XDocument doc = new XDocument( new XComment("Slick Updater config.xml File!"), new XElement("SlickUpdater", new XElement("ArmA3", new XElement("path", ""), new XElement("window", "false"), new XElement("nosplash", "true"), new XElement("skipIntro", "true"), new XElement("noLogs", "false"), new XElement("noPause", "true"), new XElement("showScriptErrors", "false"), new XElement("world", ""), new XElement("customParameters", ""), new XElement("ts3Dir", ""), new XElement("repourl", "http://projectawesomemodhost.com/beta/repo/"), new XElement("currentrepo", "PA Repo")), new XElement("ArmA2"), new XElement("repoGen", new XElement("inputDir", ""), new XElement("outputDir", "")), new XElement("Client", new XElement("FirstTimeLaunch", "true")))); doc.Save("config.xml"); } //Check if the user if a PA user or a TEST user a3DirText.Text = regcheck.arma3RegCheck(); ts3DirText.Text = regcheck.ts3RegCheck(); menuButton.Content = ConfigManager.fetch("ArmA3", "currentrepo"); var subredd = ConfigManager.fetch("ArmA3", "currentrepo"); if (subredd == "PA Repo") { subreddit = "/r/ProjectMilSim"; joinButton.Content = "Join PA server"; } else if (subredd == "Test Outfit Repo") { subreddit = "/r/testoutfit"; joinButton.Content = "Join TEST server"; } }
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"; } } } }