.NET 6
This commit is contained in:
parent
d934a3e9c9
commit
5120956e5e
@ -1 +0,0 @@
|
||||
2.1.500
|
12
LibHac.csproj
Normal file
12
LibHac.csproj
Normal file
@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
57
LibHac.sln
57
LibHac.sln
@ -1,57 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27703.2026
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibHac", "src\LibHac\LibHac.csproj", "{FFCA6C31-D9D4-4ED8-A06D-0CC6B94422B8}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "hactoolnet", "src\hactoolnet\hactoolnet.csproj", "{B1633A64-125F-40A3-9E15-654B4DE5FD98}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibHac.Nand", "src\LibHac.Nand\LibHac.Nand.csproj", "{AB503D24-F702-4E6E-B615-A9C7BDA218D1}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NandReader", "src\NandReader\NandReader.csproj", "{9889C467-284F-4061-B4DB-EC94051C29C0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NandReaderGui", "src\NandReaderGui\NandReaderGui.csproj", "{3CBD38B0-6575-4768-8E94-A8AF2D2C9F43}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibHac.Tests", "tests\LibHac.Tests\LibHac.Tests.csproj", "{679C89BD-5FDF-4CC2-9129-ABABD759035B}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{C7150117-90B8-4083-8141-BBC35C9F44F6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{FFCA6C31-D9D4-4ED8-A06D-0CC6B94422B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FFCA6C31-D9D4-4ED8-A06D-0CC6B94422B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FFCA6C31-D9D4-4ED8-A06D-0CC6B94422B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FFCA6C31-D9D4-4ED8-A06D-0CC6B94422B8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B1633A64-125F-40A3-9E15-654B4DE5FD98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B1633A64-125F-40A3-9E15-654B4DE5FD98}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B1633A64-125F-40A3-9E15-654B4DE5FD98}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B1633A64-125F-40A3-9E15-654B4DE5FD98}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AB503D24-F702-4E6E-B615-A9C7BDA218D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AB503D24-F702-4E6E-B615-A9C7BDA218D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AB503D24-F702-4E6E-B615-A9C7BDA218D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AB503D24-F702-4E6E-B615-A9C7BDA218D1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9889C467-284F-4061-B4DB-EC94051C29C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9889C467-284F-4061-B4DB-EC94051C29C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9889C467-284F-4061-B4DB-EC94051C29C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9889C467-284F-4061-B4DB-EC94051C29C0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3CBD38B0-6575-4768-8E94-A8AF2D2C9F43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3CBD38B0-6575-4768-8E94-A8AF2D2C9F43}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{679C89BD-5FDF-4CC2-9129-ABABD759035B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{679C89BD-5FDF-4CC2-9129-ABABD759035B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{679C89BD-5FDF-4CC2-9129-ABABD759035B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{679C89BD-5FDF-4CC2-9129-ABABD759035B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C7150117-90B8-4083-8141-BBC35C9F44F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C7150117-90B8-4083-8141-BBC35C9F44F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {34FFB415-7E00-49BB-B0BA-46A0ACB1D0C8}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
@ -1,4 +0,0 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=AB503D24_002DF702_002D4E6E_002DB615_002DA9C7BDA218D1_002Fd_003ADiscUtils_002ECore/@EntryIndexedValue">ExplicitlyExcluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=AB503D24_002DF702_002D4E6E_002DB615_002DA9C7BDA218D1_002Fd_003ADiscUtils_002EFat/@EntryIndexedValue">ExplicitlyExcluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=AB503D24_002DF702_002D4E6E_002DB615_002DA9C7BDA218D1_002Fd_003ADiscUtils_002EStreams/@EntryIndexedValue">ExplicitlyExcluded</s:String></wpf:ResourceDictionary>
|
@ -1,5 +0,0 @@
|
||||
version: 0.1.3-{build}
|
||||
image: Visual Studio 2017
|
||||
build_script:
|
||||
- ps: .\build.ps1
|
||||
test: off
|
@ -1 +0,0 @@
|
||||
powershell -ExecutionPolicy Bypass -NoProfile -File .\build.ps1 -configuration Release
|
77
build.ps1
77
build.ps1
@ -1,77 +0,0 @@
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
#[switch]$CustomParam,
|
||||
[Parameter(Position = 0, Mandatory = $false, ValueFromRemainingArguments = $true)]
|
||||
[string[]]$BuildArguments
|
||||
)
|
||||
|
||||
Write-Output "Windows PowerShell $($Host.Version)"
|
||||
|
||||
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { exit 1 }
|
||||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
|
||||
###########################################################################
|
||||
# CONFIGURATION
|
||||
###########################################################################
|
||||
|
||||
$BuildProjectFile = "$PSScriptRoot\build\_build.csproj"
|
||||
$TempDirectory = "$PSScriptRoot\\.tmp"
|
||||
|
||||
$DotNetGlobalFile = "$PSScriptRoot\\global.json"
|
||||
$DotNetInstallUrl = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1"
|
||||
$DotNetChannel = "Current"
|
||||
$DotNetCliVersion = Get-Content DotnetCliVersion.txt
|
||||
|
||||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
|
||||
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
|
||||
$env:NUGET_XMLDOC_MODE = "skip"
|
||||
|
||||
###########################################################################
|
||||
# EXECUTION
|
||||
###########################################################################
|
||||
|
||||
function ExecSafe([scriptblock] $cmd) {
|
||||
& $cmd
|
||||
if ($LASTEXITCODE) { exit $LASTEXITCODE }
|
||||
}
|
||||
|
||||
try {
|
||||
$json = "{`"sdk`":{`"version`":`"$DotNetCliVersion`"}}"
|
||||
Out-File -FilePath $DotNetGlobalFile -Encoding utf8 -InputObject $json
|
||||
|
||||
# If global.json exists, load expected version
|
||||
if (Test-Path $DotNetGlobalFile) {
|
||||
$DotNetVersion = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json).sdk.version
|
||||
}
|
||||
# If dotnet is installed locally, and expected version is not set or installation matches the expected version
|
||||
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
|
||||
(!(Test-Path variable:DotNetVersion) -or $(& cmd.exe /c 'dotnet --version 2>&1') -eq $DotNetVersion)) {
|
||||
$env:DOTNET_EXE = (Get-Command "dotnet").Path
|
||||
}
|
||||
else {
|
||||
$DotNetDirectory = "$TempDirectory\dotnet-win"
|
||||
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
|
||||
|
||||
# Download install script
|
||||
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
|
||||
mkdir -force $TempDirectory > $null
|
||||
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
|
||||
|
||||
# Install by channel or version
|
||||
if (!(Test-Path variable:DotNetVersion)) {
|
||||
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
|
||||
}
|
||||
else {
|
||||
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"
|
||||
|
||||
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile -- $BuildArguments }
|
||||
}
|
||||
finally {
|
||||
if (Test-Path $DotNetGlobalFile) {
|
||||
Remove-Item $DotNetGlobalFile
|
||||
}
|
||||
}
|
75
build.sh
75
build.sh
@ -1,75 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo $(bash --version 2>&1 | head -n 1)
|
||||
|
||||
#CUSTOMPARAM=0
|
||||
BUILD_ARGUMENTS=()
|
||||
for i in "$@"; do
|
||||
case $(echo $1 | awk '{print tolower($0)}') in
|
||||
# -custom-param) CUSTOMPARAM=1;;
|
||||
*) BUILD_ARGUMENTS+=("$1") ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
set -eo pipefail
|
||||
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
|
||||
|
||||
###########################################################################
|
||||
# CONFIGURATION
|
||||
###########################################################################
|
||||
|
||||
BUILD_PROJECT_FILE="$SCRIPT_DIR/build/_build.csproj"
|
||||
TEMP_DIRECTORY="$SCRIPT_DIR//.tmp"
|
||||
|
||||
DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
|
||||
DOTNET_INSTALL_URL="https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh"
|
||||
DOTNET_CHANNEL="Current"
|
||||
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
export NUGET_XMLDOC_MODE="skip"
|
||||
|
||||
###########################################################################
|
||||
# EXECUTION
|
||||
###########################################################################
|
||||
|
||||
function FirstJsonValue {
|
||||
perl -nle 'print $1 if m{"'$1'": "([^"\-]+)",?}' <<< ${@:2}
|
||||
}
|
||||
trap "rm -f $DOTNET_GLOBAL_FILE" INT TERM EXIT
|
||||
|
||||
dotnetCliVersion=$(cat DotnetCliVersion.txt)
|
||||
|
||||
json="{\"sdk\":{\"version\":\"$dotnetCliVersion\"}}"
|
||||
echo "$json" > $DOTNET_GLOBAL_FILE
|
||||
|
||||
# If global.json exists, load expected version
|
||||
if [ -f "$DOTNET_GLOBAL_FILE" ]; then
|
||||
DOTNET_VERSION=$dotnetCliVersion
|
||||
fi
|
||||
|
||||
# If dotnet is installed locally, and expected version is not set or installation matches the expected version
|
||||
if [[ -x "$(command -v dotnet)" && (-z ${DOTNET_VERSION+x} || $(dotnet --version) == "$DOTNET_VERSION") ]]; then
|
||||
export DOTNET_EXE="$(command -v dotnet)"
|
||||
else
|
||||
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
|
||||
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
|
||||
|
||||
# Download install script
|
||||
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
|
||||
mkdir -p "$TEMP_DIRECTORY"
|
||||
curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL"
|
||||
chmod +x "$DOTNET_INSTALL_FILE"
|
||||
|
||||
# Install by channel or version
|
||||
if [ -z ${DOTNET_VERSION+x} ]; then
|
||||
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path
|
||||
else
|
||||
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"
|
||||
|
||||
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" -- ${BUILD_ARGUMENTS[@]}
|
268
build/Build.cs
268
build/Build.cs
@ -1,268 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using ICSharpCode.SharpZipLib.Zip;
|
||||
using ILRepacking;
|
||||
using Nuke.Common;
|
||||
using Nuke.Common.Git;
|
||||
using Nuke.Common.ProjectModel;
|
||||
using Nuke.Common.Tools.DotNet;
|
||||
using static Nuke.Common.IO.FileSystemTasks;
|
||||
using static Nuke.Common.IO.PathConstruction;
|
||||
using static Nuke.Common.Tools.DotNet.DotNetTasks;
|
||||
|
||||
class Build : NukeBuild
|
||||
{
|
||||
public static int Main() => Execute<Build>(x => x.Results);
|
||||
|
||||
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
|
||||
readonly string Configuration = IsLocalBuild ? "Debug" : "Release";
|
||||
|
||||
[Solution("LibHac.sln")] readonly Solution Solution;
|
||||
[GitRepository] readonly GitRepository GitRepository;
|
||||
|
||||
AbsolutePath SourceDirectory => RootDirectory / "src";
|
||||
AbsolutePath TestsDirectory => RootDirectory / "tests";
|
||||
AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";
|
||||
AbsolutePath TempDirectory => RootDirectory / ".tmp";
|
||||
AbsolutePath CliCoreDir => TempDirectory / "hactoolnet_netcoreapp2.1";
|
||||
AbsolutePath CliFrameworkDir => TempDirectory / "hactoolnet_net46";
|
||||
AbsolutePath CliFrameworkZip => ArtifactsDirectory / "hactoolnet.zip";
|
||||
AbsolutePath CliCoreZip => ArtifactsDirectory / "hactoolnet_netcore.zip";
|
||||
|
||||
AbsolutePath CliMergedExe => ArtifactsDirectory / "hactoolnet.exe";
|
||||
|
||||
Project LibHacProject => Solution.GetProject("LibHac").NotNull();
|
||||
Project LibHacTestProject => Solution.GetProject("LibHac.Tests").NotNull();
|
||||
Project HactoolnetProject => Solution.GetProject("hactoolnet").NotNull();
|
||||
|
||||
Target Clean => _ => _
|
||||
.Executes(() =>
|
||||
{
|
||||
DeleteDirectories(GlobDirectories(SourceDirectory, "**/bin", "**/obj"));
|
||||
DeleteDirectories(GlobDirectories(TestsDirectory, "**/bin", "**/obj"));
|
||||
EnsureCleanDirectory(ArtifactsDirectory);
|
||||
EnsureCleanDirectory(CliCoreDir);
|
||||
EnsureCleanDirectory(CliFrameworkDir);
|
||||
});
|
||||
|
||||
Target Restore => _ => _
|
||||
.DependsOn(Clean)
|
||||
.Executes(() =>
|
||||
{
|
||||
var settings = new DotNetRestoreSettings()
|
||||
.SetProjectFile(Solution);
|
||||
|
||||
if (EnvironmentInfo.IsUnix) settings = settings.RemoveRuntimes("net46");
|
||||
|
||||
DotNetRestore(s => settings);
|
||||
});
|
||||
|
||||
Target Compile => _ => _
|
||||
.DependsOn(Restore)
|
||||
.Executes(() =>
|
||||
{
|
||||
var buildSettings = new DotNetBuildSettings()
|
||||
.SetProjectFile(Solution)
|
||||
.EnableNoRestore()
|
||||
.SetConfiguration(Configuration);
|
||||
|
||||
if (EnvironmentInfo.IsUnix) buildSettings = buildSettings.SetFramework("netcoreapp2.1");
|
||||
|
||||
DotNetBuild(s => buildSettings);
|
||||
|
||||
var publishSettings = new DotNetPublishSettings()
|
||||
.EnableNoRestore()
|
||||
.SetConfiguration(Configuration);
|
||||
|
||||
DotNetPublish(s => publishSettings
|
||||
.SetProject(HactoolnetProject)
|
||||
.SetFramework("netcoreapp2.1")
|
||||
.SetOutput(CliCoreDir));
|
||||
|
||||
if (EnvironmentInfo.IsWin)
|
||||
{
|
||||
DotNetPublish(s => publishSettings
|
||||
.SetProject(HactoolnetProject)
|
||||
.SetFramework("net46")
|
||||
.SetOutput(CliFrameworkDir));
|
||||
}
|
||||
|
||||
// Hack around OS newline differences
|
||||
if (EnvironmentInfo.IsUnix)
|
||||
{
|
||||
foreach (string filename in Directory.EnumerateFiles(CliCoreDir, "*.json"))
|
||||
{
|
||||
ReplaceLineEndings(filename);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Target Pack => _ => _
|
||||
.DependsOn(Compile)
|
||||
.Executes(() =>
|
||||
{
|
||||
var settings = new DotNetPackSettings()
|
||||
.SetProject(LibHacProject)
|
||||
.EnableNoBuild()
|
||||
.SetConfiguration(Configuration)
|
||||
.EnableIncludeSymbols()
|
||||
.SetOutputDirectory(ArtifactsDirectory);
|
||||
|
||||
if (EnvironmentInfo.IsUnix)
|
||||
settings = settings.SetProperties(
|
||||
new Dictionary<string, object> { ["TargetFrameworks"] = "netcoreapp2.1" });
|
||||
|
||||
DotNetPack(s => settings);
|
||||
|
||||
if (Host != HostType.AppVeyor) return;
|
||||
|
||||
foreach (string filename in Directory.EnumerateFiles(ArtifactsDirectory, "*.nupkg"))
|
||||
{
|
||||
PushArtifact(filename);
|
||||
}
|
||||
});
|
||||
|
||||
Target Merge => _ => _
|
||||
.DependsOn(Compile)
|
||||
.OnlyWhen(() => EnvironmentInfo.IsWin)
|
||||
.Executes(() =>
|
||||
{
|
||||
string[] libraries = Directory.GetFiles(CliFrameworkDir, "*.dll");
|
||||
var cliList = new List<string> { CliFrameworkDir / "hactoolnet.exe" };
|
||||
cliList.AddRange(libraries);
|
||||
|
||||
var cliOptions = new RepackOptions
|
||||
{
|
||||
OutputFile = CliMergedExe,
|
||||
InputAssemblies = cliList.ToArray(),
|
||||
SearchDirectories = new[] { "." }
|
||||
};
|
||||
|
||||
new ILRepack(cliOptions).Repack();
|
||||
|
||||
if (Host == HostType.AppVeyor)
|
||||
{
|
||||
PushArtifact(CliMergedExe);
|
||||
}
|
||||
});
|
||||
|
||||
Target Test => _ => _
|
||||
.DependsOn(Compile)
|
||||
.Executes(() =>
|
||||
{
|
||||
var settings = new DotNetTestSettings()
|
||||
.SetProjectFile(LibHacTestProject)
|
||||
.EnableNoBuild()
|
||||
.SetConfiguration(Configuration);
|
||||
|
||||
if (EnvironmentInfo.IsUnix) settings = settings.SetFramework("netcoreapp2.1");
|
||||
|
||||
DotNetTest(s => settings);
|
||||
});
|
||||
|
||||
Target Zip => _ => _
|
||||
.DependsOn(Pack)
|
||||
.Executes(() =>
|
||||
{
|
||||
string[] namesFx = Directory.EnumerateFiles(CliFrameworkDir, "*.exe")
|
||||
.Concat(Directory.EnumerateFiles(CliFrameworkDir, "*.dll"))
|
||||
.ToArray();
|
||||
|
||||
string[] namesCore = Directory.EnumerateFiles(CliCoreDir, "*.json")
|
||||
.Concat(Directory.EnumerateFiles(CliCoreDir, "*.dll"))
|
||||
.ToArray();
|
||||
|
||||
if (EnvironmentInfo.IsWin)
|
||||
{
|
||||
ZipFiles(CliFrameworkZip, namesFx);
|
||||
Console.WriteLine($"Created {CliFrameworkZip}");
|
||||
}
|
||||
|
||||
ZipFiles(CliCoreZip, namesCore);
|
||||
Console.WriteLine($"Created {CliCoreZip}");
|
||||
|
||||
if (Host == HostType.AppVeyor)
|
||||
{
|
||||
PushArtifact(CliFrameworkZip);
|
||||
PushArtifact(CliCoreZip);
|
||||
PushArtifact(CliMergedExe);
|
||||
}
|
||||
});
|
||||
|
||||
Target Results => _ => _
|
||||
.DependsOn(Test, Zip, Merge)
|
||||
.Executes(() =>
|
||||
{
|
||||
Console.WriteLine("SHA-1:");
|
||||
using (SHA1 sha = SHA1.Create())
|
||||
{
|
||||
foreach (string filename in Directory.EnumerateFiles(ArtifactsDirectory))
|
||||
{
|
||||
using (var stream = new FileStream(filename, FileMode.Open))
|
||||
{
|
||||
string hash = BitConverter.ToString(sha.ComputeHash(stream)).Replace("-", "");
|
||||
Console.WriteLine($"{hash} - {Path.GetFileName(filename)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
public static void ZipFiles(string outFile, string[] files)
|
||||
{
|
||||
using (var s = new ZipOutputStream(File.Create(outFile)))
|
||||
{
|
||||
s.SetLevel(9);
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
var entry = new ZipEntry(Path.GetFileName(file));
|
||||
entry.DateTime = DateTime.UnixEpoch;
|
||||
|
||||
using (FileStream fs = File.OpenRead(file))
|
||||
{
|
||||
entry.Size = fs.Length;
|
||||
s.PutNextEntry(entry);
|
||||
fs.CopyTo(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void PushArtifact(string path)
|
||||
{
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
Console.WriteLine($"Unable to add artifact {path}");
|
||||
}
|
||||
|
||||
var psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = "appveyor",
|
||||
Arguments = $"PushArtifact \"{path}\"",
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true
|
||||
};
|
||||
|
||||
var proc = new Process
|
||||
{
|
||||
StartInfo = psi
|
||||
};
|
||||
|
||||
proc.Start();
|
||||
|
||||
proc.WaitForExit();
|
||||
|
||||
Console.WriteLine($"Added AppVeyor artifact {path}");
|
||||
}
|
||||
|
||||
public static void ReplaceLineEndings(string filename)
|
||||
{
|
||||
string text = File.ReadAllText(filename);
|
||||
File.WriteAllText(filename, text.Replace("\n", "\r\n"));
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<RootNamespace></RootNamespace>
|
||||
<IsPackable>False</IsPackable>
|
||||
<NoWarn>CS0649;CS0169</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Nuke.Common" Version="0.12.0" />
|
||||
<PackageReference Include="SharpZipLib" Version="1.0.0" />
|
||||
<PackageReference Include="ILRepack.Lib" Version="2.0.16" NoWarn="NU1701" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<NukeMetadata Include="**\*.json" Exclude="bin\**;obj\**" />
|
||||
<NukeExternalFiles Include="**\*.*.ext" Exclude="bin\**;obj\**" />
|
||||
<None Remove="*.csproj.DotSettings;*.ref.*.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,23 +0,0 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeInspection/ImplicitNullability/EnableFields/@EntryValue">False</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_INTERNAL_MODIFIER/@EntryValue">Implicit</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_PRIVATE_MODIFIER/@EntryValue">Implicit</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/METHOD_OR_OPERATOR_BODY/@EntryValue">ExpressionBody</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/ThisQualifier/INSTANCE_MEMBERS_QUALIFY_MEMBERS/@EntryValue">0</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue">NEXT_LINE</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_USER_LINEBREAKS/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_INVOCATION_LPAR/@EntryValue">False</s:Boolean>
|
||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/MAX_ATTRIBUTE_LENGTH_FOR_SAME_LINE/@EntryValue">120</s:Int64>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">IF_OWNER_IS_SINGLE_LINE</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_ARGUMENTS_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ANONYMOUSMETHOD_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
@ -1,70 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="../common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>Implementation of the ISO, UDF, FAT and NTFS file systems is now fairly stable. VHD, XVA, VMDK and VDI disk formats are implemented, as well as read/write Registry support. The library also includes a simple iSCSI initiator, for accessing disks via iSCSI and an NFS client implementation.</Description>
|
||||
<AssemblyTitle>DiscUtils (for .NET and .NET Core), core library that supports parts of DiscUtils</AssemblyTitle>
|
||||
<Authors>Kenneth Bell;Quamotion;LordMike</Authors>
|
||||
<TargetFrameworks>netstandard1.5;net20;net40;net45</TargetFrameworks>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<AssemblyName>DiscUtils.Core</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>../../SigningKey.snk</AssemblyOriginatorKeyFile>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<PackageId>DiscUtils.Core</PackageId>
|
||||
<PackageTags>DiscUtils;VHD;VDI;XVA;VMDK;ISO;NTFS;EXT2FS</PackageTags>
|
||||
<PackageProjectUrl>https://github.com/DiscUtils/DiscUtils</PackageProjectUrl>
|
||||
<PackageLicenseUrl>https://github.com/DiscUtils/DiscUtils/blob/master/LICENSE.txt</PackageLicenseUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/DiscUtils/DiscUtils</RepositoryUrl>
|
||||
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
|
||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
||||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
|
||||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
|
||||
<GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute>
|
||||
<GeneratePackageOnBuild Condition="'$(Configuration)' != 'Debug'">True</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.5' ">
|
||||
<PackageReference Include="System.Security.AccessControl" Version="4.3.0" />
|
||||
<PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net20' ">
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' ">
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.5'">
|
||||
<PackageReference Include="System.IO.FileSystem.DriveInfo">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Text.Encoding.CodePages">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.5' ">
|
||||
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'net20' ">
|
||||
<DefineConstants>$(DefineConstants);NET20</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DiscUtils.Streams\DiscUtils.Streams.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,50 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="../common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>DiscUtils FAT filesystem parser</Description>
|
||||
<AssemblyTitle>DiscUtils.Fat</AssemblyTitle>
|
||||
<Authors>Kenneth Bell;LordMike</Authors>
|
||||
<TargetFrameworks>netstandard1.5;net20;net40;net45</TargetFrameworks>
|
||||
<AssemblyName>DiscUtils.Fat</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>../../SigningKey.snk</AssemblyOriginatorKeyFile>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<PackageId>DiscUtils.Fat</PackageId>
|
||||
<PackageTags>DiscUtils;Filesystem;FAT</PackageTags>
|
||||
<PackageProjectUrl>https://github.com/DiscUtils/DiscUtils</PackageProjectUrl>
|
||||
<PackageLicenseUrl>https://github.com/DiscUtils/DiscUtils/blob/master/LICENSE.txt</PackageLicenseUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/DiscUtils/DiscUtils</RepositoryUrl>
|
||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
||||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
|
||||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
|
||||
<GeneratePackageOnBuild Condition="'$(Configuration)' != 'Debug'">True</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DiscUtils.Core\DiscUtils.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net20' ">
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' ">
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.5' ">
|
||||
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'net20' ">
|
||||
<DefineConstants>$(DefineConstants);NET20</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,53 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="../common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>DiscUtils Streams</Description>
|
||||
<AssemblyTitle>DiscUtils.Streams</AssemblyTitle>
|
||||
<Authors>Kenneth Bell;LordMike;Bianco Veigel</Authors>
|
||||
<TargetFrameworks>netstandard1.5;net20;net40;net45</TargetFrameworks>
|
||||
<AssemblyName>DiscUtils.Streams</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>../../SigningKey.snk</AssemblyOriginatorKeyFile>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<PackageId>DiscUtils.Streams</PackageId>
|
||||
<PackageTags>DiscUtils;Streams</PackageTags>
|
||||
<PackageProjectUrl>https://github.com/DiscUtils/DiscUtils</PackageProjectUrl>
|
||||
<PackageLicenseUrl>https://github.com/DiscUtils/DiscUtils/blob/master/LICENSE.txt</PackageLicenseUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/DiscUtils/DiscUtils</RepositoryUrl>
|
||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
||||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
|
||||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
|
||||
<GeneratePackageOnBuild Condition="'$(Configuration)' != 'Debug'">True</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net20' ">
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' ">
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.5' ">
|
||||
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'net20' ">
|
||||
<DefineConstants>$(DefineConstants);NET20</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Block\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,11 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.1;net46</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LibHac\LibHac.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,56 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFrameworks>net471;netcoreapp2.2</TargetFrameworks>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ReleaseVersion>0.2.0</ReleaseVersion>
|
||||
<SynchReleaseVersion>false</SynchReleaseVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Authors>Alex Barney</Authors>
|
||||
<Copyright>Copyright © 2018 Alex Barney</Copyright>
|
||||
<Description>A library for reading content formats used by the Nintendo Switch.</Description>
|
||||
<PackageTags>Nintendo;Switch;nca;xci;savefile</PackageTags>
|
||||
<PackageProjectUrl>https://github.com/Thealexbarney/LibHac</PackageProjectUrl>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/Thealexbarney/LibHac</RepositoryUrl>
|
||||
|
||||
<VersionPrefix>0.2.0</VersionPrefix>
|
||||
<PathMap>$(MSBuildProjectDirectory)=C:/LibHac/</PathMap>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
<IncludeSource>true</IncludeSource>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'net46' ">
|
||||
<DefineConstants>$(DefineConstants);USE_RSA_CNG</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
|
||||
<DefineConstants>$(DefineConstants);STREAM_SPAN</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net471|AnyCPU'">
|
||||
<DefineConstants>TRACE;USE_RSA_CNG</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net471|AnyCPU'">
|
||||
<DefineConstants>TRACE;USE_RSA_CNG</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
|
||||
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
|
||||
<PackageReference Include="System.Memory" Version="4.5.1" />
|
||||
<PackageReference Include="System.Buffers" Version="4.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Buffers" Version="4.5.0" />
|
||||
<PackageReference Include="System.Memory" Version="4.5.1" />
|
||||
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -21,7 +21,7 @@ namespace LibHac
|
||||
public Dictionary<ulong, Title> Titles { get; } = new Dictionary<ulong, Title>();
|
||||
public Dictionary<ulong, Application> Applications { get; } = new Dictionary<ulong, Application>();
|
||||
|
||||
public SwitchFs(Keyset keyset, IFileSystem fs, bool leaveOpen)
|
||||
public SwitchFs(Keyset keyset, IFileSystem fs, bool leaveOpen = false)
|
||||
{
|
||||
Fs = fs;
|
||||
Keyset = keyset;
|
||||
|
@ -1,12 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>netcoreapp2.1;net46</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LibHac.Nand\LibHac.Nand.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
|
||||
</startup>
|
||||
</configuration>
|
@ -1,12 +0,0 @@
|
||||
<Application x:Class="NandReaderGui.App"
|
||||
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:viewModel="clr-namespace:NandReaderGui.ViewModel"
|
||||
StartupUri="MainWindow.xaml"
|
||||
mc:Ignorable="d">
|
||||
<Application.Resources>
|
||||
<viewModel:ViewModelLocator x:Key="Locator" d:IsDataSource="True" />
|
||||
</Application.Resources>
|
||||
</Application>
|
@ -1,9 +0,0 @@
|
||||
namespace NandReaderGui
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App
|
||||
{
|
||||
}
|
||||
}
|
@ -1,157 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace NandReaderGui
|
||||
{
|
||||
public class DeviceStream : Stream
|
||||
{
|
||||
public const short FileAttributeNormal = 0x80;
|
||||
public const short InvalidHandleValue = -1;
|
||||
public const uint GenericRead = 0x80000000;
|
||||
public const uint GenericWrite = 0x40000000;
|
||||
public const uint CreateNew = 1;
|
||||
public const uint CreateAlways = 2;
|
||||
public const uint OpenExisting = 3;
|
||||
|
||||
// Use interop to call the CreateFile function.
|
||||
// For more information about CreateFile,
|
||||
// see the unmanaged MSDN reference library.
|
||||
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||
private static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess,
|
||||
uint dwShareMode, IntPtr lpSecurityAttributes, uint dwCreationDisposition,
|
||||
uint dwFlagsAndAttributes, IntPtr hTemplateFile);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
private static extern bool ReadFile(
|
||||
IntPtr hFile, // handle to file
|
||||
byte[] lpBuffer, // data buffer
|
||||
int nNumberOfBytesToRead, // number of bytes to read
|
||||
ref int lpNumberOfBytesRead, // number of bytes read
|
||||
IntPtr lpOverlapped
|
||||
//
|
||||
// ref OVERLAPPED lpOverlapped // overlapped buffer
|
||||
);
|
||||
|
||||
private SafeFileHandle _handleValue;
|
||||
private FileStream _fs;
|
||||
|
||||
public DeviceStream(string device, long length)
|
||||
{
|
||||
Load(device);
|
||||
Length = length;
|
||||
}
|
||||
|
||||
private void Load(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
|
||||
// Try to open the file.
|
||||
IntPtr ptr = CreateFile(path, GenericRead, 0, IntPtr.Zero, OpenExisting, 0, IntPtr.Zero);
|
||||
|
||||
_handleValue = new SafeFileHandle(ptr, true);
|
||||
_fs = new FileStream(_handleValue, FileAccess.Read);
|
||||
|
||||
// If the handle is invalid,
|
||||
// get the last Win32 error
|
||||
// and throw a Win32Exception.
|
||||
if (_handleValue.IsInvalid)
|
||||
{
|
||||
Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanRead { get; } = true;
|
||||
|
||||
public override bool CanSeek => true;
|
||||
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush() { }
|
||||
|
||||
public override long Length { get; }
|
||||
|
||||
public override long Position
|
||||
{
|
||||
get => _fs.Position;
|
||||
set => _fs.Position = value;
|
||||
}
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
int bytesRead = 0;
|
||||
var bufBytes = new byte[count];
|
||||
if (!ReadFile(_handleValue.DangerousGetHandle(), bufBytes, count, ref bytesRead, IntPtr.Zero))
|
||||
{
|
||||
Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
|
||||
}
|
||||
for (int i = 0; i < bytesRead; i++)
|
||||
{
|
||||
buffer[offset + i] = bufBytes[i];
|
||||
}
|
||||
return bytesRead;
|
||||
}
|
||||
|
||||
public override int ReadByte()
|
||||
{
|
||||
int bytesRead = 0;
|
||||
var lpBuffer = new byte[1];
|
||||
if (!ReadFile(
|
||||
_handleValue.DangerousGetHandle(), // handle to file
|
||||
lpBuffer, // data buffer
|
||||
1, // number of bytes to read
|
||||
ref bytesRead, // number of bytes read
|
||||
IntPtr.Zero
|
||||
))
|
||||
{ Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); }
|
||||
return lpBuffer[0];
|
||||
}
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin) => _fs.Seek(offset, origin);
|
||||
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
_handleValue.Close();
|
||||
_handleValue.Dispose();
|
||||
_handleValue = null;
|
||||
base.Close();
|
||||
}
|
||||
|
||||
private bool _disposed;
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
// Check to see if Dispose has already been called.
|
||||
if (!_disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (_handleValue != null)
|
||||
{
|
||||
_fs.Dispose();
|
||||
_handleValue.Close();
|
||||
_handleValue.Dispose();
|
||||
_handleValue = null;
|
||||
}
|
||||
}
|
||||
// Note disposing has been done.
|
||||
_disposed = true;
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Weavers>
|
||||
<Costura />
|
||||
</Weavers>
|
@ -1,12 +0,0 @@
|
||||
<Window x:Class="NandReaderGui.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:view="clr-namespace:NandReaderGui.View"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
<view:Nand></view:Nand>
|
||||
</Grid>
|
||||
</Window>
|
@ -1,13 +0,0 @@
|
||||
namespace NandReaderGui
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,126 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" 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>{3CBD38B0-6575-4768-8E94-A8AF2D2C9F43}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>NandReaderGui</RootNamespace>
|
||||
<AssemblyName>NandReaderGui</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</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.Data" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="DeviceStream.cs" />
|
||||
<Compile Include="ViewModel\NandViewModel.cs" />
|
||||
<Compile Include="ViewModel\ViewModelLocator.cs" />
|
||||
<Compile Include="View\Nand.xaml.cs">
|
||||
<DependentUpon>Nand.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="View\Nand.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Costura.Fody">
|
||||
<Version>3.1.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MvvmLightLibs">
|
||||
<Version>5.4.1</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LibHac.Nand\LibHac.Nand.csproj">
|
||||
<Project>{ab503d24-f702-4e6e-b615-a9c7bda218d1}</Project>
|
||||
<Name>LibHac.Nand</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\LibHac\LibHac.csproj">
|
||||
<Project>{ffca6c31-d9d4-4ed8-a06d-0cc6b94422b8}</Project>
|
||||
<Name>LibHac</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
@ -1,53 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("RawNandReader")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("RawNandReader")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[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)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
63
src/NandReaderGui/Properties/Resources.Designer.cs
generated
63
src/NandReaderGui/Properties/Resources.Designer.cs
generated
@ -1,63 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace NandReaderGui.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NandReaderGui.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,117 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
26
src/NandReaderGui/Properties/Settings.Designer.cs
generated
26
src/NandReaderGui/Properties/Settings.Designer.cs
generated
@ -1,26 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace NandReaderGui.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
@ -1,15 +0,0 @@
|
||||
<UserControl x:Class="NandReaderGui.View.Nand"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
DataContext="{Binding Main, Source={StaticResource Locator}}"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<ListBox ItemsSource="{Binding Disks}" DisplayMemberPath="Display" Height="150" SelectedItem="{Binding SelectedDisk}"/>
|
||||
<Button Content="Open" Width="100" HorizontalAlignment="Left" Command="{Binding OpenCommand}"></Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
@ -1,13 +0,0 @@
|
||||
namespace NandReaderGui.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Nand.xaml
|
||||
/// </summary>
|
||||
public partial class Nand
|
||||
{
|
||||
public Nand()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,146 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Management;
|
||||
using System.Windows.Input;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using LibHac;
|
||||
using LibHac.IO;
|
||||
using LibHac.IO.Save;
|
||||
using LibHac.Nand;
|
||||
|
||||
namespace NandReaderGui.ViewModel
|
||||
{
|
||||
public class NandViewModel : ViewModelBase
|
||||
{
|
||||
public List<DiskInfo> Disks { get; } = new List<DiskInfo>();
|
||||
public ICommand OpenCommand { get; set; }
|
||||
public DiskInfo SelectedDisk { get; set; }
|
||||
|
||||
public NandViewModel()
|
||||
{
|
||||
OpenCommand = new RelayCommand(Open);
|
||||
|
||||
var query = new WqlObjectQuery("SELECT * FROM Win32_DiskDrive");
|
||||
using (var searcher = new ManagementObjectSearcher(query))
|
||||
{
|
||||
foreach (ManagementBaseObject drive in searcher.Get())
|
||||
{
|
||||
if (drive.GetPropertyValue("Size") == null) continue;
|
||||
var info = new DiskInfo();
|
||||
info.PhysicalName = (string)drive.GetPropertyValue("Name");
|
||||
info.Name = (string)drive.GetPropertyValue("Caption");
|
||||
info.Model = (string)drive.GetPropertyValue("Model");
|
||||
//todo Why is Windows returning small sizes? https://stackoverflow.com/questions/15051660
|
||||
info.Length = (long)((ulong)drive.GetPropertyValue("Size"));
|
||||
info.SectorSize = (int)((uint)drive.GetPropertyValue("BytesPerSector"));
|
||||
info.DisplaySize = Util.GetBytesReadable((long)((ulong)drive.GetPropertyValue("Size")));
|
||||
|
||||
Disks.Add(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Open()
|
||||
{
|
||||
DiskInfo disk = SelectedDisk;
|
||||
var storage = new CachedStorage(new DeviceStream(disk.PhysicalName, disk.Length).AsStorage(), disk.SectorSize * 100, 4, true);
|
||||
storage.SetReadOnly();
|
||||
Stream stream = storage.AsStream();
|
||||
|
||||
Keyset keyset = OpenKeyset();
|
||||
var nand = new Nand(stream, keyset);
|
||||
|
||||
Stream prodinfo = nand.OpenProdInfo();
|
||||
var calibration = new Calibration(prodinfo);
|
||||
|
||||
keyset.EticketExtKeyRsa = Crypto.DecryptRsaKey(calibration.EticketExtKeyRsa, keyset.EticketRsaKek);
|
||||
Ticket[] tickets = GetTickets(keyset, nand);
|
||||
|
||||
using (var outStream = new StreamWriter("titlekeys.txt"))
|
||||
{
|
||||
foreach (Ticket ticket in tickets)
|
||||
{
|
||||
byte[] key = ticket.GetTitleKey(keyset);
|
||||
outStream.WriteLine($"{ticket.RightsId.ToHexString()},{key.ToHexString()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Ticket[] GetTickets(Keyset keyset, Nand nand, IProgressReport logger = null)
|
||||
{
|
||||
var tickets = new List<Ticket>();
|
||||
NandPartition system = nand.OpenSystemPartition();
|
||||
|
||||
Stream saveE1File = system.OpenFile("save\\80000000000000E1", FileMode.Open, FileAccess.Read);
|
||||
tickets.AddRange(ReadTickets(keyset, saveE1File));
|
||||
|
||||
Stream saveE2 = system.OpenFile("save\\80000000000000E2", FileMode.Open, FileAccess.Read);
|
||||
tickets.AddRange(ReadTickets(keyset, saveE2));
|
||||
|
||||
logger?.LogMessage($"Found {tickets.Count} tickets");
|
||||
|
||||
return tickets.ToArray();
|
||||
}
|
||||
|
||||
private static List<Ticket> ReadTickets(Keyset keyset, Stream savefile)
|
||||
{
|
||||
var tickets = new List<Ticket>();
|
||||
var save = new SaveData(keyset, savefile.AsStorage(), IntegrityCheckLevel.None, true);
|
||||
var ticketList = new BinaryReader(save.OpenFile("/ticket_list.bin").AsStream());
|
||||
var ticketFile = new BinaryReader(save.OpenFile("/ticket.bin").AsStream());
|
||||
|
||||
ulong titleId = ticketList.ReadUInt64();
|
||||
while (titleId != ulong.MaxValue)
|
||||
{
|
||||
ticketList.BaseStream.Position += 0x18;
|
||||
long start = ticketFile.BaseStream.Position;
|
||||
tickets.Add(new Ticket(ticketFile));
|
||||
ticketFile.BaseStream.Position = start + 0x400;
|
||||
titleId = ticketList.ReadUInt64();
|
||||
}
|
||||
|
||||
return tickets;
|
||||
}
|
||||
|
||||
private static Keyset OpenKeyset()
|
||||
{
|
||||
string home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
string homeKeyFile = Path.Combine(home, ".switch", "prod.keys");
|
||||
string homeTitleKeyFile = Path.Combine(home, ".switch", "title.keys");
|
||||
string homeConsoleKeyFile = Path.Combine(home, ".switch", "console.keys");
|
||||
string keyFile = null;
|
||||
string titleKeyFile = null;
|
||||
string consoleKeyFile = null;
|
||||
|
||||
if (File.Exists(homeKeyFile))
|
||||
{
|
||||
keyFile = homeKeyFile;
|
||||
}
|
||||
|
||||
if (File.Exists(homeTitleKeyFile))
|
||||
{
|
||||
titleKeyFile = homeTitleKeyFile;
|
||||
}
|
||||
|
||||
if (File.Exists(homeConsoleKeyFile))
|
||||
{
|
||||
consoleKeyFile = homeConsoleKeyFile;
|
||||
}
|
||||
|
||||
return ExternalKeys.ReadKeyFile(keyFile, titleKeyFile, consoleKeyFile);
|
||||
}
|
||||
}
|
||||
|
||||
public class DiskInfo
|
||||
{
|
||||
public string PhysicalName { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Model { get; set; }
|
||||
public long Length { get; set; }
|
||||
public int SectorSize { get; set; }
|
||||
public string DisplaySize { get; set; }
|
||||
public string Display => $"{Name} ({DisplaySize})";
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
In App.xaml:
|
||||
<Application.Resources>
|
||||
<vm:ViewModelLocatorTemplate xmlns:vm="clr-namespace:MvvmLight1.ViewModel"
|
||||
x:Key="Locator" />
|
||||
</Application.Resources>
|
||||
|
||||
In the View:
|
||||
DataContext="{Binding Source={StaticResource Locator}, Path=ViewModelName}"
|
||||
*/
|
||||
|
||||
using CommonServiceLocator;
|
||||
using GalaSoft.MvvmLight.Ioc;
|
||||
|
||||
namespace NandReaderGui.ViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// This class contains static references to all the view models in the
|
||||
/// application and provides an entry point for the bindings.
|
||||
/// <para>
|
||||
/// See http://www.mvvmlight.net
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public class ViewModelLocator
|
||||
{
|
||||
static ViewModelLocator()
|
||||
{
|
||||
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
|
||||
|
||||
SimpleIoc.Default.Register<NandViewModel>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Main property.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance",
|
||||
"CA1822:MarkMembersAsStatic",
|
||||
Justification = "This non-static member is needed for data binding purposes.")]
|
||||
public NandViewModel Main => ServiceLocator.Current.GetInstance<NandViewModel>();
|
||||
|
||||
/// <summary>
|
||||
/// Cleans up all the resources.
|
||||
/// </summary>
|
||||
public static void Cleanup()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>netcoreapp2.1;net46</TargetFrameworks>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>0.2.0</VersionPrefix>
|
||||
<PathMap>$(MSBuildProjectDirectory)=C:/hactoolnet/</PathMap>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="CA00000003_XS00000020" />
|
||||
<EmbeddedResource Include="CA00000003_XS00000020" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LibHac\LibHac.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,74 +0,0 @@
|
||||
using Xunit;
|
||||
|
||||
namespace LibHac.Tests
|
||||
{
|
||||
public class AesCmac
|
||||
{
|
||||
public static readonly TheoryData<TestData> TestVectors = new TheoryData<TestData>
|
||||
{
|
||||
new TestData
|
||||
{
|
||||
Key = "2B7E151628AED2A6ABF7158809CF4F3C".ToBytes(),
|
||||
Message = "".ToBytes(),
|
||||
Expected = "BB1D6929E95937287FA37D129B756746".ToBytes()
|
||||
},
|
||||
new TestData
|
||||
{
|
||||
Key = "2B7E151628AED2A6ABF7158809CF4F3C".ToBytes(),
|
||||
Message = "6BC1BEE22E409F96E93D7E117393172A".ToBytes(),
|
||||
Expected = "070A16B46B4D4144F79BDD9DD04A287C".ToBytes(),
|
||||
Length = 0x10
|
||||
},
|
||||
new TestData
|
||||
{
|
||||
Key = "2B7E151628AED2A6ABF7158809CF4F3C".ToBytes(),
|
||||
Message = "6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E5130C81C46A35CE411".ToBytes(),
|
||||
Expected = "DFA66747DE9AE63030CA32611497C827".ToBytes(),
|
||||
Length = 0x28
|
||||
},
|
||||
new TestData
|
||||
{
|
||||
Key = "2B7E151628AED2A6ABF7158809CF4F3C".ToBytes(),
|
||||
Message = "6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E5130C81C46A35CE411E5FBC1191A0A52EFF69F2445DF4F9B17AD2B417BE66C3710".ToBytes(),
|
||||
Expected = "51F0BEBF7E3B9D92FC49741779363CFE".ToBytes(),
|
||||
Length = 0x40
|
||||
},
|
||||
new TestData
|
||||
{
|
||||
Key = "2B7E151628AED2A6ABF7158809CF4F3C".ToBytes(),
|
||||
Message = "00000000006BC1BEE22E409F96E93D7E117393172A0000000000".ToBytes(),
|
||||
Expected = "070A16B46B4D4144F79BDD9DD04A287C".ToBytes(),
|
||||
Start = 5,
|
||||
Length = 0x10
|
||||
},
|
||||
new TestData
|
||||
{
|
||||
Key = "2B7E151628AED2A6ABF7158809CF4F3C".ToBytes(),
|
||||
Message = "00000000006BC1BEE22E409F96E93D7E117393172A0000000000000000000000".ToBytes(),
|
||||
Expected = "070A16B46B4D4144F79BDD9DD04A287C".ToBytes(),
|
||||
Start = 5,
|
||||
Length = 0x10
|
||||
}
|
||||
};
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(TestVectors))]
|
||||
public static void TestCmacTestVectors(TestData data)
|
||||
{
|
||||
var actual = new byte[0x10];
|
||||
|
||||
Crypto.CalculateAesCmac(data.Key, data.Message, data.Start, actual, 0, data.Length);
|
||||
|
||||
Assert.Equal(data.Expected, actual);
|
||||
}
|
||||
|
||||
public struct TestData
|
||||
{
|
||||
public byte[] Key;
|
||||
public byte[] Message;
|
||||
public byte[] Expected;
|
||||
public int Start;
|
||||
public int Length;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,141 +0,0 @@
|
||||
using System.Linq;
|
||||
using LibHac.IO;
|
||||
using Xunit;
|
||||
|
||||
namespace LibHac.Tests
|
||||
{
|
||||
public class AesXts
|
||||
{
|
||||
public static readonly TheoryData<TestData> TestVectors = new TheoryData<TestData>
|
||||
{
|
||||
// #1 32 byte key, 32 byte PTX
|
||||
new TestData
|
||||
{
|
||||
Key1 = "00000000000000000000000000000000".ToBytes(),
|
||||
Key2 = "00000000000000000000000000000000".ToBytes(),
|
||||
PlainText = "0000000000000000000000000000000000000000000000000000000000000000".ToBytes(),
|
||||
CipherText = "917CF69EBD68B2EC9B9FE9A3EADDA692CD43D2F59598ED858C02C2652FBF922E".ToBytes(),
|
||||
Sector = 0
|
||||
},
|
||||
|
||||
// #2, 32 byte key, 32 byte PTX
|
||||
new TestData
|
||||
{
|
||||
Sector = 0x3333333333,
|
||||
Key1 = "11111111111111111111111111111111".ToBytes(),
|
||||
Key2 = "22222222222222222222222222222222".ToBytes(),
|
||||
PlainText = "4444444444444444444444444444444444444444444444444444444444444444".ToBytes(),
|
||||
CipherText = "44BEC82FFB76AEFDFBC96DFE61E192CCFA2213677C8F4FD6E4F18F7EBB69382F".ToBytes()
|
||||
},
|
||||
|
||||
// #5 from xts.7, 32 byte key, 32 byte PTX
|
||||
new TestData
|
||||
{
|
||||
Sector = 0x123456789A,
|
||||
Key1 = "FFFEFDFCFBFAF9F8F7F6F5F4F3F2F1F0".ToBytes(),
|
||||
Key2 = "BFBEBDBCBBBAB9B8B7B6B5B4B3B2B1B0".ToBytes(),
|
||||
PlainText = "4444444444444444444444444444444444444444444444444444444444444444".ToBytes(),
|
||||
CipherText = "C11839D636AD8BE5A116E48C70227763DABD3C2D1383C5DD15B2572AAA992C40".ToBytes()
|
||||
},
|
||||
|
||||
// #4, 32 byte key, 512 byte PTX
|
||||
new TestData
|
||||
{
|
||||
Sector = 0,
|
||||
Key1 = "27182818284590452353602874713526".ToBytes(),
|
||||
Key2 = "31415926535897932384626433832795".ToBytes(),
|
||||
PlainText = ("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F" +
|
||||
"202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F" +
|
||||
"404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F" +
|
||||
"606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F" +
|
||||
"808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9F" +
|
||||
"A0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF" +
|
||||
"C0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF" +
|
||||
"E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF" +
|
||||
"000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F" +
|
||||
"202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F" +
|
||||
"404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F" +
|
||||
"606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F" +
|
||||
"808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9F" +
|
||||
"A0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF" +
|
||||
"C0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF" +
|
||||
"E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF").ToBytes(),
|
||||
CipherText = ("27A7479BEFA1D476489F308CD4CFA6E2A96E4BBE3208FF25287DD3819616E89C" +
|
||||
"C78CF7F5E543445F8333D8FA7F56000005279FA5D8B5E4AD40E736DDB4D35412" +
|
||||
"328063FD2AAB53E5EA1E0A9F332500A5DF9487D07A5C92CC512C8866C7E860CE" +
|
||||
"93FDF166A24912B422976146AE20CE846BB7DC9BA94A767AAEF20C0D61AD0265" +
|
||||
"5EA92DC4C4E41A8952C651D33174BE51A10C421110E6D81588EDE82103A252D8" +
|
||||
"A750E8768DEFFFED9122810AAEB99F9172AF82B604DC4B8E51BCB08235A6F434" +
|
||||
"1332E4CA60482A4BA1A03B3E65008FC5DA76B70BF1690DB4EAE29C5F1BADD03C" +
|
||||
"5CCF2A55D705DDCD86D449511CEB7EC30BF12B1FA35B913F9F747A8AFD1B130E" +
|
||||
"94BFF94EFFD01A91735CA1726ACD0B197C4E5B03393697E126826FB6BBDE8ECC" +
|
||||
"1E08298516E2C9ED03FF3C1B7860F6DE76D4CECD94C8119855EF5297CA67E9F3" +
|
||||
"E7FF72B1E99785CA0A7E7720C5B36DC6D72CAC9574C8CBBC2F801E23E56FD344" +
|
||||
"B07F22154BEBA0F08CE8891E643ED995C94D9A69C9F1B5F499027A78572AEEBD" +
|
||||
"74D20CC39881C213EE770B1010E4BEA718846977AE119F7A023AB58CCA0AD752" +
|
||||
"AFE656BB3C17256A9F6E9BF19FDD5A38FC82BBE872C5539EDB609EF4F79C203E" +
|
||||
"BB140F2E583CB2AD15B4AA5B655016A8449277DBD477EF2C8D6C017DB738B18D" +
|
||||
"EB4A427D1923CE3FF262735779A418F20A282DF920147BEABE421EE5319D0568").ToBytes()
|
||||
},
|
||||
|
||||
// #7, 32 byte key, 17 byte PTX
|
||||
new TestData
|
||||
{
|
||||
Sector = 0x123456789A,
|
||||
Key1 = "FFFEFDFCFBFAF9F8F7F6F5F4F3F2F1F0".ToBytes(),
|
||||
Key2 = "BFBEBDBCBBBAB9B8B7B6B5B4B3B2B1B0".ToBytes(),
|
||||
PlainText = "000102030405060708090A0B0C0D0E0F10".ToBytes(),
|
||||
CipherText = "9E61715809A74B7E0EF033CD86181404C2".ToBytes()
|
||||
},
|
||||
|
||||
// #15, 32 byte key, 25 byte PTX
|
||||
new TestData
|
||||
{
|
||||
Sector = 0x123456789A,
|
||||
Key1 = "FFFEFDFCFBFAF9F8F7F6F5F4F3F2F1F0".ToBytes(),
|
||||
Key2 = "BFBEBDBCBBBAB9B8B7B6B5B4B3B2B1B0".ToBytes(),
|
||||
PlainText = "000102030405060708090A0B0C0D0E0F101112131415161718".ToBytes(),
|
||||
CipherText = "5D0B4A86EC5A91FB849D0F826A316222C274AD93FC68C2C101".ToBytes()
|
||||
},
|
||||
|
||||
// #21, 32 byte key, 31 byte PTX
|
||||
new TestData
|
||||
{
|
||||
Sector = 0x123456789A,
|
||||
Key1 = "FFFEFDFCFBFAF9F8F7F6F5F4F3F2F1F0".ToBytes(),
|
||||
Key2 = "BFBEBDBCBBBAB9B8B7B6B5B4B3B2B1B0".ToBytes(),
|
||||
PlainText = "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E".ToBytes(),
|
||||
CipherText = "42673C897D4F532CF8AA65EEB4D5B6F5C274AD93FC68C2C1015D904F33FF95".ToBytes()
|
||||
}
|
||||
};
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(TestVectors))]
|
||||
public static void Encrypt(TestData data) => TestTransform(data, false);
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(TestVectors))]
|
||||
public static void Decrypt(TestData data) => TestTransform(data, true);
|
||||
|
||||
private static void TestTransform(TestData data, bool decrypting)
|
||||
{
|
||||
var transform = new Aes128XtsTransform(data.Key1, data.Key2, decrypting);
|
||||
byte[] transformed = data.GetInitialText(decrypting).ToArray();
|
||||
|
||||
transform.TransformBlock(transformed, 0, transformed.Length, data.Sector);
|
||||
Assert.Equal(data.GetTransformedText(decrypting), transformed);
|
||||
}
|
||||
|
||||
public struct TestData
|
||||
{
|
||||
public byte[] CipherText;
|
||||
public byte[] PlainText;
|
||||
public byte[] Key1;
|
||||
public byte[] Key2;
|
||||
public ulong Sector;
|
||||
|
||||
public byte[] GetInitialText(bool decrypting) => decrypting ? CipherText : PlainText;
|
||||
public byte[] GetTransformedText(bool decrypting) => decrypting ? PlainText : CipherText;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net46;netcoreapp2.1</TargetFrameworks>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
|
||||
<PackageReference Include="xunit" Version="2.3.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\LibHac\LibHac.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Reference in New Issue
Block a user