mirror of
https://github.com/TheShadowEevee/Sharpii-NetCore.git
synced 2025-01-11 14:58:51 -06:00
Fixed a File Path Seperator Bug
Fixed a program breaking bug that caused various issues with file access.
This commit is contained in:
parent
8005685a35
commit
efabed2e35
8 changed files with 48 additions and 41 deletions
|
@ -180,6 +180,7 @@ namespace Sharpii
|
|||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Sharpii {0} - BNS - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version);
|
||||
Console.WriteLine("Sharpii .Net Core Port by TheShadowEevee");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Usage:");
|
||||
|
|
|
@ -173,7 +173,7 @@ namespace Sharpii
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!File.Exists(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\WadInstaller.dll"))
|
||||
if (!File.Exists(Path.Combine(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory), "WadInstaller.dll")))
|
||||
{
|
||||
Console.WriteLine("ERROR: WadInstaller.dll not found");
|
||||
Console.WriteLine("\n\nAttemp to download? [Y/N]");
|
||||
|
@ -331,6 +331,7 @@ namespace Sharpii
|
|||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Sharpii {0} - SendDol - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version);
|
||||
Console.WriteLine("Sharpii .Net Core Port by TheShadowEevee");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Usage:");
|
||||
|
|
|
@ -239,6 +239,7 @@ namespace Sharpii
|
|||
Console.WriteLine("");
|
||||
Console.WriteLine("Sharpii {0} - IOS - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version);
|
||||
Console.WriteLine(" Code based off PatchIOS by leathl");
|
||||
Console.WriteLine("Sharpii .Net Core Port by TheShadowEevee");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Usage:");
|
||||
Console.WriteLine("");
|
||||
|
|
|
@ -277,7 +277,7 @@ namespace Sharpii
|
|||
{
|
||||
if (wad == true)
|
||||
{
|
||||
if (!File.Exists(temp + "\\" + id + "v" + version + ".wad"))
|
||||
if (!File.Exists(Path.Combine(temp, id + "v" + version + ".wad")))
|
||||
{
|
||||
Console.WriteLine("ERROR: Can't find WAD");
|
||||
return;
|
||||
|
@ -287,19 +287,19 @@ namespace Sharpii
|
|||
int index = realout.LastIndexOf("\\") > realout.LastIndexOf("/") ? realout.LastIndexOf("\\") : realout.LastIndexOf("/");
|
||||
if (File.Exists(realout.Substring(0, index + 1) + ios))
|
||||
File.Delete(realout.Substring(0, index + 1) + ios);
|
||||
File.Move(temp + "\\" + id + "v" + version + ".wad", realout.Substring(0, index + 1) + ios);
|
||||
File.Move(Path.Combine(temp, id + "v" + version + ".wad"), realout.Substring(0, index + 1) + ios);
|
||||
}
|
||||
else if (ios == "" && NoOut == true)
|
||||
{
|
||||
if (File.Exists(realout + ".wad"))
|
||||
File.Delete(realout + ".wad");
|
||||
File.Move(temp + "\\" + id + "v" + version + ".wad", realout + ".wad");
|
||||
File.Move(Path.Combine(temp, id + "v" + version + ".wad"), realout + ".wad");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (File.Exists(realout))
|
||||
File.Delete(realout);
|
||||
File.Move(temp + "\\" + id + "v" + version + ".wad", realout);
|
||||
File.Move(Path.Combine(temp, id + "v" + version + ".wad"), realout);
|
||||
}
|
||||
DeleteADir.DeleteDirectory(temp);
|
||||
}
|
||||
|
@ -307,11 +307,11 @@ namespace Sharpii
|
|||
{
|
||||
if (output.Substring(output.Length - 1, 1) == "\\" || output.Substring(output.Length - 1, 1) == "/")
|
||||
output = output.Substring(output.Length - 1, 1);
|
||||
if (File.Exists(output + "\\" + id + "v" + version + ".wad"))
|
||||
if (File.Exists(Path.Combine(output, id + "v" + version + ".wad")))
|
||||
{
|
||||
if (File.Exists(output + "\\" + ios))
|
||||
File.Delete(output + "\\" + ios);
|
||||
File.Move(output + "\\" + id + "v" + version + ".wad", output + "\\" + ios);
|
||||
if (File.Exists(Path.Combine(output, ios)))
|
||||
File.Delete(Path.Combine(output, ios));
|
||||
File.Move(Path.Combine(output, id + "v" + version + ".wad"), Path.Combine(output, ios));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -320,6 +320,7 @@ namespace Sharpii
|
|||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Sharpii {0} - NUSD - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version);
|
||||
Console.WriteLine("Sharpii .Net Core Port by TheShadowEevee");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Usage:");
|
||||
|
|
|
@ -171,22 +171,21 @@ namespace Sharpii
|
|||
Console.WriteLine("Installing Sharpii...");
|
||||
if (BeQuiet.quiet > 1)
|
||||
Console.WriteLine("Adding Variables");
|
||||
Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine) +
|
||||
";" + Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\", EnvironmentVariableTarget.Machine);
|
||||
Environment.SetEnvironmentVariable("PATH", Path.Combine(Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine), ";", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Sharpii"), EnvironmentVariableTarget.Machine);
|
||||
|
||||
if (BeQuiet.quiet > 1)
|
||||
Console.WriteLine("Creating Directory");
|
||||
if (Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\"))
|
||||
DeleteADir.DeleteDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\");
|
||||
Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\");
|
||||
if (Directory.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Sharpii")))
|
||||
DeleteADir.DeleteDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Sharpii"));
|
||||
Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Sharpii"));
|
||||
|
||||
if (BeQuiet.quiet > 1)
|
||||
Console.WriteLine("Copying Files");
|
||||
File.Copy(AppDomain.CurrentDomain.BaseDirectory, Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\Sharpii.exe");
|
||||
if (File.Exists(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\libWiiSharp.dll"))
|
||||
File.Copy(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\libWiiSharp.dll", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\libWiiSharp.dll");
|
||||
if (File.Exists(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\WadInstaller.dll"))
|
||||
File.Copy(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\WadInstaller.dll", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\WadInstaller.dll");
|
||||
if (File.Exists(Path.Combine(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory), "libWiiSharp.dll")))
|
||||
File.Copy(Path.Combine(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory), "libWiiSharp.dll"), Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Sharpii", "libWiiSharp.dll"));
|
||||
if (File.Exists(Path.Combine(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory), "WadInstaller.dll")))
|
||||
File.Copy(Path.Combine(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory), "WadInstaller.dll"), Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Sharpii", "WadInstaller.dll"));
|
||||
|
||||
if (BeQuiet.quiet > 1)
|
||||
{
|
||||
|
@ -247,6 +246,7 @@ namespace Sharpii
|
|||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Sharpii {0} - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version);
|
||||
Console.WriteLine("Sharpii .Net Core Port by TheShadowEevee");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Usage:");
|
||||
|
@ -321,5 +321,5 @@ public class BeQuiet
|
|||
}
|
||||
public class ProgramVersion
|
||||
{
|
||||
public static string version = "1.7.3; .Net Core Port";
|
||||
public static string version = "1.0.1; .Net Core Port (Based on Sharpii 1.7.3)";
|
||||
}
|
|
@ -202,6 +202,7 @@ namespace Sharpii
|
|||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Sharpii {0} - TPL - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version);
|
||||
Console.WriteLine("Sharpii .Net Core Port by TheShadowEevee");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Usage:");
|
||||
|
|
|
@ -202,6 +202,7 @@ namespace Sharpii
|
|||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Sharpii {0} - U8 - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version);
|
||||
Console.WriteLine("Sharpii .Net Core Port by TheShadowEevee");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Usage:");
|
||||
|
|
|
@ -380,10 +380,10 @@ namespace Sharpii
|
|||
|
||||
Directory.CreateDirectory(temp);
|
||||
|
||||
wad.Unpack(temp + "\\main");
|
||||
wad.Unpack(Path.Combine(temp, "main"));
|
||||
U8 u = new U8();
|
||||
u.LoadFile(temp + "\\main\\00000000.app");
|
||||
u.Extract(temp + "\\main\\00000000");
|
||||
u.LoadFile(Path.Combine(temp, "main", "00000000.app"));
|
||||
u.Extract(Path.Combine(temp, "main", "00000000"));
|
||||
|
||||
WAD twad = new WAD();
|
||||
|
||||
|
@ -393,12 +393,12 @@ namespace Sharpii
|
|||
Console.Write("Grabbing sound...");
|
||||
|
||||
twad.LoadFile(sound);
|
||||
twad.Unpack(temp + "\\sound");
|
||||
twad.Unpack(Path.Combine(temp + "sound"));
|
||||
U8 tu = new U8();
|
||||
tu.LoadFile(temp + "\\sound\\00000000.app");
|
||||
tu.Extract(temp + "\\sound\\00000000");
|
||||
tu.LoadFile(Path.Combine(temp, "sound", "00000000.app"));
|
||||
tu.Extract(Path.Combine(temp, "sound", "00000000"));
|
||||
|
||||
File.Copy(temp + "\\sound\\00000000\\meta\\sound.bin", temp + "\\main\\00000000\\meta\\sound.bin", true);
|
||||
File.Copy(Path.Combine(temp, "sound", "00000000", "meta", "sound.bin"), Path.Combine(temp, "main", "00000000", "meta", "sound.bin"), true);
|
||||
|
||||
if (BeQuiet.quiet > 2)
|
||||
Console.Write("Done!\n");
|
||||
|
@ -409,12 +409,12 @@ namespace Sharpii
|
|||
Console.Write("Grabbing banner...");
|
||||
|
||||
twad.LoadFile(banner);
|
||||
twad.Unpack(temp + "\\banner");
|
||||
twad.Unpack(Path.Combine(temp, "banner"));
|
||||
U8 tu = new U8();
|
||||
tu.LoadFile(temp + "\\banner\\00000000.app");
|
||||
tu.Extract(temp + "\\banner\\00000000");
|
||||
tu.LoadFile(Path.Combine(temp, "banner", "00000000.app"));
|
||||
tu.Extract(Path.Combine(temp, "banner", "00000000"));
|
||||
|
||||
File.Copy(temp + "\\banner\\00000000\\meta\\banner.bin", temp + "\\main\\00000000\\meta\\banner.bin", true);
|
||||
File.Copy(Path.Combine(temp, "banner", "00000000", "meta", "banner.bin"), Path.Combine(temp, "main", "00000000", "meta", "banner.bin"), true);
|
||||
|
||||
if (BeQuiet.quiet > 2)
|
||||
Console.Write("Done!\n");
|
||||
|
@ -425,12 +425,12 @@ namespace Sharpii
|
|||
Console.Write("Grabbing icon...");
|
||||
|
||||
twad.LoadFile(icon);
|
||||
twad.Unpack(temp + "\\icon");
|
||||
twad.Unpack(Path.Combine(temp, "icon"));
|
||||
U8 tu = new U8();
|
||||
tu.LoadFile(temp + "\\icon\\00000000.app");
|
||||
tu.Extract(temp + "\\icon\\00000000");
|
||||
tu.LoadFile(Path.Combine(temp, "icon", "00000000.app"));
|
||||
tu.Extract(Path.Combine(temp, "icon", "00000000"));
|
||||
|
||||
File.Copy(temp + "\\icon\\00000000\\meta\\icon.bin", temp + "\\main\\00000000\\meta\\icon.bin", true);
|
||||
File.Copy(Path.Combine(temp, "icon", "00000000", "meta", "icon.bin"), Path.Combine(temp, "main", "00000000", "meta", "icon.bin"), true);
|
||||
|
||||
if (BeQuiet.quiet > 2)
|
||||
Console.Write("Done!\n");
|
||||
|
@ -442,8 +442,8 @@ namespace Sharpii
|
|||
|
||||
if (app.Substring(app.Length - 4, 4) == ".dol")
|
||||
{
|
||||
Directory.CreateDirectory(temp + "\\dol\\");
|
||||
File.Copy(app, temp + "\\dol\\00000001.app");
|
||||
Directory.CreateDirectory(Path.Combine(temp, "dol"));
|
||||
File.Copy(app, Path.Combine(temp, "dol", "00000001.app"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -451,15 +451,15 @@ namespace Sharpii
|
|||
twad.Unpack(temp + "\\dol");
|
||||
}
|
||||
|
||||
File.Copy(temp + "\\dol\\00000001.app", temp + "\\main\\00000001.app", true);
|
||||
File.Copy(Path.Combine(temp, "dol", "00000001.app"), Path.Combine(temp, "main", "00000001.app"), true);
|
||||
|
||||
if (BeQuiet.quiet > 2)
|
||||
Console.Write("Done!\n");
|
||||
}
|
||||
u.ReplaceFile(1, temp + "\\main\\00000000\\meta\\banner.bin");
|
||||
u.ReplaceFile(2, temp + "\\main\\00000000\\meta\\icon.bin");
|
||||
u.ReplaceFile(3, temp + "\\main\\00000000\\meta\\sound.bin");
|
||||
u.Save(temp + "\\main\\00000000.app");
|
||||
u.ReplaceFile(1, Path.Combine(temp, "main", "00000000", "meta", "banner.bin"));
|
||||
u.ReplaceFile(2, Path.Combine(temp, "main", "00000000", "meta", "icon.bin"));
|
||||
u.ReplaceFile(3, Path.Combine(temp, "main", "00000000", "meta", "sound.bin"));
|
||||
u.Save(Path.Combine(temp, "main", "00000000.app"));
|
||||
DeleteADir.DeleteDirectory(temp + "\\main\\00000000\\");
|
||||
wad.CreateNew(temp + "\\main");
|
||||
DeleteADir.DeleteDirectory(temp);
|
||||
|
@ -602,6 +602,7 @@ namespace Sharpii
|
|||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Sharpii {0} - WAD - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version);
|
||||
Console.WriteLine("Sharpii .Net Core Port by TheShadowEevee");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Usage:");
|
||||
|
|
Loading…
Reference in a new issue