Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate HXE's SFX library, replacing the use of WinRAR to create releases. #6

Merged
merged 75 commits into from
May 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
4118b08
Add HCE Suite as a submodule
BinToss Apr 9, 2021
50b097a
Add HXE to build solution
BinToss Apr 9, 2021
479595a
Retarget Solutions to .Net Framework 4.6.2 to match HXE
BinToss Apr 11, 2021
05e354d
Retarget NuGet packages to .Net Framework 4.6.2
BinToss Apr 11, 2021
273857e
Model AmaiSosu's Main classes after SPV3's Main class
BinToss Apr 11, 2021
87651e8
Add Startup arguments and application Contexts
BinToss Apr 12, 2021
d16c1b5
Move static class Startup from ns:AmaiSosu.GUI to ns:AmaiSosi.
BinToss Apr 14, 2021
36abc6f
Add Help UserControl.
BinToss Apr 14, 2021
af220a4
Move more things to their own classes
BinToss Apr 14, 2021
42b21de
Rename Main's Compile, Help, Install subclasses.
BinToss Apr 14, 2021
4841bbd
Move Compile class to AmaiSosu namespace.
BinToss Apr 18, 2021
2410663
Remove contextual work from Main.Window.xaml.cs
BinToss Apr 18, 2021
63be3dd
Start designing the Compile UserControl
BinToss Apr 18, 2021
8efef95
Add Contextual UserControl selection to MainWindow
BinToss Apr 19, 2021
7657abc
Adjust Compile's OpenFileDialog to locate OpenSauce's binaries' driec…
BinToss Apr 20, 2021
48c762e
Tweak Compile UserControl
BinToss Apr 22, 2021
db048f5
Remove redundant path/source variable from Compile DataContext
BinToss Apr 22, 2021
fc7ffe4
Begin Refitting AmaiSosu's Packaging system for the creation of packages
BinToss Apr 22, 2021
71cb89a
Expand Compiler and Package classes
BinToss Apr 24, 2021
fa24291
Trim the fat. Separate Compile, Help, Install DataContexts from Main.
BinToss Apr 24, 2021
7d4daef
Rename certain methods to avoid overlap with classes' names.
BinToss Apr 24, 2021
10b0e24
Ensure all DataContext bindings notify a property was changed.
BinToss Apr 25, 2021
ff1735d
Overwrite relevant UserControl's DataContexts with instance from Main.
BinToss Apr 25, 2021
5d5f5b6
DataContext bindings still need work.
BinToss Apr 25, 2021
fd0e607
fix: DataContexts for Compile, Help, and Install UserControls work now.
BinToss Apr 27, 2021
ad7cb4d
fix: Fix Help.xaml.cs
BinToss May 1, 2021
3592651
feat: Compile: Compile procedure works now
BinToss May 4, 2021
375ff74
feat: Compile: copy OpenSauce 'Lib' and 'Gui' files to tmp directory …
BinToss May 4, 2021
c74320c
Update AmaiSosu.GUI project
BinToss May 4, 2021
0ab031d
feat: Install: extract SFX package and then install its contents as u…
BinToss May 4, 2021
e4b9527
feat: Improve Compile UX
BinToss May 4, 2021
cff83b4
fix(Install): Change Package.Verify to check directory instead of arc…
BinToss May 4, 2021
5d75a34
Require Admin permissions to run
BinToss May 4, 2021
1cef039
revert: "Require Admin permissions to run"
BinToss May 6, 2021
114d8c8
fix(Install): *Copy* packages' contents to their destination
BinToss May 6, 2021
bbb94f9
feat(Install): Write a Batch script file and execute it as Admin if d…
BinToss May 6, 2021
c3f9f94
fix(Install): Don't copy package contents to the *parent* of the pack…
BinToss May 8, 2021
b46db60
fix(Install): Install: Fix dxsetup Start call
BinToss May 8, 2021
f1cd9fc
feat(Compile): Catch exceptions while copying files.
BinToss May 8, 2021
bde823b
refactor(Compile): Re-use Installation.IO.Copy functions, deprecating…
BinToss May 8, 2021
a82d546
feat: Add alternative AmaiSosu.Installation.IO.Copy.All() function
BinToss May 9, 2021
6168f8d
doc(Install): Add summary comments to Install()
BinToss May 9, 2021
5052939
refactor: Remove unnecessary code from the Packages class/
BinToss May 9, 2021
bfbba47
feat(Compile): Improve file/directory verification for prepping for C…
BinToss May 9, 2021
5922709
refactor: Add static paths class to AmaiSosu.Common
BinToss May 11, 2021
63800f0
refactor: Move Compiler messages to AmaiSosu GUI Resources
BinToss May 11, 2021
c4c317c
feat(Compile): Add GetCompiler to Factory class
BinToss May 11, 2021
2746a96
refactor: split the Temp path variable to a DirectoryInfo and a strin…
BinToss May 11, 2021
947340c
refactor: Adjust Package class to utilize Temp directory.
BinToss May 11, 2021
8f12062
refactor(Compile): Move temporary code from AmaiSosu.GUI to AmaiSosu
BinToss May 11, 2021
f330fd3
refactor(Install): Clarify "cleans up EMPTY backup directory"
BinToss May 14, 2021
096796a
refactor: Move AmaiSosu.Installation.IO namespace to AmaiSosu.Common.IO
BinToss May 14, 2021
1ea14ed
refactor: Remove static Using of AmaiSosu.Common.Paths;
BinToss May 14, 2021
41a05f4
refactor: Rename InstallerFactory to PackageFactory
BinToss May 14, 2021
a4f8e7c
refactor: Move PackageFactory to AmaiSosu.Common namespace
BinToss May 14, 2021
8e3840a
refactor: Remove unnecessary Usings and simplify member accesses
BinToss May 14, 2021
bff6f22
refactor: Rename PackageFactory's _installationPath to simply _path.
BinToss May 14, 2021
9c21444
refactor: Move AmaiSosu.Installation.OpenSauceException to AmaiSosu.C…
BinToss May 14, 2021
e81e2d1
fix(Compile): Removed requirement for a vccorlib120.dll
BinToss May 14, 2021
be3e892
refactor: Move AmaiSosu.Compilation.Compiler and AmaiSosu.Installatio…
BinToss May 14, 2021
d034ca6
fix: Attempt to sanitize the path supplied via --path
BinToss May 15, 2021
b962d6e
feat(Compile): Allow auto-starting Compile procedure via --auto
BinToss May 15, 2021
894455c
fix(Compile): Instruct HXE.SFX to create its product in the Current/W…
BinToss May 15, 2021
2bc2ad6
fix(Compile): Fix package paths
BinToss May 15, 2021
261866b
fix(Compile): Change Compile's success message from InstallSuccess to…
BinToss May 15, 2021
eecfde2
fix: Package Verification now uses the correct path for the package's…
BinToss May 15, 2021
7e35b11
refactor: Simplify redundant variable-definition of Paths.KStudios
BinToss May 15, 2021
3c5d856
fix(Install): Don't check if the --path argument's parameter is an ex…
BinToss May 15, 2021
acdc07b
fix(Install): Extract SFX contents to the correct path. Package names…
BinToss May 15, 2021
994735a
refactor(Install):" Copy old "Delete Kornner Studios" code to Main.In…
BinToss May 15, 2021
2c96ff2
fix(Install): Copy packages from the correct path
BinToss May 15, 2021
b70fc4f
refactor(Install): Install DirectX Extensions silently
BinToss May 15, 2021
b638b1a
refactor: Return a bool represeting the success or failure of the Ins…
BinToss May 15, 2021
7b18e03
feat: Allow AmaiSosu to close itself in Auto mode if its operations a…
BinToss May 15, 2021
eb6cbcd
fix: Try closing the MainWindow on a separate thread on a delayed loo…
BinToss May 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "ext/HCE"]
path = ext/HCE
url = ../HCE
1 change: 1 addition & 0 deletions ext/HCE
Submodule HCE added at 527d92
36 changes: 36 additions & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Code files
[*.cs,*.xaml]
indent_style = space
indent_size = 4
#end_of_line =
#charset =

# Unix-style newlines with a newline ending every file
[*]
# end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

# 4 space indentation
# [*.py]
# indent_style = space
# indent_size = 4

# Tab indentation (no size specified)
# [Makefile]
# indent_style = tab

# Indentation override for all JS under lib directory
# [lib/**.js]
# indent_style = space
# indent_size = 2

# Matches the exact files either package.json or .travis.yml
# [{package.json,.travis.yml}]
# indent_style = space
# indent_size = 2
46 changes: 41 additions & 5 deletions src/AmaiSosu.GUI/AmaiSosu.GUI.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand All @@ -9,13 +9,14 @@
<OutputType>WinExe</OutputType>
<RootNamespace>AmaiSosu.GUI</RootNamespace>
<AssemblyName>AmaiSosu.GUI</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down Expand Up @@ -47,7 +48,7 @@
<HintPath>..\packages\Costura.Fody.3.3.3\lib\net40\Costura.dll</HintPath>
</Reference>
<Reference Include="MahApps.Metro, Version=1.6.5.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.6.5\lib\net45\MahApps.Metro.dll</HintPath>
<HintPath>..\packages\MahApps.Metro.1.6.5\lib\net46\MahApps.Metro.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -72,7 +73,19 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Help.cs" />
<Compile Include="UserControl.Compile.xaml.cs">
<DependentUpon>UserControl.Compile.xaml</DependentUpon>
</Compile>
<Compile Include="UserControl.Help.xaml.cs">
<DependentUpon>UserControl.Help.xaml</DependentUpon>
</Compile>
<Compile Include="UserControl.Install.xaml.cs">
<DependentUpon>UserControl.Install.xaml</DependentUpon>
</Compile>
<Compile Include="Compile.cs" />
<Compile Include="Main.cs" />
<Compile Include="Install.cs" />
<Compile Include="Resources\FileNames.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
Expand Down Expand Up @@ -107,9 +120,25 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Page Include="UserControl.Compile.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UserControl.Help.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UserControl.Install.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\ext\HCE\hxe\kernel\src\HXE.csproj">
<Project>{acaa5d9f-b23d-43e1-b2df-8c03230975a1}</Project>
<Name>HXE</Name>
</ProjectReference>
<ProjectReference Include="..\AmaiSosu\AmaiSosu.csproj">
<Project>{693bf44b-7ba3-461c-8ce1-d0f11fbe930d}</Project>
<Name>AmaiSosu</Name>
Expand All @@ -134,16 +163,23 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>git describe --tags &gt; "$(ProjectDir)\Resources\Version.txt"</PreBuildEvent>
</PropertyGroup>
<Import Project="..\packages\Fody.4.2.1\build\Fody.targets" Condition="Exists('..\packages\Fody.4.2.1\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Fody.4.2.1\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.4.2.1\build\Fody.targets'))" />
<Error Condition="!Exists('..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props'))" />
<Error Condition="!Exists('..\packages\Fody.4.2.1\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.4.2.1\build\Fody.targets'))" />
</Target>
<Import Project="..\packages\Fody.4.2.1\build\Fody.targets" Condition="Exists('..\packages\Fody.4.2.1\build\Fody.targets')" />
</Project>
4 changes: 2 additions & 2 deletions src/AmaiSosu.GUI/App.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Application x:Class="AmaiSosu.GUI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Startup="AppStart_Auto">
Startup="AppStart">
<!--StartupUri="MainWindow.xaml"-->
<Application.Resources>
<ResourceDictionary>
Expand All @@ -17,4 +17,4 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
</Application>
46 changes: 42 additions & 4 deletions src/AmaiSosu.GUI/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,56 @@
* You should have received a copy of the GNU General Public License
* along with AmaiSosu. If not, see <http://www.gnu.org/licenses/>.
*/

using System.Windows;
using System.Linq;
using SSO = System.StringSplitOptions;

namespace AmaiSosu.GUI
namespace AmaiSosu.GUI
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private void AppStart_Auto(object sender, StartupEventArgs e)
private void AppStart(object sender, StartupEventArgs e)
{
/** Set Startup Settings */
if (e.Args.Length != 0)
{
foreach (var verb in e.Args)
{
if (!AmaiSosu.Startup.Auto && verb.ToLower().Contains("--auto"))
AmaiSosu.Startup.Auto = true;
else if (!AmaiSosu.Startup.Compile && verb.ToLower().Contains("--compile"))
AmaiSosu.Startup.Compile = true;
else if (!AmaiSosu.Startup.Help && verb.ToLower().Contains("--help"))
AmaiSosu.Startup.Help = true;
else if (verb.ToLower().Contains("--path="))
{
var path = verb.Replace("--path=", string.Empty);
path = path.Replace("\"", string.Empty);
try
{
path = RemoveInvalidChars(path);
if (System.IO.Path.IsPathRooted(path))
AmaiSosu.Startup.Path = path;
}
catch
{ }
}
}
}
new MainWindow().Show();
}

/// <summary>
/// Strip illegal characters from a path string.
/// </summary>
/// <see cref="https://stackoverflow.com/a/23182807/14894786"/>
private string RemoveInvalidChars(string filename)
{
new MainWindow(e).Show();
return string.Concat(filename.Split(System.IO.Path.GetInvalidPathChars()));
}
}
}
}
130 changes: 130 additions & 0 deletions src/AmaiSosu.GUI/Compile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/**
* Copyright (C) 2018-2019 Emilian Roman
* Copyright (c) 2021 Noah Sherwin
*
* This file is part of AmaiSosu.
*
* AmaiSosu is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AmaiSosu is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AmaiSosu. If not, see <http://www.gnu.org/licenses/>.
*/

using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Windows;
using AmaiSosu.GUI.Properties;
using AmaiSosu.GUI.Resources;
using static System.Environment;

namespace AmaiSosu.GUI
{
public class Compile : INotifyPropertyChanged
{
private bool _canCompile;
private string _compileText = "Locate the files to package.";

private string _source = string.IsNullOrWhiteSpace(Startup.Path) ?
CurrentDirectory :
Startup.Path;

private Visibility _visibility = Visibility.Collapsed;

/// <summary>
/// Gets or sets a value indicating whether AmaiSosu can compile a release.
/// </summary>
/// <value>
/// <c>true</c> if this instance can compile; otherwise, <c>false</c>.
/// </value>
public bool CanCompile
{
get => _canCompile;
set
{
if (value == _canCompile) return;
_canCompile = value;
OnPropertyChanged();
}
}

/// <summary>
/// Gets or sets the compile text message.
/// </summary>
public string CompileText
{
get => _compileText;
set
{
if (value == _compileText) return;
_compileText = value;
OnPropertyChanged();
}
}

/// <summary>
/// Gets or sets the path containing OpenSauce binaries.
/// </summary>
public string Source
{
get => _source;
set
{
if (value == _source) return;
_source = value;
OnPropertyChanged();
}
}

/// <summary>
/// Invokes HXE's SFX Compiler
/// </summary>
/// TODO instead of a bool, return a SUCCESS or FAILURE enum
public bool Invoke()
{
try
{
CompileText = "Compiling...";
new AmaiSosu.Main(Source).Compile();
CompileText = Messages.CompileSuccess;
return true;
}
catch (Exception e)
{
CompileText = e.Message;
return false;
}
}

/// <summary>
/// Visibility property of the Compile UserControl
/// </summary>
public Visibility Visibility
{
get => _visibility;
set
{
if (value == _visibility) return;
_visibility = value;
OnPropertyChanged();
}
}

public event PropertyChangedEventHandler PropertyChanged;

[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Loading