mirror of
https://github.com/StudentBlake/XCI-Explorer
synced 2024-11-10 06:34:15 +00:00
Update to .NET 6, fix #61, make message boxes less annoying, bump version to v1.6.0
This commit is contained in:
parent
a3ece743f8
commit
cfc3c70566
12 changed files with 269 additions and 155 deletions
Binary file not shown.
|
@ -11,9 +11,9 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("XCI Explorer")]
|
[assembly: AssemblyProduct("XCI Explorer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
[assembly: AssemblyCopyright("Open Source")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
[assembly: Guid("206c6c47-87b1-477f-b6e6-f7e7c1a92f8f")]
|
[assembly: Guid("206c6c47-87b1-477f-b6e6-f7e7c1a92f8f")]
|
||||||
[assembly: AssemblyFileVersion("1.5.0")]
|
[assembly: AssemblyFileVersion("1.6.0")]
|
||||||
[assembly: AssemblyVersion("1.5.0")]
|
[assembly: AssemblyVersion("1.6.0")]
|
||||||
|
|
|
@ -1,95 +1,18 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ProjectGuid>{89DBE891-22C7-40FF-A3D3-36F26224E09D}</ProjectGuid>
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<AssemblyName>XCI-Explorer</AssemblyName>
|
<AssemblyName>XCI-Explorer</AssemblyName>
|
||||||
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
|
|
||||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<NuGetPackageImportStamp>
|
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||||
</NuGetPackageImportStamp>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<TargetFrameworkProfile />
|
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
<DebugSymbols>false</DebugSymbols>
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugType>None</DebugType>
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<RootNamespace>XCI_Explorer</RootNamespace>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Be.Windows.Forms.HexBox, Version=1.6.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<PackageReference Include="Be.Windows.Forms.HexBox.Net5" Version="1.8.0" />
|
||||||
<HintPath>packages\Be.Windows.Forms.HexBox.1.6.1\lib\net40\Be.Windows.Forms.HexBox.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Windows.Forms" />
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Drawing" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="XCI_Explorer\CertForm.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="XCI_Explorer\CertForm.Designer.cs">
|
|
||||||
<DependentUpon>CertForm.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="XCI_Explorer.Helpers\BetterBinaryReader.cs" />
|
|
||||||
<Compile Include="XCI_Explorer.Helpers\BetterTreeNode.cs" />
|
|
||||||
<Compile Include="XCI_Explorer\CNMT.cs" />
|
|
||||||
<Compile Include="XCI_Explorer\MainForm.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="XCI_Explorer\MainForm.Designer.cs">
|
|
||||||
<DependentUpon>MainForm.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="XCI_Explorer\HFS0.cs" />
|
|
||||||
<Compile Include="XCI_Explorer\NACP.cs" />
|
|
||||||
<Compile Include="XCI_Explorer\NCA.cs" />
|
|
||||||
<Compile Include="XCI_Explorer\PFS0.cs" />
|
|
||||||
<Compile Include="XCI_Explorer\Program.cs" />
|
|
||||||
<Compile Include="XCI_Explorer\TreeViewFileSystem.cs" />
|
|
||||||
<Compile Include="XCI_Explorer\Util.cs" />
|
|
||||||
<Compile Include="XCI_Explorer\XCI.cs" />
|
|
||||||
<Compile Include="XTSSharp\RandomAccessSectorStream.cs" />
|
|
||||||
<Compile Include="XTSSharp\SectorStream.cs" />
|
|
||||||
<Compile Include="XTSSharp\Xts.cs" />
|
|
||||||
<Compile Include="XTSSharp\XtsAes128.cs" />
|
|
||||||
<Compile Include="XTSSharp\XtsAes256.cs" />
|
|
||||||
<Compile Include="XTSSharp\XtsCryptoTransform.cs" />
|
|
||||||
<Compile Include="XTSSharp\XtsSectorStream.cs" />
|
|
||||||
<Compile Include="XTSSharp\XtsStream.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Include="XCI_Explorer\MainForm.resx">
|
|
||||||
<DependentUpon>MainForm.cs</DependentUpon>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="app.config" />
|
|
||||||
<None Include="packages.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Include="Be.Windows.Forms.HexBox.dll" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
</Project>
|
</Project>
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 16.0.28803.156
|
VisualStudioVersion = 17.0.31825.309
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XCI Explorer", "XCI Explorer.csproj", "{89DBE891-22C7-40FF-A3D3-36F26224E09D}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XCI Explorer", "XCI Explorer.csproj", "{AF04D4B2-34AC-4514-A1A1-19810A25D308}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -11,15 +11,15 @@ Global
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{89DBE891-22C7-40FF-A3D3-36F26224E09D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{AF04D4B2-34AC-4514-A1A1-19810A25D308}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{89DBE891-22C7-40FF-A3D3-36F26224E09D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{AF04D4B2-34AC-4514-A1A1-19810A25D308}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{89DBE891-22C7-40FF-A3D3-36F26224E09D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{AF04D4B2-34AC-4514-A1A1-19810A25D308}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{89DBE891-22C7-40FF-A3D3-36F26224E09D}.Release|Any CPU.Build.0 = Release|Any CPU
|
{AF04D4B2-34AC-4514-A1A1-19810A25D308}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {F9C853DD-FEA7-470E-B594-C72A1C93ECBB}
|
SolutionGuid = {B3F75FD3-9C94-4E83-83BD-783E98162C92}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
69
XCI_Explorer/CenterWinDialog.cs
Normal file
69
XCI_Explorer/CenterWinDialog.cs
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Text;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace XCI_Explorer
|
||||||
|
{
|
||||||
|
public class CenterWinDialog : IDisposable
|
||||||
|
{
|
||||||
|
private int mTries = 0;
|
||||||
|
private Form mOwner;
|
||||||
|
|
||||||
|
public CenterWinDialog(Form owner)
|
||||||
|
{
|
||||||
|
mOwner = owner;
|
||||||
|
if (owner.WindowState != FormWindowState.Minimized)
|
||||||
|
{
|
||||||
|
owner.BeginInvoke(new MethodInvoker(findDialog));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void findDialog()
|
||||||
|
{
|
||||||
|
// Enumerate windows to find the message box
|
||||||
|
if (mTries < 0) return;
|
||||||
|
EnumThreadWndProc callback = new EnumThreadWndProc(checkWindow);
|
||||||
|
if (EnumThreadWindows(GetCurrentThreadId(), callback, IntPtr.Zero))
|
||||||
|
{
|
||||||
|
if (++mTries < 10) mOwner.BeginInvoke(new MethodInvoker(findDialog));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private bool checkWindow(IntPtr hWnd, IntPtr lp)
|
||||||
|
{
|
||||||
|
// Checks if <hWnd> is a dialog
|
||||||
|
StringBuilder sb = new StringBuilder(260);
|
||||||
|
GetClassName(hWnd, sb, sb.Capacity);
|
||||||
|
if (sb.ToString() != "#32770") return true;
|
||||||
|
// Got it
|
||||||
|
Rectangle frmRect = new Rectangle(mOwner.Location, mOwner.Size);
|
||||||
|
RECT dlgRect;
|
||||||
|
GetWindowRect(hWnd, out dlgRect);
|
||||||
|
MoveWindow(hWnd,
|
||||||
|
frmRect.Left + (frmRect.Width - dlgRect.Right + dlgRect.Left) / 2,
|
||||||
|
frmRect.Top + (frmRect.Height - dlgRect.Bottom + dlgRect.Top) / 2,
|
||||||
|
dlgRect.Right - dlgRect.Left,
|
||||||
|
dlgRect.Bottom - dlgRect.Top, true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
mTries = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// P/Invoke declarations
|
||||||
|
private delegate bool EnumThreadWndProc(IntPtr hWnd, IntPtr lp);
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern bool EnumThreadWindows(int tid, EnumThreadWndProc callback, IntPtr lp);
|
||||||
|
[DllImport("kernel32.dll")]
|
||||||
|
private static extern int GetCurrentThreadId();
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern int GetClassName(IntPtr hWnd, StringBuilder buffer, int buflen);
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern bool GetWindowRect(IntPtr hWnd, out RECT rc);
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern bool MoveWindow(IntPtr hWnd, int x, int y, int w, int h, bool repaint);
|
||||||
|
private struct RECT { public int Left; public int Top; public int Right; public int Bottom; }
|
||||||
|
}
|
||||||
|
}
|
120
XCI_Explorer/CertForm.resx
Normal file
120
XCI_Explorer/CertForm.resx
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<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" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</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" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
|
@ -5,7 +5,7 @@ using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net.Http;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -63,12 +63,14 @@ namespace XCI_Explorer
|
||||||
|
|
||||||
if (!File.Exists("keys.txt"))
|
if (!File.Exists("keys.txt"))
|
||||||
{
|
{
|
||||||
|
|
||||||
if (MessageBox.Show("keys.txt is missing.\nDo you want to automatically download it now?\n\nBy pressing 'Yes' you agree that you own these keys.\n", "XCI Explorer", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
if (MessageBox.Show("keys.txt is missing.\nDo you want to automatically download it now?\n\nBy pressing 'Yes' you agree that you own these keys.\n", "XCI Explorer", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
using (var client = new WebClient())
|
using HttpClient client = new();
|
||||||
{
|
using HttpResponseMessage response = client.Send(new HttpRequestMessage(HttpMethod.Get, Util.Base64Decode("aHR0cHM6Ly9wYXN0ZWJpbi5jb20vcmF3L1d1TXZBaTN2")));
|
||||||
client.DownloadFile(Util.Base64Decode("aHR0cHM6Ly9wYXN0ZWJpbi5jb20vcmF3L2NWR3JQSHp6"), "keys.txt");
|
using Stream stream = response.Content.ReadAsStream();
|
||||||
}
|
using FileStream fs = new("keys.txt", FileMode.CreateNew);
|
||||||
|
stream.CopyTo(fs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!File.Exists("keys.txt"))
|
if (!File.Exists("keys.txt"))
|
||||||
|
@ -95,6 +97,7 @@ namespace XCI_Explorer
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
ProcessFile();
|
ProcessFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string getAssemblyVersion()
|
private string getAssemblyVersion()
|
||||||
|
@ -166,6 +169,7 @@ namespace XCI_Explorer
|
||||||
|
|
||||||
private void ProcessFile()
|
private void ProcessFile()
|
||||||
{
|
{
|
||||||
|
using CenterWinDialog center = new CenterWinDialog(this);
|
||||||
// Code needs refactoring
|
// Code needs refactoring
|
||||||
LB_SelectedData.Text = "";
|
LB_SelectedData.Text = "";
|
||||||
LB_DataOffset.Text = "";
|
LB_DataOffset.Text = "";
|
||||||
|
@ -212,6 +216,7 @@ namespace XCI_Explorer
|
||||||
|
|
||||||
private void B_LoadROM_Click(object sender, EventArgs e)
|
private void B_LoadROM_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
using CenterWinDialog center = new CenterWinDialog(this);
|
||||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||||
openFileDialog.Filter = "Switch Game File (*.xci, *.nsp, *.nsz)|*.xci;*.nsp;*.nsz|All Files (*.*)|*.*";
|
openFileDialog.Filter = "Switch Game File (*.xci, *.nsp, *.nsz)|*.xci;*.nsp;*.nsz|All Files (*.*)|*.*";
|
||||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
@ -548,7 +553,9 @@ namespace XCI_Explorer
|
||||||
{
|
{
|
||||||
WindowStyle = ProcessWindowStyle.Hidden,
|
WindowStyle = ProcessWindowStyle.Hidden,
|
||||||
FileName = $"tools{Path.DirectorySeparatorChar}hactool.exe",
|
FileName = $"tools{Path.DirectorySeparatorChar}hactool.exe",
|
||||||
Arguments = "-k keys.txt --romfsdir=tmp tmp/" + ncaTarget
|
Arguments = "-k keys.txt --romfsdir=tmp tmp/" + ncaTarget,
|
||||||
|
UseShellExecute = false,
|
||||||
|
CreateNoWindow = true
|
||||||
};
|
};
|
||||||
|
|
||||||
process.Start();
|
process.Start();
|
||||||
|
@ -651,22 +658,10 @@ namespace XCI_Explorer
|
||||||
string MasterKey = strArray[1].Trim();
|
string MasterKey = strArray[1].Trim();
|
||||||
int keyblob;
|
int keyblob;
|
||||||
|
|
||||||
if (MasterKey.Contains("Unknown"))
|
MasterKey = MasterKey.Split(new char[2] { 'x', ' ' })[1];
|
||||||
{
|
keyblob = Convert.ToInt32(MasterKey, 16);
|
||||||
if (int.TryParse(new string(MasterKey.TakeWhile(Char.IsDigit).ToArray()), out keyblob))
|
MasterKey = Util.GetMkey((byte)(keyblob + 1));
|
||||||
{
|
TB_MKeyRev.Text = MasterKey;
|
||||||
MasterKey = Util.GetMkey((byte)(keyblob + 1)).Replace("MasterKey", "");
|
|
||||||
}
|
|
||||||
TB_MKeyRev.Text = "MasterKey" + MasterKey;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MasterKey = MasterKey.Split(new char[2] { 'x', ' ' })[1];
|
|
||||||
keyblob = Convert.ToInt32(MasterKey, 16);
|
|
||||||
MasterKey = Util.GetMkey((byte)(keyblob + 1));
|
|
||||||
TB_MKeyRev.Text = MasterKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -743,7 +738,9 @@ namespace XCI_Explorer
|
||||||
{
|
{
|
||||||
WindowStyle = ProcessWindowStyle.Hidden,
|
WindowStyle = ProcessWindowStyle.Hidden,
|
||||||
FileName = $"tools{Path.DirectorySeparatorChar}hactool.exe",
|
FileName = $"tools{Path.DirectorySeparatorChar}hactool.exe",
|
||||||
Arguments = "-k keys.txt --section0dir=data meta"
|
Arguments = "-k keys.txt --section0dir=data meta",
|
||||||
|
UseShellExecute = false,
|
||||||
|
CreateNoWindow = true
|
||||||
};
|
};
|
||||||
process.Start();
|
process.Start();
|
||||||
process.WaitForExit();
|
process.WaitForExit();
|
||||||
|
@ -811,7 +808,9 @@ namespace XCI_Explorer
|
||||||
{
|
{
|
||||||
WindowStyle = ProcessWindowStyle.Hidden,
|
WindowStyle = ProcessWindowStyle.Hidden,
|
||||||
FileName = $"tools{Path.DirectorySeparatorChar}hactool.exe",
|
FileName = $"tools{Path.DirectorySeparatorChar}hactool.exe",
|
||||||
Arguments = "-k keys.txt --romfsdir=data meta"
|
Arguments = "-k keys.txt --romfsdir=data meta",
|
||||||
|
UseShellExecute = false,
|
||||||
|
CreateNoWindow = true
|
||||||
};
|
};
|
||||||
process.Start();
|
process.Start();
|
||||||
process.WaitForExit();
|
process.WaitForExit();
|
||||||
|
@ -901,7 +900,7 @@ namespace XCI_Explorer
|
||||||
|
|
||||||
public static string SHA256Bytes(byte[] ba)
|
public static string SHA256Bytes(byte[] ba)
|
||||||
{
|
{
|
||||||
SHA256 mySHA256 = SHA256Managed.Create();
|
SHA256 mySHA256 = SHA256.Create();
|
||||||
byte[] hashValue;
|
byte[] hashValue;
|
||||||
hashValue = mySHA256.ComputeHash(ba);
|
hashValue = mySHA256.ComputeHash(ba);
|
||||||
return ByteArrayToString(hashValue);
|
return ByteArrayToString(hashValue);
|
||||||
|
@ -1185,6 +1184,7 @@ namespace XCI_Explorer
|
||||||
|
|
||||||
private void B_ExportCert_Click(object sender, EventArgs e)
|
private void B_ExportCert_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
using CenterWinDialog center = new CenterWinDialog(this);
|
||||||
if (Util.checkFile(TB_File.Text))
|
if (Util.checkFile(TB_File.Text))
|
||||||
{
|
{
|
||||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||||
|
@ -1198,7 +1198,7 @@ namespace XCI_Explorer
|
||||||
fileStream.Read(array, 0, 512);
|
fileStream.Read(array, 0, 512);
|
||||||
File.WriteAllBytes(saveFileDialog.FileName, array);
|
File.WriteAllBytes(saveFileDialog.FileName, array);
|
||||||
fileStream.Close();
|
fileStream.Close();
|
||||||
MessageBox.Show("cert successfully exported to:\n\n" + saveFileDialog.FileName);
|
MessageBox.Show("Cert successfully exported to:\n\n" + saveFileDialog.FileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1209,6 +1209,7 @@ namespace XCI_Explorer
|
||||||
|
|
||||||
private void B_ImportCert_Click(object sender, EventArgs e)
|
private void B_ImportCert_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
using CenterWinDialog center = new CenterWinDialog(this);
|
||||||
if (Util.checkFile(TB_File.Text))
|
if (Util.checkFile(TB_File.Text))
|
||||||
{
|
{
|
||||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||||
|
@ -1231,6 +1232,7 @@ namespace XCI_Explorer
|
||||||
|
|
||||||
private void B_ViewCert_Click(object sender, EventArgs e)
|
private void B_ViewCert_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
using CenterWinDialog center = new CenterWinDialog(this);
|
||||||
if (Util.checkFile(TB_File.Text))
|
if (Util.checkFile(TB_File.Text))
|
||||||
{
|
{
|
||||||
CertForm cert = new CertForm(this);
|
CertForm cert = new CertForm(this);
|
||||||
|
@ -1245,6 +1247,7 @@ namespace XCI_Explorer
|
||||||
|
|
||||||
private void B_ClearCert_Click(object sender, EventArgs e)
|
private void B_ClearCert_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
using CenterWinDialog center = new CenterWinDialog(this);
|
||||||
if (Util.checkFile(TB_File.Text))
|
if (Util.checkFile(TB_File.Text))
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("The cert will be deleted permanently.\nContinue?", "XCI Explorer", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
if (MessageBox.Show("The cert will be deleted permanently.\nContinue?", "XCI Explorer", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
|
@ -1284,8 +1287,6 @@ namespace XCI_Explorer
|
||||||
|
|
||||||
// Start the asynchronous operation.
|
// Start the asynchronous operation.
|
||||||
backgroundWorker1.RunWorkerAsync(saveFileDialog.FileName);
|
backgroundWorker1.RunWorkerAsync(saveFileDialog.FileName);
|
||||||
|
|
||||||
MessageBox.Show("Extracting NCA\nPlease wait...");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1339,6 +1340,7 @@ namespace XCI_Explorer
|
||||||
|
|
||||||
private void B_TrimXCI_Click(object sender, EventArgs e)
|
private void B_TrimXCI_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
using CenterWinDialog center = new CenterWinDialog(this);
|
||||||
if (Util.checkFile(TB_File.Text))
|
if (Util.checkFile(TB_File.Text))
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("Trim XCI?", "XCI Explorer", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
if (MessageBox.Show("Trim XCI?", "XCI Explorer", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
|
@ -1458,6 +1460,7 @@ namespace XCI_Explorer
|
||||||
|
|
||||||
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||||
{
|
{
|
||||||
|
using CenterWinDialog center = new CenterWinDialog(this);
|
||||||
B_Extract.Enabled = true;
|
B_Extract.Enabled = true;
|
||||||
B_LoadROM.Enabled = true;
|
B_LoadROM.Enabled = true;
|
||||||
B_TrimXCI.Enabled = true;
|
B_TrimXCI.Enabled = true;
|
||||||
|
|
|
@ -49,55 +49,55 @@ namespace XCI_Explorer
|
||||||
case 8:
|
case 8:
|
||||||
return "MasterKey7 (7.0.0-8.0.1)";
|
return "MasterKey7 (7.0.0-8.0.1)";
|
||||||
case 9:
|
case 9:
|
||||||
return "MasterKey8 (8.1.0)";
|
return "MasterKey8 (8.1.0-8.1.1)";
|
||||||
case 10:
|
case 10:
|
||||||
return "MasterKey9 (9.0.0-9.0.1)";
|
return "MasterKey9 (9.0.0-9.0.1)";
|
||||||
case 11:
|
case 11:
|
||||||
return "MasterKey10 (9.1.0-9.2.0)";
|
return "MasterKey10 (9.1.0-12.0.3)";
|
||||||
case 12:
|
case 12:
|
||||||
return "MasterKey11 (?)";
|
return "MasterKey11 (12.1.0)";
|
||||||
case 13:
|
case 13:
|
||||||
return "MasterKey12 (?)";
|
return "MasterKey12 (13.0.0-?)";
|
||||||
case 14:
|
case 14:
|
||||||
return "MasterKey13 (?)";
|
return "MasterKey13";
|
||||||
case 15:
|
case 15:
|
||||||
return "MasterKey14 (?)";
|
return "MasterKey14";
|
||||||
case 16:
|
case 16:
|
||||||
return "MasterKey15 (?)";
|
return "MasterKey15";
|
||||||
case 17:
|
case 17:
|
||||||
return "MasterKey16 (?)";
|
return "MasterKey16";
|
||||||
case 18:
|
case 18:
|
||||||
return "MasterKey17 (?)";
|
return "MasterKey17";
|
||||||
case 19:
|
case 19:
|
||||||
return "MasterKey18 (?)";
|
return "MasterKey18";
|
||||||
case 20:
|
case 20:
|
||||||
return "MasterKey19 (?)";
|
return "MasterKey19";
|
||||||
case 21:
|
case 21:
|
||||||
return "MasterKey20 (?)";
|
return "MasterKey20";
|
||||||
case 22:
|
case 22:
|
||||||
return "MasterKey21 (?)";
|
return "MasterKey21";
|
||||||
case 23:
|
case 23:
|
||||||
return "MasterKey22 (?)";
|
return "MasterKey22";
|
||||||
case 24:
|
case 24:
|
||||||
return "MasterKey23 (?)";
|
return "MasterKey23";
|
||||||
case 25:
|
case 25:
|
||||||
return "MasterKey24 (?)";
|
return "MasterKey24";
|
||||||
case 26:
|
case 26:
|
||||||
return "MasterKey25 (?)";
|
return "MasterKey25";
|
||||||
case 27:
|
case 27:
|
||||||
return "MasterKey26 (?)";
|
return "MasterKey26";
|
||||||
case 28:
|
case 28:
|
||||||
return "MasterKey27 (?)";
|
return "MasterKey27";
|
||||||
case 29:
|
case 29:
|
||||||
return "MasterKey28 (?)";
|
return "MasterKey28";
|
||||||
case 30:
|
case 30:
|
||||||
return "MasterKey29 (?)";
|
return "MasterKey29";
|
||||||
case 31:
|
case 31:
|
||||||
return "MasterKey30 (?)";
|
return "MasterKey30";
|
||||||
case 32:
|
case 32:
|
||||||
return "MasterKey31 (?)";
|
return "MasterKey31";
|
||||||
case 33:
|
case 33:
|
||||||
return "MasterKey32 (?)";
|
return "MasterKey32";
|
||||||
default:
|
default:
|
||||||
return "?";
|
return "?";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<configuration>
|
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="Be.Windows.Forms.HexBox" version="1.6.1" targetFramework="net461" />
|
|
||||||
</packages>
|
|
6
tools/SOURCE.txt
Normal file
6
tools/SOURCE.txt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
Source: https://github.com/SciresM/hactool/releases/tag/1.4.0
|
||||||
|
|
||||||
|
Algorithm Hash Path
|
||||||
|
--------- ---- ----
|
||||||
|
SHA256 36E9A221C8A7949C86ADA9388EB703C90663AEDFE9F65B6032429614C5E1ABE8 hactool-1.4.0-win.zip
|
||||||
|
SHA256 01E6CCB916C74071645DF84F13E05D0185C9B2F5D748E469C84A157A53395CF9 hactool.exe
|
BIN
tools/hactool.exe
Normal file
BIN
tools/hactool.exe
Normal file
Binary file not shown.
Loading…
Reference in a new issue