Skip to content
Browse files

Fixing some bugs with previous commits

  • Loading branch information...
1 parent 937ce96 commit 4d2a594cad82bd209c20bd8730c28c08d2770dc0 @synhershko committed Jun 20, 2012
View
3 NAppUpdate.sln
@@ -8,6 +8,9 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{78F44777-F4E4-4154-A396-80DAD1E47065}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAppUpdate.Tests", "src\NAppUpdate.Tests\NAppUpdate.Tests.csproj", "{2742ABE7-977D-4989-B12A-992A50B28E2F}"
+ ProjectSection(ProjectDependencies) = postProject
+ {7D4D18D4-DBD2-4ADC-9D82-397D6C5E9F40} = {7D4D18D4-DBD2-4ADC-9D82-397D6C5E9F40}
+ EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAppUpdate.Updater", "src\NAppUpdate.Updater\NAppUpdate.Updater.csproj", "{7D4D18D4-DBD2-4ADC-9D82-397D6C5E9F40}"
EndProject
View
3 src/NAppUpdate.Framework/Utils/NauIpc.cs
@@ -109,15 +109,14 @@ public static Process LaunchProcessAndSendDto(NauDto dto, ProcessStartInfo proce
//failed to connect client pipe
if (success == 0)
// TODO Log error
- return null;
+ break;
//client connection successfull
using (var fStream = new FileStream(clientPipeHandle, FileAccess.Write, (int)BUFFER_SIZE, true))
{
new BinaryFormatter().Serialize(fStream, dto);
fStream.Close();
}
- break;
}
}
View
4 src/NAppUpdate.Tests/Core/UpdateStarterTests.cs
@@ -47,6 +47,7 @@ public void UpdaterDeploymentAndIPCWorks()
if (Directory.Exists(path))
FileSystem.DeleteDirectory(path);
+ NauIpc.ExtractUpdaterFromResource(path, dto.Configs.UpdateExecutableName);
var info = new ProcessStartInfo
{
UseShellExecute = true,
@@ -55,8 +56,7 @@ public void UpdaterDeploymentAndIPCWorks()
Arguments = string.Format(@"""{0}"" -showConsole", dto.Configs.UpdateProcessName),
};
- NauIpc.ExtractUpdaterFromResource(path, dto.Configs.UpdateExecutableName);
- var p = NauIpc.LaunchProcessAndSendDto(dto, info, "NAppUpdate-Tests");
+ var p = NauIpc.LaunchProcessAndSendDto(dto, info, dto.Configs.UpdateProcessName);
Assert.IsNotNull(p);
p.WaitForExit();
View
15 src/NAppUpdate.Updater/AppStart.cs
@@ -66,11 +66,9 @@ private static void Main()
bool updateSuccessful = true;
- if (dto == null || dto.Configs == null || dto.Tasks == null || dto.Tasks.Count == 0)
+ if (dto == null || dto.Configs == null)
{
- throw new Exception("Could not find the updates list (or it was empty).");
- //Application.Exit();
- //return;
+ throw new Exception("Invalid DTO received");
}
Log("Got {0} task objects", dto.Tasks.Count);
@@ -82,6 +80,11 @@ private static void Main()
string backupFolder = dto.Configs.BackupFolder;
bool relaunchApp = dto.RelaunchApplication;
+ if (dto.Tasks == null || dto.Tasks.Count == 0)
+ {
+ throw new Exception("Could not find the updates list (or it was empty).");
+ }
+
// Perform the actual off-line update process
Log("Starting the updates...");
@@ -180,7 +183,7 @@ private static void Main()
_console.WriteLine("Press any key or close this window to exit.");
_console.ReadKey();
}
- SelfCleanUp(tempFolder);
+ if (!string.IsNullOrEmpty(tempFolder)) SelfCleanUp(tempFolder);
Application.Exit();
}
}
@@ -190,7 +193,7 @@ private static void SelfCleanUp(string tempFolder)
try
{
// Delete the updater EXE and the temp folder)
- Log("Removing updater and temp folder...");
+ Log("Removing updater and temp folder... {0}", tempFolder);
try
{
var Info = new ProcessStartInfo();

0 comments on commit 4d2a594

Please sign in to comment.
Something went wrong with that request. Please try again.