mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-20 23:54:26 +08:00
52 lines
1.1 KiB
C#
52 lines
1.1 KiB
C#
|
|
namespace LanMountainDesktop.Launcher.Update;
|
||
|
|
|
||
|
|
internal sealed class IncomingArtifactsCleaner(UpdateEnginePaths paths)
|
||
|
|
{
|
||
|
|
public void Cleanup()
|
||
|
|
{
|
||
|
|
foreach (var path in new[]
|
||
|
|
{
|
||
|
|
paths.FileMapPath,
|
||
|
|
paths.SignaturePath,
|
||
|
|
paths.ArchivePath,
|
||
|
|
paths.PlondsFileMapPath,
|
||
|
|
paths.PlondsSignaturePath,
|
||
|
|
paths.PlondsUpdateMetadataPath,
|
||
|
|
paths.InstallCheckpointPath
|
||
|
|
})
|
||
|
|
{
|
||
|
|
TryDeleteFile(path);
|
||
|
|
}
|
||
|
|
|
||
|
|
TryDeleteDirectory(paths.PlondsObjectsRoot);
|
||
|
|
}
|
||
|
|
|
||
|
|
private static void TryDeleteFile(string path)
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
if (File.Exists(path))
|
||
|
|
{
|
||
|
|
File.Delete(path);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
catch
|
||
|
|
{
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private static void TryDeleteDirectory(string path)
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
if (Directory.Exists(path))
|
||
|
|
{
|
||
|
|
Directory.Delete(path, true);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
catch
|
||
|
|
{
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|