diff --git a/Qwilight/System/AvatarDrawingSystem.cs b/Qwilight/System/AvatarDrawingSystem.cs index fbaba32..7c9b128 100644 --- a/Qwilight/System/AvatarDrawingSystem.cs +++ b/Qwilight/System/AvatarDrawingSystem.cs @@ -49,7 +49,7 @@ var avatarCSX = _avatarCSXs.GetOrAdd(avatarID, GetCSX); try { - await avatarCSX.WaitAsync().ConfigureAwait(false); + await avatarCSX.WaitAsync(); if (!_avatarDrawings.TryGetValue(avatarID, out var avatarDrawing)) { if (string.IsNullOrEmpty(avatarID)) diff --git a/Qwilight/System/AvatarEdgeSystem.cs b/Qwilight/System/AvatarEdgeSystem.cs index 52a4fa2..a143b05 100644 --- a/Qwilight/System/AvatarEdgeSystem.cs +++ b/Qwilight/System/AvatarEdgeSystem.cs @@ -49,7 +49,7 @@ var avatarCSX = _avatarCSXs.GetOrAdd(avatarID, GetCSX); try { - await avatarCSX.WaitAsync().ConfigureAwait(false); + await avatarCSX.WaitAsync(); if (!_avatarEdges.TryGetValue(avatarID, out var avatarEdge)) { if (string.IsNullOrEmpty(avatarID)) diff --git a/Qwilight/System/AvatarTitleSystem.cs b/Qwilight/System/AvatarTitleSystem.cs index 76a959a..fddb693 100644 --- a/Qwilight/System/AvatarTitleSystem.cs +++ b/Qwilight/System/AvatarTitleSystem.cs @@ -33,7 +33,7 @@ var avatarCSX = _avatarCSXs.GetOrAdd(avatarID, GetCSX); try { - await avatarCSX.WaitAsync().ConfigureAwait(false); + await avatarCSX.WaitAsync(); if (!_avatarTitles.TryGetValue(avatarID, out var avatarTitle)) { if (string.IsNullOrEmpty(avatarID)) diff --git a/Qwilight/System/LevelSystem.cs b/Qwilight/System/LevelSystem.cs index 855679d..cdc40f7 100644 --- a/Qwilight/System/LevelSystem.cs +++ b/Qwilight/System/LevelSystem.cs @@ -111,7 +111,7 @@ { using var s = await TwilightSystem.Instance.GetWwwParallel(www); using var sr = new StreamReader(s); - return await (www.IsTailCaselsss(".json") ? GetJSON(levelNotifyItem, s, www) : GetHTML(levelNotifyItem, await sr.ReadToEndAsync().ConfigureAwait(false), www)); + return await (www.IsTailCaselsss(".json") ? GetJSON(levelNotifyItem, s, www) : GetHTML(levelNotifyItem, await sr.ReadToEndAsync(), www)); }); } @@ -166,23 +166,23 @@ using (var wwwClient = new HttpClient()) { wwwClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0"); - using (var hrm = await wwwClient.GetAsync(target, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false)) + using (var hrm = await wwwClient.GetAsync(target, HttpCompletionOption.ResponseHeadersRead)) { levelNotifyItem.MaxStatus = hrm.Content.Headers.ContentLength ?? 0L; } using var fs = File.Open(Path.Combine(EntryPath, $"{levelTableFileName}.json"), FileMode.Create); - using var ws = await wwwClient.GetStreamAsync(target).ConfigureAwait(false); + using var ws = await wwwClient.GetStreamAsync(target); var data = ArrayPool.Shared.Rent(QwilightComponent.SendUnit); try { var length = 0; - while ((length = await ws.ReadAsync(data.AsMemory(0, data.Length)).ConfigureAwait(false)) > 0) + while ((length = await ws.ReadAsync(data.AsMemory(0, data.Length))) > 0) { if (levelNotifyItem.IsStopped) { throw new OperationCanceledException(); } - await fs.WriteAsync(data.AsMemory(0, length)).ConfigureAwait(false); + await fs.WriteAsync(data.AsMemory(0, length)); levelNotifyItem.Status += length; } } @@ -194,7 +194,7 @@ using (var fs = File.Open(Path.Combine(EntryPath, $"#{levelTableFileName}.json"), FileMode.Create)) { s.Position = 0; - await s.CopyToAsync(fs).ConfigureAwait(false); + await s.CopyToAsync(fs); } levelNotifyItem.Variety = NotifySystem.NotifyVariety.Closed; levelNotifyItem.Text = LanguageSystem.Instance.SavedLevelContents; diff --git a/Qwilight/System/TwilightSystem.cs b/Qwilight/System/TwilightSystem.cs index 5d35e22..25f8722 100644 --- a/Qwilight/System/TwilightSystem.cs +++ b/Qwilight/System/TwilightSystem.cs @@ -1440,9 +1440,9 @@ try { var dataGet = new HttpRequestMessage(HttpMethod.Get, target); - var www = await _wwwClient.SendAsync(dataGet).ConfigureAwait(false); + var www = await _wwwClient.SendAsync(dataGet); www.EnsureSuccessStatusCode(); - return await www.Content.ReadAsStreamAsync().ConfigureAwait(false); + return await www.Content.ReadAsStreamAsync(); } catch { @@ -1459,9 +1459,9 @@ try { var dataGet = new HttpRequestMessage(HttpMethod.Get, target); - using var www = await _wwwClient.SendAsync(dataGet).ConfigureAwait(false); + using var www = await _wwwClient.SendAsync(dataGet); www.EnsureSuccessStatusCode(); - var text = await www.Content.ReadAsStringAsync().ConfigureAwait(false); + var text = await www.Content.ReadAsStringAsync(); if (!string.IsNullOrEmpty(text)) { return Utility.GetJSON(text); @@ -1486,7 +1486,7 @@ Content = new StringContent(data, Encoding.UTF8, dataVariety) }; dataPost.Headers.Add("millis", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString()); - using var www = await _wwwClient.SendAsync(dataPost).ConfigureAwait(false); + using var www = await _wwwClient.SendAsync(dataPost); www.EnsureSuccessStatusCode(); return true; } @@ -1506,11 +1506,11 @@ { var dataPost = new HttpRequestMessage(HttpMethod.Post, target) { - Content = new ByteArrayContent(await File.ReadAllBytesAsync(fileName).ConfigureAwait(false)) + Content = new ByteArrayContent(await File.ReadAllBytesAsync(fileName)) }; dataPost.Headers.Add("millis", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString()); dataPost.Headers.Add("totem", Totem); - using var www = await _wwwClient.SendAsync(dataPost).ConfigureAwait(false); + using var www = await _wwwClient.SendAsync(dataPost); www.EnsureSuccessStatusCode(); return true; } @@ -1533,9 +1533,9 @@ Content = new ByteArrayContent(data) }; dataPost.Headers.Add("millis", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString()); - using var www = await _wwwClient.SendAsync(dataPost).ConfigureAwait(false); + using var www = await _wwwClient.SendAsync(dataPost); www.EnsureSuccessStatusCode(); - return await www.Content.ReadAsStringAsync().ConfigureAwait(false); + return await www.Content.ReadAsStringAsync(); } catch { @@ -1557,7 +1557,7 @@ }; dataPut.Headers.Add("millis", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString()); dataPut.Headers.Add("totem", Totem); - using var www = await _wwwClient.SendAsync(dataPut).ConfigureAwait(false); + using var www = await _wwwClient.SendAsync(dataPut); www.EnsureSuccessStatusCode(); } catch diff --git a/Qwilight/ViewModel/LevelViewModel.cs b/Qwilight/ViewModel/LevelViewModel.cs index 56e0977..875fed9 100644 --- a/Qwilight/ViewModel/LevelViewModel.cs +++ b/Qwilight/ViewModel/LevelViewModel.cs @@ -97,7 +97,7 @@ }).Response; if (!string.IsNullOrEmpty(filePath)) { - if (await LevelSystem.Instance.GetLevelNotifyItem(async levelNotifyItem => await LevelSystem.Instance.GetHTML(levelNotifyItem, await File.ReadAllTextAsync(filePath).ConfigureAwait(false), string.Empty))) + if (await LevelSystem.Instance.GetLevelNotifyItem(async levelNotifyItem => await LevelSystem.Instance.GetHTML(levelNotifyItem, await File.ReadAllTextAsync(filePath), string.Empty))) { LevelSystem.Instance.Load(true); SetLevelItemCollection(); diff --git a/Qwilight/ViewModel/MainViewModel.cs b/Qwilight/ViewModel/MainViewModel.cs index c8d739a..1debac2 100644 --- a/Qwilight/ViewModel/MainViewModel.cs +++ b/Qwilight/ViewModel/MainViewModel.cs @@ -1405,7 +1405,7 @@ } var assistFileViewModel = ViewModels.Instance.AssistFileValue; assistFileViewModel.Title = noteFile.EntryItem.Title; - assistFileViewModel.Assist = await File.ReadAllTextAsync(assistFilePath, Encoding.GetEncoding(format)).ConfigureAwait(false); + assistFileViewModel.Assist = await File.ReadAllTextAsync(assistFilePath, Encoding.GetEncoding(format)); assistFileViewModel.Open(); } } @@ -3264,8 +3264,9 @@ { foreach (var entryPath in Utility.GetEntry(targetEntryPath).Where(entryPath => entryPath != QwilightComponent.QwilightEntryPath)) { + var entryName = Path.GetFileName(entryPath); #if X64 - if (entryPath != "x64") + if (entryName != "x64") #endif { SetFilePaths(entryPath); @@ -3296,7 +3297,7 @@ var hashes = new ConcurrentDictionary(); await Parallel.ForEachAsync(filePaths, CancellationToken.None, async (filePath, t) => { - hashes[Path.GetRelativePath(AppContext.BaseDirectory, filePath).Replace(Path.DirectorySeparatorChar, '/')] = Utility.GetID128(await File.ReadAllBytesAsync(filePath, t).ConfigureAwait(false)); + hashes[Path.GetRelativePath(AppContext.BaseDirectory, filePath).Replace(Path.DirectorySeparatorChar, '/')] = Utility.GetID128(await File.ReadAllBytesAsync(filePath, t)); }); var toWipeFiles = hashes.Keys.Except(taehuiQwilightDateValue.hashes.Keys).ToArray(); @@ -3349,22 +3350,22 @@ Directory.CreateDirectory(Path.GetDirectoryName(toNewFilePath)); using var fs = File.OpenWrite(toNewFilePath); #if X64 - using var ws = await wwwClient.GetStreamAsync($"{QwilightComponent.TaehuiNetFE}/qwilight/zip/AMD64/{toNewFile}").ConfigureAwait(false); + using var ws = await wwwClient.GetStreamAsync($"{QwilightComponent.TaehuiNetFE}/qwilight/zip/AMD64/{toNewFile}"); #endif #if ARM64 - using var ws = await wwwClient.GetStreamAsync($"{QwilightComponent.TaehuiNetFE}/qwilight/zip/ARM64/{toNewFile}").ConfigureAwait(false); + using var ws = await wwwClient.GetStreamAsync($"{QwilightComponent.TaehuiNetFE}/qwilight/zip/ARM64/{toNewFile}"); #endif var data = ArrayPool.Shared.Rent(QwilightComponent.SendUnit); try { var length = 0; - while ((length = await ws.ReadAsync(data.AsMemory(0, data.Length)).ConfigureAwait(false)) > 0) + while ((length = await ws.ReadAsync(data.AsMemory(0, data.Length))) > 0) { if (qwilightNotifyItem.IsStopped) { throw new OperationCanceledException(); } - await fs.WriteAsync(data.AsMemory(0, length)).ConfigureAwait(false); + await fs.WriteAsync(data.AsMemory(0, length)); } } finally diff --git a/Qwilight/ViewModel/NoteFileViewModel.cs b/Qwilight/ViewModel/NoteFileViewModel.cs index ac387ec..41d0f08 100644 --- a/Qwilight/ViewModel/NoteFileViewModel.cs +++ b/Qwilight/ViewModel/NoteFileViewModel.cs @@ -114,7 +114,7 @@ var bmscFilePath = Path.Combine(Path.GetDirectoryName(Configure.Instance.BMSEditorFilePath), "iBMSC.Settings.xml"); if (File.Exists(bmseViewerFilePath) && File.Exists(bmseFilePath)) { - var bmseViewerData = (await File.ReadAllTextAsync(bmseViewerFilePath, Encoding.ASCII).ConfigureAwait(false)).Trim(Environment.NewLine.ToCharArray()).Split(Environment.NewLine).ToList(); + var bmseViewerData = (await File.ReadAllTextAsync(bmseViewerFilePath, Encoding.ASCII)).Trim(Environment.NewLine.ToCharArray()).Split(Environment.NewLine).ToList(); bmseViewerData.AddRange(Enumerable.Repeat(string.Empty, 6 - bmseViewerData.Count % 6)); var data = $""" Qwilight @@ -127,7 +127,7 @@ if (!bmseViewerData.Contains(flintFilePath)) { bmseViewerData.AddRange(data.Split(Environment.NewLine)); - await File.WriteAllTextAsync(bmseViewerFilePath, string.Join(Environment.NewLine, bmseViewerData) + Environment.NewLine, Encoding.UTF8).ConfigureAwait(false); + await File.WriteAllTextAsync(bmseViewerFilePath, string.Join(Environment.NewLine, bmseViewerData) + Environment.NewLine, Encoding.UTF8); } var bmseCompiler = new FileIniDataParser(); @@ -147,7 +147,7 @@ else if (File.Exists(bmscFilePath)) { var bmscCompiler = new XmlDocument(); - bmscCompiler.LoadXml(await File.ReadAllTextAsync(bmscFilePath).ConfigureAwait(false)); + bmscCompiler.LoadXml(await File.ReadAllTextAsync(bmscFilePath)); var nodesViewer = bmscCompiler.SelectNodes("/iBMSC/Player/Player").Cast().ToList(); var flintID = nodesViewer.FindIndex(node => Utility.EqualsCaseless(node.Attributes["Path"].Value, flintFilePath)); diff --git a/Qwilight/ViewModel/SiteViewModel.cs b/Qwilight/ViewModel/SiteViewModel.cs index 577a561..f0b70f7 100644 --- a/Qwilight/ViewModel/SiteViewModel.cs +++ b/Qwilight/ViewModel/SiteViewModel.cs @@ -238,7 +238,7 @@ }).Response; if (!string.IsNullOrEmpty(filePath)) { - TwilightSystem.Instance.SendParallel(Event.Types.EventID.PostFile, Path.GetFileName(filePath), UnsafeByteOperations.UnsafeWrap(await File.ReadAllBytesAsync(filePath).ConfigureAwait(false))); + TwilightSystem.Instance.SendParallel(Event.Types.EventID.PostFile, Path.GetFileName(filePath), UnsafeByteOperations.UnsafeWrap(await File.ReadAllBytesAsync(filePath))); } }