Merge pull request #541 from daemitus/asyncstuff

This commit is contained in:
goaaats 2021-09-08 03:23:00 +02:00 committed by GitHub
commit bd48297745
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View file

@ -391,8 +391,7 @@ namespace Dalamud.Game.Gui
if (!FastByteArrayCompare(originalMessageData, message.RawData)) if (!FastByteArrayCompare(originalMessageData, message.RawData))
{ {
allocatedString = Service<LibcFunction>.Get().NewString(message.RawData); allocatedString = Service<LibcFunction>.Get().NewString(message.RawData);
Log.Debug( Log.Debug($"HandlePrintMessageDetour String modified: {originalMessageData}({messagePtr}) -> {message}({allocatedString.Address})");
$"HandlePrintMessageDetour String modified: {originalMessageData}({messagePtr}) -> {message}({allocatedString.Address})");
messagePtr = allocatedString.Address; messagePtr = allocatedString.Address;
} }

View file

@ -30,8 +30,7 @@ namespace Dalamud.Plugin.Internal
this.IsThirdParty = pluginMasterUrl != DalamudPluginsMasterUrl; this.IsThirdParty = pluginMasterUrl != DalamudPluginsMasterUrl;
this.IsEnabled = isEnabled; this.IsEnabled = isEnabled;
// No need to wait for this this.ReloadPluginMasterAsync();
Task.Run(this.ReloadPluginMasterAsync);
} }
/// <summary> /// <summary>
@ -73,12 +72,12 @@ namespace Dalamud.Plugin.Internal
this.State = PluginRepositoryState.InProgress; this.State = PluginRepositoryState.InProgress;
this.PluginMaster = new List<RemotePluginManifest>().AsReadOnly(); this.PluginMaster = new List<RemotePluginManifest>().AsReadOnly();
return Task.Run(() => return Task.Run(async () =>
{ {
Log.Information($"Fetching repo: {this.PluginMasterUrl}"); Log.Information($"Fetching repo: {this.PluginMasterUrl}");
using var client = new HttpClient(); using var client = new HttpClient();
using var response = client.GetAsync(this.PluginMasterUrl).Result; using var response = await client.GetAsync(this.PluginMasterUrl);
var data = response.Content.ReadAsStringAsync().Result; var data = await response.Content.ReadAsStringAsync();
var pluginMaster = JsonConvert.DeserializeObject<List<RemotePluginManifest>>(data); var pluginMaster = JsonConvert.DeserializeObject<List<RemotePluginManifest>>(data);
pluginMaster.Sort((pm1, pm2) => pm1.Name.CompareTo(pm2.Name)); pluginMaster.Sort((pm1, pm2) => pm1.Name.CompareTo(pm2.Name));