Include version in update/install

This commit is contained in:
Eric Reed 2013-05-13 21:47:10 -04:00
parent c2be223828
commit 4225e175ee
3 changed files with 13 additions and 4 deletions

View File

@ -19,6 +19,13 @@ namespace MediaBrowser.Common.Implementations.Updates
private const string UpdaterDll = "Mediabrowser.InstallUtil.dll"; private const string UpdaterDll = "Mediabrowser.InstallUtil.dll";
public void UpdateApplication(MBApplication app, IApplicationPaths appPaths, string archive) public void UpdateApplication(MBApplication app, IApplicationPaths appPaths, string archive)
{ {
// First see if there is a version file and read that in
var version = "Unknown";
if (File.Exists(archive + ".ver"))
{
version = File.ReadAllText(archive + ".ver");
}
// Use our installer passing it the specific archive // Use our installer passing it the specific archive
// We need to copy to a temp directory and execute it there // We need to copy to a temp directory and execute it there
var source = Path.Combine(appPaths.ProgramSystemPath, UpdaterExe); var source = Path.Combine(appPaths.ProgramSystemPath, UpdaterExe);
@ -33,7 +40,7 @@ namespace MediaBrowser.Common.Implementations.Updates
File.Copy(source, Path.Combine(Path.GetTempPath(), "ServiceStack.Text.dll"), true); File.Copy(source, Path.Combine(Path.GetTempPath(), "ServiceStack.Text.dll"), true);
source = Path.Combine(appPaths.ProgramSystemPath, "Ionic.Zip.dll"); source = Path.Combine(appPaths.ProgramSystemPath, "Ionic.Zip.dll");
File.Copy(source, Path.Combine(Path.GetTempPath(), "Ionic.Zip.dll"), true); File.Copy(source, Path.Combine(Path.GetTempPath(), "Ionic.Zip.dll"), true);
Process.Start(tempUpdater, string.Format("product={0} archive=\"{1}\" caller={2} pismo=false", product, archive, Process.GetCurrentProcess().Id)); Process.Start(tempUpdater, string.Format("product={0} archive=\"{1}\" caller={2} pismo=false version={3}", product, archive, Process.GetCurrentProcess().Id, version));
// That's it. The installer will do the work once we exit // That's it. The installer will do the work once we exit
} }

View File

@ -101,6 +101,11 @@ namespace MediaBrowser.Common.Implementations.Updates
try try
{ {
File.Copy(tempFile, target, true); File.Copy(tempFile, target, true);
//If it is an archive - write out a version file so we know what it is
if (isArchive)
{
File.WriteAllText(target+".ver", package.versionStr);
}
} }
catch (IOException e) catch (IOException e)
{ {

View File

@ -189,7 +189,4 @@ Global
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
EndGlobal EndGlobal