Skip to content

Commit

Permalink
Update: remove orphan files at the end
Browse files Browse the repository at this point in the history
  • Loading branch information
meee1 committed Aug 1, 2024
1 parent ca3731f commit 54d2dfc
Showing 1 changed file with 25 additions and 27 deletions.
52 changes: 25 additions & 27 deletions Utilities/Update.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,33 +269,6 @@ static void CheckMD5(IProgressReporterDialogue frmProgressReporter, string md5ur
files.Add(file);
}

// cleanup unused dlls and exes
dlls.ForEach(dll =>
{
try
{
var result = files.Any(task => Path.GetFullPath(Path.Combine(Settings.GetRunningDirectory(), task)).ToLower().Equals(dll.ToLower()));

if (result == false)
File.Delete(dll);
}
catch { }
});

exes.ForEach(exe =>
{
try
{
var result = files.Any(task => Path.GetFullPath(Path.Combine(Settings.GetRunningDirectory(), task)).ToLower().Equals(exe.ToLower()));

if (result == false)
File.Delete(exe);
}
catch { }
});



// background md5
List<Tuple<string, string, Task<bool>>> tasklist = new List<Tuple<string, string, Task<bool>>>();

Expand Down Expand Up @@ -461,6 +434,31 @@ static void CheckMD5(IProgressReporterDialogue frmProgressReporter, string md5ur
frmProgressReporter.UpdateProgressAndStatus(-1, Strings.Checking + file);
}
});

// cleanup unused dlls and exes
dlls.ForEach(dll =>
{
try
{
var result = files.Any(task => Path.GetFullPath(Path.Combine(Settings.GetRunningDirectory(), task)).ToLower().Equals(dll.ToLower()));

if (result == false)
File.Delete(dll);
}
catch { }
});

exes.ForEach(exe =>
{
try
{
var result = files.Any(task => Path.GetFullPath(Path.Combine(Settings.GetRunningDirectory(), task)).ToLower().Equals(exe.ToLower()));

if (result == false)
File.Delete(exe);
}
catch { }
});
}
}

Expand Down

0 comments on commit 54d2dfc

Please sign in to comment.