Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
Added buttons to open selected game directory and delete moddata for …
Browse files Browse the repository at this point in the history
…selected game
  • Loading branch information
Dyvinia committed May 31, 2021
1 parent f14625d commit 3e275d0
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 4 deletions.
52 changes: 50 additions & 2 deletions AboutWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
Originally based off the batch file by<LineBreak/>BattleDash, Dulana57, and VictorPLopes
</TextBlock>
<Grid Height="155" Margin="10,0,10,117" VerticalAlignment="Bottom" Background="#FF141414">
<TextBlock Margin="10,6" TextWrapping="Wrap" Foreground="#FFF1F1F1" TextAlignment="Left" FontSize="13"><Run Text="It is recommended to launch the game with Frosty."/><LineBreak/><Run/><LineBreak/><Run Text="You must disable this whenever you play any other Frostbite game or if you encounter issues with other games."/></TextBlock>
<TextBlock Margin="10,6" TextWrapping="Wrap" Foreground="#FFF1F1F1" TextAlignment="Center" FontSize="16"><Run Text="Extra Options"/></TextBlock>
</Grid>
<TextBlock Margin="40,357,40,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FFF1F1F1" Height="20" TextAlignment="Center" FontSize="13">
GitHub:
Expand Down Expand Up @@ -99,7 +99,55 @@
https://discord.gg/advqsyv
</Hyperlink>
</TextBlock>
<Button Content="Refresh Status on Main Window" HorizontalAlignment="Center" Margin="75,310,75,0" VerticalAlignment="Top" Width="210" Height="25" Click="ButtonEnvVar" BorderBrush="#FFB90000" FontSize="14">
<Button Content="Refresh Status on Main Window" HorizontalAlignment="Center" Margin="75,300,75,0" VerticalAlignment="Top" Width="210" Height="25" Click="ButtonEnvVar" BorderBrush="#FFB90000" FontSize="14">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Setter Property="Background" Value="#FF323232"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="Foreground" Value="#FFF1F1F1"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FF6C6C6C"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#FF5A5A5A"/>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="{TemplateBinding Background}">
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
<Button Content="Delete Selected Game ModData" HorizontalAlignment="Center" Margin="75,268,75,0" VerticalAlignment="Top" Width="210" Height="25" Click="ButtonDelModData" BorderBrush="#FFB90000" FontSize="14">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Setter Property="Background" Value="#FF323232"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="Foreground" Value="#FFF1F1F1"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FF6C6C6C"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#FF5A5A5A"/>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="{TemplateBinding Background}">
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
<Button Content="Open Selected Game Directory" HorizontalAlignment="Center" Margin="75,236,75,0" VerticalAlignment="Top" Width="210" Height="25" Click="ButtonGameDir" BorderBrush="#FFB90000" FontSize="14">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Setter Property="Background" Value="#FF323232"/>
Expand Down
8 changes: 8 additions & 0 deletions AboutWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,13 @@ private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e
private void ButtonEnvVar(object sender, RoutedEventArgs e) {
(Application.Current.MainWindow as MainWindow).checkStatus();
}

private void ButtonGameDir(object sender, RoutedEventArgs e) {
(Application.Current.MainWindow as MainWindow).openGameDir();
}

private void ButtonDelModData(object sender, RoutedEventArgs e) {
(Application.Current.MainWindow as MainWindow).delModData();
}
}
}
44 changes: 44 additions & 0 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,50 @@ public void checkEnabled() {
}
}

public void openGameDir() {
if (datadir != null) {
Process.Start("explorer.exe", datadir);
}
else {
string message = "Select a game in the main window";
string title = "Select a game";
MessageBoxButton buttons = MessageBoxButton.OK;
MessageBoxImage icon = MessageBoxImage.Warning;
MessageBoxResult result = MessageBox.Show(message, title, buttons, icon);
}
}

public void delModData() {
if (datadir != null) {
if (Directory.Exists(datadir + "\\ModData")) {
string message = "Are you sure you want to delete ModData for the selected game? You will have to regenerate ModData again through Frosty.";
string title = "Delete ModData";
MessageBoxButton buttons = MessageBoxButton.YesNo;
MessageBoxImage icon = MessageBoxImage.Warning;
MessageBoxResult result = MessageBox.Show(message, title, buttons, icon);
switch (result) {
case MessageBoxResult.Yes:
Directory.Delete(datadir + "\\ModData");
break;
}
}
else {
string message = "ModData does not exist for selected game.";
string title = "ModData does not exist";
MessageBoxButton buttons = MessageBoxButton.OK;
MessageBoxImage icon = MessageBoxImage.Warning;
MessageBoxResult result = MessageBox.Show(message, title, buttons, icon);
}
}
else {
string message = "Select a game in the main window";
string title = "Select a game";
MessageBoxButton buttons = MessageBoxButton.OK;
MessageBoxImage icon = MessageBoxImage.Warning;
MessageBoxResult result = MessageBox.Show(message, title, buttons, icon);
}
}

private async void btn_enable_Click(object sender, RoutedEventArgs e) {
Directory.CreateDirectory(datadir + "\\ModData");
if (Directory.GetDirectories(datadir + "\\ModData").Length == 0 || Directory.Exists(datadir + "\\ModData\\Data")) {
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.0.2")]
[assembly: AssemblyFileVersion("3.0.2")]
[assembly: AssemblyVersion("3.1.0")]
[assembly: AssemblyFileVersion("3.1.0")]

0 comments on commit 3e275d0

Please sign in to comment.