mirror of
https://github.com/stuff-by-3-random-dudes/UWUVCI-AIO-WPF
synced 2024-11-10 05:34:13 +00:00
Reverting merge stomps
This commit is contained in:
parent
ece404f2fc
commit
419107d129
3 changed files with 527 additions and 483 deletions
File diff suppressed because it is too large
Load diff
|
@ -66,14 +66,10 @@ namespace UWUVCI_AIO_WPF.Classes
|
|||
|
||||
public static bool DoesToolsFolderExist()
|
||||
{
|
||||
if (Directory.Exists(FolderName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return Directory.Exists(FolderName);
|
||||
}
|
||||
|
||||
public static bool IsToolRight(string name)
|
||||
public static async Task<bool> IsToolRightAsync(string name)
|
||||
{
|
||||
bool ret = false;
|
||||
string md5Name = FolderName + "\\" + name + ".md5";
|
||||
|
@ -114,7 +110,6 @@ namespace UWUVCI_AIO_WPF.Classes
|
|||
using (var stream = File.OpenRead(filename))
|
||||
{
|
||||
string ret = BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", "").ToLower();
|
||||
stream.Close();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +117,7 @@ namespace UWUVCI_AIO_WPF.Classes
|
|||
public static List<MissingTool> CheckForMissingTools()
|
||||
{
|
||||
List<MissingTool> ret = new List<MissingTool>();
|
||||
foreach(string s in ToolNames)
|
||||
foreach (string s in ToolNames)
|
||||
{
|
||||
string path = $@"{FolderName}\{s}";
|
||||
if (!DoesToolExist(path))
|
||||
|
|
|
@ -440,9 +440,9 @@ namespace UWUVCI_AIO_WPF
|
|||
private CustomBaseFrame cb = null;
|
||||
DispatcherTimer timer = new DispatcherTimer();
|
||||
public bool PokePatch = false;
|
||||
public void Update(bool button)
|
||||
public void UpdateAsync(bool button)
|
||||
{
|
||||
if (CheckForInternetConnection())
|
||||
if (Task.Run(() => CheckForInternetConnectionAsync()).GetAwaiter().GetResult())
|
||||
{
|
||||
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
|
||||
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
|
||||
|
@ -455,7 +455,7 @@ namespace UWUVCI_AIO_WPF
|
|||
Properties.Settings.Default.UpgradeRequired = false;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
if (button && Convert.ToInt32(version.Split('.')[3]) >= GetNewVersion())
|
||||
if (button && Convert.ToInt32(version.Split('.')[3]) >= Task.Run(() => GetNewVersionAsync()).GetAwaiter().GetResult())
|
||||
{
|
||||
Custom_Message cm = new Custom_Message("No Updates available", " You are currently using the newest version of UWUVCI AIO ");
|
||||
try
|
||||
|
@ -494,7 +494,7 @@ namespace UWUVCI_AIO_WPF
|
|||
using (var webClient = new WebClient())
|
||||
{
|
||||
webClient.Headers.Add(HttpRequestHeader.UserAgent, "MyUserAgent");
|
||||
webClient.DownloadFile(releases[0].ZipballUrl, "UWUVCI_INSTALLER.exe");
|
||||
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());
|
||||
try
|
||||
|
@ -509,7 +509,7 @@ namespace UWUVCI_AIO_WPF
|
|||
|
||||
}
|
||||
|
||||
private int GetNewVersion()
|
||||
private async Task<int> GetNewVersionAsync()
|
||||
{
|
||||
|
||||
try
|
||||
|
@ -520,7 +520,7 @@ namespace UWUVCI_AIO_WPF
|
|||
request = WebRequest.Create("https://uwuvciapi.azurewebsites.net/GetVersionNum");
|
||||
|
||||
|
||||
var response = request.GetResponse();
|
||||
var response = await request.GetResponseAsync();
|
||||
using (Stream dataStream = response.GetResponseStream())
|
||||
{
|
||||
// Open the stream using a StreamReader for easy access.
|
||||
|
@ -580,32 +580,41 @@ namespace UWUVCI_AIO_WPF
|
|||
|
||||
|
||||
//if (Directory.Exists(@"Tools")) Directory.Delete(@"Tools", true);
|
||||
if (Directory.Exists(@"bases")) Directory.Delete(@"bases", true);
|
||||
if (Directory.Exists(@"temp")) Directory.Delete(@"temp", true);
|
||||
if (Directory.Exists(@"bases"))
|
||||
Directory.Delete(@"bases", true);
|
||||
|
||||
if (Directory.Exists(@"temp"))
|
||||
Directory.Delete(@"temp", true);
|
||||
|
||||
if (Directory.Exists(@"keys"))
|
||||
{
|
||||
if (Directory.Exists(@"bin\keys")) Directory.Delete(@"bin\keys", true);
|
||||
if (Directory.Exists(@"bin\keys"))
|
||||
Directory.Delete(@"bin\keys", true);
|
||||
|
||||
Injection.DirectoryCopy("keys", "bin/keys", true);
|
||||
Directory.Delete("keys", true);
|
||||
}
|
||||
if (!Directory.Exists("InjectedGames")) Directory.CreateDirectory("InjectedGames");
|
||||
if (!Directory.Exists("SourceFiles")) Directory.CreateDirectory("SourceFiles");
|
||||
if (!Directory.Exists("bin\\BaseGames")) Directory.CreateDirectory("bin\\BaseGames");
|
||||
if (!Directory.Exists("InjectedGames"))
|
||||
Directory.CreateDirectory("InjectedGames");
|
||||
|
||||
if (!Directory.Exists("SourceFiles"))
|
||||
Directory.CreateDirectory("SourceFiles");
|
||||
|
||||
if (!Directory.Exists("bin\\BaseGames"))
|
||||
Directory.CreateDirectory("bin\\BaseGames");
|
||||
|
||||
if (Properties.Settings.Default.OutPath == "" || Properties.Settings.Default.OutPath == null)
|
||||
{
|
||||
Settings.Default.OutPath = Path.Combine(Directory.GetCurrentDirectory(), "InjectedGames");
|
||||
}
|
||||
|
||||
if (Settings.Default.BasePath == "" || Properties.Settings.Default.BasePath == null)
|
||||
{
|
||||
Settings.Default.BasePath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "BaseGames");
|
||||
}
|
||||
|
||||
Settings.Default.Save();
|
||||
ArePathsSet();
|
||||
|
||||
Update(false);
|
||||
UpdateAsync(false);
|
||||
|
||||
toolCheck();
|
||||
toolCheckAsync();
|
||||
BaseCheck();
|
||||
|
||||
GameConfiguration = new GameConfig();
|
||||
|
@ -625,6 +634,8 @@ namespace UWUVCI_AIO_WPF
|
|||
UpdatePathSet();
|
||||
|
||||
GetAllBases();
|
||||
|
||||
|
||||
}
|
||||
public string turbocd()
|
||||
{
|
||||
|
@ -1217,7 +1228,7 @@ namespace UWUVCI_AIO_WPF
|
|||
var test = GetMissingVCBs();
|
||||
if (test.Count > 0)
|
||||
{
|
||||
if (CheckForInternetConnection())
|
||||
if (Task.Run(() => CheckForInternetConnectionAsync()).GetAwaiter().GetResult())
|
||||
{
|
||||
Progress = 0;
|
||||
Task.Run(() =>
|
||||
|
@ -1225,11 +1236,12 @@ namespace UWUVCI_AIO_WPF
|
|||
double stuff = 100 / test.Count;
|
||||
foreach (string s in test)
|
||||
{
|
||||
DownloadBase(s, this);
|
||||
Task.Run(() => DownloadBaseAsync(s, this)).GetAwaiter();
|
||||
Progress += Convert.ToInt32(stuff);
|
||||
}
|
||||
Progress = 100;
|
||||
});
|
||||
|
||||
DownloadWait dw = new DownloadWait("Downloading needed Data - Please Wait", "", this);
|
||||
try
|
||||
{
|
||||
|
@ -1258,21 +1270,23 @@ namespace UWUVCI_AIO_WPF
|
|||
}
|
||||
else
|
||||
{
|
||||
if (CheckForInternetConnection())
|
||||
if (Task.Run(() => CheckForInternetConnectionAsync()).GetAwaiter().GetResult())
|
||||
{
|
||||
Directory.CreateDirectory(@"bin\bases");
|
||||
var test = GetMissingVCBs();
|
||||
Progress = 0;
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
double stuff = 100 / test.Count;
|
||||
foreach (string s in test)
|
||||
{
|
||||
DownloadBase(s, this);
|
||||
Task.Run(() => DownloadBaseAsync(s, this)).GetAwaiter();
|
||||
Progress += Convert.ToInt32(stuff);
|
||||
}
|
||||
Progress = 100;
|
||||
});
|
||||
|
||||
DownloadWait dw = new DownloadWait("Downloading needed Data - Please Wait", "", this);
|
||||
try
|
||||
{
|
||||
|
@ -1312,9 +1326,10 @@ namespace UWUVCI_AIO_WPF
|
|||
foreach (string s in bases)
|
||||
{
|
||||
DeleteTool(s);
|
||||
DownloadTool(s, this);
|
||||
Task.Run(() => DownloadToolAsync(s, this)).GetAwaiter();
|
||||
Progress += Convert.ToInt32(l);
|
||||
}
|
||||
|
||||
Progress = 100;
|
||||
});
|
||||
|
||||
|
@ -1328,7 +1343,7 @@ namespace UWUVCI_AIO_WPF
|
|||
|
||||
}
|
||||
dw.ShowDialog();
|
||||
toolCheck();
|
||||
toolCheckAsync();
|
||||
Custom_Message cm = new Custom_Message("Finished Update", " Finished Updating Tools! Restarting UWUVCI AIO ");
|
||||
try
|
||||
{
|
||||
|
@ -1418,7 +1433,7 @@ namespace UWUVCI_AIO_WPF
|
|||
string[] bases = { "bases.vcbnds", "bases.vcbn64", "bases.vcbgba", "bases.vcbsnes", "bases.vcbnes", "bases.vcbtg16", "bases.vcbmsx", "bases.vcbwii" };
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
{
|
||||
Progress = 0;
|
||||
double l = 100 / bases.Length;
|
||||
foreach (string s in bases)
|
||||
|
@ -1552,13 +1567,13 @@ namespace UWUVCI_AIO_WPF
|
|||
}
|
||||
|
||||
}
|
||||
private bool RemoteFileExists(string url)
|
||||
private async Task<bool> RemoteFileExists(string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
|
||||
request.Method = "HEAD";
|
||||
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
|
||||
HttpWebResponse response = await request.GetResponseAsync() as HttpWebResponse;
|
||||
response.Close();
|
||||
return (response.StatusCode == HttpStatusCode.OK);
|
||||
}
|
||||
|
@ -1762,7 +1777,7 @@ namespace UWUVCI_AIO_WPF
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
public static void DownloadBase(string name, MainViewModel mvm)
|
||||
public static async Task DownloadBaseAsync(string name, MainViewModel mvm)
|
||||
{
|
||||
var filePath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "bases", name);
|
||||
try
|
||||
|
@ -1785,11 +1800,21 @@ namespace UWUVCI_AIO_WPF
|
|||
Environment.Exit(1);
|
||||
}
|
||||
}
|
||||
public static void DownloadTool(string name, MainViewModel mvm)
|
||||
public static async Task DownloadToolAsync(string name, MainViewModel mvm)
|
||||
{
|
||||
var filePath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "Tools", name);
|
||||
try
|
||||
{
|
||||
/*
|
||||
if(Directory.GetCurrentDirectory().Contains("bin") && Directory.GetCurrentDirectory().Contains("Tools"))
|
||||
{
|
||||
olddir = Directory.GetCurrentDirectory().Replace("bin\\Tools", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string basePath = olddir + $@"bin\Tools\";
|
||||
}
|
||||
*/
|
||||
do
|
||||
{
|
||||
if (File.Exists(filePath))
|
||||
|
@ -1800,7 +1825,7 @@ namespace UWUVCI_AIO_WPF
|
|||
{
|
||||
await client.DownloadFileTaskAsync(getDownloadLink(name, true), filePath);
|
||||
}
|
||||
} while (!ToolCheck.IsToolRight(name));
|
||||
} while (!Task.Run(() => ToolCheck.IsToolRightAsync(name)).GetAwaiter().GetResult());
|
||||
|
||||
|
||||
}
|
||||
|
@ -1829,7 +1854,8 @@ namespace UWUVCI_AIO_WPF
|
|||
else
|
||||
{
|
||||
return $@"https://github.com/Hotbrawl20/UWUVCI-VCB/raw/master/" + toolname.Replace("bin\\bases\\", "");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -1849,17 +1875,22 @@ namespace UWUVCI_AIO_WPF
|
|||
{
|
||||
if (ToolCheck.DoesToolsFolderExist())
|
||||
{
|
||||
|
||||
List<MissingTool> missingTools = new List<MissingTool>();
|
||||
missingTools = ToolCheck.CheckForMissingTools();
|
||||
if (missingTools.Count > 0)
|
||||
{
|
||||
|
||||
|
||||
|
||||
foreach (MissingTool m in missingTools)
|
||||
{
|
||||
DownloadTool(m.Name, this);
|
||||
Task.Run(() => DownloadToolAsync(m.Name, this)).GetAwaiter();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
InjcttoolCheck();
|
||||
|
||||
}
|
||||
|
@ -1884,6 +1915,7 @@ namespace UWUVCI_AIO_WPF
|
|||
{
|
||||
if (m.Name == "blank.ini")
|
||||
{
|
||||
|
||||
StreamWriter sw = new StreamWriter(Path.Combine(Directory.GetCurrentDirectory(), "bin", "Tools", "blank.ini"));
|
||||
sw.Close();
|
||||
}
|
||||
|
@ -1895,11 +1927,9 @@ namespace UWUVCI_AIO_WPF
|
|||
Progress += Convert.ToInt32(l);
|
||||
}
|
||||
Progress = 100;
|
||||
|
||||
});
|
||||
thread.SetApartmentState(ApartmentState.STA);
|
||||
thread.Start();
|
||||
|
||||
}
|
||||
private void timer_Tick2(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -1914,7 +1944,7 @@ namespace UWUVCI_AIO_WPF
|
|||
Progress = 0;
|
||||
}
|
||||
}
|
||||
private void toolCheck()
|
||||
private void toolCheckAsync()
|
||||
{
|
||||
if (ToolCheck.DoesToolsFolderExist())
|
||||
{
|
||||
|
@ -1923,9 +1953,9 @@ namespace UWUVCI_AIO_WPF
|
|||
|
||||
if (missingTools.Count > 0)
|
||||
{
|
||||
if (CheckForInternetConnection())
|
||||
if (Task.Run(() => CheckForInternetConnectionAsync()).GetAwaiter().GetResult())
|
||||
{
|
||||
Task.Run(() => ThreadDownload(missingTools));
|
||||
Task.Run(() => ThreadDownload(missingTools)).GetAwaiter();
|
||||
DownloadWait dw = new DownloadWait("Downloading Tools - Please Wait", "", this);
|
||||
try
|
||||
{
|
||||
|
@ -1939,7 +1969,7 @@ namespace UWUVCI_AIO_WPF
|
|||
Thread.Sleep(200);
|
||||
//Download Tools
|
||||
Progress = 0;
|
||||
toolCheck();
|
||||
toolCheckAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1967,7 +1997,7 @@ namespace UWUVCI_AIO_WPF
|
|||
Directory.CreateDirectory("bin/Tools");
|
||||
}
|
||||
|
||||
toolCheck();
|
||||
toolCheckAsync();
|
||||
|
||||
|
||||
}
|
||||
|
@ -2306,7 +2336,8 @@ namespace UWUVCI_AIO_WPF
|
|||
}
|
||||
public bool checkKey(string key)
|
||||
{
|
||||
if (GbTemp.KeyHash == key.ToLower().GetHashCode())
|
||||
var thingy = key.ToLower().GetHashCode();
|
||||
if (GbTemp.KeyHash == thingy)
|
||||
{
|
||||
UpdateKeyInFile(key, $@"bin\keys\{GetConsoleOfBase(gbTemp).ToString().ToLower()}.vck", GbTemp, GetConsoleOfBase(gbTemp));
|
||||
return true;
|
||||
|
@ -2399,7 +2430,7 @@ namespace UWUVCI_AIO_WPF
|
|||
public void Download()
|
||||
{
|
||||
ValidatePathsStillExist();
|
||||
if (CheckForInternetConnection())
|
||||
if (Task.Run(() => CheckForInternetConnectionAsync()).GetAwaiter().GetResult())
|
||||
{
|
||||
Task.Run(() => { Injection.Download(this); });
|
||||
|
||||
|
@ -2682,7 +2713,7 @@ namespace UWUVCI_AIO_WPF
|
|||
|
||||
return true;
|
||||
}
|
||||
public void getBootIMGGBA(string rom)
|
||||
public async Task getBootIMGGBA(string rom)
|
||||
{
|
||||
string repoid = "";
|
||||
string SystemType = "gba/";
|
||||
|
@ -2703,19 +2734,19 @@ namespace UWUVCI_AIO_WPF
|
|||
Console.WriteLine("prodcode after scramble: " + repoid);
|
||||
}
|
||||
List<string> repoids = new List<string>();
|
||||
if (CheckForInternetConnectionWOWarning())
|
||||
if (await CheckForInternetConnectionWOWarningAsync())
|
||||
{
|
||||
repoids.Add(SystemType + repoid);
|
||||
repoids.Add(SystemType + repoid.Substring(0, 3) + "E");
|
||||
repoids.Add(SystemType + repoid.Substring(0, 3) + "P");
|
||||
repoids.Add(SystemType + repoid.Substring(0, 3) + "J");
|
||||
|
||||
GetRepoImages(SystemType, repoid);
|
||||
checkForAdditionalFiles(GameConsoles.GBA, repoids);
|
||||
await GetRepoImages(SystemType, repoid);
|
||||
await checkForAdditionalFiles(GameConsoles.GBA, repoids);
|
||||
}
|
||||
|
||||
}
|
||||
public void getBootIMGSNES(string rom)
|
||||
public async Task getBootIMGSNES(string rom)
|
||||
{
|
||||
string SystemType = "snes/";
|
||||
var repoid = GetFakeSNESProdcode(rom);
|
||||
|
@ -2724,15 +2755,15 @@ namespace UWUVCI_AIO_WPF
|
|||
SystemType + repoid
|
||||
};
|
||||
|
||||
if (CheckForInternetConnectionWOWarning())
|
||||
if (await CheckForInternetConnectionWOWarningAsync())
|
||||
{
|
||||
GetRepoImages(SystemType, repoid);
|
||||
checkForAdditionalFiles(GameConsoles.SNES, repoids);
|
||||
await GetRepoImages(SystemType, repoid);
|
||||
await checkForAdditionalFiles(GameConsoles.SNES, repoids);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public void getBootIMGMSX(string rom)
|
||||
public async Task getBootIMGMSX(string rom)
|
||||
{
|
||||
string SystemType = "msx/";
|
||||
var repoid = GetFakeMSXTGProdcode(rom, true);
|
||||
|
@ -2741,14 +2772,14 @@ namespace UWUVCI_AIO_WPF
|
|||
SystemType + repoid
|
||||
};
|
||||
|
||||
if (CheckForInternetConnectionWOWarning())
|
||||
if (await CheckForInternetConnectionWOWarningAsync())
|
||||
{
|
||||
GetRepoImages(SystemType, repoid);
|
||||
checkForAdditionalFiles(GameConsoles.MSX, repoids);
|
||||
await GetRepoImages(SystemType, repoid);
|
||||
await checkForAdditionalFiles(GameConsoles.MSX, repoids);
|
||||
}
|
||||
|
||||
}
|
||||
public void getBootIMGTG(string rom)
|
||||
public async Task getBootIMGTG(string rom)
|
||||
{
|
||||
string SystemType = "tg16/";
|
||||
var repoid = GetFakeMSXTGProdcode(rom, false);
|
||||
|
@ -2756,10 +2787,10 @@ namespace UWUVCI_AIO_WPF
|
|||
{
|
||||
SystemType + repoid
|
||||
};
|
||||
if (CheckForInternetConnectionWOWarning())
|
||||
if (await CheckForInternetConnectionWOWarningAsync())
|
||||
{
|
||||
GetRepoImages(SystemType, repoid);
|
||||
checkForAdditionalFiles(GameConsoles.TG16, repoids);
|
||||
await GetRepoImages(SystemType, repoid);
|
||||
await checkForAdditionalFiles(GameConsoles.TG16, repoids);
|
||||
|
||||
}
|
||||
|
||||
|
@ -2883,7 +2914,7 @@ namespace UWUVCI_AIO_WPF
|
|||
|
||||
}
|
||||
}
|
||||
public void getBootIMGNES(string rom)
|
||||
public async Task getBootIMGNES(string rom)
|
||||
{
|
||||
string SystemType = "nes/";
|
||||
var repoid = GetFakeNESProdcode(rom);
|
||||
|
@ -2892,10 +2923,10 @@ namespace UWUVCI_AIO_WPF
|
|||
SystemType + repoid
|
||||
};
|
||||
|
||||
if (CheckForInternetConnectionWOWarning())
|
||||
if (await CheckForInternetConnectionWOWarningAsync())
|
||||
{
|
||||
GetRepoImages(SystemType, repoid);
|
||||
checkForAdditionalFiles(GameConsoles.NES, repoids);
|
||||
await GetRepoImages(SystemType, repoid);
|
||||
await checkForAdditionalFiles(GameConsoles.NES, repoids);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3014,7 +3045,7 @@ namespace UWUVCI_AIO_WPF
|
|||
var toret = new char[] { letters[n1], letters[n2], letters[n3], letters[n4] };
|
||||
return new string(toret).ToUpper();
|
||||
}
|
||||
public void getBootIMGNDS(string rom)
|
||||
public async Task getBootIMGNDS(string rom)
|
||||
{
|
||||
string repoid = "";
|
||||
string SystemType = "nds/";
|
||||
|
@ -3035,19 +3066,19 @@ namespace UWUVCI_AIO_WPF
|
|||
Console.WriteLine("prodcode after scramble: " + repoid);
|
||||
}
|
||||
List<string> repoids = new List<string>();
|
||||
if (CheckForInternetConnectionWOWarning())
|
||||
if (await CheckForInternetConnectionWOWarningAsync())
|
||||
{
|
||||
repoids.Add(SystemType + repoid);
|
||||
repoids.Add(SystemType + repoid.Substring(0, 3) + "E");
|
||||
repoids.Add(SystemType + repoid.Substring(0, 3) + "P");
|
||||
repoids.Add(SystemType + repoid.Substring(0, 3) + "J");
|
||||
GetRepoImages(SystemType, repoid);
|
||||
checkForAdditionalFiles(GameConsoles.NDS, repoids);
|
||||
await GetRepoImages(SystemType, repoid);
|
||||
await checkForAdditionalFiles(GameConsoles.NDS, repoids);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public void getBootIMGN64(string rom)
|
||||
public async Task getBootIMGN64(string rom)
|
||||
{
|
||||
string repoid = "";
|
||||
string SystemType = "n64/";
|
||||
|
@ -3067,13 +3098,13 @@ namespace UWUVCI_AIO_WPF
|
|||
fs.Close();
|
||||
Console.WriteLine("prodcode after scramble: " + repoid);
|
||||
}
|
||||
if (CheckForInternetConnectionWOWarning())
|
||||
if (await CheckForInternetConnectionWOWarningAsync())
|
||||
{
|
||||
repoids.Add(SystemType + repoid);
|
||||
repoids.Add(SystemType + new string(new char[] { repoid[0], repoid[2], repoid[1], repoid[3] }));
|
||||
|
||||
GetRepoImages(SystemType, repoid);
|
||||
checkForAdditionalFiles(GameConsoles.N64, repoids);
|
||||
await GetRepoImages(SystemType, repoid);
|
||||
await checkForAdditionalFiles(GameConsoles.N64, repoids);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3084,8 +3115,6 @@ namespace UWUVCI_AIO_WPF
|
|||
}
|
||||
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/";
|
||||
string ret = "";
|
||||
try
|
||||
{
|
||||
|
@ -3127,15 +3156,15 @@ namespace UWUVCI_AIO_WPF
|
|||
repoid = TempString;
|
||||
}
|
||||
|
||||
if (CheckForInternetConnectionWOWarning())
|
||||
if (Task.Run(() => CheckForInternetConnectionWOWarningAsync()).GetAwaiter().GetResult())
|
||||
{
|
||||
repoids.Add(SystemType + repoid);
|
||||
repoids.Add(SystemType + repoid.Substring(0, 3) + "E" + repoid.Substring(4, 2));
|
||||
repoids.Add(SystemType + repoid.Substring(0, 3) + "P" + repoid.Substring(4, 2));
|
||||
repoids.Add(SystemType + repoid.Substring(0, 3) + "J" + repoid.Substring(4, 2));
|
||||
|
||||
GetRepoImages(SystemType, repoid, repoids);
|
||||
checkForAdditionalFiles(test == GameConsoles.GCN ? GameConsoles.GCN : GameConsoles.WII, repoids);
|
||||
Task.Run(() => GetRepoImages(SystemType, repoid, repoids)).GetAwaiter();
|
||||
Task.Run(() => checkForAdditionalFiles(test == GameConsoles.GCN ? GameConsoles.GCN : GameConsoles.WII, repoids)).GetAwaiter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3154,17 +3183,27 @@ namespace UWUVCI_AIO_WPF
|
|||
|
||||
return ret;
|
||||
}
|
||||
public bool CheckForInternetConnection()
|
||||
public async Task<bool> CheckForInternetConnectionAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var client = new WebClient())
|
||||
using (client.OpenRead("http://google.com/generate_204"))
|
||||
using (await client.OpenReadTaskAsync("http://google.com/generate_204"))
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
Custom_Message cm = new Custom_Message("No Internet Connection", " To Download Tools, Bases or required Files you need to be connected to the Internet. The Program will now terminate. ");
|
||||
var googleBlocked = false;
|
||||
|
||||
using (var client = new WebClient())
|
||||
using (await client.OpenReadTaskAsync("https://raw.githubusercontent.com"))
|
||||
googleBlocked = true;
|
||||
|
||||
Custom_Message cm;
|
||||
if (!googleBlocked)
|
||||
cm = new Custom_Message("No Internet Connection", " To Download Tools, Bases or required Files you need to be connected to the Internet. The Program will now terminate. ");
|
||||
else
|
||||
cm = new Custom_Message("Google Can't Be Reached On Your Connection", " To check for Internet on non webapps, Google is normally used since it's the fastest site to reach. You may run into issues with other programs. ");
|
||||
try
|
||||
{
|
||||
cm.Owner = mw;
|
||||
|
@ -3174,26 +3213,31 @@ namespace UWUVCI_AIO_WPF
|
|||
|
||||
catch (Exception) { }
|
||||
cm.ShowDialog();
|
||||
Environment.Exit(1);
|
||||
return false;
|
||||
|
||||
if (!googleBlocked)
|
||||
Environment.Exit(1);
|
||||
|
||||
return googleBlocked;
|
||||
}
|
||||
}
|
||||
public bool CheckForInternetConnectionWOWarning()
|
||||
public async Task<bool> CheckForInternetConnectionWOWarningAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var client = new WebClient())
|
||||
using (client.OpenRead("http://google.com/generate_204"))
|
||||
using (await client.OpenReadTaskAsync("http://google.com/generate_204"))
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
using (var client = new WebClient())
|
||||
using (await client.OpenReadTaskAsync("http://raw.githubusercontent.com"))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private void checkForAdditionalFiles(GameConsoles console, List<string> repoids)
|
||||
private async Task checkForAdditionalFiles(GameConsoles console, List<string> repoids)
|
||||
{
|
||||
if (!Directory.Exists(Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo")))
|
||||
{
|
||||
|
@ -3209,7 +3253,7 @@ namespace UWUVCI_AIO_WPF
|
|||
{
|
||||
foreach (string repoid in repoids)
|
||||
{
|
||||
if (RemoteFileExists(linkbase + repoid + "/game.ini"))
|
||||
if (await RemoteFileExists(linkbase + repoid + "/game.ini"))
|
||||
{
|
||||
ini = true;
|
||||
inip = linkbase + repoid + "/game.ini";
|
||||
|
@ -3224,7 +3268,7 @@ namespace UWUVCI_AIO_WPF
|
|||
{
|
||||
foreach (string repoid in repoids)
|
||||
{
|
||||
if (RemoteFileExists(linkbase + repoid + "/BootSound." + e))
|
||||
if (await RemoteFileExists(linkbase + repoid + "/BootSound." + e))
|
||||
{
|
||||
btsnd = true;
|
||||
btsndp = linkbase + repoid + "/BootSound." + e;
|
||||
|
@ -3466,11 +3510,11 @@ namespace UWUVCI_AIO_WPF
|
|||
/// <param name="SystemType"></param>
|
||||
/// <param name="repoid"></param>
|
||||
/// <param name="repoids"></param>
|
||||
private void GetRepoImages(string SystemType, string repoid, List<string> repoids = null)
|
||||
private async Task GetRepoImages(string SystemType, string repoid, List<string> repoids = null)
|
||||
{
|
||||
string linkbase = "https://raw.githubusercontent.com/Flumpster/UWUVCI-Images/master/";
|
||||
IMG_Message img = null;
|
||||
string[] ext = { "png", "jpg", "jpeg", "tga" };
|
||||
string[] ext = { "png", "jpg", "jpeg" , "tga"};
|
||||
|
||||
if (repoids == null || repoids?.Count == 0)
|
||||
{
|
||||
|
@ -3493,8 +3537,9 @@ namespace UWUVCI_AIO_WPF
|
|||
{
|
||||
foreach (var id in repoids)
|
||||
{
|
||||
if (RemoteFileExists(linkbase + id + $"/iconTex.{e}") == true)
|
||||
if (await RemoteFileExists(linkbase + id + $"/iconTex.{e}") == true)
|
||||
{
|
||||
|
||||
if (e.Contains("tga"))
|
||||
{
|
||||
var message = new Custom_Message("TGA Extension Warning", "TGA files can't natively be rendered in UWUVCI, instead it will say something along the lines of the image not being able to be shown.\nThis is correct and is normal behavior.\n\nIf there are actual errors then grab the files from \"https://github.com/flumpster/uwuvci-images\", convert them to png, and then manually insert them.");
|
||||
|
@ -3508,6 +3553,7 @@ namespace UWUVCI_AIO_WPF
|
|||
}
|
||||
message.ShowDialog();
|
||||
}
|
||||
|
||||
img = new IMG_Message(linkbase + id + $"/iconTex.{e}", linkbase + id + $"/bootTvTex.{e}", id);
|
||||
try
|
||||
{
|
||||
|
@ -3521,4 +3567,4 @@ namespace UWUVCI_AIO_WPF
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue