add patchclient, update other projects, blah
This commit is contained in:
parent
f44bb375c2
commit
308ea92267
9
Patcher/PatchClient/App.xaml
Normal file
9
Patcher/PatchClient/App.xaml
Normal file
@ -0,0 +1,9 @@
|
||||
<Application x:Class="PatchClient.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PatchClient"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
17
Patcher/PatchClient/App.xaml.cs
Normal file
17
Patcher/PatchClient/App.xaml.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace PatchClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
10
Patcher/PatchClient/AssemblyInfo.cs
Normal file
10
Patcher/PatchClient/AssemblyInfo.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using System.Windows;
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
48
Patcher/PatchClient/Extensions/ControlExtensions.cs
Normal file
48
Patcher/PatchClient/Extensions/ControlExtensions.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace PatchClient.Extensions
|
||||
{
|
||||
public static class ControlExtensions
|
||||
{
|
||||
public static void DispatcherSetValue(this ProgressBar pb, int Value)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
pb.Value = Value;
|
||||
});
|
||||
}
|
||||
|
||||
public static void DispatcherSetIndetermination(this ProgressBar pb, bool Indeterminate)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
pb.IsIndeterminate = Indeterminate;
|
||||
});
|
||||
}
|
||||
|
||||
public static void DispaatcherSetContent(this ContentControl cc, object content)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
cc.Content = content;
|
||||
});
|
||||
}
|
||||
|
||||
public static void DispatcherSetText(this TextBlock tb, string Text)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
tb.Text = Text;
|
||||
});
|
||||
}
|
||||
|
||||
public static void DispatcherSetEnabled(this UIElement uie, bool Enabled)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
uie.IsEnabled = Enabled;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
36
Patcher/PatchClient/MainWindow.xaml
Normal file
36
Patcher/PatchClient/MainWindow.xaml
Normal file
@ -0,0 +1,36 @@
|
||||
<Window x:Class="PatchClient.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:PatchClient"
|
||||
mc:Ignorable="d"
|
||||
Title="Patching Client" Height="200" Width="600"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Loaded="Window_Loaded">
|
||||
<Grid>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<Label x:Name="PatchMessageLabel"
|
||||
Margin="10"
|
||||
/>
|
||||
|
||||
<ContentControl Margin="10">
|
||||
<Grid>
|
||||
<ProgressBar x:Name="PatchProgressBar"
|
||||
Height="20"
|
||||
Foreground="MediumPurple"
|
||||
/>
|
||||
<Label x:Name="PatchProgressInfoLabel"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
FontSize="15" FontWeight="SemiBold"
|
||||
/>
|
||||
</Grid>
|
||||
</ContentControl>
|
||||
|
||||
<TextBlock x:Name="AdditionalInfoBlock"
|
||||
TextWrapping="Wrap"
|
||||
Margin="10"
|
||||
/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
82
Patcher/PatchClient/MainWindow.xaml.cs
Normal file
82
Patcher/PatchClient/MainWindow.xaml.cs
Normal file
@ -0,0 +1,82 @@
|
||||
using PatchClient.Extensions;
|
||||
using PatcherUtils;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace PatchClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void RunPatcher()
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
FilePatcher bp = new FilePatcher()
|
||||
{
|
||||
TargetBase = Environment.CurrentDirectory,
|
||||
PatchBase = LazyOperations.PatchFolder.FromCwd()
|
||||
};
|
||||
|
||||
bp.ProgressChanged += Bp_ProgressChanged;
|
||||
|
||||
try
|
||||
{
|
||||
if (bp.Run())
|
||||
{
|
||||
MessageBox.Show("Patch completed without issues", "Patching Successful");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Failed to patch client.", "Patching Failed", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
Application.Current.Shutdown(0);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void Bp_ProgressChanged(object Sender, int Progress, int Total, int Percent, string Message = "", params LineItem[] AdditionalLineItems)
|
||||
{
|
||||
string additionalInfo = "";
|
||||
foreach (LineItem item in AdditionalLineItems)
|
||||
{
|
||||
additionalInfo += $"{item.ItemText}: {item.ItemValue}\n";
|
||||
}
|
||||
|
||||
|
||||
PatchProgressBar.DispatcherSetValue(Percent);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Message))
|
||||
{
|
||||
PatchMessageLabel.DispaatcherSetContent(Message);
|
||||
}
|
||||
|
||||
PatchProgressInfoLabel.DispaatcherSetContent($"[{Progress}/{Total}]");
|
||||
|
||||
AdditionalInfoBlock.DispatcherSetText(additionalInfo);
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RunPatcher();
|
||||
}
|
||||
}
|
||||
}
|
13
Patcher/PatchClient/PatchClient.csproj
Normal file
13
Patcher/PatchClient/PatchClient.csproj
Normal file
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PatcherUtils\PatcherUtils.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
48
Patcher/PatchGenerator/Extensions/ControlExtensions.cs
Normal file
48
Patcher/PatchGenerator/Extensions/ControlExtensions.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace PatchGenerator.Extensions
|
||||
{
|
||||
public static class ControlExtensions
|
||||
{
|
||||
public static void DispatcherSetValue(this ProgressBar pb, int Value)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
pb.Value = Value;
|
||||
});
|
||||
}
|
||||
|
||||
public static void DispatcherSetIndetermination(this ProgressBar pb, bool Indeterminate)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
pb.IsIndeterminate = Indeterminate;
|
||||
});
|
||||
}
|
||||
|
||||
public static void DispaatcherSetContent(this ContentControl cc, object content)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
cc.Content = content;
|
||||
});
|
||||
}
|
||||
|
||||
public static void DispatcherSetText(this TextBlock tb, string Text)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
tb.Text = Text;
|
||||
});
|
||||
}
|
||||
|
||||
public static void DispatcherSetEnabled(this UIElement uie, bool Enabled)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
uie.IsEnabled = Enabled;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,8 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:PatchGenerator"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
Title="Patch Generator" Height="450" Width="800"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@ -14,30 +15,41 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="AUTO"/>
|
||||
<RowDefinition Height="AUTO"/>
|
||||
<RowDefinition Height="200"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="AUTO"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<DockPanel Grid.ColumnSpan="2" Margin="10 10 10 5"
|
||||
LastChildFill="True">
|
||||
<Label Content="Output Folder Name"
|
||||
/>
|
||||
<TextBox x:Name="FileNameBox"
|
||||
TextChanged="FileNameBox_TextChanged"
|
||||
/>
|
||||
</DockPanel>
|
||||
|
||||
<ProgressBar x:Name="GenProgressBar"
|
||||
Grid.ColumnSpan="2"
|
||||
Height="20" Margin="10"
|
||||
Grid.Row="1" Grid.ColumnSpan="2"
|
||||
Height="20" Margin="10 5 10 10"
|
||||
Foreground="MediumPurple"
|
||||
/>
|
||||
|
||||
<Label x:Name="GenProgressMessageLabel"
|
||||
FontSize="15" FontWeight="SemiBold"
|
||||
Grid.ColumnSpan="2" Margin="0 0 10 0"
|
||||
Grid.Row="1" Grid.ColumnSpan="2" Margin="0 0 10 5"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
/>
|
||||
|
||||
<Label x:Name="GenProgressInfoLabel"
|
||||
FontSize="15" FontWeight="SemiBold"
|
||||
Grid.ColumnSpan="2" Margin="10 0 0 0"
|
||||
Grid.Row="1" Grid.ColumnSpan="2" Margin="10 0 0 5"
|
||||
HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||
/>
|
||||
|
||||
<Label x:Name="CompareLabel"
|
||||
Grid.Row="1" Margin="10 10 5 10"
|
||||
Grid.Row="2" Margin="10 10 5 10"
|
||||
Drop="CompareLabel_Drop"
|
||||
AllowDrop="True"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
@ -47,7 +59,7 @@
|
||||
/>
|
||||
|
||||
<Label x:Name="TargetLabel"
|
||||
Grid.Column="1" Grid.Row="1" Margin="5 10 10 10"
|
||||
Grid.Column="1" Grid.Row="2" Margin="5 10 10 10"
|
||||
Drop="TargetLabel_Drop"
|
||||
AllowDrop="True"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
@ -57,12 +69,13 @@
|
||||
/>
|
||||
|
||||
<TextBlock x:Name="AdditionalInfoBlock"
|
||||
Grid.Row="2" Margin="10"
|
||||
Grid.Row="3" Grid.RowSpan="2" Margin="10"
|
||||
VerticalAlignment="Bottom"
|
||||
TextWrapping="Wrap"
|
||||
/>
|
||||
|
||||
<Button x:Name="GenButton"
|
||||
Grid.Column="1" Grid.Row="2"
|
||||
Grid.Column="1" Grid.Row="4"
|
||||
MinHeight="40" Margin="10"
|
||||
Content="Generate Patches"
|
||||
Click="GenButton_Click"
|
||||
|
@ -1,9 +1,12 @@
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using PatcherUtils;
|
||||
using PatchGenerator.Extensions;
|
||||
|
||||
namespace PatchGenerator
|
||||
{
|
||||
@ -14,7 +17,8 @@ namespace PatchGenerator
|
||||
{
|
||||
private string compareFolder = "";
|
||||
private string targetFolder = "";
|
||||
private readonly string patchFolder = "Aki_Data/Patcher/".FromCwd();
|
||||
private string outputFolderName = "";
|
||||
|
||||
private Stopwatch stopwatch = new Stopwatch();
|
||||
|
||||
public MainWindow()
|
||||
@ -74,26 +78,19 @@ namespace PatchGenerator
|
||||
}
|
||||
}
|
||||
|
||||
private void GeneratePatches()
|
||||
private void GeneratePatches(string patchBase)
|
||||
{
|
||||
//create temp data
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
GenProgressBar.IsIndeterminate = true;
|
||||
GenProgressMessageLabel.Content = "Extracting temp data ...";
|
||||
});
|
||||
GenProgressBar.DispatcherSetIndetermination(true);
|
||||
GenProgressMessageLabel.DispaatcherSetContent("Extracting temp data ...");
|
||||
|
||||
LazyOperations.CleanupTempDir();
|
||||
LazyOperations.PrepTempDir();
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
GenProgressBar.IsIndeterminate = false;
|
||||
});
|
||||
|
||||
GenProgressBar.DispatcherSetIndetermination(false);
|
||||
|
||||
//generate patches
|
||||
|
||||
FileCompare bc = new FileCompare(targetFolder, compareFolder, patchFolder);
|
||||
FileCompare bc = new FileCompare(targetFolder, compareFolder, patchBase);
|
||||
|
||||
bc.ProgressChanged += Bc_ProgressChanged;
|
||||
|
||||
@ -102,50 +99,89 @@ namespace PatchGenerator
|
||||
MessageBox.Show("Failed to generate diffs.", ":(", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
|
||||
//TODO - Build patcher
|
||||
//Copy patch client to output folder
|
||||
File.Copy(LazyOperations.PatcherClientPath, $"{outputFolderName}\\patcher.exe", true);
|
||||
|
||||
//TODO - compress to file (should add a name textbox or something)
|
||||
//compress patch output folder to 7z file
|
||||
LazyOperations.StartZipProcess(outputFolderName, $"{outputFolderName}.7z".FromCwd());
|
||||
|
||||
//Cleanup temp data
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
GenProgressBar.Value = 100;
|
||||
GenProgressMessageLabel.Content = $"Done";
|
||||
});
|
||||
|
||||
if (!LazyOperations.CleanupTempDir())
|
||||
{
|
||||
MessageBox.Show($"Looks like some temp files could not be removed. You can safely delete this folder:\n\n{LazyOperations.TempDir}");
|
||||
}
|
||||
GenProgressBar.DispatcherSetValue(100);
|
||||
GenProgressMessageLabel.DispaatcherSetContent("Done");
|
||||
}
|
||||
|
||||
private void Bc_ProgressChanged(object Sender, int Progress, int Total, int Percent, string Message = "", params LineItem[] AdditionalLineItems)
|
||||
{
|
||||
|
||||
string additionalInfo = "";
|
||||
foreach(LineItem item in AdditionalLineItems)
|
||||
foreach (LineItem item in AdditionalLineItems)
|
||||
{
|
||||
additionalInfo += $"{item.ItemText}: {item.ItemValue}\n";
|
||||
}
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
|
||||
GenProgressBar.DispatcherSetValue(Percent);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Message))
|
||||
{
|
||||
GenProgressBar.Value = Percent;
|
||||
GenProgressMessageLabel.DispaatcherSetContent(Message);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Message))
|
||||
{
|
||||
GenProgressMessageLabel.Content = Message;
|
||||
}
|
||||
GenProgressInfoLabel.DispaatcherSetContent($"[{Progress}/{Total}]");
|
||||
|
||||
GenProgressInfoLabel.Content = $"[{Progress}/{Total}]";
|
||||
|
||||
AdditionalInfoBlock.Text = additionalInfo;
|
||||
});
|
||||
AdditionalInfoBlock.DispatcherSetText(additionalInfo);
|
||||
}
|
||||
|
||||
private void GenButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
GenButton.IsEnabled = false;
|
||||
CompareLabel.IsEnabled = false;
|
||||
TargetLabel.IsEnabled = false;
|
||||
FileNameBox.IsEnabled = false;
|
||||
|
||||
string InfoNeededMessage = "You must set the following: ";
|
||||
bool infoNeeded = false;
|
||||
|
||||
if(string.IsNullOrWhiteSpace(FileNameBox.Text))
|
||||
{
|
||||
InfoNeededMessage += "\n[Output File Name]";
|
||||
FileNameBox.BorderBrush = Brushes.Red;
|
||||
infoNeeded = true;
|
||||
}
|
||||
|
||||
if(string.IsNullOrWhiteSpace(compareFolder))
|
||||
{
|
||||
InfoNeededMessage += "\n[COMPARE Folder]";
|
||||
CompareLabel.BorderBrush = Brushes.Red;
|
||||
infoNeeded = true;
|
||||
}
|
||||
|
||||
if(string.IsNullOrWhiteSpace(targetFolder))
|
||||
{
|
||||
InfoNeededMessage += "\n[TARGET Folder]";
|
||||
TargetLabel.BorderBrush = Brushes.Red;
|
||||
infoNeeded = true;
|
||||
}
|
||||
|
||||
if (infoNeeded)
|
||||
{
|
||||
MessageBox.Show(InfoNeededMessage, "Info Required", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
GenButton.IsEnabled = true;
|
||||
CompareLabel.IsEnabled = true;
|
||||
TargetLabel.IsEnabled = true;
|
||||
FileNameBox.IsEnabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
void SetEndingInfo(string info)
|
||||
{
|
||||
GenButton.DispatcherSetEnabled(true);
|
||||
CompareLabel.DispatcherSetEnabled(true);
|
||||
TargetLabel.DispatcherSetEnabled(true);
|
||||
FileNameBox.DispatcherSetEnabled(true);
|
||||
|
||||
GenProgressMessageLabel.DispaatcherSetContent("");
|
||||
GenProgressInfoLabel.DispaatcherSetContent(info);
|
||||
}
|
||||
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
@ -154,20 +190,27 @@ namespace PatchGenerator
|
||||
|
||||
try
|
||||
{
|
||||
GeneratePatches();
|
||||
GeneratePatches(Path.Combine(outputFolderName.FromCwd(), LazyOperations.PatchFolder));
|
||||
stopwatch.Stop();
|
||||
SetEndingInfo($"Patches Generated in: {GetStopWatchTime()}");
|
||||
}
|
||||
finally
|
||||
catch(Exception ex)
|
||||
{
|
||||
stopwatch.Stop();
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
GenButton.IsEnabled = true;
|
||||
GenProgressMessageLabel.Content = "";
|
||||
GenProgressInfoLabel.Content = $"Patches Generated in: {GetStopWatchTime()}";
|
||||
});
|
||||
SetEndingInfo(ex.Message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void FileNameBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
|
||||
{
|
||||
FileNameBox.BorderBrush = Brushes.Gainsboro;
|
||||
|
||||
if (outputFolderName == FileNameBox.Text) return;
|
||||
|
||||
outputFolderName = Regex.Replace(FileNameBox.Text, "[^A-Za-z0-9.\\-_]", "");
|
||||
|
||||
FileNameBox.Text = outputFolderName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,14 +6,6 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Resources\7za.exe" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\7za.exe" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PatcherUtils\PatcherUtils.csproj" />
|
||||
</ItemGroup>
|
||||
|
@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PatchGenerator", "PatchGene
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PatcherUtils", "PatcherUtils\PatcherUtils.csproj", "{A9819B34-8111-4344-B2B3-3DE5D7A43A45}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PatchClient", "PatchClient\PatchClient.csproj", "{9CA4D2BD-6596-41D1-8354-135868DF8DAB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -21,6 +23,10 @@ Global
|
||||
{A9819B34-8111-4344-B2B3-3DE5D7A43A45}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A9819B34-8111-4344-B2B3-3DE5D7A43A45}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A9819B34-8111-4344-B2B3-3DE5D7A43A45}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9CA4D2BD-6596-41D1-8354-135868DF8DAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9CA4D2BD-6596-41D1-8354-135868DF8DAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9CA4D2BD-6596-41D1-8354-135868DF8DAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9CA4D2BD-6596-41D1-8354-135868DF8DAB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -140,7 +140,7 @@ namespace PatcherUtils
|
||||
AdditionalInfo[3].ItemValue = matchCount.ToString();
|
||||
|
||||
fileIt++;
|
||||
RaiseProgressChanged(fileIt, fileCount, "", AdditionalInfo.ToArray());
|
||||
RaiseProgressChanged(fileIt, fileCount, file.Name, AdditionalInfo.ToArray());
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ namespace PatcherUtils
|
||||
|
||||
foreach (FileInfo file in di.GetFiles())
|
||||
{
|
||||
FileInfo target;
|
||||
FileInfo target = null;
|
||||
|
||||
switch (file.Extension)
|
||||
{
|
||||
@ -106,7 +106,7 @@ namespace PatcherUtils
|
||||
AdditionalInfo[2].ItemValue = delCount.ToString();
|
||||
|
||||
++fileIt;
|
||||
RaiseProgressChanged(fileIt, fileCount, "", AdditionalInfo.ToArray());
|
||||
RaiseProgressChanged(fileIt, fileCount, target.Name, AdditionalInfo.ToArray());
|
||||
}
|
||||
|
||||
foreach (DirectoryInfo directory in di.GetDirectories())
|
||||
|
@ -1,4 +1,6 @@
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace PatcherUtils
|
||||
@ -11,12 +13,18 @@ namespace PatcherUtils
|
||||
public static string TempDir = "PATCHER_TEMP".FromCwd();
|
||||
|
||||
private static string SevenZExe = "7za.exe";
|
||||
|
||||
/// <summary>
|
||||
/// The folder that the patches will be stored in
|
||||
/// </summary>
|
||||
public static string PatchFolder = "Aki_Data\\Patcher";
|
||||
|
||||
/// <summary>
|
||||
/// The path to the 7za.exe file in the <see cref="TempDir"/>
|
||||
/// </summary>
|
||||
public static string SevenZExePath = $"{TempDir}\\{SevenZExe}";
|
||||
|
||||
private static string PatcherClient = "patcher.exe";
|
||||
private static string PatcherClient = "PatchClient.exe";
|
||||
/// <summary>
|
||||
/// The path to the patcher.exe file in the <see cref="TempDir"/>
|
||||
/// </summary>
|
||||
@ -69,11 +77,22 @@ namespace PatcherUtils
|
||||
}
|
||||
}
|
||||
|
||||
public static void StartZipProcess(string SourcePath, string DestinationPath)
|
||||
{
|
||||
ProcessStartInfo procInfo = new ProcessStartInfo()
|
||||
{
|
||||
FileName = SevenZExePath,
|
||||
Arguments = $"a {DestinationPath} {SourcePath}"
|
||||
};
|
||||
|
||||
Process.Start(procInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the <see cref="TempDir"/> recursively
|
||||
/// </summary>
|
||||
/// <Returns>Returns true if the temp directory was deleted.</Returns>
|
||||
public static bool CleanupTempDir()
|
||||
public static void CleanupTempDir()
|
||||
{
|
||||
DirectoryInfo dir = new DirectoryInfo(TempDir);
|
||||
|
||||
@ -81,15 +100,6 @@ namespace PatcherUtils
|
||||
{
|
||||
dir.Delete(true);
|
||||
}
|
||||
|
||||
dir.Refresh();
|
||||
|
||||
if(dir.Exists)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,16 @@
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Resources\7za.exe" />
|
||||
<None Remove="Resources\PatchClient.exe" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\7za.exe" />
|
||||
<EmbeddedResource Include="Resources\PatchClient.exe" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Aki.ByteBanger">
|
||||
<HintPath>..\PatchGenerator\References\Aki.ByteBanger.dll</HintPath>
|
||||
|
BIN
Patcher/PatcherUtils/Resources/PatchClient.exe
Normal file
BIN
Patcher/PatcherUtils/Resources/PatchClient.exe
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user