Delete install path on install error
This commit is contained in:
parent
cb770f8dab
commit
f05005460f
1 changed files with 24 additions and 14 deletions
|
@ -102,25 +102,35 @@ namespace LANCommander.PlaynitePlugin
|
||||||
|
|
||||||
Plugin.PlayniteApi.Dialogs.ActivateGlobalProgress(progress =>
|
Plugin.PlayniteApi.Dialogs.ActivateGlobalProgress(progress =>
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(destination);
|
try
|
||||||
progress.ProgressMaxValue = 100;
|
|
||||||
progress.CurrentProgressValue = 0;
|
|
||||||
|
|
||||||
using (var gameStream = Plugin.LANCommander.StreamGame(game.Id))
|
|
||||||
using (var reader = ReaderFactory.Open(gameStream))
|
|
||||||
{
|
{
|
||||||
progress.ProgressMaxValue = gameStream.Length;
|
Directory.CreateDirectory(destination);
|
||||||
|
progress.ProgressMaxValue = 100;
|
||||||
|
progress.CurrentProgressValue = 0;
|
||||||
|
|
||||||
gameStream.OnProgress += (pos, len) =>
|
using (var gameStream = Plugin.LANCommander.StreamGame(game.Id))
|
||||||
|
using (var reader = ReaderFactory.Open(gameStream))
|
||||||
{
|
{
|
||||||
progress.CurrentProgressValue = pos;
|
progress.ProgressMaxValue = gameStream.Length;
|
||||||
};
|
|
||||||
|
|
||||||
reader.WriteAllToDirectory(destination, new ExtractionOptions()
|
gameStream.OnProgress += (pos, len) =>
|
||||||
|
{
|
||||||
|
progress.CurrentProgressValue = pos;
|
||||||
|
};
|
||||||
|
|
||||||
|
reader.WriteAllToDirectory(destination, new ExtractionOptions()
|
||||||
|
{
|
||||||
|
ExtractFullPath = true,
|
||||||
|
Overwrite = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (Directory.Exists(destination))
|
||||||
{
|
{
|
||||||
ExtractFullPath = true,
|
Directory.Delete(destination, true);
|
||||||
Overwrite = true
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new GlobalProgressOptions($"Downloading {game.Title}...")
|
new GlobalProgressOptions($"Downloading {game.Title}...")
|
||||||
|
|
Loading…
Add table
Reference in a new issue