Merge pull request #46 from stuff-by-3-random-dudes/OverhaulToNet6

Overhaul to net6
This commit is contained in:
ZestyTS 2022-08-31 00:06:35 -07:00 committed by GitHub
commit 33bcbb4d6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 102 additions and 51 deletions

View file

@ -8,13 +8,25 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Debug|x64.ActiveCfg = Debug|x64
{6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Debug|x64.Build.0 = Debug|x64
{6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Debug|x86.ActiveCfg = Debug|x86
{6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Debug|x86.Build.0 = Debug|x86
{6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Release|Any CPU.Build.0 = Release|Any CPU
{6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Release|x64.ActiveCfg = Release|x64
{6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Release|x64.Build.0 = Release|x64
{6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Release|x86.ActiveCfg = Release|x86
{6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -49,6 +49,9 @@
<setting name="gczw" serializeAs="String">
<value>False</value>
</setting>
<setting name="Ancast" serializeAs="String">
<value />
</setting>
</UWUVCI_AIO_WPF.Properties.Settings>
</userSettings>
<runtime>

View file

@ -1623,9 +1623,8 @@ namespace UWUVCI_AIO_WPF
}
mvm.Progress = 40;
mvm.msg = "Packing...";
if (Environment.Is64BitOperatingSystem)
CNUSPACKER.Program.Main(new string[] { "-in", baseRomPath, "-out", outputPath, "-encryptKeyWidth", Settings.Default.Ckey });
if (Environment.Is64BitProcess)
CNUSPACKER.Program.Main(new string[] { "-in", baseRomPath, "-out", outputPath, "-encryptKeyWith", Properties.Settings.Default.Ckey });
else
{
using var cnuspacker = new Process();
@ -1635,7 +1634,7 @@ namespace UWUVCI_AIO_WPF
cnuspacker.StartInfo.CreateNoWindow = true;
}
cnuspacker.StartInfo.FileName = "java";
cnuspacker.StartInfo.Arguments = $"-jar \"{Path.Combine(toolsPath, "NUSPacker.jar")}\" -in \"{baseRomPath}\" -out \"{outputPath}\" -encryptKeyWith {Settings.Default.Ckey}";
cnuspacker.StartInfo.Arguments = $"-jar \"{Path.Combine(toolsPath, "NUSPacker.jar")}\" -in \"{baseRomPath}\" -out \"{outputPath}\" -encryptKeyWith {Properties.Settings.Default.Ckey}";
cnuspacker.Start();
cnuspacker.WaitForExit();
}
@ -1660,7 +1659,7 @@ namespace UWUVCI_AIO_WPF
var titleData = new TitleData(b.Tid, key.Tkey);
var downloadFolder = Path.Combine(tempPath, "download");
await Downloader.DownloadAsync(titleData, downloadFolder);
await WiiUDownloaderLibrary.Downloader.DownloadAsync(titleData, downloadFolder);
mvm.Progress = 75;
@ -2133,7 +2132,7 @@ namespace UWUVCI_AIO_WPF
for (var i = 0; i < titleIds.Length; i++)
{
var titleData = new TitleData(titleIds[i], Settings.Default.SysKey);
await Downloader.DownloadAsync(titleData, downloadFolder);
await WiiUDownloaderLibrary.Downloader.DownloadAsync(titleData, downloadFolder);
CSharpDecrypt.CSharpDecrypt.Decrypt(new string[] { Settings.Default.Ckey, Path.Combine(downloadFolder, titleIds[i]), paths[i] });
}
@ -2165,7 +2164,7 @@ namespace UWUVCI_AIO_WPF
using (var stream = new FileStream(zipLocation, FileMode.Create))
using (var archive = new ZipArchive(stream, ZipArchiveMode.Create))
archive.CreateEntryFromFile(romPath, Path.GetFileNameWithoutExtension(romPath));
archive.CreateEntryFromFile(romPath, Path.GetFileName(romPath));
mvvm.Progress = 80;
File.Delete(RomName);
@ -2582,6 +2581,8 @@ namespace UWUVCI_AIO_WPF
}
}
catch (Exception e)
{
if (!e.Message.Contains("Could not find"))
{
if (e.Message.Contains("Size"))
{
@ -2589,7 +2590,7 @@ namespace UWUVCI_AIO_WPF
}
throw new Exception("Images");
}
}
}
private static void CopyAndConvertImage(string inputPath, string outputPath, bool delete, int widht, int height, int bit, string newname)

View file

@ -2,10 +2,9 @@
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Net.Http;
using System.Net;
using System.Security.Cryptography;
using System.Threading;
using System.Threading.Tasks;
namespace UWUVCI_AIO_WPF.Classes
{
@ -54,7 +53,8 @@ namespace UWUVCI_AIO_WPF.Classes
"font2.ttf",
"forwarder.dol",
"gba1.zip",
"gba2.zip"
"gba2.zip",
"c2w_patcher.exe"
};
public static bool DoesToolsFolderExist()
@ -62,23 +62,28 @@ namespace UWUVCI_AIO_WPF.Classes
return Directory.Exists(FolderName);
}
public static async Task<bool> IsToolRightAsync(string name)
public static bool IsToolRightAsync(string name)
{
var result = false;
string md5Name = name + ".md5";
string md5Path = FolderName + "\\" + md5Name;
string filePath = FolderName + "\\" + name;
using (var httpClient = new HttpClient())
{
using var response = await httpClient.GetStreamAsync(backupulr + md5Name);
using var fs = new FileStream(md5Path, FileMode.Create);
await response.CopyToAsync(fs);
}
if (!File.Exists(filePath))
return result;
using (var webClient = new WebClient())
webClient.DownloadFile(backupulr + md5Name, md5Path);
var md5 = "";
using (var sr = new StreamReader(md5Path))
md5 = await sr.ReadToEndAsync();
md5 = sr.ReadLine();
return CalculateMD5(md5Path) == md5;
result = CalculateMD5(filePath) == md5.ToLower();
File.Delete(md5Path);
return result;
}
static string CalculateMD5(string filename)
{

View file

@ -434,14 +434,24 @@ namespace UWUVCI_AIO_WPF
//Someone messed up versioning, so eff it just don't even bother then
return;
}
if (comparison > 0)
if (comparison < 0)
{
using (var webClient = new WebClient())
{
webClient.Headers.Add(HttpRequestHeader.UserAgent, "MyUserAgent");
Task.Run(() => webClient.DownloadFileTaskAsync(releases[0].ZipballUrl, "UWUVCI_INSTALLER.exe")).GetAwaiter();
}
var cm = new Custom_Message("Update Available!", "Latest version is currently being downloaded!\nPlease look for the file \"UWUVCI_INSTALLER.exe\" in\n" + Directory.GetCurrentDirectory());
var cm = new Custom_Message("Update Available!", "Latest version is currently being downloaded!\nPlease look for the file \"UWUVCI" + "_" + "INSTALLER.exe\" in\n" + Directory.GetCurrentDirectory());
try
{
cm.Owner = mw;
}
catch (Exception) { }
cm.ShowDialog();
}
else if (comparison > 0)
{
var cm = new Custom_Message("Possible Update Available", "It somehow looks like your version is newer than the public release version:\nhttps://github.com/stuff-by-3-random-dudes/UWUVCI-AIO-WPF/releases/latest\n\nNo update attempt will be made.");
try
{
cm.Owner = mw;
@ -451,6 +461,7 @@ namespace UWUVCI_AIO_WPF
}
else
{
var cm = new Custom_Message("No Update Available", "This is currently the latest version.");
try
{
@ -486,7 +497,7 @@ namespace UWUVCI_AIO_WPF
}
public MainViewModel()
{
if (!Environment.Is64BitOperatingSystem)
if (true)
{
List<string> Tools = ToolCheck.ToolNames.ToList();
Tools.Add("NUSPacker.jar");
@ -1168,7 +1179,7 @@ namespace UWUVCI_AIO_WPF
foreach (string s in bases)
{
DeleteTool(s);
Task.Run(() => DownloadToolAsync(s, this)).GetAwaiter();
DownloadToolAsync(s, this);
Progress += Convert.ToInt32(l);
}
@ -1622,21 +1633,19 @@ namespace UWUVCI_AIO_WPF
Environment.Exit(1);
}
}
public static async Task DownloadToolAsync(string name, MainViewModel mvm)
public static void DownloadToolAsync(string name, MainViewModel mvm)
{
var filePath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "Tools", name);
try
{
while (true)
{
var isToolRight = await ToolCheck.IsToolRightAsync(name);
var isToolRight = ToolCheck.IsToolRightAsync(name);
if (isToolRight)
break;
using var httpClient = new HttpClient();
using var response = await httpClient.GetStreamAsync(getDownloadLink(name, true));
using var fs = new FileStream(filePath, FileMode.Create);
await response.CopyToAsync(fs);
using (var webClient = new WebClient())
webClient.DownloadFile(getDownloadLink(name, true), filePath);
}
}
catch (Exception e)
@ -1682,7 +1691,7 @@ namespace UWUVCI_AIO_WPF
if (missingTools.Count > 0)
{
foreach (MissingTool m in missingTools)
Task.Run(() => DownloadToolAsync(m.Name, this)).GetAwaiter();
DownloadToolAsync(m.Name, this);
InjcttoolCheck();
}
@ -1696,6 +1705,7 @@ namespace UWUVCI_AIO_WPF
private void ThreadDownload(List<MissingTool> missingTools)
{
var percentage = 100 / missingTools.Count;
Progress = 0;
var thread = new Thread(() =>
{
foreach (MissingTool m in missingTools)
@ -1706,9 +1716,10 @@ namespace UWUVCI_AIO_WPF
sw.Close();
}
else
Task.Run(() => DownloadToolAsync(m.Name, this)).GetAwaiter();
DownloadToolAsync(m.Name, this);
Progress += percentage;
}
Progress = 100;
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();

View file

@ -51,5 +51,5 @@ using System.Windows;
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.99.0.0")]
[assembly: AssemblyFileVersion("3.99.0.0")]
[assembly: AssemblyVersion("3.99.1.0")]
[assembly: AssemblyFileVersion("3.99.1.0")]

View file

@ -12,7 +12,7 @@ namespace UWUVCI_AIO_WPF.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@ -178,5 +178,17 @@ namespace UWUVCI_AIO_WPF.Properties {
this["gczw"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string Ancast {
get {
return ((string)(this["Ancast"]));
}
set {
this["Ancast"] = value;
}
}
}
}

View file

@ -41,5 +41,8 @@
<Setting Name="gczw" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="Ancast" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

View file

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
@ -170,6 +171,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
gamepad.ItemsSource = gpEmu;
mvm.RomPath = path;
mvm.RomSet = true;
ancastKey.Text = Settings.Default.Ancast;
if (mvm.BaseDownloaded)
{
mvm.CanInject = true;
@ -348,6 +350,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
if (hash == "31-8D-1F-9D-98-FB-08-E7-7C-7F-E1-77-AA-49-05-43")
{
Settings.Default.Ancast = ancastKey.Text;
string[] ancastKeyCopy = { ancastKey.Text };
Task.Run(() =>
@ -364,7 +367,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
foreach (var titleId in titleIds)
{
Task.Run(() => Downloader.DownloadAsync(titleId, downloadPath)).GetAwaiter().GetResult();
Task.Run(() => WiiUDownloaderLibrary.Downloader.DownloadAsync(titleId, downloadPath)).GetAwaiter().GetResult();
mvm.Progress += 5;
}
@ -382,7 +385,6 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
mvm.Progress += 5;
var currentDir = Directory.GetCurrentDirectory();
Directory.SetCurrentDirectory(c2wPath);
using (Process c2w = new Process())
{
@ -391,7 +393,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
c2w.Start();
c2w.WaitForExit();
}
Directory.SetCurrentDirectory(currentDir);
Directory.SetCurrentDirectory(new FileInfo(Assembly.GetEntryAssembly().Location).DirectoryName);
File.Copy(System.IO.Path.Combine(c2wPath, "c2p.img"), imgFileCode, true);
mvm.Progress = 100;

View file

@ -46,7 +46,7 @@
<Ellipse Fill="#FF2196F3" HorizontalAlignment="Left" Height="21" Margin="12,7,0,0" VerticalAlignment="Top" Width="17"/>
<Ellipse Fill="#FF2196F3" HorizontalAlignment="Left" Height="21" Margin="12,7,0,0" VerticalAlignment="Top" Width="17"/>
<Border BorderBrush="#FF2196F3" BorderThickness="1" HorizontalAlignment="Left" Height="33" Margin="12,6,0,0" VerticalAlignment="Top" Width="1108" CornerRadius="5" Background="#FF2196F3"/>
<Label Content="v3.99.0" HorizontalAlignment="Left" Margin="1075,10,0,0" VerticalAlignment="Top" Foreground="#DDFFFFFF" Width="81" Height="24"/>
<Label Content="v3.99.1" HorizontalAlignment="Left" Margin="1075,10,0,0" VerticalAlignment="Top" Foreground="#DDFFFFFF" Width="81" Height="24"/>
<Button HorizontalAlignment="Left" Margin="32,522,0,0" VerticalAlignment="Top" Width="74" Click="Button_Click_13" IsTabStop="False" Height="58" ToolTip="Support UWUVCI on Ko-Fi">
<Image HorizontalAlignment="Left" Height="46" VerticalAlignment="Top" Width="46" Source="/UI/Images/61e111774d3a2f67c827cd25_Frame 5.png" />
</Button>

View file

@ -8,7 +8,7 @@
d:DesignHeight="480" d:DesignWidth="1130"
Title="SettingsFrame" >
<Grid>
<TextBlock x:Name="tb" Margin="10,172,10,192" TextWrapping="Wrap" Text="Welcome to UWUVCI AIO v3.99.0. To start Injecting select a Console to your left." FontSize="20" Height="116" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center" Width="1110" />
<TextBlock x:Name="tb" Margin="10,172,10,192" TextWrapping="Wrap" Text="Welcome to UWUVCI AIO v3.99.1. To start Injecting select a Console to your left." FontSize="20" Height="116" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center" Width="1110" />
<TextBlock Margin="15,505,15,0" HorizontalAlignment="Right" VerticalAlignment="Top" Text="Support MAC Development" TextAlignment="Right"></TextBlock>
<Button HorizontalAlignment="Right" Margin="15,525,15,0" VerticalAlignment="Top" Width="74" Click="Button_Click" IsTabStop="False" Height="58" ToolTip="Support UWUVCI MAC Development on Ko-Fi">
<Image HorizontalAlignment="Left" Height="46" VerticalAlignment="Top" Width="46" Source="/UI/Images/61e111774d3a2f67c827cd25_Frame 5.png" />

View file

@ -73,6 +73,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows
if (mvm.Progress < 79)
mvm.Progress += 1;
}
else if (Key.Text.Contains("Downloading Tools")) { }
else
mvm.Progress += 1;

View file

@ -514,7 +514,7 @@ namespace UWUVCI_AIO_WPF
var p = new Process();
var fileName = Application.ResourceAssembly.Location;
foreach (var file in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.exe"))
if (!Path.GetFileName(file).Contains(Path.GetFileNameWithoutExtension(fileName)))
if (Path.GetFileName(file).Contains("vWii"))
{
fileName = file;
break;

View file

@ -21,6 +21,7 @@
<UseWindowsForms>True</UseWindowsForms>
<UseWPF>true</UseWPF>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>
<PropertyGroup>
<SignManifests>false</SignManifests>
@ -33,7 +34,6 @@
</PropertyGroup>
<PropertyGroup>
<StartupObject>UWUVCI_AIO_WPF.App</StartupObject>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="GameBaseClassLibrary">
@ -159,7 +159,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CDecryptSharp" Version="1.0.4" />
<PackageReference Include="CNUSPACKER" Version="1.0.4" />
<PackageReference Include="CNUSPACKER" Version="1.0.3" />
<PackageReference Include="Downloader" Version="2.3.7" />
<PackageReference Include="GMWare.M2" Version="1.1.2" />
<PackageReference Include="Json.Net" Version="1.0.33" />
<PackageReference Include="MaterialDesignThemes" Version="2.5.1" />