Skip to content
Permalink
Browse files

Select the same effects as previously when overwriting an existing in…

…stallation with the setup tool
  • Loading branch information...
crosire committed May 19, 2018
1 parent 59b2af5 commit 296af082b2b5233f853491cdc0e41dd7ff2ecc70
Showing with 16 additions and 2 deletions.
  1. +2 −1 setup/Select.xaml
  2. +14 −1 setup/Wizard.xaml.cs
@@ -8,7 +8,8 @@
WindowStyle="None"
WindowStartupLocation="CenterOwner">
<DockPanel LastChildFill="True">
<Label Content="Choose which effect files you want to install:" DockPanel.Dock="Top" Margin="5,5,5,0" />
<Label Content="Select which effect files you want to install:" DockPanel.Dock="Top" Margin="5,5,5,0" />
<Label Content="It is recommended to choose as few as possible!" DockPanel.Dock="Top" Margin="5,0,5,0"/>
<DockPanel DockPanel.Dock="Bottom" Margin="10,5,10,10">
<Button Content="Uncheck All" Width="100" HorizontalAlignment="Left" Click="ChangeChecked" />
<Button Content="OK" Width="100" HorizontalAlignment="Right" Click="ConfirmSelection" />
@@ -320,7 +320,6 @@ void InstallationStep2()
EnableConfigEditor();
}
}

void InstallationStep3()
{
Title = Title.Remove(Title.Length - 11);
@@ -377,9 +376,13 @@ void InstallationStep4()
string shadersDirectoryFinal = Path.Combine(targetDirectory, "reshade-shaders");
string shadersDirectoryExtracted = Path.Combine(targetDirectory, "reshade-shaders-master");

string[] installedEffects = null;

// Delete existing directories since "ExtractToDirectory" fails if the target is not empty
if (Directory.Exists(shadersDirectoryFinal))
{
installedEffects = Directory.GetFiles(Path.Combine(shadersDirectoryFinal, "Shaders")).ToArray();

try { Directory.Delete(shadersDirectoryFinal, true); } catch { }
}
if (Directory.Exists(shadersDirectoryExtracted))
@@ -415,6 +418,16 @@ void InstallationStep4()
{
var wnd = new SelectWindow(Directory.GetFiles(Path.Combine(shadersDirectoryFinal, "Shaders")));
wnd.Owner = this;

// If there was an existing installation, select the same effects as previously
if (installedEffects != null)
{
foreach (var item in wnd.GetSelection())
{
item.IsChecked = installedEffects.Contains(item.Path);
}
}

wnd.ShowDialog();

foreach (var item in wnd.GetSelection())

0 comments on commit 296af08

Please sign in to comment.
You can’t perform that action at this time.