0
0
mirror of https://github.com/sp-tarkov/patcher.git synced 2025-02-12 21:10:46 -05:00

updated patching client style, add checkbox for autozip

This commit is contained in:
IsWaffle 2021-08-06 20:36:11 -04:00
parent 8acbe63c32
commit 92d0aa2ae6
8 changed files with 214 additions and 8 deletions

View File

@ -4,6 +4,153 @@
xmlns:local="clr-namespace:PatchClient"
StartupUri="MainWindow.xaml">
<Application.Resources>
<!-- Colors -->
<Color x:Key="AKI_DarkGray">#121212</Color>
<Color x:Key="AKI_Yellow">#FFC107</Color>
<Color x:Key="AKI_White">#FFFFFF</Color>
<Color x:Key="AKI_Gray">#282828</Color>
<Color x:Key="AKI_DarkGrayBlue">#323947</Color>
<!-- Brushes -->
<SolidColorBrush x:Key="AKI_Foreground_Light" Color="{StaticResource AKI_White}"/>
<SolidColorBrush x:Key="AKI_Background_Light" Color="{StaticResource AKI_Gray}"/>
<SolidColorBrush x:Key="AKI_Background_Dark" Color="{StaticResource AKI_DarkGray}"/>
<SolidColorBrush x:Key="AKI_Background_Yellow" Color="{StaticResource AKI_Yellow}"/>
<SolidColorBrush x:Key="AKI_Background_DarkGrayBlue" Color="{StaticResource AKI_DarkGrayBlue}"/>
<!-- Remove Hightlight effect from buttons -->
<Style x:Key="NoChromeButton" TargetType="{x:Type Button}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid x:Name="NoChromeGrid" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Trigger.EnterActions>
<BeginStoryboard x:Name="disable_enter">
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="0.5" Duration="0:0:0.100" BeginTime="0:0:0.100"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<RemoveStoryboard BeginStoryboardName="disable_enter"/>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.100"/>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- App Button Base Style -->
<Style x:Key="AppButtonStyleBase" TargetType="{x:Type Button}" BasedOn="{StaticResource NoChromeButton}">
<Setter Property="Foreground" Value="Gray"/>
<Setter Property="Background" Value="{StaticResource AKI_Background_Dark}"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="40"/>
<Setter Property="MinHeight" Value="25"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontWeight" Value="Bold"/>
</Style>
<!-- Close App Button Style -->
<Style x:Key="AppCloseButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource AppButtonStyleBase}">
<Style.Triggers>
<EventTrigger RoutedEvent="PreviewMouseDown">
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)" To="{StaticResource AKI_DarkGrayBlue}" Duration="0:0:0.200"/>
<ColorAnimation Storyboard.TargetProperty="(Button.Foreground).(SolidColorBrush.Color)" To="White" Duration="0:0:0.200"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)" To="IndianRed" Duration="0:0:0.200"/>
<ColorAnimation Storyboard.TargetProperty="(Button.Foreground).(SolidColorBrush.Color)" To="White" Duration="0:0:0.200"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="MouseLeave">
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)" To="{StaticResource AKI_DarkGray}" Duration="0:0:0.200"/>
<ColorAnimation Storyboard.TargetProperty="(Button.Foreground).(SolidColorBrush.Color)" To="Gray" Duration="0:0:0.200"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
<!-- TextBlock Style -->
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="{StaticResource AKI_Foreground_Light}"/>
<Setter Property="Opacity" Value="0"/>
<Style.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.250" BeginTime="0:0:0.150"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
<!-- Label Style-->
<Style TargetType="{x:Type Label}">
<Setter Property="Foreground" Value="{StaticResource AKI_Foreground_Light}"/>
<Setter Property="Opacity" Value="0"/>
<Style.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.250" BeginTime="0:0:0.150"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
<!-- Progressbar Style -->
<Style TargetType="{x:Type ProgressBar}">
<Setter Property="Foreground" Value="{StaticResource AKI_Background_Yellow}"/>
<Setter Property="Background" Value="{StaticResource AKI_Background_DarkGrayBlue}"/>
<Setter Property="BorderBrush" Value="{StaticResource AKI_Background_DarkGrayBlue}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Opacity" Value="0"/>
<Style.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.250" BeginTime="0:0:0.150"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
</Application.Resources>
</Application>
<!--Foreground="{StaticResource AKI_Background_Yellow}"
Background="{StaticResource AKI_Background_DarkGrayBlue}"
BorderBrush="{StaticResource AKI_Background_DarkGrayBlue}"
BorderThickness="0"-->

View File

@ -1,5 +1,6 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Shell;
namespace PatchClient.Extensions
{

View File

@ -7,18 +7,45 @@
mc:Ignorable="d"
Title="Patching Client" Height="200" Width="600"
WindowStartupLocation="CenterScreen"
Loaded="Window_Loaded">
Background="{StaticResource AKI_Background_Light}"
Loaded="Window_Loaded"
WindowStyle="SingleBorderWindow">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" CornerRadius="0" GlassFrameThickness="0 0 0 5" UseAeroCaptionButtons="False"
ResizeBorderThickness="5"
/>
</WindowChrome.WindowChrome>
<Grid>
<StackPanel VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="AUTO"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="AUTO"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Label Content="Patching Client"
FontSize="15" Background="{StaticResource AKI_Background_Dark}"
MouseDown="label_topbar_MouseDown"
/>
<Button x:Name="Close_Button" Grid.Column="1" Content="X" HorizontalAlignment="Right" VerticalAlignment="Stretch"
Style="{StaticResource AppCloseButtonStyle}"
Click="Close_Button_Click"
/>
<StackPanel Grid.ColumnSpan="2" Grid.Row="1">
<Label x:Name="PatchMessageLabel"
Margin="10"
/>
<ContentControl Margin="10">
<ContentControl Margin="10 0 10 10">
<Grid>
<ProgressBar x:Name="PatchProgressBar"
Height="20"
Foreground="MediumPurple"
/>
<Label x:Name="PatchProgressInfoLabel"
HorizontalAlignment="Center" VerticalAlignment="Center"

View File

@ -3,6 +3,7 @@ using PatcherUtils;
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace PatchClient
{
@ -14,6 +15,8 @@ namespace PatchClient
public MainWindow()
{
InitializeComponent();
this.TaskbarItemInfo = new System.Windows.Shell.TaskbarItemInfo() { ProgressState = System.Windows.Shell.TaskbarItemProgressState.Normal };
}
private void RunPatcher()
@ -78,5 +81,18 @@ namespace PatchClient
{
RunPatcher();
}
private void Close_Button_Click(object sender, RoutedEventArgs e)
{
Application.Current.Shutdown(0);
}
private void label_topbar_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left)
{
this.DragMove();
}
}
}
}

View File

@ -80,5 +80,15 @@
Content="Generate Patches"
Click="GenButton_Click"
/>
<CheckBox x:Name="AutoZip_checkBox" Grid.Row="3" Grid.Column="1" VerticalAlignment="Bottom"
Margin="10"
ToolTip="This will compress the patch files after they are generated using 7z format."
Content="Auto Zip After Patches are Generated"
IsChecked="{Binding Path=AutoZip,
RelativeSource={
RelativeSource AncestorType=Window,
Mode=FindAncestor}}"
/>
</Grid>
</Window>

View File

@ -18,6 +18,7 @@ namespace PatchGenerator
private string compareFolder = "";
private string targetFolder = "";
private string outputFolderName = "";
public bool AutoZip { get; set; } = true;
private Stopwatch stopwatch = new Stopwatch();
@ -103,7 +104,10 @@ namespace PatchGenerator
File.Copy(LazyOperations.PatcherClientPath, $"{outputFolderName}\\patcher.exe", true);
//compress patch output folder to 7z file
LazyOperations.StartZipProcess(outputFolderName, $"{outputFolderName}.7z".FromCwd());
if (AutoZip)
{
LazyOperations.StartZipProcess(outputFolderName, $"{outputFolderName}.7z".FromCwd());
}
GenProgressBar.DispatcherSetValue(100);
GenProgressMessageLabel.DispaatcherSetContent("Done");
@ -136,6 +140,7 @@ namespace PatchGenerator
CompareLabel.IsEnabled = false;
TargetLabel.IsEnabled = false;
FileNameBox.IsEnabled = false;
AutoZip_checkBox.IsEnabled = false;
string InfoNeededMessage = "You must set the following: ";
bool infoNeeded = false;
@ -168,6 +173,7 @@ namespace PatchGenerator
CompareLabel.IsEnabled = true;
TargetLabel.IsEnabled = true;
FileNameBox.IsEnabled = true;
AutoZip_checkBox.IsEnabled = true;
return;
}
@ -177,6 +183,7 @@ namespace PatchGenerator
CompareLabel.DispatcherSetEnabled(true);
TargetLabel.DispatcherSetEnabled(true);
FileNameBox.DispatcherSetEnabled(true);
AutoZip_checkBox.DispatcherSetEnabled(true);
GenProgressMessageLabel.DispaatcherSetContent("");
GenProgressInfoLabel.DispaatcherSetContent(info);

View File

@ -58,8 +58,6 @@ namespace PatcherUtils
{
DirectoryInfo di = new DirectoryInfo(patchpath);
//RaiseProgressChanged(0, fileCount, "Patching client...");
foreach (FileInfo file in di.GetFiles())
{
FileInfo target = null;