internal UpdateManager() { _downloadManager = new DownloadManager(); Directory.CreateDirectory(Settings.TempFolder); Logger.Info("Creating temporary folder at: {0}", Settings.TempFolder); }
private static void PrepUpdate() { logger.Info( "New version of XBMCUpdate is available from the server. Initiating Download." ); string zipDestination = string.Format( "{0}\\xbmcupdate{1}.zip", SelfUpdateTemp, LatestBuild.ToString() ); DownloadManager download = new DownloadManager(); download.Download( LatestBuildUrl, zipDestination ); logger.Info( "Extracting update" ); FastZip zipClient = new FastZip(); zipClient.ExtractZip( zipDestination, SelfUpdatePath, @"+\.exe$;+\.pdb$;+\.dll$;-^nlog\.dll$" ); logger.Info( "Update extracted to {0}", SelfUpdatePath ); if( File.Exists( SelfUpdatePath + "\\selfupdate.exe" ) ) { File.Copy( SelfUpdatePath + "\\selfupdate.exe", Application.StartupPath + "\\\\selfupdate.exe", true ); //File.Delete( SelfUpdatePath + "\\selfupdate.exe" ); } if( File.Exists( SelfUpdatePath + "\\selfupdate.pdb" ) ) { File.Copy( SelfUpdatePath + "\\selfupdate.pdb", Application.StartupPath + "\\\\selfupdate.pdb", true ); File.Delete( SelfUpdatePath + "\\selfupdate.pdb" ); } }
private void PrepUpdate() { Logger.Info("Initiating Download."); string zipDestination = string.Format("{0}\\xbmcupdate{1}.zip", SelfUpdateTemp, _latestBuild); var download = new DownloadManager(); download.Download(_latestBuildUrl, zipDestination); Logger.Info("Extracting update"); var zipClient = new FastZip(); zipClient.ExtractZip(zipDestination, SelfUpdatePath, @"+\.exe$;+\.pdb$;+\.dll$;-^nlog\.dll$"); Logger.Info("Update extracted to {0}", SelfUpdatePath); string selfUpdateExe = Path.Combine(SelfUpdatePath, "selfupdate.exe"); string selfUpdatePdb = Path.Combine(SelfUpdatePath, "selfupdate.pdb"); if (File.Exists(selfUpdateExe)) { File.Copy(selfUpdateExe, Path.Combine(Application.StartupPath, "selfupdate.exe"), true); File.Delete(selfUpdateExe); } if (File.Exists(selfUpdatePdb)) { File.Copy(selfUpdatePdb, Path.Combine(Application.StartupPath, "selfupdate.pdb"), true); File.Delete(selfUpdatePdb); } }