forked from sim0n00ps/OF-DL
Fixed async usage.
This commit is contained in:
parent
dd2b7cd82c
commit
be9e4929e9
@ -2703,7 +2703,7 @@ public class APIHelper : IAPIHelper
|
||||
|
||||
using var response = await client.SendAsync(request);
|
||||
|
||||
Log.Debug($"CDRM Project Response (Attempt {attempt}): {response.Content.ReadAsStringAsync().Result}");
|
||||
Log.Debug($"CDRM Project Response (Attempt {attempt}): {await response.Content.ReadAsStringAsync()}");
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
var body = await response.Content.ReadAsStringAsync();
|
||||
|
@ -852,7 +852,7 @@ public class DownloadHelper : IDownloadHelper
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
MD5 md5 = MD5.Create();
|
||||
byte[] hash = md5.ComputeHash(memoryStream);
|
||||
byte[] hash = await md5.ComputeHashAsync(memoryStream);
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
if (!avatarMD5Hashes.Contains(BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant()))
|
||||
{
|
||||
@ -895,7 +895,7 @@ public class DownloadHelper : IDownloadHelper
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
MD5 md5 = MD5.Create();
|
||||
byte[] hash = md5.ComputeHash(memoryStream);
|
||||
byte[] hash = await md5.ComputeHashAsync(memoryStream);
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
if (!headerMD5Hashes.Contains(BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant()))
|
||||
{
|
||||
|
@ -45,15 +45,15 @@ public class Program
|
||||
AuthHelper authHelper = new();
|
||||
Task setupBrowserTask = authHelper.SetupBrowser(runningInDocker);
|
||||
|
||||
Task.Delay(1000).Wait();
|
||||
await Task.Delay(1000);
|
||||
if (!setupBrowserTask.IsCompleted)
|
||||
{
|
||||
AnsiConsole.MarkupLine($"[yellow]Downloading dependencies. Please wait ...[/]");
|
||||
}
|
||||
setupBrowserTask.Wait();
|
||||
await setupBrowserTask;
|
||||
|
||||
Task<Auth?> getAuthTask = authHelper.GetAuthFromBrowser();
|
||||
Task.Delay(5000).Wait();
|
||||
await Task.Delay(5000);
|
||||
if (!getAuthTask.IsCompleted)
|
||||
{
|
||||
if (runningInDocker)
|
||||
@ -124,7 +124,7 @@ public class Program
|
||||
AnsiConsole.Markup("[green]config.json located successfully!\n[/]");
|
||||
try
|
||||
{
|
||||
string jsonText = File.ReadAllText("config.json");
|
||||
string jsonText = await File.ReadAllTextAsync("config.json");
|
||||
var jsonConfig = JsonConvert.DeserializeObject<Entities.Config>(jsonText);
|
||||
|
||||
if (jsonConfig != null)
|
||||
@ -220,7 +220,7 @@ public class Program
|
||||
hoconConfig.AppendLine($" LoggingLevel = \"{jsonConfig.LoggingLevel.ToString().ToLower()}\"");
|
||||
hoconConfig.AppendLine("}");
|
||||
|
||||
File.WriteAllText("config.conf", hoconConfig.ToString());
|
||||
await File.WriteAllTextAsync("config.conf", hoconConfig.ToString());
|
||||
File.Delete("config.json");
|
||||
AnsiConsole.Markup("[green]config.conf created successfully from config.json!\n[/]");
|
||||
}
|
||||
@ -246,7 +246,7 @@ public class Program
|
||||
AnsiConsole.Markup("[green]config.conf located successfully!\n[/]");
|
||||
try
|
||||
{
|
||||
string hoconText = File.ReadAllText("config.conf");
|
||||
string hoconText = await File.ReadAllTextAsync("config.conf");
|
||||
|
||||
var hoconConfig = ConfigurationFactory.ParseString(hoconText);
|
||||
|
||||
@ -607,9 +607,10 @@ public class Program
|
||||
AnsiConsole.Markup("[green]rules.json located successfully!\n[/]");
|
||||
try
|
||||
{
|
||||
JsonConvert.DeserializeObject<DynamicRules>(File.ReadAllText("rules.json"));
|
||||
string rulesJson = await File.ReadAllTextAsync("rules.json");
|
||||
DynamicRules? dynamicRules = JsonConvert.DeserializeObject<DynamicRules>(rulesJson);
|
||||
Log.Debug($"Rules.json: ");
|
||||
Log.Debug(JsonConvert.SerializeObject(File.ReadAllText("rules.json"), Formatting.Indented));
|
||||
Log.Debug(JsonConvert.SerializeObject(dynamicRules, Formatting.Indented));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -2924,7 +2925,7 @@ public class Program
|
||||
hoconConfig.AppendLine($" LoggingLevel = \"{newConfig.LoggingLevel.ToString().ToLower()}\"");
|
||||
hoconConfig.AppendLine("}");
|
||||
|
||||
File.WriteAllText("config.conf", hoconConfig.ToString());
|
||||
await File.WriteAllTextAsync("config.conf", hoconConfig.ToString());
|
||||
|
||||
string newConfigString = JsonConvert.SerializeObject(newConfig, Formatting.Indented);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user