2011-09-26 22:19:01 -05:00
|
|
|
|
/* This file is part of Sharpii.
|
2013-02-16 00:55:46 -06:00
|
|
|
|
* Copyright (C) 2013 Person66
|
2020-04-03 12:58:15 -05:00
|
|
|
|
* Copyright (C) 2020 Sharpii-NetCore Contributors
|
2011-09-26 22:19:01 -05:00
|
|
|
|
*
|
|
|
|
|
* Sharpii is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* Sharpii is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2011-11-01 20:02:11 -05:00
|
|
|
|
* along with Sharpii. If not, see <http://www.gnu.org/licenses/>.
|
2011-09-26 22:19:01 -05:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
2011-11-01 20:02:11 -05:00
|
|
|
|
using System.Net;
|
2011-09-26 22:19:01 -05:00
|
|
|
|
using libWiiSharp;
|
2011-11-09 00:07:17 -06:00
|
|
|
|
using System.Diagnostics;
|
2020-04-03 12:58:15 -05:00
|
|
|
|
using System.Runtime.InteropServices;
|
2011-09-26 22:19:01 -05:00
|
|
|
|
|
|
|
|
|
namespace Sharpii
|
|
|
|
|
{
|
|
|
|
|
class MainApp
|
|
|
|
|
{
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Length < 1)
|
|
|
|
|
{
|
|
|
|
|
help();
|
2011-10-02 22:43:22 -05:00
|
|
|
|
Environment.Exit(0);
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-17 23:45:36 -06:00
|
|
|
|
if (!File.Exists(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + Path.DirectorySeparatorChar + "libWiiSharp.dll"))
|
2011-10-02 22:43:22 -05:00
|
|
|
|
{
|
2011-11-07 22:59:31 -06:00
|
|
|
|
Console.WriteLine("ERROR: libWiiSharp.dll not found");
|
2020-03-07 14:44:42 -06:00
|
|
|
|
Console.WriteLine("This should not appear on the .Net Core port.");
|
|
|
|
|
Console.WriteLine("If you see this, report how you got here on https://github.com/TheShadowEevee/Sharpii-NetCore/issues.");
|
|
|
|
|
Console.WriteLine("Error: SHARPII_NET_CORE_MAIN_MISSING_DLL_LIBWIISHARP_01");
|
2020-04-03 16:36:26 -05:00
|
|
|
|
if (OperatingSystem.Windows())
|
|
|
|
|
{
|
|
|
|
|
Environment.Exit(0x00003E8F);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Environment.Exit(0x00000011);
|
|
|
|
|
}
|
|
|
|
|
return;
|
2011-09-26 22:19:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i < args.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
switch (args[i].ToUpper())
|
|
|
|
|
{
|
|
|
|
|
case "-QUIET":
|
2020-01-17 23:45:36 -06:00
|
|
|
|
BeQuiet.quiet = 1;
|
2011-09-26 22:19:01 -05:00
|
|
|
|
break;
|
|
|
|
|
case "-Q":
|
2020-01-17 23:45:36 -06:00
|
|
|
|
BeQuiet.quiet = 1;
|
2011-09-26 22:19:01 -05:00
|
|
|
|
break;
|
|
|
|
|
case "-LOTS":
|
2020-01-17 23:45:36 -06:00
|
|
|
|
BeQuiet.quiet = 3;
|
2011-09-26 22:19:01 -05:00
|
|
|
|
break;
|
2020-03-07 14:44:42 -06:00
|
|
|
|
case "-NOLOG":
|
|
|
|
|
Logging.log = 0;
|
|
|
|
|
break;
|
2011-09-26 22:19:01 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-07 22:59:31 -06:00
|
|
|
|
string Function = args[0].ToUpper();
|
2011-11-01 20:02:11 -05:00
|
|
|
|
bool gotSomewhere = false;
|
2011-09-26 22:19:01 -05:00
|
|
|
|
|
2011-11-07 22:59:31 -06:00
|
|
|
|
if (Function == "-H" || Function == "-HELP" || Function == "H" || Function == "HELP")
|
2011-09-26 22:19:01 -05:00
|
|
|
|
{
|
|
|
|
|
help();
|
2011-11-01 20:02:11 -05:00
|
|
|
|
gotSomewhere = true;
|
2011-09-26 22:19:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-07 22:59:31 -06:00
|
|
|
|
if (Function == "BNS")
|
2011-09-26 22:19:01 -05:00
|
|
|
|
{
|
|
|
|
|
BNS_Stuff.BNS(args);
|
2011-11-01 20:02:11 -05:00
|
|
|
|
gotSomewhere = true;
|
2011-09-26 22:19:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-07 22:59:31 -06:00
|
|
|
|
if (Function == "WAD")
|
2011-09-26 22:19:01 -05:00
|
|
|
|
{
|
|
|
|
|
WAD_Stuff.WAD(args);
|
2011-11-01 20:02:11 -05:00
|
|
|
|
gotSomewhere = true;
|
2011-09-26 22:19:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-07 22:59:31 -06:00
|
|
|
|
if (Function == "TPL")
|
2011-09-26 22:19:01 -05:00
|
|
|
|
{
|
|
|
|
|
TPL_Stuff.TPL(args);
|
2011-11-01 20:02:11 -05:00
|
|
|
|
gotSomewhere = true;
|
2011-09-26 22:19:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-07 22:59:31 -06:00
|
|
|
|
if (Function == "U8")
|
2011-09-26 22:19:01 -05:00
|
|
|
|
{
|
|
|
|
|
U8_Stuff.U8(args);
|
2011-11-01 20:02:11 -05:00
|
|
|
|
gotSomewhere = true;
|
2011-09-26 22:19:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-07 22:59:31 -06:00
|
|
|
|
if (Function == "IOS")
|
2011-09-26 22:19:01 -05:00
|
|
|
|
{
|
|
|
|
|
IOS_Stuff.IOS(args);
|
2011-11-01 20:02:11 -05:00
|
|
|
|
gotSomewhere = true;
|
2011-09-26 22:19:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-07 22:59:31 -06:00
|
|
|
|
if (Function == "NUS" || Function == "NUSD")
|
2011-09-30 10:05:58 -05:00
|
|
|
|
{
|
|
|
|
|
NUS_Stuff.NUS(args);
|
2011-11-01 20:02:11 -05:00
|
|
|
|
gotSomewhere = true;
|
2011-09-30 10:05:58 -05:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-07 22:59:31 -06:00
|
|
|
|
if (Function == "SENDDOL" || Function == "SENDOL")
|
2011-09-26 22:19:01 -05:00
|
|
|
|
{
|
|
|
|
|
HBC_Stuff.SendDol(args);
|
2011-11-01 20:02:11 -05:00
|
|
|
|
gotSomewhere = true;
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-07 22:59:31 -06:00
|
|
|
|
if (Function == "SENDWAD")
|
2011-11-01 20:02:11 -05:00
|
|
|
|
{
|
|
|
|
|
bool cont = HBC_Stuff.SendWad_Check(args);
|
|
|
|
|
if (cont == true) HBC_Stuff.SendWad(args);
|
|
|
|
|
gotSomewhere = true;
|
2011-09-26 22:19:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-09 00:07:17 -06:00
|
|
|
|
if (Function == "INSTALL")
|
|
|
|
|
{
|
|
|
|
|
Install();
|
|
|
|
|
gotSomewhere = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Function == "UNINSTALL")
|
|
|
|
|
{
|
|
|
|
|
Uninstall();
|
|
|
|
|
gotSomewhere = true;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-07 17:56:28 -06:00
|
|
|
|
if (Function == "ERRORS")
|
|
|
|
|
{
|
|
|
|
|
ERROR_Stuff.ERROR(args);
|
|
|
|
|
gotSomewhere = true;
|
|
|
|
|
}
|
2020-03-07 23:44:10 -06:00
|
|
|
|
|
|
|
|
|
if (Function == "EXITCODES")
|
|
|
|
|
{
|
|
|
|
|
ERRORCODE_Stuff.ERRORCODE(args);
|
|
|
|
|
gotSomewhere = true;
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-07 22:59:31 -06:00
|
|
|
|
if (Function == "WHICH CAME FIRST" || Function == "WHICH CAME FIRST?" ||
|
|
|
|
|
(Function == "WHICH" && args[1].ToUpper() == "CAME" && args[2].Substring(0,5).ToUpper() == "FIRST"))
|
|
|
|
|
{
|
|
|
|
|
InconspicuousNotEasterEggThingamajig();
|
|
|
|
|
gotSomewhere = true;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-26 22:19:01 -05:00
|
|
|
|
|
|
|
|
|
|
2011-11-01 20:02:11 -05:00
|
|
|
|
if (gotSomewhere == false)
|
|
|
|
|
{
|
|
|
|
|
//If tuser gets here, they entered something wrong
|
2011-11-07 22:59:31 -06:00
|
|
|
|
Console.WriteLine("ERROR: The argument {0} is invalid", args[0]);
|
2020-03-07 17:56:28 -06:00
|
|
|
|
Console.WriteLine("Error: SHARPII_NET_CORE_MAIN_INVALID_ARG_01");
|
2020-04-03 16:36:26 -05:00
|
|
|
|
if (OperatingSystem.Windows())
|
|
|
|
|
{
|
|
|
|
|
Environment.Exit(0x00003E90);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Environment.Exit(0x00000012);
|
|
|
|
|
}
|
|
|
|
|
return;
|
2011-11-01 20:02:11 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string temp = Path.GetTempPath() + "Sharpii.tmp";
|
|
|
|
|
if (Directory.Exists(temp) == true)
|
2020-01-17 23:45:36 -06:00
|
|
|
|
DeleteADir.DeleteDirectory(temp);
|
2011-09-26 22:19:01 -05:00
|
|
|
|
|
|
|
|
|
Environment.Exit(0);
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-09 00:07:17 -06:00
|
|
|
|
private static void Install()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2020-01-17 23:45:36 -06:00
|
|
|
|
if (BeQuiet.quiet > 1)
|
2011-11-09 00:07:17 -06:00
|
|
|
|
Console.WriteLine("Installing Sharpii...");
|
2020-01-17 23:45:36 -06:00
|
|
|
|
if (BeQuiet.quiet > 1)
|
2011-11-09 00:07:17 -06:00
|
|
|
|
Console.WriteLine("Adding Variables");
|
2020-03-06 22:01:25 -06:00
|
|
|
|
Environment.SetEnvironmentVariable("PATH", Path.Combine(Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine), ";", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Sharpii"), EnvironmentVariableTarget.Machine);
|
2011-11-09 00:07:17 -06:00
|
|
|
|
|
2020-01-17 23:45:36 -06:00
|
|
|
|
if (BeQuiet.quiet > 1)
|
2011-11-09 00:07:17 -06:00
|
|
|
|
Console.WriteLine("Creating Directory");
|
2020-03-06 22:01:25 -06:00
|
|
|
|
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"));
|
2011-11-09 00:07:17 -06:00
|
|
|
|
|
2020-01-17 23:45:36 -06:00
|
|
|
|
if (BeQuiet.quiet > 1)
|
2011-11-09 00:07:17 -06:00
|
|
|
|
Console.WriteLine("Copying Files");
|
2020-01-17 23:45:36 -06:00
|
|
|
|
File.Copy(AppDomain.CurrentDomain.BaseDirectory, Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\Sharpii.exe");
|
2020-03-06 22:01:25 -06:00
|
|
|
|
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"));
|
2011-11-09 00:07:17 -06:00
|
|
|
|
|
2020-01-17 23:45:36 -06:00
|
|
|
|
if (BeQuiet.quiet > 1)
|
2011-11-09 00:07:17 -06:00
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Sharpii was successfully installed to: {0}", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\");
|
|
|
|
|
Console.WriteLine("You can now use Sharpii in any directory!");
|
|
|
|
|
Console.WriteLine("\nNOTE: You may need to restart your computer for this to take effect");
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("An unknown error occured, please try again\n\nERROR DETAILS: {0}", ex.Message);
|
2020-04-03 16:36:26 -05:00
|
|
|
|
if (OperatingSystem.Windows())
|
|
|
|
|
{
|
|
|
|
|
Environment.Exit(0x00003E82);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Environment.Exit(0x00000004);
|
|
|
|
|
}
|
2011-11-09 00:07:17 -06:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void Uninstall()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2020-01-17 23:45:36 -06:00
|
|
|
|
if (BeQuiet.quiet > 1)
|
2011-11-09 00:07:17 -06:00
|
|
|
|
Console.WriteLine("Uninstalling Sharpii...");
|
|
|
|
|
string path = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine);
|
|
|
|
|
Environment.SetEnvironmentVariable("PATH", path.Replace(";" + Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\", ""), EnvironmentVariableTarget.Machine);
|
|
|
|
|
Process.Start("cmd.exe", "/C mode con:cols=50 lines=4 & color 0B & echo Finishing Uninstallation... & sleep 2 & rmdir /s /q " + '"' +
|
|
|
|
|
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Sharpii\\" + '"' + " & CLS & echo Sharpii has been successfully uninstalled! & echo. & pause");
|
2020-01-17 23:45:36 -06:00
|
|
|
|
Environment.Exit(0);
|
2011-11-09 00:07:17 -06:00
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("An unknown error occured, please try again\n\nERROR DETAILS: {0}", ex.Message);
|
2020-04-03 16:36:26 -05:00
|
|
|
|
if (OperatingSystem.Windows())
|
|
|
|
|
{
|
|
|
|
|
Environment.Exit(0x00003E82);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Environment.Exit(0x00000004);
|
|
|
|
|
}
|
2011-11-09 00:07:17 -06:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-07 22:59:31 -06:00
|
|
|
|
private static void InconspicuousNotEasterEggThingamajig()
|
|
|
|
|
{
|
|
|
|
|
WebClient egg = new WebClient(); string all = "";
|
|
|
|
|
try { all = egg.DownloadString("http://sites.google.com/site/person66files/home/EASTEREGG.txt"); }
|
|
|
|
|
catch (Exception) { Console.WriteLine("\n Easter eggs are more fun if you has internetz"); return; }
|
|
|
|
|
int width = Console.WindowWidth; int height = Console.WindowHeight; int bwidth = Console.BufferWidth; int bheight = Console.BufferHeight;
|
|
|
|
|
ConsoleKeyInfo key; Console.Clear(); Console.CursorVisible = false; Console.SetWindowSize(75, 5); Console.SetBufferSize(75, 5);
|
|
|
|
|
Console.WriteLine("Complete the following: \n\n UP, __ , __ , __ , __ , __ , __ , __ , __ , __ , START"); key = Console.ReadKey(true);
|
|
|
|
|
if (key.Key.ToString() == "UpArrow") { Console.SetCursorPosition(7, 2); Console.Write("UP"); } else { goto ByeBye; }
|
|
|
|
|
key = Console.ReadKey(true); if (key.Key.ToString() == "DownArrow") { Console.SetCursorPosition(12, 2); Console.Write("DOWN , __ , __ , __ , __ , __ , __ , __ , START"); } else { goto ByeBye; }
|
|
|
|
|
key = Console.ReadKey(true); if (key.Key.ToString() == "DownArrow") { Console.SetCursorPosition(19, 2); Console.Write("DOWN , __ , __ , __ , __ , __ , __ , START"); } else { goto ByeBye; }
|
|
|
|
|
key = Console.ReadKey(true); if (key.Key.ToString() == "LeftArrow") { Console.SetCursorPosition(26, 2); Console.Write("LEFT , __ , __ , __ , __ , __ , START"); } else { goto ByeBye; }
|
|
|
|
|
key = Console.ReadKey(true); if (key.Key.ToString() == "RightArrow") { Console.SetCursorPosition(33, 2); Console.Write("RIGHT , __ , __ , __ , __ , START"); } else { goto ByeBye; }
|
|
|
|
|
key = Console.ReadKey(true); if (key.Key.ToString() == "LeftArrow") { Console.SetCursorPosition(41, 2); Console.Write("LEFT , __ , __ , __ , START"); } else { goto ByeBye; }
|
|
|
|
|
key = Console.ReadKey(true); if (key.Key.ToString() == "RightArrow") { Console.SetCursorPosition(48, 2); Console.Write("RIGHT , __ , __ , START"); } else { goto ByeBye; }
|
|
|
|
|
key = Console.ReadKey(true); if (key.Key.ToString() == "B") { Console.SetCursorPosition(56, 2); Console.Write("B , __ , START "); } else { goto ByeBye; }
|
|
|
|
|
key = Console.ReadKey(true); if (key.Key.ToString() == "A") { Console.SetCursorPosition(60, 2); Console.Write("A , START "); } else { goto ByeBye; }
|
|
|
|
|
Console.SetBufferSize(95, 44); Console.SetWindowSize(95, 44); Console.SetCursorPosition(0, 0); Console.Clear(); Console.Write(all); Console.ReadKey(true);
|
|
|
|
|
ByeBye: Console.Clear(); Console.CursorVisible = true; Console.SetWindowSize(width, height); Console.SetBufferSize(bwidth, bheight); Environment.Exit(0);
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-26 22:19:01 -05:00
|
|
|
|
private static void help()
|
|
|
|
|
{
|
2011-11-07 22:59:31 -06:00
|
|
|
|
Console.WriteLine("");
|
2020-01-17 23:45:36 -06:00
|
|
|
|
Console.WriteLine("Sharpii {0} - A tool by person66, using libWiiSharp.dll by leathl", ProgramVersion.version);
|
2020-03-06 22:01:25 -06:00
|
|
|
|
Console.WriteLine("Sharpii .Net Core Port by TheShadowEevee");
|
2011-11-07 22:59:31 -06:00
|
|
|
|
Console.WriteLine("");
|
|
|
|
|
Console.WriteLine("");
|
|
|
|
|
Console.WriteLine(" Usage:");
|
|
|
|
|
Console.WriteLine("");
|
|
|
|
|
Console.WriteLine(" Sharpii [function] [parameters] [-quiet | -q | -lots]");
|
|
|
|
|
Console.WriteLine("");
|
|
|
|
|
Console.WriteLine("");
|
|
|
|
|
Console.WriteLine(" Functions:");
|
|
|
|
|
Console.WriteLine("");
|
|
|
|
|
Console.WriteLine(" BNS Convert a wav to bns, or vice versa");
|
|
|
|
|
Console.WriteLine(" WAD Pack/Unpack/Edit a wad file");
|
|
|
|
|
Console.WriteLine(" TPL Convert a image to a tpl, or vice versa");
|
|
|
|
|
Console.WriteLine(" U8 Pack/Unpack a U8 archive");
|
|
|
|
|
Console.WriteLine(" IOS Apply various patches to an IOS");
|
|
|
|
|
Console.WriteLine(" NUSD Download files from NUS");
|
|
|
|
|
Console.WriteLine(" SendDol Send a dol to the HBC over wifi");
|
|
|
|
|
Console.WriteLine(" SendWad Send a wad to the HBC over wifi");
|
2020-03-07 17:56:28 -06:00
|
|
|
|
Console.WriteLine(" Errors Get a Sharpii error's description");
|
2020-03-07 23:44:10 -06:00
|
|
|
|
Console.WriteLine(" ExitCodes List of all Sharpii exit codes");
|
2011-11-07 22:59:31 -06:00
|
|
|
|
Console.WriteLine("");
|
|
|
|
|
Console.WriteLine(" NOTE: Too see more detailed descriptions of any of the above,");
|
|
|
|
|
Console.WriteLine(" use 'Sharpii [function] -h'");
|
|
|
|
|
Console.WriteLine("");
|
|
|
|
|
Console.WriteLine("");
|
2020-03-08 23:23:33 -05:00
|
|
|
|
//Console.WriteLine(" Other Functions:");
|
|
|
|
|
//Console.WriteLine("");
|
2020-03-07 23:44:10 -06:00
|
|
|
|
//Console.WriteLine(" Install Install Sharpii to your computer so you can run it");
|
|
|
|
|
//Console.WriteLine(" from anywhere without needing the exe");
|
|
|
|
|
//Console.WriteLine(" Uninstall Uninstall Sharpii from your computer");
|
2020-03-08 23:23:33 -05:00
|
|
|
|
//Console.WriteLine("");
|
|
|
|
|
//Console.WriteLine("");
|
2011-11-07 22:59:31 -06:00
|
|
|
|
Console.WriteLine(" Global Arguments:");
|
|
|
|
|
Console.WriteLine("");
|
|
|
|
|
Console.WriteLine(" -quiet | -q Try not to display any output");
|
|
|
|
|
Console.WriteLine(" -lots Display lots of output");
|
|
|
|
|
Console.WriteLine("");
|
2011-09-26 22:19:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-01-17 23:45:36 -06:00
|
|
|
|
public class DeleteADir
|
|
|
|
|
{
|
|
|
|
|
public static bool DeleteDirectory(string target_dir)
|
2011-10-10 21:48:10 -05:00
|
|
|
|
{
|
2020-01-17 23:45:36 -06:00
|
|
|
|
bool result = false;
|
2011-10-10 21:48:10 -05:00
|
|
|
|
|
2020-01-17 23:45:36 -06:00
|
|
|
|
string[] files = Directory.GetFiles(target_dir);
|
|
|
|
|
string[] dirs = Directory.GetDirectories(target_dir);
|
2011-10-10 21:48:10 -05:00
|
|
|
|
|
2020-01-17 23:45:36 -06:00
|
|
|
|
foreach (string file in files)
|
|
|
|
|
{
|
|
|
|
|
File.SetAttributes(file, FileAttributes.Normal);
|
|
|
|
|
File.Delete(file);
|
|
|
|
|
}
|
2011-10-10 21:48:10 -05:00
|
|
|
|
|
2020-01-17 23:45:36 -06:00
|
|
|
|
foreach (string dir in dirs)
|
|
|
|
|
{
|
|
|
|
|
DeleteDirectory(dir);
|
|
|
|
|
}
|
2011-10-10 21:48:10 -05:00
|
|
|
|
|
2020-01-17 23:45:36 -06:00
|
|
|
|
Directory.Delete(target_dir, false);
|
2011-10-10 21:48:10 -05:00
|
|
|
|
|
2020-01-17 23:45:36 -06:00
|
|
|
|
return result;
|
2011-10-10 21:48:10 -05:00
|
|
|
|
}
|
2020-01-17 23:45:36 -06:00
|
|
|
|
}
|
|
|
|
|
public class BeQuiet
|
|
|
|
|
{
|
|
|
|
|
//1 = little
|
|
|
|
|
//2 = normal
|
|
|
|
|
//3 = lots
|
|
|
|
|
public static int quiet = 2;
|
|
|
|
|
}
|
|
|
|
|
public class ProgramVersion
|
|
|
|
|
{
|
2020-04-03 17:28:59 -05:00
|
|
|
|
public static string version = "1.1.1; .Net Core Port (Based on Sharpii 1.7.3)";
|
2020-03-07 14:44:42 -06:00
|
|
|
|
}
|
|
|
|
|
public class Logging
|
|
|
|
|
{
|
|
|
|
|
//By default, Sharpii should create a log.
|
|
|
|
|
//Using the option -NoLog will disable it.
|
|
|
|
|
//Everything should check this when it checks the BeQuiet.Quiet variable.
|
2020-03-07 17:56:28 -06:00
|
|
|
|
|
|
|
|
|
//This isn't used yet.
|
2020-03-07 14:44:42 -06:00
|
|
|
|
public static int log = 1;
|
2020-04-03 12:58:15 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class OperatingSystem
|
|
|
|
|
{
|
|
|
|
|
//To check the running OS for Exit Code use.
|
|
|
|
|
public static bool Windows() =>
|
|
|
|
|
RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
|
|
|
|
|
|
|
|
|
public static bool Mac() =>
|
|
|
|
|
RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
|
|
|
|
|
|
|
|
|
|
public static bool GNULinux() =>
|
|
|
|
|
RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
|
2020-01-17 23:45:36 -06:00
|
|
|
|
}
|