Revert "Removed all but three of the errors"

This reverts commit 77b89900bd.
This commit is contained in:
Zesty Fernandez 2022-07-14 08:48:40 -07:00
parent 599ba61422
commit 7755cbde75
2 changed files with 58 additions and 61 deletions

View file

@ -72,7 +72,7 @@ namespace UWUVCI_AIO_WPF.Classes
bool ret = false;
using (var client = new WebClient())
{
await client.DownloadFileTaskAsync(backupulr + name + ".md5", name + ".md5");
await client.DownloadFile(backupulr + name + ".md5", name + ".md5");
using (var sr = new StreamReader(name + ".md5"))
{
var md5 = sr.ReadLine();

View file

@ -409,7 +409,7 @@ namespace UWUVCI_AIO_WPF
}
}
public bool NKITFLAG { get; set; } = false;
public async Task<bool> NKITFLAG { get; set; } = false;
public MainWindow mw;
private CustomBaseFrame cb = null;
@ -544,6 +544,12 @@ namespace UWUVCI_AIO_WPF
cm.ShowDialog();
}
private MainViewModel()
{
}
//TODO: Figure wtf is going on here
//Notes: Constructor wasn't used like a constructor
// MainViewModel is never created just only references are type checking
public static async Task<MainViewModel> SetupAsync()
{
if (!Environment.Is64BitOperatingSystem)
{
@ -555,15 +561,15 @@ namespace UWUVCI_AIO_WPF
//if (Directory.Exists(@"Tools")) Directory.Delete(@"Tools", true);
if (Directory.Exists(@"bases"))
if (Directory.Exists(@"bases"))
Directory.Delete(@"bases", true);
if (Directory.Exists(@"temp"))
if (Directory.Exists(@"temp"))
Directory.Delete(@"temp", true);
if (Directory.Exists(@"keys"))
{
if (Directory.Exists(@"bin\keys"))
if (Directory.Exists(@"bin\keys"))
Directory.Delete(@"bin\keys", true);
Injection.DirectoryCopy("keys", "bin/keys", true);
@ -612,13 +618,6 @@ namespace UWUVCI_AIO_WPF
}
//TODO: Figure wtf is going on here
//Notes: Constructor wasn't used like a constructor
// MainViewModel is never created just only references are type checking
public static async Task<MainViewModel> SetupAsync()
{
return new MainViewModel();
}
public string turbocd()
{
@ -1211,7 +1210,7 @@ namespace UWUVCI_AIO_WPF
if (await CheckForInternetConnectionAsync())
{
Progress = 0;
await Task.Run(async () =>
Task.Run(() =>
{
double stuff = 100 / test.Count;
foreach (string s in test)
@ -1254,7 +1253,7 @@ namespace UWUVCI_AIO_WPF
Directory.CreateDirectory(@"bin\bases");
var test = GetMissingVCBs();
Progress = 0;
await Task.Run(async() =>
Task.Run(() =>
{
double stuff = 100 / test.Count;
foreach (string s in test)
@ -1295,7 +1294,7 @@ namespace UWUVCI_AIO_WPF
if (await CheckForInternetConnectionAsync())
{
string[] bases = ToolCheck.ToolNames;
await Task.Run(async () =>
Task.Run(() =>
{
Progress = 0;
double l = 100 / bases.Length;
@ -1406,7 +1405,7 @@ namespace UWUVCI_AIO_WPF
if (Task.Run(() => CheckForInternetConnectionAsync()).GetAwaiter().GetResult())
{
string[] bases = { "bases.vcbnds", "bases.vcbn64", "bases.vcbgba", "bases.vcbsnes", "bases.vcbnes", "bases.vcbtg16", "bases.vcbmsx", "bases.vcbwii" };
await Task.Run(async () => {
Task.Run(() => {
Progress = 0;
double l = 100 / bases.Length;
foreach (string s in bases)
@ -1540,7 +1539,7 @@ namespace UWUVCI_AIO_WPF
}
}
private async Task<bool> RemoteFileExists(string url)
private bool RemoteFileExists(string url)
{
try
{
@ -1758,7 +1757,7 @@ namespace UWUVCI_AIO_WPF
using (var client = new WebClient())
{
var fixname = name.Split('\\');
await client.DownloadFileTaskAsync(await getDownloadLinkAsync(name, false), fixname[fixname.Length -1]);
await client.DownloadFileAsync(await getDownloadLinkAsync(name, false), fixname[fixname.Length -1]);
}
}catch(Exception e)
{
@ -1789,7 +1788,6 @@ namespace UWUVCI_AIO_WPF
string basePath = $@"bin\Tools\";
Directory.SetCurrentDirectory(basePath);
}
var toolsDownloaded = await ToolCheck.IsToolRightAsync(name);
do
{
if (File.Exists(name))
@ -1798,10 +1796,9 @@ namespace UWUVCI_AIO_WPF
}
using (var client = new WebClient())
{
await client.DownloadFileTaskAsync(await getDownloadLinkAsync(name, true), name);
await client.DownloadFileAsync(await getDownloadLinkAsync(name, true), name);
}
toolsDownloaded = await ToolCheck.IsToolRightAsync(name);
} while (!toolsDownloaded);
} while (await !ToolCheck.IsToolRightAsync(name));
}
@ -1828,7 +1825,7 @@ namespace UWUVCI_AIO_WPF
try
{
System.Net.WebClient client = new System.Net.WebClient();
string result = await client.DownloadStringTaskAsync("https://uwuvciapi.azurewebsites.net/api/values");
string result = await client.DownloadStringAsync("https://uwuvciapi.azurewebsites.net/api/values");
ok = true;
}
catch (System.Net.WebException ex)
@ -1931,17 +1928,17 @@ namespace UWUVCI_AIO_WPF
}
}
private void ThreadDownload(List<MissingTool> missingTools)
private async Task ThreadDownload(List<MissingTool> missingTools)
{
var thread = new Thread(async () =>
var thread = new Thread(() =>
{
double l = 100 / missingTools.Count;
foreach (MissingTool m in missingTools)
{
if (m.Name == "blank.ini")
if(m.Name == "blank.ini")
{
StreamWriter sw = new StreamWriter(Path.Combine(Directory.GetCurrentDirectory(), "bin", "Tools", "blank.ini"));
sw.Close();
@ -1950,15 +1947,15 @@ namespace UWUVCI_AIO_WPF
{
await DownloadToolAsync(m.Name, this);
}
Progress += Convert.ToInt32(l);
}
Progress = 100;
});
thread.SetApartmentState(ApartmentState.STA);
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
}
private void timer_Tick2(object sender, EventArgs e)
{
@ -1984,7 +1981,7 @@ namespace UWUVCI_AIO_WPF
{
if (await CheckForInternetConnectionAsync())
{
Task.Run(() => ThreadDownload(missingTools));
Task.Run(() => await ThreadDownload(missingTools));
DownloadWait dw = new DownloadWait("Downloading Tools - Please Wait", "", this);
try
{
@ -2445,12 +2442,12 @@ namespace UWUVCI_AIO_WPF
}
public async Task Download()
public void Download()
{
ValidatePathsStillExist();
if (await CheckForInternetConnectionAsync())
if (CheckForInternetConnectionAsync())
{
await Task.Run(async () => { Injection.Download(this); });
Task.Run(() => { Injection.Download(this); });
DownloadWait dw = new DownloadWait("Downloading Base - Please Wait", "", this);
try
@ -2729,7 +2726,7 @@ namespace UWUVCI_AIO_WPF
return true;
}
public async Task getBootIMGGBA(string rom)
public void getBootIMGGBA(string rom)
{
string repoid = "";
string SystemType = "gba/";
@ -2750,7 +2747,7 @@ namespace UWUVCI_AIO_WPF
Console.WriteLine("prodcode after scramble: " + repoid);
}
List<string> repoids = new List<string>();
if (await CheckForInternetConnectionWOWarningAsync())
if (await CheckForInternetConnectionWOWarning())
{
repoids.Add(SystemType + repoid);
repoids.Add(SystemType + repoid.Substring(0, 3) + "E");
@ -2762,7 +2759,7 @@ namespace UWUVCI_AIO_WPF
}
}
public async Task getBootIMGSNES(string rom)
public void getBootIMGSNES(string rom)
{
string SystemType = "snes/";
var repoid = GetFakeSNESProdcode(rom);
@ -2771,7 +2768,7 @@ namespace UWUVCI_AIO_WPF
SystemType + repoid
};
if (await CheckForInternetConnectionWOWarningAsync())
if (CheckForInternetConnectionWOWarningAsync())
{
GetRepoImages(SystemType, repoid);
checkForAdditionalFiles(GameConsoles.SNES, repoids);
@ -2779,7 +2776,7 @@ namespace UWUVCI_AIO_WPF
}
}
public async Task getBootIMGMSX(string rom)
public void getBootIMGMSX(string rom)
{
string SystemType = "msx/";
var repoid = GetFakeMSXTGProdcode(rom, true);
@ -2788,14 +2785,14 @@ namespace UWUVCI_AIO_WPF
SystemType + repoid
};
if (await CheckForInternetConnectionWOWarningAsync())
if (await CheckForInternetConnectionWOWarning())
{
GetRepoImages(SystemType, repoid);
checkForAdditionalFiles(GameConsoles.MSX, repoids);
}
}
public async Task getBootIMGTG(string rom)
public void getBootIMGTG(string rom)
{
string SystemType = "tg16/";
var repoid = GetFakeMSXTGProdcode(rom, false);
@ -2803,7 +2800,7 @@ namespace UWUVCI_AIO_WPF
{
SystemType + repoid
};
if (await CheckForInternetConnectionWOWarningAsync())
if (await CheckForInternetConnectionWOWarning())
{
GetRepoImages(SystemType, repoid);
checkForAdditionalFiles(GameConsoles.TG16, repoids);
@ -2930,7 +2927,7 @@ namespace UWUVCI_AIO_WPF
}
}
public async Task getBootIMGNES(string rom)
public void getBootIMGNES(string rom)
{
string SystemType = "nes/";
var repoid = GetFakeNESProdcode(rom);
@ -2939,7 +2936,7 @@ namespace UWUVCI_AIO_WPF
SystemType + repoid
};
if (await CheckForInternetConnectionWOWarningAsync())
if (await CheckForInternetConnectionWOWarning())
{
GetRepoImages(SystemType, repoid);
checkForAdditionalFiles(GameConsoles.NES, repoids);
@ -3060,7 +3057,7 @@ namespace UWUVCI_AIO_WPF
var toret = new char[] { letters[n1], letters[n2], letters[n3], letters[n4] };
return new string(toret).ToUpper();
}
public async Task getBootIMGNDS(string rom)
public void getBootIMGNDS(string rom)
{
string repoid = "";
string SystemType = "nds/";
@ -3081,7 +3078,7 @@ namespace UWUVCI_AIO_WPF
Console.WriteLine("prodcode after scramble: " + repoid);
}
List<string> repoids = new List<string>();
if (await CheckForInternetConnectionWOWarningAsync())
if (CheckForInternetConnectionWOWarningAsync())
{
repoids.Add(SystemType + repoid);
repoids.Add(SystemType + repoid.Substring(0, 3) + "E");
@ -3093,7 +3090,7 @@ namespace UWUVCI_AIO_WPF
}
}
public async Task getBootIMGN64(string rom)
public void getBootIMGN64(string rom)
{
string repoid = "";
string SystemType = "n64/";
@ -3113,7 +3110,7 @@ namespace UWUVCI_AIO_WPF
fs.Close();
Console.WriteLine("prodcode after scramble: "+repoid);
}
if (await CheckForInternetConnectionWOWarningAsync())
if (await CheckForInternetConnectionWOWarning())
{
repoids.Add(SystemType + repoid);
repoids.Add(SystemType + new string(new char[] { repoid[0], repoid[2], repoid[1], repoid[3] }));
@ -3128,7 +3125,7 @@ namespace UWUVCI_AIO_WPF
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
return enc.GetString(arr);
}
public async Task<string> getInternalWIIGCNName(string OpenGame, bool gc)
public string getInternalWIIGCNName(string OpenGame, bool gc)
{
//string linkbase = "https://raw.githubusercontent.com/Flumpster/wiivc-bis/master/";
string linkbase = "https://raw.githubusercontent.com/Flumpster/UWUVCI-Images/master/";
@ -3173,7 +3170,7 @@ namespace UWUVCI_AIO_WPF
repoid = TempString;
}
if (await CheckForInternetConnectionWOWarningAsync())
if (await CheckForInternetConnectionWOWarning())
{
repoids.Add(SystemType + repoid);
repoids.Add(SystemType + repoid.Substring(0, 3) + "E" + repoid.Substring(4, 2));
@ -3199,12 +3196,12 @@ namespace UWUVCI_AIO_WPF
return ret;
}
public async Task<bool> CheckForInternetConnectionAsync()
public async Task CheckForInternetConnectionAsync()
{
try
{
using (var client = new WebClient())
using (await client.OpenReadTaskAsync("http://google.com/generate_204"))
using (await client.OpenReadAsync("http://google.com/generate_204"))
return true;
}
catch
@ -3212,7 +3209,7 @@ namespace UWUVCI_AIO_WPF
var googleBlocked = false;
using (var client = new WebClient())
using (await client.OpenReadTaskAsync("https://raw.githubusercontent.com"))
using (await client.OpenReadAsync("https://raw.githubusercontent.com"))
googleBlocked = true;
Custom_Message cm;
@ -3241,19 +3238,19 @@ namespace UWUVCI_AIO_WPF
try
{
using (var client = new WebClient())
using (await client.OpenReadTaskAsync("http://google.com/generate_204"))
using (await client.OpenReadAsync("http://google.com/generate_204"))
return true;
}
catch
{
using (var client = new WebClient())
using (await client.OpenReadTaskAsync("http://raw.githubusercontent.com"))
using (await client.OpenReadAsync("http://raw.githubusercontent.com"))
return true;
return false;
}
}
private async Task checkForAdditionalFiles(GameConsoles console, List<string> repoids)
private void checkForAdditionalFiles(GameConsoles console, List<string> repoids)
{
if (!Directory.Exists(Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo")))
{
@ -3269,7 +3266,7 @@ namespace UWUVCI_AIO_WPF
{
foreach(string repoid in repoids)
{
if (await RemoteFileExists(linkbase + repoid + "/game.ini"))
if (RemoteFileExists(linkbase + repoid + "/game.ini"))
{
ini = true;
inip = linkbase + repoid + "/game.ini";
@ -3283,7 +3280,7 @@ namespace UWUVCI_AIO_WPF
foreach (var e in ext)
{ foreach(string repoid in repoids)
{
if (await RemoteFileExists(linkbase + repoid + "/BootSound." + e))
if (RemoteFileExists(linkbase + repoid + "/BootSound." + e))
{
btsnd = true;
btsndp = linkbase + repoid + "/BootSound." + e;
@ -3525,7 +3522,7 @@ namespace UWUVCI_AIO_WPF
/// <param name="SystemType"></param>
/// <param name="repoid"></param>
/// <param name="repoids"></param>
private async Task GetRepoImages(string SystemType, string repoid, List<string> repoids = null)
private void GetRepoImages(string SystemType, string repoid, List<string> repoids = null)
{
string linkbase = "https://raw.githubusercontent.com/Flumpster/UWUVCI-Images/master/";
IMG_Message img = null;
@ -3552,7 +3549,7 @@ namespace UWUVCI_AIO_WPF
{
foreach (var id in repoids)
{
if (await RemoteFileExists(linkbase + id + $"/iconTex.{e}") == true)
if (RemoteFileExists(linkbase + id + $"/iconTex.{e}") == true)
{
img = new IMG_Message(linkbase + id + $"/iconTex.{e}", linkbase + id + $"/bootTvTex.{e}", id);
try