Skip to content

Commit

Permalink
Introduce the AmaiSosu library & discard Atarashii
Browse files Browse the repository at this point in the history
  • Loading branch information
MirisWisdom committed Nov 23, 2018
1 parent ff5c8d3 commit 6c2dbfe
Show file tree
Hide file tree
Showing 113 changed files with 464 additions and 4,454 deletions.
13 changes: 4 additions & 9 deletions AmaiSosu.GUI/AmaiSosu.GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="IO\Copy.cs" />
<Compile Include="IO\Move.cs" />
<Compile Include="IO\MoveDirectory.cs" />
<Compile Include="IO\MoveFactory.cs" />
<Compile Include="IO\MoveFile.cs" />
<Compile Include="Main.cs" />
<Compile Include="Resources\FileNames.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
Expand All @@ -74,7 +70,6 @@
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
</Compile>
Expand All @@ -99,9 +94,9 @@
<Page Include="MainWindow.xaml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Atarashii\Atarashii.API\Atarashii.API.csproj">
<Project>{2c5d2b0e-fea7-43f2-9960-215280cca7b7}</Project>
<Name>Atarashii.API</Name>
<ProjectReference Include="..\AmaiSosu\AmaiSosu.csproj">
<Project>{693bf44b-7ba3-461c-8ce1-d0f11fbe930d}</Project>
<Name>AmaiSosu</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
Expand Down
55 changes: 2 additions & 53 deletions AmaiSosu.GUI/Main.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using AmaiSosu.GUI.IO;
using AmaiSosu.Detection;
using AmaiSosu.GUI.Properties;
using AmaiSosu.GUI.Resources;
using Atarashii.API;

namespace AmaiSosu.GUI
{
Expand Down Expand Up @@ -117,12 +114,7 @@ public void Install()
{
try
{
var backupDir = System.IO.Path.Combine(_path, FileNames.AmaiSosuBackup + '.' + Guid.NewGuid());

CommitBackups(backupDir);
OpenSauce.Install(Path);
FinishInstall(backupDir);

new AmaiSosu.Main(_path).Install();
InstallText = Messages.InstallSuccess;
}
catch (Exception e)
Expand All @@ -131,49 +123,6 @@ public void Install()
}
}

/// <summary>
/// Conducts the OpenSauce & HAC2 data backup routines.
/// </summary>
/// <param name="backupDir">
/// Backup directory to use for backing up OpenSauce & HAC2 data.
/// </param>
private void CommitBackups(string backupDir)
{
Directory.CreateDirectory(backupDir);

new List<Move>
{
MoveFactory.Get(MoveFactory.Type.BackupOsFiles, _path, backupDir),
MoveFactory.Get(MoveFactory.Type.BackupOsDirectories, _path, backupDir),
MoveFactory.Get(MoveFactory.Type.BackupHac2Files, _path, backupDir)
}.ForEach(move => move.Commit());
}

/// <summary>
/// Conducts optional installation finalisation routines.
/// - Restore the HCE shaders.
/// - Move the OpenSauce IDE.
/// - Backup directory cleanup.
/// </summary>
/// <param name="backupDir"></param>
private void FinishInstall(string backupDir)
{
// restore backed up HCE shaders
MoveFactory.Get(MoveFactory.Type.RestoreHceShaders, _path, backupDir).Commit();

var source =
System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
FileNames.OpenSauceDeveloper, FileNames.OpenSauceDirectory, FileNames.OpenSauceIDE);

var target = System.IO.Path.Combine(Path, FileNames.OpenSauceIDE);

Copy.All(new DirectoryInfo(source), new DirectoryInfo(target));
Directory.Delete(source, true);

// cleans up backup directory
if (!Directory.EnumerateFileSystemEntries(backupDir).Any()) Directory.Delete(backupDir);
}

/// <summary>
/// Updates the install text upon successful path provision.
/// </summary>
Expand Down
22 changes: 6 additions & 16 deletions AmaiSosu.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,25 @@ ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Atarashii.API", "Atarashii\Atarashii.API\Atarashii.API.csproj", "{2C5D2B0E-FEA7-43F2-9960-215280CCA7B7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Atarashii", "Atarashii", "{E25ADF8A-11C3-435C-A767-E74F2335FEE8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Atarashii", "Atarashii\Atarashii\Atarashii.csproj", "{9665535F-B184-41F6-AC56-85DB14FD3B79}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AmaiSosu.GUI", "AmaiSosu.GUI\AmaiSosu.GUI.csproj", "{4AB5A870-7A84-4206-994B-EAB91473CD6C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AmaiSosu", "AmaiSosu\AmaiSosu.csproj", "{693BF44B-7BA3-461C-8CE1-D0F11FBE930D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2C5D2B0E-FEA7-43F2-9960-215280CCA7B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2C5D2B0E-FEA7-43F2-9960-215280CCA7B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C5D2B0E-FEA7-43F2-9960-215280CCA7B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C5D2B0E-FEA7-43F2-9960-215280CCA7B7}.Release|Any CPU.Build.0 = Release|Any CPU
{9665535F-B184-41F6-AC56-85DB14FD3B79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9665535F-B184-41F6-AC56-85DB14FD3B79}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9665535F-B184-41F6-AC56-85DB14FD3B79}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9665535F-B184-41F6-AC56-85DB14FD3B79}.Release|Any CPU.Build.0 = Release|Any CPU
{4AB5A870-7A84-4206-994B-EAB91473CD6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4AB5A870-7A84-4206-994B-EAB91473CD6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4AB5A870-7A84-4206-994B-EAB91473CD6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4AB5A870-7A84-4206-994B-EAB91473CD6C}.Release|Any CPU.Build.0 = Release|Any CPU
{693BF44B-7BA3-461C-8CE1-D0F11FBE930D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{693BF44B-7BA3-461C-8CE1-D0F11FBE930D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{693BF44B-7BA3-461C-8CE1-D0F11FBE930D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{693BF44B-7BA3-461C-8CE1-D0F11FBE930D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{2C5D2B0E-FEA7-43F2-9960-215280CCA7B7} = {E25ADF8A-11C3-435C-A767-E74F2335FEE8}
{9665535F-B184-41F6-AC56-85DB14FD3B79} = {E25ADF8A-11C3-435C-A767-E74F2335FEE8}
EndGlobalSection
EndGlobal
89 changes: 89 additions & 0 deletions AmaiSosu/AmaiSosu.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{693BF44B-7BA3-461C-8CE1-D0F11FBE930D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AmaiSosu</RootNamespace>
<AssemblyName>AmaiSosu</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Common\Exceptions\PackageException.cs" />
<Compile Include="Common\Exceptions\VerifierException.cs" />
<Compile Include="Common\IVerifiable.cs" />
<Compile Include="Common\Module.cs" />
<Compile Include="Common\Output.cs" />
<Compile Include="Common\Package.cs" />
<Compile Include="Common\Verification.cs" />
<Compile Include="Detection\Executable.cs" />
<Compile Include="Detection\ExecutableFactory.cs" />
<Compile Include="Detection\Loader.cs" />
<Compile Include="Detection\LoaderException.cs" />
<Compile Include="Installation\Installer.cs" />
<Compile Include="Installation\InstallerFactory.cs" />
<Compile Include="Installation\IO\Copy.cs" />
<Compile Include="Installation\IO\Move.cs" />
<Compile Include="Installation\IO\MoveDirectory.cs" />
<Compile Include="Installation\IO\MoveFactory.cs" />
<Compile Include="Installation\IO\MoveFile.cs" />
<Compile Include="Installation\OpenSauceException.cs" />
<Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\FileNames.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>FileNames.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Background.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\FileNames.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>FileNames.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Version.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Runtime.Serialization;

namespace Atarashii.Common.Exceptions
namespace AmaiSosu.Common.Exceptions
{
[Serializable]
public class PackageException : Exception
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Runtime.Serialization;

namespace Atarashii.Common.Exceptions
namespace AmaiSosu.Common.Exceptions
{
[Serializable]
public class VerifierException : Exception
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Atarashii.Common
namespace AmaiSosu.Common
{
public interface IVerifiable
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace Atarashii.Common
namespace AmaiSosu.Common
{
/// <summary>
/// Abstract type representing an Atarashii module.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Atarashii.Common
namespace AmaiSosu.Common
{
/// <summary>
/// Abstract representing an object that outputs inbound messages.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.IO;
using System.IO.Compression;
using Atarashii.Common.Exceptions;
using AmaiSosu.Common.Exceptions;

namespace Atarashii.Common
namespace AmaiSosu.Common
{
/// <summary>
/// Archive installer and verifier.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace Atarashii.Common
namespace AmaiSosu.Common
{
public class Verification
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Diagnostics;
using System.IO;
using Atarashii.Common;
using AmaiSosu.Common;

namespace Atarashii.Modules.Loader
namespace AmaiSosu.Detection
{
public class Executable : Module, IVerifiable
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.IO;
using Atarashii.Common;
using AmaiSosu.Common;
using Microsoft.Win32;

namespace Atarashii.Modules.Loader
namespace AmaiSosu.Detection
{
public static class ExecutableFactory
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
using Atarashii.Modules.Loader;

namespace Atarashii.API
namespace AmaiSosu.Detection
{
/// <summary>
/// Static API for the Atarashii Loader Module.
/// </summary>
public static class Loader
{
/// <summary>
/// Verifies and loads the inbound HCE executable if valid.
/// </summary>
/// <param name="hceExecutable">
/// Absolute path to a valid HCE executable.
/// </param>
public static void Load(string hceExecutable)
{
new Executable(hceExecutable).Load();
}

/// <summary>
/// Attempts to detect the path of the HCE executable on the file system.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Runtime.Serialization;

namespace Atarashii.Modules.Loader
namespace AmaiSosu.Detection
{
[Serializable]
public class LoaderException : Exception
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.IO;

namespace AmaiSosu.GUI.IO
namespace AmaiSosu.Installation.IO
{
/// <summary>
/// Copy a directory and its contents. Adapted from the MSDN CopyAll method.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace AmaiSosu.GUI.IO
namespace AmaiSosu.Installation.IO
{
/// <summary>
/// Abstract representing a type that conducts data migration.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.IO;

namespace AmaiSosu.GUI.IO
namespace AmaiSosu.Installation.IO
{
/// <inheritdoc />
public class MoveDirectory : Move
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.IO;

namespace AmaiSosu.GUI.IO
namespace AmaiSosu.Installation.IO
{
/// <summary>
/// Returns Move instances built using the inbound arguments. This factory is designed for backing up or
Expand Down
Loading

0 comments on commit 6c2dbfe

Please sign in to comment.