Update 1.0.4
- Fixed unhandled exceptions when cleaning up files - Added Mutex to make sure only one instance of program is active at a time
This commit is contained in:
parent
8caf8b91b7
commit
8edcd53017
3 changed files with 19 additions and 14 deletions
|
@ -43,12 +43,8 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="SelectForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="MainForm.cs" />
|
||||
<Compile Update="SelectForm.cs" />
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace CreamInstaller
|
|||
{
|
||||
File.Delete(Program.OutputFile);
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
catch
|
||||
{
|
||||
throw new Exception("Unable to delete old archive file for " + selection.ProgramName);
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ namespace CreamInstaller
|
|||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
catch
|
||||
{
|
||||
throw new Exception("Unable to delete Steam API files for " + selection.ProgramName);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,9 @@ namespace CreamInstaller
|
|||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
static extern bool AllocConsole();
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
|
||||
|
||||
public static string ApplicationName = "CreamInstaller v" + Application.ProductVersion + ": CreamAPI Downloader & Installer";
|
||||
|
||||
public static Assembly EntryAssembly = Assembly.GetEntryAssembly();
|
||||
|
@ -27,6 +30,10 @@ namespace CreamInstaller
|
|||
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
bool createdNew = true;
|
||||
Mutex mutex = new Mutex(true, "CreamInstaller", out createdNew);
|
||||
if (createdNew)
|
||||
{
|
||||
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
||||
Application.EnableVisualStyles();
|
||||
|
@ -34,6 +41,8 @@ namespace CreamInstaller
|
|||
Application.ApplicationExit += new EventHandler(OnApplicationExit);
|
||||
Application.Run(new MainForm());
|
||||
}
|
||||
mutex.Close();
|
||||
}
|
||||
|
||||
public static bool IsFilePathLocked(this string filePath)
|
||||
{
|
||||
|
@ -111,7 +120,7 @@ namespace CreamInstaller
|
|||
{
|
||||
File.Delete(OutputFile);
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
catch
|
||||
{
|
||||
InstallForm?.UpdateUser($"WARNING: Couldn't clean up downloaded archive ({OutputFile})", LogColor.Warning);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue