Implemented launching scapland

This commit is contained in:
strongleong 2022-02-06 21:20:32 +11:00
parent b168b7403a
commit 4d34f4eaa6
2 changed files with 19 additions and 3 deletions

View File

@ -73,9 +73,9 @@
<ComboBoxItem Content="Original" IsEnabled="False" /> <ComboBoxItem Content="Original" IsEnabled="False" />
<ComboBoxItem Content="Remastered" /> <ComboBoxItem Content="Remastered" />
</ComboBox> </ComboBox>
<CheckBox Content=" Windowed " Margin="0,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" /> <CheckBox Name="Windowed" Content=" Windowed " Margin="0,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" />
<CheckBox Content=" Close launcher " Margin="0,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" /> <CheckBox Name="CloseLauncher" Content=" Close launcher " Margin="0,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" />
<Button Content=" Run Scrapland " Name="ButtonRunScrapland" /> <Button Content=" Run Scrapland " Name="ButtonRunScrapland" Click="ButtonRunScrapland_Click" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</Grid> </Grid>

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
@ -153,5 +154,20 @@ namespace ScrapModLoader
modsLauncher.ScanMods(); modsLauncher.ScanMods();
ModsList.Items.Refresh(); ModsList.Items.Refresh();
} }
private void ButtonRunScrapland_Click(Object sender, RoutedEventArgs e)
{
String executablePath = ScraplandVersion.SelectedIndex == 0
? modsLauncher.ScraplandPath : modsLauncher.ScraplandRemasteredPath;
String args = "-fullscreen:1";
if (Windowed.IsChecked ?? false)
args = "-fullscreen:0";
Process.Start(executablePath + @"\bin\Scrap.exe", args);
if (CloseLauncher.IsChecked ?? false)
Close();
}
} }
} }