diff --git a/Qwilight/Assets/Language.json b/Qwilight/Assets/Language.json index d554d8a..7e3e4a0 100644 --- a/Qwilight/Assets/Language.json +++ b/Qwilight/Assets/Language.json @@ -3175,19 +3175,19 @@ "ko-KR": "실시간 랭킹", "en-US": "Real-time Ranking" }, - "UndoColorContents": { + "InitColorContents": { "ko-KR": "색상 설정을 기본으로 복원합니다.", "en-US": "Reset color settings to their default values." }, - "UndoColorNotify": { + "InitColorNotify": { "ko-KR": "색상 설정을 기본으로 복원할까요?", "en-US": "Do you want to reset the color settings?" }, - "UndoColorOK": { + "InitColorOK": { "ko-KR": "색상 설정이 성공적으로 복원됨", "en-US": "Color settings restored successfully" }, - "UndoColorText": { + "InitColorText": { "ko-KR": "색상 설정 복원", "en-US": "Reset color settings" }, @@ -3411,7 +3411,7 @@ "ko-KR": "폴더가 성공적으로 삭제됨", "en-US": "Folder deleted successfully" }, - "WipeEventNoteContents": { + "WipeEventNoteNotify": { "ko-KR": "이 코스를 삭제할까요?", "en-US": "Delete this course?" }, diff --git a/Qwilight/ICC.cs b/Qwilight/ICC.cs index 26bf75b..885d7a3 100644 --- a/Qwilight/ICC.cs +++ b/Qwilight/ICC.cs @@ -4,8 +4,6 @@ { public enum ID { - ViewEntryWindow, - ViewFileWindow, Quit, ViewPwWindow, ViewInputWindow, diff --git a/Qwilight/MSG/ViewAllowWindow.cs b/Qwilight/MSG/ViewAllowWindow.cs index e102963..270f270 100644 --- a/Qwilight/MSG/ViewAllowWindow.cs +++ b/Qwilight/MSG/ViewAllowWindow.cs @@ -1,6 +1,12 @@ -namespace Qwilight.MSG +using CommunityToolkit.Mvvm.Messaging.Messages; +using Windows.Win32.UI.WindowsAndMessaging; + +namespace Qwilight.MSG { - public sealed class ViewAllowWindow + internal sealed class ViewAllowWindow : RequestMessage { + public string Text { get; init; } + + internal MESSAGEBOX_STYLE Data { get; init; } } } \ No newline at end of file diff --git a/Qwilight/MSG/ViewEntryWindow.cs b/Qwilight/MSG/ViewEntryWindow.cs new file mode 100644 index 0000000..f8b3f94 --- /dev/null +++ b/Qwilight/MSG/ViewEntryWindow.cs @@ -0,0 +1,8 @@ +using CommunityToolkit.Mvvm.Messaging.Messages; + +namespace Qwilight.MSG +{ + internal sealed class ViewEntryWindow : AsyncRequestMessage + { + } +} \ No newline at end of file diff --git a/Qwilight/MSG/ViewFileWindow.cs b/Qwilight/MSG/ViewFileWindow.cs new file mode 100644 index 0000000..df2e2aa --- /dev/null +++ b/Qwilight/MSG/ViewFileWindow.cs @@ -0,0 +1,9 @@ +using CommunityToolkit.Mvvm.Messaging.Messages; + +namespace Qwilight.MSG +{ + internal sealed class ViewFileWindow : AsyncRequestMessage + { + public IEnumerable Filters { get; init; } + } +} \ No newline at end of file diff --git a/Qwilight/QwilightComponent.cs b/Qwilight/QwilightComponent.cs index efdd1ca..67bc80e 100644 --- a/Qwilight/QwilightComponent.cs +++ b/Qwilight/QwilightComponent.cs @@ -44,7 +44,7 @@ public static readonly string[] BMSNoteFileFormats = new[] { ".bms", ".bme", ".bml", ".pms" }; public static readonly string[] BMSONNoteFileFormats = new[] { ".bmson" }; public static readonly string[] NoteFileFormats = BMSNoteFileFormats.Concat(BMSONNoteFileFormats).ToArray(); - public static readonly string[] AudioFileFormatItems = new[] { ".aif", ".aiff", ".asf", ".flac", ".m4a", ".mid", ".midi", ".mp2", ".mp3", ".ogg", ".opus", ".raw", ".wav", ".wma" }; + public static readonly string[] AudioFileFormats = new[] { ".aif", ".aiff", ".asf", ".flac", ".m4a", ".mid", ".midi", ".mp2", ".mp3", ".ogg", ".opus", ".raw", ".wav", ".wma" }; public static readonly string[] DrawingFileFormats = new[] { ".bmp", ".gif", ".jpeg", ".jpg", ".png" }; public static readonly string[] MediaFileFormats = new[] { ".avi", ".flv", ".m1v", ".mkv", ".mov", ".mp4", ".mpeg", ".mpg", ".wmv" }; public static readonly string HashText = Utility.GetID512s(File.ReadAllBytes(Path.Combine(AppContext.BaseDirectory, "Qwilight.dll"))); diff --git a/Qwilight/System/Configure/Configure.cs b/Qwilight/System/Configure/Configure.cs index 125ceb6..4bff1b2 100644 --- a/Qwilight/System/Configure/Configure.cs +++ b/Qwilight/System/Configure/Configure.cs @@ -2206,7 +2206,7 @@ Utility.CopyFile(_fileName, _tmp0FileName); Utility.MoveFile(_tmp0FileName, _tmp1FileName); - Utility.SaveText(_fileName, Utility.SetJSON(this, new JsonSerializerOptions + File.WriteAllText(_fileName, Utility.SetJSON(this, new JsonSerializerOptions { Converters = { @@ -2216,7 +2216,7 @@ IgnoreReadOnlyProperties = true, IncludeFields = true, WriteIndented = QwilightComponent.IsVS - })); + }), Encoding.UTF8); Utility.WipeFile(_tmp1FileName); } diff --git a/Qwilight/System/Configure/GPUConfigure.cs b/Qwilight/System/Configure/GPUConfigure.cs index ad6b046..df65133 100644 --- a/Qwilight/System/Configure/GPUConfigure.cs +++ b/Qwilight/System/Configure/GPUConfigure.cs @@ -1,7 +1,6 @@ using Qwilight.Utilities; using System.IO; using System.Text; -using System.Text.Json; using System.Text.Json.Serialization; namespace Qwilight @@ -64,10 +63,7 @@ { Utility.CopyFile(_fileName, _tmp0FileName); Utility.MoveFile(_tmp0FileName, _tmp1FileName); - Utility.SaveText(_fileName, Utility.SetJSON(this, new JsonSerializerOptions - { - WriteIndented = QwilightComponent.IsVS - })); + File.WriteAllText(_fileName, Utility.SetJSON(this), Encoding.UTF8); Utility.WipeFile(_tmp1FileName); } diff --git a/Qwilight/System/DrawingSystem/DrawingSystem.cs b/Qwilight/System/DrawingSystem/DrawingSystem.cs index cd5ddda..4f5e6a3 100644 --- a/Qwilight/System/DrawingSystem/DrawingSystem.cs +++ b/Qwilight/System/DrawingSystem/DrawingSystem.cs @@ -5,6 +5,7 @@ using Microsoft.Graphics.Canvas.Text; using Microsoft.UI; using Qwilight.Compute; +using Qwilight.MSG; using Qwilight.Note; using Qwilight.UIComponent; using Qwilight.Utilities; @@ -124,22 +125,15 @@ { CanvasDevice.GetSharedDevice().DeviceLost += (sender, args) => { + StrongReferenceMessenger.Default.Send(new ViewAllowWindow + { + Text = LanguageSystem.Instance.D2DSystemFault, + Data = MESSAGEBOX_STYLE.MB_OK | MESSAGEBOX_STYLE.MB_ICONERROR + }); WeakReferenceMessenger.Default.Send(new ICC { - IDValue = ICC.ID.ViewAllowWindow, - Contents = new object[] - { - LanguageSystem.Instance.D2DSystemFault, - MESSAGEBOX_STYLE.MB_OK | MESSAGEBOX_STYLE.MB_ICONERROR, - new Action(r => - { - WeakReferenceMessenger.Default.Send(new ICC - { - IDValue = ICC.ID.Quit, - Contents = false - }); - }) - } + IDValue = ICC.ID.Quit, + Contents = false }); }; diff --git a/Qwilight/System/LanguageSystem/LanguageSystem.g.cs b/Qwilight/System/LanguageSystem/LanguageSystem.g.cs index fd37b9e..4c4fd97 100644 --- a/Qwilight/System/LanguageSystem/LanguageSystem.g.cs +++ b/Qwilight/System/LanguageSystem/LanguageSystem.g.cs @@ -796,10 +796,10 @@ public string UIMainDrawingPaint { get; set; } public string UIMainJudgmentMeter { get; set; } public string UINet { get; set; } - public string UndoColorContents { get; set; } - public string UndoColorNotify { get; set; } - public string UndoColorOK { get; set; } - public string UndoColorText { get; set; } + public string InitColorContents { get; set; } + public string InitColorNotify { get; set; } + public string InitColorOK { get; set; } + public string InitColorText { get; set; } public string UndoContents { get; set; } public string ValidNetMode0Text { get; set; } public string ValidNetMode1Text { get; set; } @@ -855,7 +855,7 @@ public string WipedSiteYell { get; set; } public string WipeEntryItemNotify { get; set; } public string WipeEntryOK { get; set; } - public string WipeEventNoteContents { get; set; } + public string WipeEventNoteNotify { get; set; } public string WipeFavoriteEntryNotify { get; set; } public string WipeFavoritesF10 { get; set; } public string WipeHandled { get; set; } diff --git a/Qwilight/System/LevelSystem.cs b/Qwilight/System/LevelSystem.cs index 99a4ddd..891b0dd 100644 --- a/Qwilight/System/LevelSystem.cs +++ b/Qwilight/System/LevelSystem.cs @@ -122,14 +122,14 @@ if (levelTable.HasValue) { var levelTableValue = levelTable.Value; - var savingBundleItem = new NotifyItem + var savingLevelItem = new NotifyItem { Text = LanguageSystem.Instance.SavingLevelContents, Variety = NotifySystem.NotifyVariety.Levying, OnStop = isTotal => false }; - HandlingUISystem.Instance.HandleParallel(() => ViewModels.Instance.NotifyValue.NotifyItemCollection.Insert(0, savingBundleItem)); - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text); + HandlingUISystem.Instance.HandleParallel(() => ViewModels.Instance.NotifyValue.NotifyItemCollection.Insert(0, savingLevelItem)); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savingLevelItem.Text); var target = ModifyDataValue(levelTableValue.data_url); var levelTableFileName = levelTableValue.name; foreach (var targetFileName in Path.GetInvalidFileNameChars()) @@ -142,13 +142,13 @@ using (var fs = File.Open(Path.Combine(EntryPath, $"{levelTableFileName}.json"), FileMode.Create)) using (var ts = await wwwClient.GetAsync(target).ConfigureAwait(false)) { - savingBundleItem.QuitStatus = ts.Content.Headers.ContentLength ?? 0L; + savingLevelItem.QuitStatus = ts.Content.Headers.ContentLength ?? 0L; var length = 0; while ((length = await (await ts.Content.ReadAsStreamAsync().ConfigureAwait(false)).ReadAsync(data.AsMemory(0, data.Length)).ConfigureAwait(false)) > 0) { await fs.WriteAsync(data.AsMemory(0, length)).ConfigureAwait(false); - savingBundleItem.LevyingStatus += length; - savingBundleItem.NotifyBundleStatus(); + savingLevelItem.LevyingStatus += length; + savingLevelItem.NotifyBundleStatus(); } } } @@ -156,9 +156,9 @@ { await s.CopyToAsync(fs).ConfigureAwait(false); } - savingBundleItem.Variety = NotifySystem.NotifyVariety.Quit; - savingBundleItem.Text = LanguageSystem.Instance.SavedLevelContents; - savingBundleItem.OnStop = isTotal => true; + savingLevelItem.Variety = NotifySystem.NotifyVariety.Quit; + savingLevelItem.Text = LanguageSystem.Instance.SavedLevelContents; + savingLevelItem.OnStop = isTotal => true; NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, LanguageSystem.Instance.SavedLevelContents); Configure.Instance.LevelTargetMap[levelTableFileName] = www; LoadLevelFiles(); diff --git a/Qwilight/System/TelnetSystem/DefaultTelnetSystem.cs b/Qwilight/System/TelnetSystem/DefaultTelnetSystem.cs index d589990..9501d2a 100644 --- a/Qwilight/System/TelnetSystem/DefaultTelnetSystem.cs +++ b/Qwilight/System/TelnetSystem/DefaultTelnetSystem.cs @@ -1,6 +1,7 @@ using CommunityToolkit.Mvvm.Messaging; using Qwilight.Compiler; using Qwilight.Compute; +using Qwilight.MSG; using Qwilight.NoteFile; using Qwilight.Utilities; using Qwilight.ViewModel; @@ -23,7 +24,7 @@ _handleTelnet = handleTelnet; } - public void HandleSystem() => Utility.HandleParallelly(() => + public void HandleSystem() => Utility.HandleParallelly(async () => { while (_isAvailable) { @@ -130,55 +131,52 @@ NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, _handleTelnet.IsAlwaysNewStand.ToString()); break; case ConsoleKey.T: - WeakReferenceMessenger.Default.Send(new() + var fileName = await StrongReferenceMessenger.Default.Send(); + if (!string.IsNullOrEmpty(fileName)) { - IDValue = ICC.ID.ViewEntryWindow, - Contents = new Action(fileName => + ViewModels.Instance.MainValue.ModeComponentValue.Salt = 0; + Utility.HandleLowlyParallelly(new ConcurrentBag(ViewModels.Instance.MainValue.EntryItems.SelectMany(entryItem => entryItem.WellNoteFiles.Where(noteFile => !noteFile.IsLogical))), Configure.Instance.UIBin, noteFile => { - ViewModels.Instance.MainValue.ModeComponentValue.Salt = 0; - Utility.HandleLowlyParallelly(new ConcurrentBag(ViewModels.Instance.MainValue.EntryItems.SelectMany(entryItem => entryItem.WellNoteFiles.Where(noteFile => !noteFile.IsLogical))), Configure.Instance.UIBin, noteFile => - { - Console.WriteLine(noteFile.NoteFilePath); - var targetCompiler = BaseCompiler.GetCompiler(noteFile, null); - var defaultComputer = new TestCompute(noteFile); - targetCompiler.Compile(defaultComputer); - var noteID = noteFile.GetNoteID512(); - noteID = noteID.Substring(0, noteID.IndexOf(':')); - File.WriteAllBytes(Path.Combine(fileName, Path.ChangeExtension(noteID, Path.GetExtension(noteFile.NoteFilePath))), noteFile.GetContents()); - var builder = new StringBuilder(); - builder.AppendLine(defaultComputer.IsAutoLongNote.ToString()); - builder.AppendLine(defaultComputer.IsBanned.ToString()); - builder.AppendLine(defaultComputer.InputMode.ToString()); - builder.AppendLine(defaultComputer.Genre); - builder.AppendLine(defaultComputer.Artist); - builder.AppendLine(defaultComputer.Title); - builder.AppendLine(defaultComputer.LevelText); - builder.AppendLine(defaultComputer.LevelTextValue.ToString()); - builder.AppendLine(defaultComputer.LevyingBPM.ToString()); - builder.AppendLine(defaultComputer.BPM.ToString()); - builder.AppendLine(defaultComputer.Length.ToString()); - builder.AppendLine(defaultComputer.TotalNotes.ToString()); - builder.AppendLine(defaultComputer.AutoableNotes.ToString()); - builder.AppendLine(defaultComputer.TrapNotes.ToString()); - builder.AppendLine(defaultComputer.LongNotes.ToString()); - builder.AppendLine(defaultComputer.JudgmentStage.ToString()); - builder.AppendLine(defaultComputer.HitPointsValue.ToString()); - builder.AppendLine(defaultComputer.LevelValue.ToString()); - builder.AppendLine(defaultComputer.NoteDrawingName); - builder.AppendLine(defaultComputer.BannerDrawingName); - builder.AppendLine(defaultComputer.TrailerAudioName); - builder.AppendLine(defaultComputer.AudioLevyingPosition.ToString()); - builder.AppendLine(defaultComputer.IsSalt.ToString()); - builder.AppendLine(defaultComputer.Tag); - builder.AppendLine(defaultComputer.LowestBPM.ToString()); - builder.AppendLine(defaultComputer.HighestBPM.ToString()); - builder.AppendLine(defaultComputer.HighestInputCount.ToString()); - builder.AppendLine(defaultComputer.IsHellBPM.ToString()); - File.WriteAllText(Path.Combine(fileName, Path.ChangeExtension(noteID, ".txt")), builder.ToString(), Encoding.UTF8); - }); - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, "OK"); - }) - }); + Console.WriteLine(noteFile.NoteFilePath); + var targetCompiler = BaseCompiler.GetCompiler(noteFile, null); + var defaultComputer = new TestCompute(noteFile); + targetCompiler.Compile(defaultComputer); + var noteID = noteFile.GetNoteID512(); + noteID = noteID.Substring(0, noteID.IndexOf(':')); + File.WriteAllBytes(Path.Combine(fileName, Path.ChangeExtension(noteID, Path.GetExtension(noteFile.NoteFilePath))), noteFile.GetContents()); + var builder = new StringBuilder(); + builder.AppendLine(defaultComputer.IsAutoLongNote.ToString()); + builder.AppendLine(defaultComputer.IsBanned.ToString()); + builder.AppendLine(defaultComputer.InputMode.ToString()); + builder.AppendLine(defaultComputer.Genre); + builder.AppendLine(defaultComputer.Artist); + builder.AppendLine(defaultComputer.Title); + builder.AppendLine(defaultComputer.LevelText); + builder.AppendLine(defaultComputer.LevelTextValue.ToString()); + builder.AppendLine(defaultComputer.LevyingBPM.ToString()); + builder.AppendLine(defaultComputer.BPM.ToString()); + builder.AppendLine(defaultComputer.Length.ToString()); + builder.AppendLine(defaultComputer.TotalNotes.ToString()); + builder.AppendLine(defaultComputer.AutoableNotes.ToString()); + builder.AppendLine(defaultComputer.TrapNotes.ToString()); + builder.AppendLine(defaultComputer.LongNotes.ToString()); + builder.AppendLine(defaultComputer.JudgmentStage.ToString()); + builder.AppendLine(defaultComputer.HitPointsValue.ToString()); + builder.AppendLine(defaultComputer.LevelValue.ToString()); + builder.AppendLine(defaultComputer.NoteDrawingName); + builder.AppendLine(defaultComputer.BannerDrawingName); + builder.AppendLine(defaultComputer.TrailerAudioName); + builder.AppendLine(defaultComputer.AudioLevyingPosition.ToString()); + builder.AppendLine(defaultComputer.IsSalt.ToString()); + builder.AppendLine(defaultComputer.Tag); + builder.AppendLine(defaultComputer.LowestBPM.ToString()); + builder.AppendLine(defaultComputer.HighestBPM.ToString()); + builder.AppendLine(defaultComputer.HighestInputCount.ToString()); + builder.AppendLine(defaultComputer.IsHellBPM.ToString()); + File.WriteAllText(Path.Combine(fileName, Path.ChangeExtension(noteID, ".txt")), builder.ToString(), Encoding.UTF8); + }); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, "OK"); + } break; } } diff --git a/Qwilight/System/TwilightSystem.cs b/Qwilight/System/TwilightSystem.cs index b2b8862..5ff2c43 100644 --- a/Qwilight/System/TwilightSystem.cs +++ b/Qwilight/System/TwilightSystem.cs @@ -2,6 +2,7 @@ using Google.Protobuf; using Ionic.Zip; using Qwilight.Compute; +using Qwilight.MSG; using Qwilight.UIComponent; using Qwilight.Utilities; using Qwilight.View; @@ -1543,22 +1544,14 @@ } else { - WeakReferenceMessenger.Default.Send(new() + if (StrongReferenceMessenger.Default.Send(new ViewAllowWindow { - IDValue = ICC.ID.ViewAllowWindow, - Contents = new object[] - { - string.Format(LanguageSystem.Instance.SaveDefaultNoteNotify, DateTimeOffset.FromUnixTimeMilliseconds(date).LocalDateTime.ToLongDateString()), - MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, - new Action(r => - { - if (r == MESSAGEBOX_RESULT.IDYES) - { - GetDefaultNote(); - } - }) - } - }); + Text = string.Format(LanguageSystem.Instance.SaveDefaultNoteNotify, DateTimeOffset.FromUnixTimeMilliseconds(date).LocalDateTime.ToLongDateString()), + Data = MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1 + }) == MESSAGEBOX_RESULT.IDYES) + { + GetDefaultNote(); + } } void GetDefaultNote() @@ -1582,22 +1575,14 @@ } else { - WeakReferenceMessenger.Default.Send(new() + if (StrongReferenceMessenger.Default.Send(new ViewAllowWindow { - IDValue = ICC.ID.ViewAllowWindow, - Contents = new object[] - { - string.Format(LanguageSystem.Instance.SaveDefaultUINotify, DateTimeOffset.FromUnixTimeMilliseconds(date).LocalDateTime.ToLongDateString()), - MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, - new Action(r => - { - if (r == MESSAGEBOX_RESULT.IDYES) - { - GetDefaultUI(); - } - }) - } - }); + Text = string.Format(LanguageSystem.Instance.SaveDefaultUINotify, DateTimeOffset.FromUnixTimeMilliseconds(date).LocalDateTime.ToLongDateString()), + Data = MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1 + }) == MESSAGEBOX_RESULT.IDYES) + { + GetDefaultUI(); + } } void GetDefaultUI() diff --git a/Qwilight/UIComponent/BundleItem.cs b/Qwilight/UIComponent/BundleItem.cs index 3114a21..91eca17 100644 --- a/Qwilight/UIComponent/BundleItem.cs +++ b/Qwilight/UIComponent/BundleItem.cs @@ -1,5 +1,6 @@ using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Messaging; +using Qwilight.MSG; using Qwilight.ViewModel; using Windows.Win32.UI.WindowsAndMessaging; @@ -57,26 +58,21 @@ }); [RelayCommand] - void OnWipe() => WeakReferenceMessenger.Default.Send(new() + void OnWipe() { - IDValue = ICC.ID.ViewAllowWindow, - Contents = new object[] + if (StrongReferenceMessenger.Default.Send(new ViewAllowWindow { - LanguageSystem.Instance.WipeBundleNotify, - MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1, - new Action(r => - { - if (r == MESSAGEBOX_RESULT.IDYES) - { - BundleCollection.Remove(this); - var bundleViewModel = ViewModels.Instance.BundleValue; - bundleViewModel.TargetValue -= Length; - bundleViewModel.NotifyUI(); - TwilightSystem.Instance.SendParallel(Event.Types.EventID.WipeBundle, Name); - } - }) + Text = LanguageSystem.Instance.WipeBundleNotify, + Data = MESSAGEBOX_STYLE.MB_YESNO | MESSAGEBOX_STYLE.MB_ICONQUESTION | MESSAGEBOX_STYLE.MB_DEFBUTTON1 + }) == MESSAGEBOX_RESULT.IDYES) + { + BundleCollection.Remove(this); + var bundleViewModel = ViewModels.Instance.BundleValue; + bundleViewModel.TargetValue -= Length; + bundleViewModel.NotifyUI(); + TwilightSystem.Instance.SendParallel(Event.Types.EventID.WipeBundle, Name); } - }); + } public BundleItem(BundleCompetence bundleCompetence) => _bundleCompetence = bundleCompetence; } diff --git a/Qwilight/Utilities/IOUtility.cs b/Qwilight/Utilities/IOUtility.cs index 56aa4d4..6e66b1b 100644 --- a/Qwilight/Utilities/IOUtility.cs +++ b/Qwilight/Utilities/IOUtility.cs @@ -70,24 +70,12 @@ } } - public static void SaveText(string filePath, string text, Encoding format = null) - { - try - { - Directory.CreateDirectory(Path.GetDirectoryName(filePath)); - File.WriteAllText(filePath, text, format ?? Encoding.UTF8); - } - catch - { - } - } - public static (string, string) SetFault(string faultEntryPath, Exception e) { var faultFilePath = Path.Combine(faultEntryPath, Path.GetInvalidFileNameChars().Aggregate($"{DateTime.Now:F}.log", (faultFileName, target) => faultFileName.Replace(target, ' '))); var faultText = Utility.GetFault(e); Console.WriteLine(faultText); - SaveText(faultFilePath, faultText); + File.WriteAllText(faultFilePath, faultText, Encoding.UTF8); return (faultFilePath, faultText); } diff --git a/Qwilight/Utilities/JSONUtility.cs b/Qwilight/Utilities/JSONUtility.cs index dc417c2..7c484f0 100644 --- a/Qwilight/Utilities/JSONUtility.cs +++ b/Qwilight/Utilities/JSONUtility.cs @@ -33,6 +33,7 @@ new XORFloat64Modifier() }, IncludeFields = true, + IgnoreReadOnlyProperties = true, WriteIndented = QwilightComponent.IsVS }; diff --git a/Qwilight/Utilities/Utility.cs b/Qwilight/Utilities/Utility.cs index e0cd97f..d1cbc3c 100644 --- a/Qwilight/Utilities/Utility.cs +++ b/Qwilight/Utilities/Utility.cs @@ -358,7 +358,7 @@ public static AvailableFlag GetAvailable(string filePath) { - foreach (var audioFileFormat in QwilightComponent.AudioFileFormatItems) + foreach (var audioFileFormat in QwilightComponent.AudioFileFormats) { if (filePath.IsTailCaselsss(audioFileFormat)) { diff --git a/Qwilight/View/AvatarWindow.xaml.cs b/Qwilight/View/AvatarWindow.xaml.cs index fb7e70f..eef082c 100644 --- a/Qwilight/View/AvatarWindow.xaml.cs +++ b/Qwilight/View/AvatarWindow.xaml.cs @@ -7,6 +7,6 @@ { public AvatarWindow() => InitializeComponent(); - void OnAvatarDrawing(object sender, MouseButtonEventArgs e) => (DataContext as AvatarViewModel).OnAvatarDrawing(); + void OnAvatarDrawing(object sender, MouseButtonEventArgs e) => _ = (DataContext as AvatarViewModel).OnAvatarDrawing(); } } \ No newline at end of file diff --git a/Qwilight/View/ConfigureWindow/ComputingGUIConfigureWindow.xaml.cs b/Qwilight/View/ConfigureWindow/ComputingGUIConfigureWindow.xaml.cs index ea16cdc..18b4d6f 100644 --- a/Qwilight/View/ConfigureWindow/ComputingGUIConfigureWindow.xaml.cs +++ b/Qwilight/View/ConfigureWindow/ComputingGUIConfigureWindow.xaml.cs @@ -10,7 +10,7 @@ public ComputingGUIConfigureWindow() => InitializeComponent(); - void OnVeilDrawing(object sender, MouseButtonEventArgs e) => (DataContext as ConfigureViewModel).OnVeilDrawing(); + void OnVeilDrawing(object sender, MouseButtonEventArgs e) => _ = (DataContext as ConfigureViewModel).OnVeilDrawing(); void OnComputingPointed(object sender, DragStartedEventArgs e) => (DataContext as ConfigureViewModel).OnComputingPointed(); diff --git a/Qwilight/View/ConfigureWindow/DefaultConfigureWindow.xaml b/Qwilight/View/ConfigureWindow/DefaultConfigureWindow.xaml index 4c74e5c..427c3bb 100644 --- a/Qwilight/View/ConfigureWindow/DefaultConfigureWindow.xaml +++ b/Qwilight/View/ConfigureWindow/DefaultConfigureWindow.xaml @@ -76,8 +76,8 @@ -