diff --git a/Qwilight/Assets/Language.json b/Qwilight/Assets/Language.json index 2da5b10..d68c99f 100644 --- a/Qwilight/Assets/Language.json +++ b/Qwilight/Assets/Language.json @@ -851,6 +851,10 @@ "ko-KR": "롱 노트 모드를 적용하지 않습니다.", "en-US": "Does not apply long note mode." }, + "DefaultNotify": { + "ko-KR": "메시지 알림 ({0} 개)", + "en-US": "Message notifications ({0})" + }, "DefaultPutCopyNotesText": { "ko-KR": "노트 복사하지 않기", "en-US": "Don't copy notes" @@ -1299,6 +1303,10 @@ "ko-KR": "#,##0 개 출력", "en-US": "#,##0 output" }, + "HandlingNotify": { + "ko-KR": "작업 알림 ({0} 개)", + "en-US": "Job notifications ({0})" + }, "HasNotEventNoteNoteFile": { "ko-KR": "노트 파일을 먼저 불러오세요", "en-US": "Load the chart file first." @@ -2768,6 +2776,10 @@ "en-US": "Skip it" }, "PassNotify": { + "ko-KR": "기록 추월 알림 ({0} 개)", + "en-US": "Record overtaking notifications ({0})" + }, + "PassNotifyText": { "ko-KR": "{0}의 기록을 {1}님이 추월함", "en-US": "{1} has overtaken the record of {0}" }, @@ -3579,6 +3591,10 @@ "ko-KR": "뒤로 가기 ({0})", "en-US": "Go Back ({0})" }, + "WaitingDefaultNotifyContents": { + "ko-KR": "F11 키로 도착한 {0} 개의 메시지 알림을 확인하세요", + "en-US": "Press F11 to see the {0} message notifications that have arrived" + }, "WaitingIOContents": { "ko-KR": "관전 동기화 중…", "en-US": "Synchronizing observations…" @@ -3587,9 +3603,9 @@ "ko-KR": "다른 플레이어를 기다리는 중…", "en-US": "Waiting for another player…" }, - "WaitingNotifyContents": { - "ko-KR": "F11 키로 도착한 {0}개의 알림을 확인하세요", - "en-US": "Check {0} alerts that arrived with F11 keys." + "WaitingPassNotifyContents": { + "ko-KR": "F11 키로 도착한 {0} 개의 기록 추월 알림을 확인하세요", + "en-US": "Press F11 to see the {0} record overtake notifications that have arrived" }, "WaitSiteContents": { "ko-KR": "대화방에 자동으로 입장하지 않습니다.", diff --git a/Qwilight/JSON.cs b/Qwilight/JSON.cs index 2e544f5..72a90b6 100644 --- a/Qwilight/JSON.cs +++ b/Qwilight/JSON.cs @@ -255,6 +255,7 @@ public string artist; public string genre; public string levelText; + public string avatarID; public string avatarName; public string noteID; } diff --git a/Qwilight/Qwilight.csproj b/Qwilight/Qwilight.csproj index 784ae90..5bc3809 100644 --- a/Qwilight/Qwilight.csproj +++ b/Qwilight/Qwilight.csproj @@ -10,7 +10,7 @@ Qwilight.ico Taehui 불로그 - 1.16.38 + 1.16.39 true enable false diff --git a/Qwilight/System/LanguageSystem/LanguageSystem.g.cs b/Qwilight/System/LanguageSystem/LanguageSystem.g.cs index f5849fc..b3f005e 100644 --- a/Qwilight/System/LanguageSystem/LanguageSystem.g.cs +++ b/Qwilight/System/LanguageSystem/LanguageSystem.g.cs @@ -215,6 +215,7 @@ public string DefaultModeContents { get; set; } public string DefaultNoteAssister { get; set; } public string DefaultNoteModifyContents { get; set; } + public string DefaultNotify { get; set; } public string DefaultPutCopyNotesText { get; set; } public string DefaultSaltModeContents { get; set; } public string DefaultSetNoteModeContents { get; set; } @@ -327,6 +328,7 @@ public string HandleUndoContents { get; set; } public string HandlingAudioCountText { get; set; } public string HandlingCountContents { get; set; } + public string HandlingNotify { get; set; } public string HasNotEventNoteNoteFile { get; set; } public string HasNotIONoteFile { get; set; } public string HasNotNetNoteFile { get; set; } @@ -695,6 +697,7 @@ public string P2SymmetricCopyNotesText { get; set; } public string PassContents { get; set; } public string PassNotify { get; set; } + public string PassNotifyText { get; set; } public string PauseAssist { get; set; } public string PlatformAutoComputing { get; set; } public string PlatformCommentComputing { get; set; } @@ -897,9 +900,10 @@ public string VoidPutSetNoteModeContents { get; set; } public string VoteText { get; set; } public string WaitContents { get; set; } + public string WaitingDefaultNotifyContents { get; set; } public string WaitingIOContents { get; set; } public string WaitingNetContents { get; set; } - public string WaitingNotifyContents { get; set; } + public string WaitingPassNotifyContents { get; set; } public string WaitSiteContents { get; set; } public string WaitUnitContents { get; set; } public string WantAverageInputCountContents { get; set; } diff --git a/Qwilight/System/LevelSystem.cs b/Qwilight/System/LevelSystem.cs index befd144..ade7f31 100644 --- a/Qwilight/System/LevelSystem.cs +++ b/Qwilight/System/LevelSystem.cs @@ -138,14 +138,14 @@ if (levelTable.HasValue) { var levelTableValue = levelTable.Value; - var savingLevelItem = new NotifyItem + var levelNotifyItem = new NotifyItem { Text = LanguageSystem.Instance.SavingLevelContents, - Variety = NotifySystem.NotifyVariety.Levying, + Variety = NotifySystem.NotifyVariety.Handling, OnStop = wipeTotal => false }; - UIHandler.Instance.HandleParallel(() => ViewModels.Instance.NotifyValue.NotifyItemCollection.Insert(0, savingLevelItem)); - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savingLevelItem.Text, false, null, null, NotifySystem.SaveLevelID); + UIHandler.Instance.HandleParallel(() => ViewModels.Instance.NotifyValue.HandlingNotifyItemCollection.Insert(0, levelNotifyItem)); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, levelNotifyItem.Text, false, null, null, NotifySystem.SaveLevelID); var target = ModifyDataValue(levelTableValue.data_url, www); var levelTableFileName = levelTableValue.name; foreach (var targetFileName in Path.GetInvalidFileNameChars()) @@ -157,7 +157,7 @@ wwwClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0"); using (var hrm = await wwwClient.GetAsync(target, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false)) { - savingLevelItem.MaxStatus = hrm.Content.Headers.ContentLength ?? 0L; + 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)) @@ -166,7 +166,7 @@ while ((length = await ws.ReadAsync(data.AsMemory(0, data.Length)).ConfigureAwait(false)) > 0) { await fs.WriteAsync(data.AsMemory(0, length)); - savingLevelItem.Status += length; + levelNotifyItem.Status += length; } } } @@ -175,9 +175,9 @@ s.Position = 0; await s.CopyToAsync(fs); } - savingLevelItem.Variety = NotifySystem.NotifyVariety.Quit; - savingLevelItem.Text = LanguageSystem.Instance.SavedLevelContents; - savingLevelItem.OnStop = wipeTotal => true; + levelNotifyItem.Variety = NotifySystem.NotifyVariety.Stopped; + levelNotifyItem.Text = LanguageSystem.Instance.SavedLevelContents; + levelNotifyItem.OnStop = wipeTotal => true; NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, LanguageSystem.Instance.SavedLevelContents, false, null, null, NotifySystem.SaveLevelID); Configure.Instance.LevelTargetMap[levelTableFileName] = www; LoadLevelFiles(); diff --git a/Qwilight/System/NotifySystem.cs b/Qwilight/System/NotifySystem.cs index 4851820..feffbfe 100644 --- a/Qwilight/System/NotifySystem.cs +++ b/Qwilight/System/NotifySystem.cs @@ -17,7 +17,7 @@ public enum NotifyVariety { - OK, Fault, Warning, Info, Levying, Stopped, Quit + OK, Fault, Warning, Info, Handling, Cancelled, Stopped } public enum NotifyConfigure @@ -27,19 +27,41 @@ public static readonly NotifySystem Instance = new(); - int _toNotifyID; + int _defaultNotifyID; - public void NotifyPending() => UIHandler.Instance.HandleParallel(() => + public void NotifyPendingDefaultNotify() => UIHandler.Instance.HandleParallel(() => { - var toNotifyCount = ViewModels.Instance.NotifyValue.NotifyItemCollection.Count(toNotifyItem => + var defaultNotifyCount = ViewModels.Instance.NotifyValue.DefaultNotifyItemCollection.Count(defaultNotifyItem => { - var isNew = toNotifyItem.IsNew; - toNotifyItem.IsNew = false; - return isNew; + var isNew = defaultNotifyItem.IsNew; + defaultNotifyItem.IsNew = false; + return defaultNotifyItem.IsNew; }); - if (toNotifyCount > 0) + if (defaultNotifyCount > 0) { - Notify(NotifyVariety.Info, NotifyConfigure.NotSave, string.Format(LanguageSystem.Instance.WaitingNotifyContents, toNotifyCount)); + Notify(NotifyVariety.Info, NotifyConfigure.NotSave, string.Format(LanguageSystem.Instance.WaitingDefaultNotifyContents, defaultNotifyCount), false, null, () => + { + ViewModels.Instance.NotifyValue.TabPosition = 0; + ViewModels.Instance.NotifyValue.Open(); + }); + } + }); + + public void NotifyPendingPassNotify() => UIHandler.Instance.HandleParallel(() => + { + var passNotifyCount = ViewModels.Instance.NotifyValue.PassNotifyItemCollection.Count(passNotifyItem => + { + var isNew = passNotifyItem.IsNew; + passNotifyItem.IsNew = false; + return passNotifyItem.IsNew; + }); + if (passNotifyCount > 0) + { + Notify(NotifyVariety.Info, NotifyConfigure.NotSave, string.Format(LanguageSystem.Instance.WaitingPassNotifyContents, passNotifyCount), false, null, () => + { + ViewModels.Instance.NotifyValue.TabPosition = 2; + ViewModels.Instance.NotifyValue.Open(); + }); } }); @@ -104,7 +126,7 @@ }, Contents = toNotify, OnHandle = onHandle, - ID = toNotifyID ?? ++_toNotifyID + ID = toNotifyID ?? ++_defaultNotifyID }); return true; } @@ -113,12 +135,7 @@ void Save(NotifyVariety toNotifyVariety, string toNotify, bool isNew) { - var toNotifyCollection = ViewModels.Instance.NotifyValue.NotifyItemCollection; - if (toNotifyCollection.Count == 100) - { - toNotifyCollection.RemoveAt(99); - } - toNotifyCollection.Insert(0, new() + ViewModels.Instance.NotifyValue.DefaultNotifyItemCollection.Insert(0, new() { Variety = toNotifyVariety, Text = toNotify, diff --git a/Qwilight/System/TelnetSystem/DefaultTelnetSystem.cs b/Qwilight/System/TelnetSystem/DefaultTelnetSystem.cs index dc8b8c8..2df3199 100644 --- a/Qwilight/System/TelnetSystem/DefaultTelnetSystem.cs +++ b/Qwilight/System/TelnetSystem/DefaultTelnetSystem.cs @@ -3,6 +3,7 @@ using Qwilight.Compute; using Qwilight.MSG; using Qwilight.NoteFile; +using Qwilight.UIComponent; using Qwilight.Utilities; using Qwilight.ViewModel; using System.Collections.Concurrent; @@ -106,20 +107,63 @@ break; case ConsoleKey.N: Console.Clear(); - Console.WriteLine("1, 2, 3, 4"); + Console.WriteLine("1, 2, 3, 4, 5, 6, 7, 8"); switch (Console.ReadKey(true).Key) { case ConsoleKey.D1: - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, Guid.NewGuid().ToString()); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, Guid.NewGuid().ToString(), true); break; case ConsoleKey.D2: - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, Guid.NewGuid().ToString()); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, Guid.NewGuid().ToString(), true); break; case ConsoleKey.D3: - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, Guid.NewGuid().ToString()); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, Guid.NewGuid().ToString(), true); break; case ConsoleKey.D4: - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, Guid.NewGuid().ToString()); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, Guid.NewGuid().ToString(), true); + break; + case ConsoleKey.D5: + var valueNotifyItem = new NotifyItem + { + Text = Guid.NewGuid().ToString(), + Variety = NotifySystem.NotifyVariety.Handling + }; + UIHandler.Instance.HandleParallel(() => ViewModels.Instance.NotifyValue.HandlingNotifyItemCollection.Insert(0, valueNotifyItem)); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, valueNotifyItem.Text, true); + break; + case ConsoleKey.D6: + valueNotifyItem = new NotifyItem + { + Text = Guid.NewGuid().ToString(), + Variety = NotifySystem.NotifyVariety.Cancelled + }; + UIHandler.Instance.HandleParallel(() => ViewModels.Instance.NotifyValue.HandlingNotifyItemCollection.Insert(0, valueNotifyItem)); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, valueNotifyItem.Text, true); + break; + case ConsoleKey.D7: + valueNotifyItem = new NotifyItem + { + Text = Guid.NewGuid().ToString(), + Variety = NotifySystem.NotifyVariety.Stopped + }; + UIHandler.Instance.HandleParallel(() => ViewModels.Instance.NotifyValue.HandlingNotifyItemCollection.Insert(0, valueNotifyItem)); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, valueNotifyItem.Text, true); + break; + case ConsoleKey.D8: + var mainViewModel = ViewModels.Instance.MainValue; + var noteFile = mainViewModel.EntryItemValue?.NoteFile; + if (noteFile != null) + { + var passNotifyItem = new NotifyItem + { + Text = string.Format(LanguageSystem.Instance.PassNotifyText, noteFile.PlatformText, TwilightSystem.Instance.AvatarName), + Variety = NotifySystem.NotifyVariety.Info, + OnHandle = async () => await mainViewModel.MoveEntryItemsView(noteFile.GetNoteID512()), + AvatarWwwValue = new(TwilightSystem.Instance.AvatarID) + }; + UIHandler.Instance.HandleParallel(() => ViewModels.Instance.NotifyValue.PassNotifyItemCollection.Insert(0, passNotifyItem)); + NotifySystem.Instance.Notify(passNotifyItem.Variety, NotifySystem.NotifyConfigure.NotSave, passNotifyItem.Text, true, "Notify Pass"); + } break; } break; diff --git a/Qwilight/System/TwilightSystem.cs b/Qwilight/System/TwilightSystem.cs index c68fa19..f817c54 100644 --- a/Qwilight/System/TwilightSystem.cs +++ b/Qwilight/System/TwilightSystem.cs @@ -329,8 +329,30 @@ NotifySystem.Instance.Notify(twilightNotify.v, NotifySystem.NotifyConfigure.Default, twilightNotify.text, twilightNotify.isUrgent); break; case Event.Types.EventID.NotifyPass: - var twilightNotifyPass = Utility.GetJSON(eventItemText); - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.PassNotify, Utility.GetPlatformText(twilightNotifyPass.title, twilightNotifyPass.artist, Utility.GetGenreText(twilightNotifyPass.genre), twilightNotifyPass.levelText), twilightNotifyPass.avatarName), false, "Notify Pass", async () => await mainViewModel.MoveEntryItemsView(twilightNotifyPass.noteID)); + var twilightNotifyPasses = Utility.GetJSON(eventItemText); + var passNotifyItems = twilightNotifyPasses.Select(twilightNotifyPass => new NotifyItem + { + Text = string.Format(LanguageSystem.Instance.PassNotifyText, Utility.GetPlatformText(twilightNotifyPass.title, twilightNotifyPass.artist, Utility.GetGenreText(twilightNotifyPass.genre), twilightNotifyPass.levelText), twilightNotifyPass.avatarName), + Variety = NotifySystem.NotifyVariety.Info, + OnHandle = async () => await mainViewModel.MoveEntryItemsView(twilightNotifyPass.noteID), + AvatarWwwValue = new(twilightNotifyPass.avatarID) + }).ToArray(); + UIHandler.Instance.HandleParallel(() => + { + foreach (var passNotifyItem in passNotifyItems) + { + ViewModels.Instance.NotifyValue.PassNotifyItemCollection.Insert(0, passNotifyItem); + } + }); + if (passNotifyItems.Length > 1) + { + NotifySystem.Instance.NotifyPendingPassNotify(); + } + else + { + var passNotifyItem = passNotifyItems.Single(); + NotifySystem.Instance.Notify(passNotifyItem.Variety, NotifySystem.NotifyConfigure.NotSave, passNotifyItem.Text, false, "Notify Pass"); + } break; case Event.Types.EventID.LevelUp: var twilightLevelUp = Utility.GetJSON(eventItemText); @@ -725,10 +747,10 @@ var bundleEntryPath = twilightSaveAsBundle.bundleEntryPath; var saveAsBundleID = twilightSaveAsBundle.bundleID; var saveAsBundleVariety = (BundleItem.BundleVariety)twilightSaveAsBundle.bundleVariety; - var savingBundleItem = new NotifyItem + var bundleNotifyItem = new NotifyItem { Text = LanguageSystem.Instance.SaveAsBundleContents, - Variety = NotifySystem.NotifyVariety.Levying, + Variety = NotifySystem.NotifyVariety.Handling, Data = ArrayPool.Shared.Rent(QwilightComponent.SendUnit), OnStop = wipeTotal => { @@ -740,7 +762,7 @@ { if (_savingBundleItems.Remove(saveAsBundleID, out var savingBundleItem)) { - savingBundleItem.Variety = NotifySystem.NotifyVariety.Stopped; + savingBundleItem.Variety = NotifySystem.NotifyVariety.Cancelled; savingBundleItem.Text = LanguageSystem.Instance.StopSavingAsBundleContents; savingBundleItem.IsStopped = true; SendParallel(Event.Types.EventID.StopSavingAsBundle, saveAsBundleID); @@ -753,9 +775,9 @@ } } }; - _savingBundleItems[saveAsBundleID] = savingBundleItem; - UIHandler.Instance.HandleParallel(() => toNotifyViewModel.NotifyItemCollection.Insert(0, savingBundleItem)); - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text, false, null, null, NotifySystem.SaveAsBundleID); + _savingBundleItems[saveAsBundleID] = bundleNotifyItem; + UIHandler.Instance.HandleParallel(() => toNotifyViewModel.HandlingNotifyItemCollection.Insert(0, bundleNotifyItem)); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, bundleNotifyItem.Text, false, null, null, NotifySystem.SaveAsBundleID); Task.Run(() => { try @@ -840,11 +862,11 @@ } } - if (!savingBundleItem.IsStopped) + if (!bundleNotifyItem.IsStopped) { - savingBundleItem.Text = LanguageSystem.Instance.SavingAsBundleContents; - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text, false, null, null, NotifySystem.SaveAsBundleID); - savingBundleItem.MaxStatus = rms.Length; + bundleNotifyItem.Text = LanguageSystem.Instance.SavingAsBundleContents; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, bundleNotifyItem.Text, false, null, null, NotifySystem.SaveAsBundleID); + bundleNotifyItem.MaxStatus = rms.Length; rms.Position = 0; while (_savingBundleItems.TryGetValue(saveAsBundleID, out var savingBundleItem)) { @@ -856,7 +878,7 @@ Send(Event.Types.EventID.SavedAsBundle, saveAsBundleID, UnsafeByteOperations.UnsafeWrap(savingBundleItem.Data.AsMemory(0, length))); if (_savingBundleItems.Remove(saveAsBundleID, out _)) { - savingBundleItem.Variety = NotifySystem.NotifyVariety.Quit; + savingBundleItem.Variety = NotifySystem.NotifyVariety.Stopped; savingBundleItem.Text = LanguageSystem.Instance.SavedAsBundleContents; NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text, false, null, null, NotifySystem.SaveAsBundleID); } @@ -871,37 +893,37 @@ void OnSavingZipFile(object sender, SaveProgressEventArgs e) { - if (savingBundleItem.IsStopped) + if (bundleNotifyItem.IsStopped) { e.Cancel = true; - savingBundleItem.Dispose(); + bundleNotifyItem.Dispose(); } else { if (e.EntriesTotal > 0) { - savingBundleItem.Status = e.EntriesSaved; - savingBundleItem.MaxStatus = e.EntriesTotal; + bundleNotifyItem.Status = e.EntriesSaved; + bundleNotifyItem.MaxStatus = e.EntriesTotal; } } } } catch (Exception e) { - savingBundleItem.OnStop(false); + bundleNotifyItem.OnStop(false); NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.SaveAsBundleFault, e.Message), false, null, null, NotifySystem.SaveAsBundleID); } finally { - savingBundleItem.Dispose(); + bundleNotifyItem.Dispose(); } }); break; case Event.Types.EventID.StopSavingAsBundle: - if (_savingBundleItems.TryGetValue(eventItemText, out savingBundleItem)) + if (_savingBundleItems.TryGetValue(eventItemText, out bundleNotifyItem)) { - savingBundleItem.Variety = NotifySystem.NotifyVariety.Stopped; - savingBundleItem.Text = LanguageSystem.Instance.StopSavingAsBundleContents; + bundleNotifyItem.Variety = NotifySystem.NotifyVariety.Cancelled; + bundleNotifyItem.Text = LanguageSystem.Instance.StopSavingAsBundleContents; } break; case Event.Types.EventID.SaveBundle: @@ -909,10 +931,10 @@ var saveBundleID = twilightSaveBundle.bundleID; var saveBundleVariety = (BundleItem.BundleVariety)twilightSaveBundle.bundleVariety; var bundleLength = twilightSaveBundle.bundleLength; - savingBundleItem = new NotifyItem + bundleNotifyItem = new NotifyItem { Text = LanguageSystem.Instance.SaveBundleContents, - Variety = NotifySystem.NotifyVariety.Levying, + Variety = NotifySystem.NotifyVariety.Handling, DataFlow = PoolSystem.Instance.GetDataFlow(bundleLength), OnStop = wipeTotal => { @@ -924,7 +946,7 @@ { if (_savingBundleItems.Remove(saveBundleID, out var savingBundleItem)) { - savingBundleItem.Variety = NotifySystem.NotifyVariety.Stopped; + savingBundleItem.Variety = NotifySystem.NotifyVariety.Cancelled; savingBundleItem.Text = LanguageSystem.Instance.StopSavingBundleContents; savingBundleItem.IsStopped = true; SendParallel(Event.Types.EventID.StopSavingBundle, saveBundleID); @@ -938,42 +960,42 @@ }, MaxStatus = bundleLength }; - _savingBundleItems[saveBundleID] = savingBundleItem; - UIHandler.Instance.HandleParallel(() => toNotifyViewModel.NotifyItemCollection.Insert(0, savingBundleItem)); + _savingBundleItems[saveBundleID] = bundleNotifyItem; + UIHandler.Instance.HandleParallel(() => toNotifyViewModel.HandlingNotifyItemCollection.Insert(0, bundleNotifyItem)); if (saveBundleVariety != BundleItem.BundleVariety.DefaultNoteFiles && saveBundleVariety != BundleItem.BundleVariety.DefaultUI) { - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text, false, null, null, NotifySystem.SaveBundleID); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, bundleNotifyItem.Text, false, null, null, NotifySystem.SaveBundleID); } SendParallel(Event.Types.EventID.SavingBundle, saveBundleID); break; case Event.Types.EventID.SavingBundle: - if (_savingBundleItems.TryGetValue(eventItemText, out savingBundleItem)) + if (_savingBundleItems.TryGetValue(eventItemText, out bundleNotifyItem)) { - if (savingBundleItem.IsStopped) + if (bundleNotifyItem.IsStopped) { - savingBundleItem.Dispose(); + bundleNotifyItem.Dispose(); } else { - eventItemData[0].WriteTo(savingBundleItem.DataFlow); + eventItemData[0].WriteTo(bundleNotifyItem.DataFlow); } - savingBundleItem.Status += eventItemData[0].Length; + bundleNotifyItem.Status += eventItemData[0].Length; } break; case Event.Types.EventID.SavedBundle: var twilightSavedBundle = Utility.GetJSON(eventItemText); - if (_savingBundleItems.Remove(twilightSavedBundle.bundleID, out savingBundleItem)) + if (_savingBundleItems.Remove(twilightSavedBundle.bundleID, out bundleNotifyItem)) { - if (savingBundleItem.IsStopped) + if (bundleNotifyItem.IsStopped) { - savingBundleItem.Dispose(); + bundleNotifyItem.Dispose(); } else { - eventItemData[0].WriteTo(savingBundleItem.DataFlow); + eventItemData[0].WriteTo(bundleNotifyItem.DataFlow); Utility.HandleParallelly(() => { - var dataFlow = savingBundleItem.DataFlow; + var dataFlow = bundleNotifyItem.DataFlow; dataFlow.Position = 0; var bundleVariety = (BundleItem.BundleVariety)twilightSavedBundle.bundleVariety; var isNotDefaultBundle = bundleVariety != BundleItem.BundleVariety.DefaultNoteFiles && bundleVariety != BundleItem.BundleVariety.DefaultUI; @@ -987,22 +1009,22 @@ var bundleEntryPath = Path.Combine(QwilightComponent.BundleEntryPath, twilightSavedBundle.bundleName); using (var zipFile = ZipFile.Read(dataFlow)) { - savingBundleItem.Text = LanguageSystem.Instance.SavingBundleContents; + bundleNotifyItem.Text = LanguageSystem.Instance.SavingBundleContents; if (isNotDefaultBundle) { - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text, false, null, null, NotifySystem.SaveBundleID); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, bundleNotifyItem.Text, false, null, null, NotifySystem.SaveBundleID); } zipFile.ExtractProgress += OnSavingZipFile; zipFile.ExtractAll(bundleEntryPath, ExtractExistingFileAction.OverwriteSilently); } - if (!savingBundleItem.IsStopped) + if (!bundleNotifyItem.IsStopped) { mainViewModel.LoadEntryItem(DefaultEntryItem.EssentialBundle, bundleEntryPath, isNotDefaultBundle); - savingBundleItem.Variety = NotifySystem.NotifyVariety.Quit; - savingBundleItem.Text = LanguageSystem.Instance.SavedBundleContents; + bundleNotifyItem.Variety = NotifySystem.NotifyVariety.Stopped; + bundleNotifyItem.Text = LanguageSystem.Instance.SavedBundleContents; if (isNotDefaultBundle) { - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text, false, null, null, NotifySystem.SaveBundleID); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.NotSave, bundleNotifyItem.Text, false, null, null, NotifySystem.SaveBundleID); } else if (twilightSavedBundle.isLastDefault) { @@ -1014,21 +1036,21 @@ case BundleItem.BundleVariety.UI: using (var zipFile = ZipFile.Read(dataFlow)) { - savingBundleItem.Text = LanguageSystem.Instance.SavingBundleContents; + bundleNotifyItem.Text = LanguageSystem.Instance.SavingBundleContents; if (isNotDefaultBundle) { - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text, false, null, null, NotifySystem.SaveBundleID); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, bundleNotifyItem.Text, false, null, null, NotifySystem.SaveBundleID); } zipFile.ExtractProgress += OnSavingZipFile; zipFile.ExtractAll(string.IsNullOrEmpty(Path.GetDirectoryName(zipFile.Where(zipEntry => zipEntry.FileName.IsTailCaselsss(".yaml")).OrderBy(zipEntry => zipEntry.FileName).FirstOrDefault().FileName)) ? Path.Combine(QwilightComponent.UIEntryPath, twilightSavedBundle.bundleName) : QwilightComponent.UIEntryPath, ExtractExistingFileAction.OverwriteSilently); } - if (!savingBundleItem.IsStopped) + if (!bundleNotifyItem.IsStopped) { - savingBundleItem.Variety = NotifySystem.NotifyVariety.Quit; - savingBundleItem.Text = LanguageSystem.Instance.SavedBundleContents; + bundleNotifyItem.Variety = NotifySystem.NotifyVariety.Stopped; + bundleNotifyItem.Text = LanguageSystem.Instance.SavedBundleContents; if (isNotDefaultBundle) { - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text, false, null, null, NotifySystem.SaveBundleID); + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.NotSave, bundleNotifyItem.Text, false, null, null, NotifySystem.SaveBundleID); } else if (twilightSavedBundle.isLastDefault) { @@ -1041,9 +1063,9 @@ { dataFlow.CopyTo(fs); } - savingBundleItem.Variety = NotifySystem.NotifyVariety.Quit; - savingBundleItem.Text = LanguageSystem.Instance.SavedQwilightBundleContents; - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text, false, null, null, NotifySystem.SaveBundleID); + bundleNotifyItem.Variety = NotifySystem.NotifyVariety.Stopped; + bundleNotifyItem.Text = LanguageSystem.Instance.SavedQwilightBundleContents; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, bundleNotifyItem.Text, false, null, null, NotifySystem.SaveBundleID); break; case BundleItem.BundleVariety.EventNote: try @@ -1058,9 +1080,9 @@ }; var date = DateTime.Now; DB.Instance.SetEventNote(eventNoteID, eventNoteName, date, eventNoteVariety); - savingBundleItem.Variety = NotifySystem.NotifyVariety.Quit; - savingBundleItem.Text = LanguageSystem.Instance.SavedBundleContents; - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text, false, null, null, NotifySystem.SaveBundleID); + bundleNotifyItem.Variety = NotifySystem.NotifyVariety.Stopped; + bundleNotifyItem.Text = LanguageSystem.Instance.SavedBundleContents; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.NotSave, bundleNotifyItem.Text, false, null, null, NotifySystem.SaveBundleID); mainViewModel.LoadEventNoteEntryItems(); mainViewModel.Want(); } @@ -1075,30 +1097,30 @@ { using (var zipFile = ZipFile.Read(dataFlow)) { - savingBundleItem.Text = LanguageSystem.Instance.SavingBundleContents; - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text, false, null, null, NotifySystem.SaveBundleID); + bundleNotifyItem.Text = LanguageSystem.Instance.SavingBundleContents; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.NotSave, bundleNotifyItem.Text, false, null, null, NotifySystem.SaveBundleID); zipFile.ExtractProgress += OnSavingZipFile; zipFile.ExtractAll(noteFile.EntryItem.EntryPath, ExtractExistingFileAction.OverwriteSilently); } - if (!savingBundleItem.IsStopped) + if (!bundleNotifyItem.IsStopped) { mainViewModel.LoadEntryItem(noteFile.DefaultEntryItem, noteFile.EntryItem.EntryPath); - savingBundleItem.Variety = NotifySystem.NotifyVariety.Quit; - savingBundleItem.Text = LanguageSystem.Instance.SavedBundleContents; - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text, false, null, null, NotifySystem.SaveBundleID); + bundleNotifyItem.Variety = NotifySystem.NotifyVariety.Stopped; + bundleNotifyItem.Text = LanguageSystem.Instance.SavedBundleContents; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.NotSave, bundleNotifyItem.Text, false, null, null, NotifySystem.SaveBundleID); } } else { - savingBundleItem.Text = LanguageSystem.Instance.NotHaveNoteFileEntryText; - NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.NotSave, savingBundleItem.Text, false, null, null, NotifySystem.SaveBundleID); + bundleNotifyItem.Text = LanguageSystem.Instance.NotHaveNoteFileEntryText; + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.NotSave, bundleNotifyItem.Text, false, null, null, NotifySystem.SaveBundleID); } break; } void OnSavingZipFile(object sender, ExtractProgressEventArgs e) { - if (savingBundleItem.IsStopped) + if (bundleNotifyItem.IsStopped) { e.Cancel = true; } @@ -1106,20 +1128,20 @@ { if (e.EntriesTotal > 0) { - savingBundleItem.Status = e.EntriesExtracted; - savingBundleItem.MaxStatus = e.EntriesTotal; + bundleNotifyItem.Status = e.EntriesExtracted; + bundleNotifyItem.MaxStatus = e.EntriesTotal; } } } } catch (Exception e) { - savingBundleItem.OnStop(false); + bundleNotifyItem.OnStop(false); NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Fault, NotifySystem.NotifyConfigure.Default, string.Format(LanguageSystem.Instance.SaveBundleFault, e.Message), false, null, null, NotifySystem.SaveBundleID); } finally { - savingBundleItem.Dispose(); + bundleNotifyItem.Dispose(); } }, false); } diff --git a/Qwilight/UIComponent/NotifyItem.cs b/Qwilight/UIComponent/NotifyItem.cs index 6a6315f..b246811 100644 --- a/Qwilight/UIComponent/NotifyItem.cs +++ b/Qwilight/UIComponent/NotifyItem.cs @@ -11,6 +11,8 @@ double _quitStatus; string _text; + public AvatarWww AvatarWwwValue { get; set; } + public byte[] Data { get; set; } public MemoryStream DataFlow { get; set; } diff --git a/Qwilight/View/NetSiteCommentWindow.xaml b/Qwilight/View/NetSiteCommentWindow.xaml index ef623ec..e3eb1f1 100644 --- a/Qwilight/View/NetSiteCommentWindow.xaml +++ b/Qwilight/View/NetSiteCommentWindow.xaml @@ -21,6 +21,13 @@ + + + + + + + diff --git a/Qwilight/View/NotifyWindow.xaml b/Qwilight/View/NotifyWindow.xaml index 88e0950..a8019d0 100644 --- a/Qwilight/View/NotifyWindow.xaml +++ b/Qwilight/View/NotifyWindow.xaml @@ -2,7 +2,7 @@ x:Class="Qwilight.View.NotifyWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:view="clr-namespace:Qwilight.View" DataContext="{Binding NotifyValue, Source={StaticResource ViewModels}}" Style="{StaticResource StandardModalWindow}"> @@ -11,37 +11,119 @@ - - - - - - - - - - - - - - - - - - - - - - - - - -