Skip to content

Commit

Permalink
Merge pull request #6 from HaloSPV3/SFX
Browse files Browse the repository at this point in the history
Integrate HXE's SFX library, replacing the use of WinRAR to create releases.
  • Loading branch information
BinToss authored May 16, 2021
2 parents 6ae54c1 + eb6cbcd commit 14116a4
Show file tree
Hide file tree
Showing 44 changed files with 1,513 additions and 420 deletions.
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

0 comments on commit 14116a4

Please sign in to comment.