diff --git a/Qwilight/Compute/AutoCompute.cs b/Qwilight/Compute/AutoCompute.cs
index 46e8161..13f7b87 100644
--- a/Qwilight/Compute/AutoCompute.cs
+++ b/Qwilight/Compute/AutoCompute.cs
@@ -86,7 +86,6 @@
public override void SetNoteFileMode(string faultText = null)
{
IsAutoMode = true;
- FadingViewLayer = 1;
ViewModels.Instance.MainValue.SetNoteFileMode(faultText);
}
diff --git a/Qwilight/Compute/DefaultCompute.cs b/Qwilight/Compute/DefaultCompute.cs
index 75faeda..4998da4 100644
--- a/Qwilight/Compute/DefaultCompute.cs
+++ b/Qwilight/Compute/DefaultCompute.cs
@@ -419,7 +419,7 @@
public virtual bool CanModifySalt => (IsSalt || ModeComponentValue.CanModifySalt) && string.IsNullOrEmpty(EventNoteEntryItem?.EventNoteID);
- public int FadingViewLayer { get; set; }
+ public int QuitModeFadingViewLayer { get; set; }
public bool LoadedMedia { get; } = Configure.Instance.LoadedMedia;
@@ -697,10 +697,8 @@
{
if (Configure.Instance.Media && IsMediaHandling)
{
- var defaultHandlerItem = GetHandlerItem(MediaNote.Mode.Default);
- var layerHandlerItem = GetHandlerItem(MediaNote.Mode.Layer);
- HandleHandlerItem(defaultHandlerItem, ref r);
- HandleHandlerItem(layerHandlerItem, ref r);
+ HandleHandlerItem(GetHandlerItem(MediaNote.Mode.Default), ref r);
+ HandleHandlerItem(GetHandlerItem(MediaNote.Mode.Layer), ref r);
void HandleHandlerItem(IHandlerItem handler, ref Bound r)
{
@@ -1080,11 +1078,11 @@
if (IsF)
{
HandleUIAudio("At Failed");
- FadingViewLayer = 3;
+ QuitModeFadingViewLayer = 3;
}
else
{
- FadingViewLayer = 2;
+ QuitModeFadingViewLayer = 2;
}
ViewModels.Instance.MainValue.SetQuitMode(this);
}
@@ -1092,7 +1090,6 @@
public virtual void SetNoteFileMode(string faultText = null)
{
SetStop = true;
- FadingViewLayer = 1;
ViewModels.Instance.MainValue.SetNoteFileMode(faultText);
}
diff --git a/Qwilight/Qwilight.csproj b/Qwilight/Qwilight.csproj
index 5bc3809..4cf3be8 100644
--- a/Qwilight/Qwilight.csproj
+++ b/Qwilight/Qwilight.csproj
@@ -44,7 +44,7 @@
-
+
diff --git a/Qwilight/System/Configure/Configure.cs b/Qwilight/System/Configure/Configure.cs
index f1b42ae..a4acd9d 100644
--- a/Qwilight/System/Configure/Configure.cs
+++ b/Qwilight/System/Configure/Configure.cs
@@ -718,8 +718,9 @@
if (SetProperty(ref _language, value) && _isLoaded)
{
LanguageSystem.Instance.Init(value);
- TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetLanguage, value);
+ AvatarTitleSystem.Instance.WipeAvatarTitles();
ViewModels.Instance.MainValue.NotifyModel();
+ TwilightSystem.Instance.SendParallel(Event.Types.EventID.SetLanguage, value);
}
}
}
diff --git a/Qwilight/System/DrawingSystem/DrawingSystem.cs b/Qwilight/System/DrawingSystem/DrawingSystem.cs
index c3879ef..cd57392 100644
--- a/Qwilight/System/DrawingSystem/DrawingSystem.cs
+++ b/Qwilight/System/DrawingSystem/DrawingSystem.cs
@@ -2892,7 +2892,7 @@
{
if (fadingStatus > 0.0)
{
- BaseUI.Instance.FadingProperties[(int)mode]?[fading.Layer].Paint(targetSession, ref r, fadingStatus);
+ BaseUI.Instance.FadingProperties[(int)fading.ModeLayer.Item1]?[fading.ModeLayer.Item2]?.Paint(targetSession, ref r, fadingStatus);
}
}
}
diff --git a/Qwilight/System/FlintSystem.cs b/Qwilight/System/FlintSystem.cs
index f1349a2..69c53cc 100644
--- a/Qwilight/System/FlintSystem.cs
+++ b/Qwilight/System/FlintSystem.cs
@@ -1,5 +1,6 @@
using CommandLine;
using Qwilight.Compute;
+using Qwilight.Utilities;
using Qwilight.ViewModel;
using System.IO;
using System.IO.Pipes;
@@ -11,13 +12,15 @@
{
public static readonly FlintSystem Instance = new();
+ static readonly string FaultEntryPath = Path.Combine(QwilightComponent.FaultEntryPath, nameof(FlintSystem));
+
public void HandleSystem()
{
while (true)
{
+ using var ss = new NamedPipeServerStream("Qwilight", PipeDirection.In);
try
{
- using var ss = new NamedPipeServerStream("Qwilight", PipeDirection.In);
ss.WaitForConnection();
using var sr = new StreamReader(ss, Encoding.UTF8);
Parser.Default.ParseArguments(sr.ReadLine()?.Split(" ", 3) ?? Array.Empty()).WithParsed(o =>
@@ -48,8 +51,9 @@
}
});
}
- catch
+ catch (Exception e)
{
+ Utility.SaveFaultFile(FaultEntryPath, e);
}
}
}
diff --git a/Qwilight/System/PlatformSystem.cs b/Qwilight/System/PlatformSystem.cs
index 50c714e..5a25628 100644
--- a/Qwilight/System/PlatformSystem.cs
+++ b/Qwilight/System/PlatformSystem.cs
@@ -55,6 +55,7 @@
break;
}
targetSystem.SetPresence(data);
+
Thread.Sleep(1000);
}
}
@@ -62,9 +63,7 @@
catch (Exception e)
{
Utility.SaveFaultFile(FaultEntryPath, e);
- }
- finally
- {
+
Thread.Sleep(1000);
}
}
diff --git a/Qwilight/System/RGBSystem/RGBSystem.cs b/Qwilight/System/RGBSystem/RGBSystem.cs
index 936e718..78e5f28 100644
--- a/Qwilight/System/RGBSystem/RGBSystem.cs
+++ b/Qwilight/System/RGBSystem/RGBSystem.cs
@@ -356,7 +356,7 @@
var inputs = Configure.Instance.DefaultInputBundlesV6.Inputs[(int)defaultComputer.InputMode];
if (inputs != null)
{
- for (var i = inputs.Length - 1; i > 0; --i)
+ for (var i = inputs.Length - 1; i > 0; --i)
{
foreach (var defaultInput in inputs[i])
{
@@ -460,6 +460,106 @@
}
OnHandled();
+
+ void PaintEtc()
+ {
+ SetEtcColor(failedValue, meterValue);
+ }
+
+ void PaintStatusStatus(DefaultCompute defaultComputer)
+ {
+ var statusColor = defaultComputer.IsHandling ? defaultComputer.IsPausing ? BaseUI.Instance.StatusPausedColor : BaseUI.Instance.StatusHandlingColor : BaseUI.Instance.StatusLoadingNoteFileColor;
+ var handlingMeterValue = defaultComputer.IsHandling && !defaultComputer.IsPausing ? meterValue : 1.0;
+ SetStatusColors(defaultComputer.Status, (uint)(statusColor.R * handlingMeterValue), (uint)(statusColor.G * handlingMeterValue), (uint)(statusColor.B * handlingMeterValue), (uint)(statusColor.A * handlingMeterValue));
+ }
+
+ void PaintInputStatus(DefaultCompute defaultComputer)
+ {
+ var statusColor = defaultComputer.IsHandling ? defaultComputer.IsPausing ? BaseUI.Instance.StatusPausedColor : BaseUI.Instance.StatusHandlingColor : BaseUI.Instance.StatusLoadingNoteFileColor;
+ var handlingMeterValue = defaultComputer.IsHandling && !defaultComputer.IsPausing ? meterValue : 1.0;
+ for (var i = defaultStatusInputsLength - 1; i >= 0; --i)
+ {
+ SetInputColor(defaultStatusInputs[i], GetValueColor(statusColor, handlingMeterValue * Math.Clamp((defaultComputer.Status - (double)i / defaultStatusInputsLength) / defaultStatusInputsUnit, 0, 1)));
+ }
+ }
+
+ void PaintInputAudioVisualizer()
+ {
+ for (var i = audioVisualizerInputsLength - 1; i >= 0; --i)
+ {
+ var audioMainVisualizerValue = 0.0;
+ var audioInputVisualizerValue = 0.0;
+ for (var j = ((i + 1) * Configure.Instance.AudioVisualizerCount / audioVisualizerInputsLength) - 1; j >= i * Configure.Instance.AudioVisualizerCount / audioVisualizerInputsLength; --j)
+ {
+ audioMainVisualizerValue = Math.Max(audioMainVisualizerValue, AudioSystem.Instance.GetAudioVisualizerValue(AudioSystem.MainAudio, j));
+ audioInputVisualizerValue = Math.Max(audioInputVisualizerValue, AudioSystem.Instance.GetAudioVisualizerValue(AudioSystem.InputAudio, j));
+ }
+ audioMainVisualizerValues[i] = audioMainVisualizerValue;
+ audioInputVisualizerValues[i] = audioInputVisualizerValue;
+
+ var distance = lastAudioVisualizerMainValues[i] - audioMainVisualizerValues[i];
+ audioMainVisualizerFrames[i] = Math.Clamp(audioMainVisualizerFrames[i] + (distance == 0.0 ? 0.0 : distance > 0 ? -1 / 3.0 : 1 / 3.0), 0.0, 3.0);
+ distance = lastAudioVisualizerInputValues[i] - audioInputVisualizerValues[i];
+ audioInputVisualizerFrames[i] = Math.Clamp(audioInputVisualizerFrames[i] + (distance == 0.0 ? 0.0 : distance > 0 ? -1 / 3.0 : 1 / 3.0), 0.0, 3.0);
+ }
+
+ Array.Copy(audioMainVisualizerValues, lastAudioVisualizerMainValues, audioVisualizerInputsLength);
+ Array.Copy(audioInputVisualizerValues, lastAudioVisualizerInputValues, audioVisualizerInputsLength);
+
+ Array.Clear(audioVisualizerColors, 0, audioVisualizerColors.Length);
+ var audioVisualizerMainColor = Configure.Instance.AudioVisualizerMainColor;
+ var audioVisualizerInputColor = Configure.Instance.AudioVisualizerInputColor;
+ for (var i = audioVisualizerInputsLength - 1; i >= 0; --i)
+ {
+ var value = audioMainVisualizerFrames[i];
+ var valueInt = (int)value;
+ var remainder = value - valueInt;
+ if (remainder > 0.0)
+ {
+ audioVisualizerColors[i, valueInt, 0] = new()
+ {
+ R = (byte)(audioVisualizerMainColor.R * remainder),
+ G = (byte)(audioVisualizerMainColor.R * remainder),
+ B = (byte)(audioVisualizerMainColor.R * remainder),
+ };
+ }
+ for (var j = valueInt - 1; j >= 0; --j)
+ {
+ audioVisualizerColors[i, j, 0] = audioVisualizerMainColor;
+ }
+
+ value = audioInputVisualizerFrames[i];
+ valueInt = (int)value;
+ remainder = value - valueInt;
+ if (remainder > 0.0)
+ {
+ audioVisualizerColors[i, valueInt, 1] = new()
+ {
+ R = (byte)(audioVisualizerInputColor.R * remainder),
+ G = (byte)(audioVisualizerInputColor.R * remainder),
+ B = (byte)(audioVisualizerInputColor.R * remainder),
+ };
+ }
+ for (var j = valueInt - 1; j >= 0; --j)
+ {
+ audioVisualizerColors[i, j, 1] = audioVisualizerInputColor;
+ }
+
+ for (var j = audioVisualizerColors.GetLength(0) - 1; j >= 0; --j)
+ {
+ for (var m = audioVisualizerColors.GetLength(1) - 1; m >= 0; --m)
+ {
+ SetInputColor(audioVisualizerInputs[j][m], GetValueColor(new()
+ {
+ A = (byte)((audioVisualizerColors[j, m, 0].A + audioVisualizerColors[j, m, 1].A) / 2),
+ R = (byte)((audioVisualizerColors[j, m, 0].R + audioVisualizerColors[j, m, 1].R) / 2),
+ G = (byte)((audioVisualizerColors[j, m, 0].G + audioVisualizerColors[j, m, 1].G) / 2),
+ B = (byte)((audioVisualizerColors[j, m, 0].B + audioVisualizerColors[j, m, 1].B) / 2)
+ }, 1.0));
+ }
+ }
+ }
+ }
}
loopingCounter += 1000.0 / 60;
@@ -476,109 +576,6 @@
Monitor.Wait(_availableCSX);
}
}
-
- void PaintEtc()
- {
- SetEtcColor(failedValue, meterValue);
- }
-
- void PaintStatusStatus(DefaultCompute defaultComputer)
- {
- var statusColor = defaultComputer.IsHandling ? defaultComputer.IsPausing ? BaseUI.Instance.StatusPausedColor : BaseUI.Instance.StatusHandlingColor : BaseUI.Instance.StatusLoadingNoteFileColor;
- var handlingMeterValue = defaultComputer.IsHandling && !defaultComputer.IsPausing ? meterValue : 1.0;
- SetStatusColors(defaultComputer.Status, (uint)(statusColor.R * handlingMeterValue), (uint)(statusColor.G * handlingMeterValue), (uint)(statusColor.B * handlingMeterValue), (uint)(statusColor.A * handlingMeterValue));
- }
-
- void PaintInputStatus(DefaultCompute defaultComputer)
- {
- var statusColor = defaultComputer.IsHandling ? defaultComputer.IsPausing ? BaseUI.Instance.StatusPausedColor : BaseUI.Instance.StatusHandlingColor : BaseUI.Instance.StatusLoadingNoteFileColor;
- var handlingMeterValue = defaultComputer.IsHandling && !defaultComputer.IsPausing ? meterValue : 1.0;
- for (var i = defaultStatusInputsLength - 1; i >= 0; --i)
- {
- SetInputColor(defaultStatusInputs[i], GetValueColor(statusColor, handlingMeterValue * Math.Clamp((defaultComputer.Status - (double)i / defaultStatusInputsLength) / defaultStatusInputsUnit, 0, 1)));
- }
- }
-
- void PaintInputAudioVisualizer()
- {
- for (var i = audioVisualizerInputsLength - 1; i >= 0; --i)
- {
- var audioMainVisualizerValue = 0.0;
- var audioInputVisualizerValue = 0.0;
- for (var j = ((i + 1) * Configure.Instance.AudioVisualizerCount / audioVisualizerInputsLength) - 1; j >= i * Configure.Instance.AudioVisualizerCount / audioVisualizerInputsLength; --j)
- {
- audioMainVisualizerValue = Math.Max(audioMainVisualizerValue, AudioSystem.Instance.GetAudioVisualizerValue(AudioSystem.MainAudio, j));
- audioInputVisualizerValue = Math.Max(audioInputVisualizerValue, AudioSystem.Instance.GetAudioVisualizerValue(AudioSystem.InputAudio, j));
- }
- audioMainVisualizerValues[i] = audioMainVisualizerValue;
- audioInputVisualizerValues[i] = audioInputVisualizerValue;
-
- var distance = lastAudioVisualizerMainValues[i] - audioMainVisualizerValues[i];
- audioMainVisualizerFrames[i] = Math.Clamp(audioMainVisualizerFrames[i] + (distance == 0.0 ? 0.0 : distance > 0 ? -1 / 3.0 : 1 / 3.0), 0.0, 3.0);
- distance = lastAudioVisualizerInputValues[i] - audioInputVisualizerValues[i];
- audioInputVisualizerFrames[i] = Math.Clamp(audioInputVisualizerFrames[i] + (distance == 0.0 ? 0.0 : distance > 0 ? -1 / 3.0 : 1 / 3.0), 0.0, 3.0);
- }
-
- Array.Copy(audioMainVisualizerValues, lastAudioVisualizerMainValues, audioVisualizerInputsLength);
- Array.Copy(audioInputVisualizerValues, lastAudioVisualizerInputValues, audioVisualizerInputsLength);
-
- Array.Clear(audioVisualizerColors, 0, audioVisualizerColors.Length);
- var audioVisualizerMainColor = Configure.Instance.AudioVisualizerMainColor;
- var audioVisualizerInputColor = Configure.Instance.AudioVisualizerInputColor;
- for (var i = audioVisualizerInputsLength - 1; i >= 0; --i)
- {
- var value = audioMainVisualizerFrames[i];
- var valueInt = (int)value;
- var remainder = value - valueInt;
- if (remainder > 0.0)
- {
- audioVisualizerColors[i, valueInt, 0] = new()
- {
- R = (byte)(audioVisualizerMainColor.R * remainder),
- G = (byte)(audioVisualizerMainColor.R * remainder),
- B = (byte)(audioVisualizerMainColor.R * remainder),
- };
- }
- for (var j = valueInt - 1; j >= 0; --j)
- {
- audioVisualizerColors[i, j, 0] = audioVisualizerMainColor;
- }
-
- value = audioInputVisualizerFrames[i];
- valueInt = (int)value;
- remainder = value - valueInt;
- if (remainder > 0.0)
- {
- audioVisualizerColors[i, valueInt, 1] = new()
- {
- R = (byte)(audioVisualizerInputColor.R * remainder),
- G = (byte)(audioVisualizerInputColor.R * remainder),
- B = (byte)(audioVisualizerInputColor.R * remainder),
- };
- }
- for (var j = valueInt - 1; j >= 0; --j)
- {
- audioVisualizerColors[i, j, 1] = audioVisualizerInputColor;
- }
-
- for (var j = audioVisualizerColors.GetLength(0) - 1; j >= 0; --j)
- {
- for (var m = audioVisualizerColors.GetLength(1) - 1; m >= 0; --m)
- {
- SetInputColor(audioVisualizerInputs[j][m], GetValueColor(new()
- {
- A = (byte)((audioVisualizerColors[j, m, 0].A + audioVisualizerColors[j, m, 1].A) / 2),
- R = (byte)((audioVisualizerColors[j, m, 0].R + audioVisualizerColors[j, m, 1].R) / 2),
- G = (byte)((audioVisualizerColors[j, m, 0].G + audioVisualizerColors[j, m, 1].G) / 2),
- B = (byte)((audioVisualizerColors[j, m, 0].B + audioVisualizerColors[j, m, 1].B) / 2)
- }, 1.0));
- }
- }
- }
- }
- }
- catch (ThreadInterruptedException)
- {
}
catch (Exception e)
{
@@ -595,15 +592,14 @@
static uint GetInputColor(double status, Component.InputMode inputMode, int noteFrame, int i)
{
- var inputNoteDrawings = UI.Instance.NoteDrawings[(int)inputMode][i][noteFrame];
- var inputNoteDrawing = inputNoteDrawings[InputNote.InputNoteContents][LongNote.LongNoteBefore];
- if (inputNoteDrawing.HasValue)
+ var averageColor = UI.Instance.NoteDrawings[(int)inputMode]?[i]?[noteFrame]?[InputNote.InputNoteContents]?[LongNote.LongNoteBefore]?.AverageColor;
+ if (averageColor.HasValue)
{
- var averageColor = inputNoteDrawing.Value.AverageColor;
- var value0 = averageColor & 255;
- var value1 = (averageColor & 65280) >> 8;
- var value2 = (averageColor & 16711680) >> 16;
- var value3 = (averageColor & 4278190080) >> 24;
+ var averageColorValue = averageColor.Value;
+ var value0 = averageColorValue & 255;
+ var value1 = (averageColorValue & 65280) >> 8;
+ var value2 = (averageColorValue & 16711680) >> 16;
+ var value3 = (averageColorValue & 4278190080) >> 24;
return Utility.GetColor((uint)(value1 * (0.5 + status / 2)), (uint)(value2 * (0.5 + status / 2)), (uint)(value3 * (0.5 + status / 2)), value0);
}
else
diff --git a/Qwilight/System/TVSystem.cs b/Qwilight/System/TVSystem.cs
index e0d9432..6238d2f 100644
--- a/Qwilight/System/TVSystem.cs
+++ b/Qwilight/System/TVSystem.cs
@@ -81,7 +81,7 @@
}
}
}
- if ((tvAssists[0] || tvAssists[1]) && !TVAssist0 && !TVAssist1 && Configure.Instance.TVAssistConfigure)
+ if ((tvAssists[0] || tvAssists[1]) && !TVAssists && Configure.Instance.TVAssistConfigure)
{
ViewModels.Instance.AssistValue.Open();
}
diff --git a/Qwilight/System/TwilightSystem.cs b/Qwilight/System/TwilightSystem.cs
index 7ff0225..54b4c6a 100644
--- a/Qwilight/System/TwilightSystem.cs
+++ b/Qwilight/System/TwilightSystem.cs
@@ -1388,18 +1388,7 @@
{
if (_isAvailable)
{
- if (textClose == null)
- {
- Utility.SaveFaultFile(FaultEntryPath, e);
- }
- else if (textClose.Length > 0)
- {
- NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, string.Format($"{LanguageSystem.Instance.TwilightCloseContents} ({{0}})", textClose), false);
- }
- else
- {
- NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.TwilightCloseContents, false);
- }
+ Utility.SaveFaultFile(FaultEntryPath, e);
}
}
}
@@ -1407,7 +1396,22 @@
}
catch
{
- Thread.Sleep(1000);
+ if (_isAvailable)
+ {
+ if (textClose != null)
+ {
+ if (textClose.Length > 0)
+ {
+ NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, string.Format($"{LanguageSystem.Instance.TwilightCloseContents} ({{0}})", textClose), false);
+ }
+ else
+ {
+ NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Info, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.TwilightCloseContents, false);
+ }
+ }
+
+ Thread.Sleep(1000);
+ }
}
finally
{
@@ -1417,9 +1421,9 @@
UIHandler.Instance.HandleParallel(siteContainerViewModel.SiteViewCollection.Clear);
foreach (var bundleID in _bundleNotifyItems.Keys)
{
- if (_bundleNotifyItems.Remove(bundleID, out var savingBundleItem))
+ if (_bundleNotifyItems.Remove(bundleID, out var bundleNotifyItem))
{
- savingBundleItem.OnStop(false);
+ bundleNotifyItem.OnStop(false);
}
}
Totem = string.Empty;
diff --git a/Qwilight/Utilities/FaultUtility.cs b/Qwilight/Utilities/FaultUtility.cs
index ad221c4..dc0c7be 100644
--- a/Qwilight/Utilities/FaultUtility.cs
+++ b/Qwilight/Utilities/FaultUtility.cs
@@ -7,7 +7,6 @@
{
public static (string, string) SaveFaultFile(string faultEntryPath, Exception e)
{
- var faultFilePath = Path.Combine(faultEntryPath, Path.GetInvalidFileNameChars().Aggregate($"{DateTime.Now:F}.log", (faultFileName, target) => faultFileName.Replace(target, ' ')));
var builder = new StringBuilder();
var fault = e;
builder.AppendLine(fault.ToString());
@@ -18,8 +17,10 @@
}
var faultText = builder.ToString();
Console.WriteLine(faultText);
+
+ var faultFilePath = Path.Combine(faultEntryPath, Path.GetInvalidFileNameChars().Aggregate($"{DateTime.Now:F}.log", (faultFileName, target) => faultFileName.Replace(target, ' ')));
Directory.CreateDirectory(Path.GetDirectoryName(faultFilePath));
- File.WriteAllText(faultFilePath, faultText, Encoding.UTF8);
+ File.AppendAllText(faultFilePath, faultText, Encoding.UTF8);
return (faultFilePath, faultText);
}
}
diff --git a/Qwilight/View/AssistWindow.xaml b/Qwilight/View/AssistWindow.xaml
index b477766..5eba254 100644
--- a/Qwilight/View/AssistWindow.xaml
+++ b/Qwilight/View/AssistWindow.xaml
@@ -50,15 +50,17 @@
-
+
-
-
+
+
-
-
+
+
+
+
diff --git a/Qwilight/View/MainWindow/Layer1View.xaml.cs b/Qwilight/View/MainWindow/Layer1View.xaml.cs
index a5e86f4..0a7f60f 100644
--- a/Qwilight/View/MainWindow/Layer1View.xaml.cs
+++ b/Qwilight/View/MainWindow/Layer1View.xaml.cs
@@ -80,7 +80,7 @@
if (fadingStatus > 0.0)
{
- BaseUI.Instance.FadingProperties[(int)mainViewModel.ModeValue]?[fadingValue.Layer].Paint(targetSession, fadingStatus);
+ BaseUI.Instance.FadingProperties[(int)fadingValue.ModeLayer.Item1]?[fadingValue.ModeLayer.Item2].Paint(targetSession, fadingStatus);
}
if (allowFramerate)
diff --git a/Qwilight/View/QwilightClass.xaml.cs b/Qwilight/View/QwilightClass.xaml.cs
index d0e05f3..4d682f5 100644
--- a/Qwilight/View/QwilightClass.xaml.cs
+++ b/Qwilight/View/QwilightClass.xaml.cs
@@ -92,7 +92,7 @@
if (handledFaults.TryAdd(e, default))
{
var (logFilePath, faultText) = Utility.SaveFaultFile(QwilightComponent.FaultEntryPath, e);
- if (!QwilightComponent.IsVS && !(e is OutOfMemoryException))
+ if (!QwilightComponent.IsVS)
{
_ = TwilightSystem.Instance.PostWwwParallel($"{QwilightComponent.QwilightAPI}/fault", faultText);
}
diff --git a/Qwilight/ViewModel/MainViewModel.cs b/Qwilight/ViewModel/MainViewModel.cs
index 63ca501..1d99694 100644
--- a/Qwilight/ViewModel/MainViewModel.cs
+++ b/Qwilight/ViewModel/MainViewModel.cs
@@ -46,7 +46,7 @@
{
public double Status { get; set; }
- public int Layer { get; set; }
+ public (Mode, int) ModeLayer { get; set; }
public DefaultCompute Computer { get; set; }
@@ -147,7 +147,7 @@
public bool IsBPM1Visible => EntryItemValue?.NoteFile?.HasBPMMap == true;
- bool HasNotInput(BaseViewModel targetViewModel = null) => IsNotModal(targetViewModel) && IsAvailable && (!IsWPFViewVisible || !_isInputWantPointed && !_isTwilightCommentaryPointed && !ViewModels.Instance.SiteContainerValue.IsInputPointed);
+ bool IsInputIdle(BaseViewModel targetViewModel = null) => IsNotModal(targetViewModel) && IsAvailable && (!IsWPFViewVisible || !_isInputWantPointed && !_isTwilightCommentaryPointed && !ViewModels.Instance.SiteContainerValue.IsInputPointed);
public double WindowDPI
{
@@ -1416,7 +1416,7 @@
public void Pause()
{
- if (HasNotInput())
+ if (IsInputIdle())
{
switch (ModeValue)
{
@@ -1600,7 +1600,7 @@
public void HandleLevyNoteFile(BaseNoteFile noteFile = null, EntryItem entryItem = null, string ubuntuID = null, WwwLevelData wwwLevelDataValue = null, ModeComponent defaultModeComponentValue = null)
{
- if ((noteFile != null && entryItem != null) || HasNotInput())
+ if ((noteFile != null && entryItem != null) || IsInputIdle())
{
entryItem ??= EntryItemValue;
noteFile ??= entryItem?.NoteFile;
@@ -2453,9 +2453,9 @@
FadingValue.Computer = fadingViewComputer;
FadingValue.IsComputerStable = isFadingComputerStable;
- FadingValue.Layer = fadingViewLayer;
+ FadingValue.ModeLayer = (ModeValue, fadingViewLayer);
- var millis = BaseUI.Instance.FadingProperties[(int)ModeValue]?[FadingValue.Layer]?.Millis;
+ var millis = BaseUI.Instance.FadingProperties[(int)FadingValue.ModeLayer.Item1]?[FadingValue.ModeLayer.Item2]?.Millis;
var fadingCounter = Stopwatch.StartNew();
var fadeHandler = new DispatcherTimer(QwilightComponent.StandardFrametime, DispatcherPriority.Send, (sender, e) =>
{
@@ -2474,10 +2474,9 @@
(sender as DispatcherTimer).Stop();
onFade();
+ FadingValue.ModeLayer = (ModeValue, 0);
- FadingValue.Layer = 0;
-
- var millis = BaseUI.Instance.FadingProperties[(int)ModeValue]?[FadingValue.Layer]?.Millis;
+ var millis = BaseUI.Instance.FadingProperties[(int)FadingValue.ModeLayer.Item1]?[FadingValue.ModeLayer.Item2]?.Millis;
fadingCounter.Restart();
_fadeInHandler = new(QwilightComponent.StandardFrametime, DispatcherPriority.Send, (sender, e) =>
{
@@ -2505,7 +2504,7 @@
public void InitMultiplierUnit()
{
- if (HasNotInput())
+ if (IsInputIdle())
{
switch (ModeValue)
{
@@ -2521,7 +2520,7 @@
public void LowerMultiplier()
{
- if (HasNotInput())
+ if (IsInputIdle())
{
switch (ModeValue)
{
@@ -2541,7 +2540,7 @@
public void HigherMultiplier()
{
- if (HasNotInput())
+ if (IsInputIdle())
{
switch (ModeValue)
{
@@ -2561,7 +2560,7 @@
public void LowerAudioMultiplier()
{
- if (HasNotInput())
+ if (IsInputIdle())
{
switch (ModeValue)
{
@@ -2584,7 +2583,7 @@
public void HigherAudioMultiplier()
{
- if (HasNotInput())
+ if (IsInputIdle())
{
switch (ModeValue)
{
@@ -2607,7 +2606,7 @@
public void HigherDefaultSpinningMode()
{
- if (HasNotInput())
+ if (IsInputIdle())
{
Configure.Instance.DefaultSpinningModeValue = (Configure.DefaultSpinningMode)(((int)Configure.Instance.DefaultSpinningModeValue + 3) % 4);
}
@@ -2615,7 +2614,7 @@
public void LowerDefaultSpinningMode()
{
- if (HasNotInput())
+ if (IsInputIdle())
{
Configure.Instance.DefaultSpinningModeValue = (Configure.DefaultSpinningMode)(((int)Configure.Instance.DefaultSpinningModeValue + 1) % 4);
}
@@ -2623,7 +2622,7 @@
public void HandleModifyAutoMode()
{
- if (HasNotInput())
+ if (IsInputIdle())
{
Computer.ModifyAutoMode();
}
@@ -2631,7 +2630,7 @@
public void HandleMediaMode()
{
- if (HasNotInput())
+ if (IsInputIdle())
{
Configure.Instance.Media = !Configure.Instance.Media;
}
@@ -2639,7 +2638,7 @@
public void LowerEntryItem()
{
- if (HasNotInput() && EntryItemPosition >= 1)
+ if (IsInputIdle() && EntryItemPosition >= 1)
{
--EntryItemPosition;
Utility.HandleUIAudio("Lower Entry Item");
@@ -2649,7 +2648,7 @@
public void HigherEntryItem()
{
- if (HasNotInput() && EntryItemPosition < EntryItems.Count - 1)
+ if (IsInputIdle() && EntryItemPosition < EntryItems.Count - 1)
{
++EntryItemPosition;
Utility.HandleUIAudio("Higher Entry Item");
@@ -2659,7 +2658,7 @@
public void LowerNoteFile()
{
- if (HasNotInput() && EntryItemValue?.LowerNoteFile() == true)
+ if (IsInputIdle() && EntryItemValue?.LowerNoteFile() == true)
{
NotifyNoteFile();
Utility.HandleUIAudio("Lower Note File");
@@ -2668,7 +2667,7 @@
public void HigherNoteFile()
{
- if (HasNotInput() && EntryItemValue?.HigherNoteFile() == true)
+ if (IsInputIdle() && EntryItemValue?.HigherNoteFile() == true)
{
NotifyNoteFile();
Utility.HandleUIAudio("Higher Note File");
@@ -2677,7 +2676,7 @@
public void HandleF1()
{
- if (HasNotInput(ViewModels.Instance.AssistValue))
+ if (IsInputIdle(ViewModels.Instance.AssistValue))
{
ViewModels.Instance.AssistValue.Toggle();
}
@@ -2685,7 +2684,7 @@
public void HandleF5()
{
- if (HasNotInput() && !IsDefaultEntryLoading)
+ if (IsInputIdle() && !IsDefaultEntryLoading)
{
var lastDefaultEntryItem = Configure.Instance.LastDefaultEntryItem;
if (lastDefaultEntryItem != null)
@@ -2735,7 +2734,7 @@
public void HandleF7()
{
- if (HasNotInput(ViewModels.Instance.VoteValue))
+ if (IsInputIdle(ViewModels.Instance.VoteValue))
{
ViewModels.Instance.VoteValue.Toggle();
}
@@ -2743,7 +2742,7 @@
public void HandleF8()
{
- if (TwilightSystem.Instance.IsEstablished)
+ if (IsInputIdle(ViewModels.Instance.SiteContainerValue) && TwilightSystem.Instance.IsEstablished)
{
ViewModels.Instance.SiteContainerValue.Toggle();
}
@@ -2751,108 +2750,111 @@
public void HandleF9()
{
- var targetNoteFile = ViewModels.Instance.NoteFileValue.IsOpened ? ViewModels.Instance.NoteFileValue.NoteFile : null;
- if (IsNoteFileMode || targetNoteFile != null)
+ if (IsInputIdle())
{
- var favoriteEntryViewModel = ViewModels.Instance.FavoriteEntryValue;
- if (!favoriteEntryViewModel.IsOpened)
+ var targetNoteFile = ViewModels.Instance.NoteFileValue.IsOpened ? ViewModels.Instance.NoteFileValue.NoteFile : null;
+ if (IsNoteFileMode || targetNoteFile != null)
{
- var favoriteEntryItems = Configure.Instance.DefaultEntryItems.Where(defaultEntryItem => defaultEntryItem.DefaultEntryVarietyValue == DefaultEntryItem.DefaultEntryVariety.Favorite).ToArray();
- switch (favoriteEntryItems.Length)
+ var favoriteEntryViewModel = ViewModels.Instance.FavoriteEntryValue;
+ if (!favoriteEntryViewModel.IsOpened)
{
- case 0:
- ViewModels.Instance.ModifyDefaultEntryValue.Open();
- NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotFavoritesF10);
- break;
- case 1:
- var targetFavoriteEntryItem = favoriteEntryItems.Single();
- DefaultEntryItem favoriteEntryItemModified = null;
- var setFavorites = false;
- if (targetNoteFile != null)
- {
- if (!targetNoteFile.IsLogical)
+ var favoriteEntryItems = Configure.Instance.DefaultEntryItems.Where(defaultEntryItem => defaultEntryItem.DefaultEntryVarietyValue == DefaultEntryItem.DefaultEntryVariety.Favorite).ToArray();
+ switch (favoriteEntryItems.Length)
+ {
+ case 0:
+ ViewModels.Instance.ModifyDefaultEntryValue.Open();
+ NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.NotFavoritesF10);
+ break;
+ case 1:
+ var targetFavoriteEntryItem = favoriteEntryItems.Single();
+ DefaultEntryItem favoriteEntryItemModified = null;
+ var setFavorites = false;
+ if (targetNoteFile != null)
{
- setFavorites = !targetNoteFile.FavoriteEntryItems.Contains(targetFavoriteEntryItem);
- if (setFavorites)
+ if (!targetNoteFile.IsLogical)
{
- if (targetNoteFile.FavoriteEntryItems.Add(targetFavoriteEntryItem))
- {
- favoriteEntryItemModified = targetFavoriteEntryItem;
- targetNoteFile.NotifyHasFavoriteEntryItem();
- }
- }
- else
- {
- if (targetNoteFile.FavoriteEntryItems.Remove(targetFavoriteEntryItem))
- {
- favoriteEntryItemModified = targetFavoriteEntryItem;
- targetNoteFile.NotifyHasFavoriteEntryItem();
- }
- }
- foreach (var favoriteEntryItem in targetNoteFile.FavoriteEntryItems)
- {
- favoriteEntryItem.FrontEntryPaths.Add(targetNoteFile.DefaultEntryItem.DefaultEntryPath);
- }
- DB.Instance.SetFavoriteEntry(targetNoteFile);
- }
- }
- else
- {
- var noteFiles = EntryItemValue.NoteFiles;
- setFavorites = !EntryItemValue.NoteFile.FavoriteEntryItems.Contains(targetFavoriteEntryItem);
- foreach (var noteFile in noteFiles)
- {
- if (!noteFile.IsLogical)
- {
+ setFavorites = !targetNoteFile.FavoriteEntryItems.Contains(targetFavoriteEntryItem);
if (setFavorites)
{
- if (noteFile.FavoriteEntryItems.Add(targetFavoriteEntryItem))
+ if (targetNoteFile.FavoriteEntryItems.Add(targetFavoriteEntryItem))
{
favoriteEntryItemModified = targetFavoriteEntryItem;
- noteFile.NotifyHasFavoriteEntryItem();
+ targetNoteFile.NotifyHasFavoriteEntryItem();
}
}
else
{
- if (noteFile.FavoriteEntryItems.Remove(targetFavoriteEntryItem))
+ if (targetNoteFile.FavoriteEntryItems.Remove(targetFavoriteEntryItem))
{
favoriteEntryItemModified = targetFavoriteEntryItem;
- noteFile.NotifyHasFavoriteEntryItem();
+ targetNoteFile.NotifyHasFavoriteEntryItem();
}
}
- foreach (var favoriteEntryItem in noteFile.FavoriteEntryItems)
+ foreach (var favoriteEntryItem in targetNoteFile.FavoriteEntryItems)
{
- favoriteEntryItem.FrontEntryPaths.Add(noteFile.DefaultEntryItem.DefaultEntryPath);
+ favoriteEntryItem.FrontEntryPaths.Add(targetNoteFile.DefaultEntryItem.DefaultEntryPath);
}
- DB.Instance.SetFavoriteEntry(noteFile);
+ DB.Instance.SetFavoriteEntry(targetNoteFile);
}
}
- }
- if (favoriteEntryItemModified != null)
- {
- NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, string.Format(setFavorites ? LanguageSystem.Instance.SetFavoritesF10 : LanguageSystem.Instance.WipeFavoritesF10, favoriteEntryItemModified.FavoriteEntryName), false, null, null, NotifySystem.SetFavoritesID);
- if (favoriteEntryItemModified == Configure.Instance.LastDefaultEntryItem)
- {
- Want();
- }
- }
- break;
- default:
- UIHandler.Instance.HandleParallel(() =>
- {
- if (targetNoteFile != null)
- {
- favoriteEntryViewModel.NoteFile = targetNoteFile;
- favoriteEntryViewModel.Mode = 0;
- }
else
{
- favoriteEntryViewModel.EntryItem = EntryItemValue;
- favoriteEntryViewModel.Mode = 1;
+ var noteFiles = EntryItemValue.NoteFiles;
+ setFavorites = !EntryItemValue.NoteFile.FavoriteEntryItems.Contains(targetFavoriteEntryItem);
+ foreach (var noteFile in noteFiles)
+ {
+ if (!noteFile.IsLogical)
+ {
+ if (setFavorites)
+ {
+ if (noteFile.FavoriteEntryItems.Add(targetFavoriteEntryItem))
+ {
+ favoriteEntryItemModified = targetFavoriteEntryItem;
+ noteFile.NotifyHasFavoriteEntryItem();
+ }
+ }
+ else
+ {
+ if (noteFile.FavoriteEntryItems.Remove(targetFavoriteEntryItem))
+ {
+ favoriteEntryItemModified = targetFavoriteEntryItem;
+ noteFile.NotifyHasFavoriteEntryItem();
+ }
+ }
+ foreach (var favoriteEntryItem in noteFile.FavoriteEntryItems)
+ {
+ favoriteEntryItem.FrontEntryPaths.Add(noteFile.DefaultEntryItem.DefaultEntryPath);
+ }
+ DB.Instance.SetFavoriteEntry(noteFile);
+ }
+ }
}
- favoriteEntryViewModel.Toggle();
- });
- break;
+ if (favoriteEntryItemModified != null)
+ {
+ NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.OK, NotifySystem.NotifyConfigure.Default, string.Format(setFavorites ? LanguageSystem.Instance.SetFavoritesF10 : LanguageSystem.Instance.WipeFavoritesF10, favoriteEntryItemModified.FavoriteEntryName), false, null, null, NotifySystem.SetFavoritesID);
+ if (favoriteEntryItemModified == Configure.Instance.LastDefaultEntryItem)
+ {
+ Want();
+ }
+ }
+ break;
+ default:
+ UIHandler.Instance.HandleParallel(() =>
+ {
+ if (targetNoteFile != null)
+ {
+ favoriteEntryViewModel.NoteFile = targetNoteFile;
+ favoriteEntryViewModel.Mode = 0;
+ }
+ else
+ {
+ favoriteEntryViewModel.EntryItem = EntryItemValue;
+ favoriteEntryViewModel.Mode = 1;
+ }
+ favoriteEntryViewModel.Toggle();
+ });
+ break;
+ }
}
}
}
@@ -2860,7 +2862,7 @@
public void HandleF10()
{
- if (HasNotInput(ViewModels.Instance.WwwLevelValue))
+ if (IsInputIdle(ViewModels.Instance.WwwLevelValue))
{
if (TwilightSystem.Instance.IsLoggedIn)
{
@@ -2876,7 +2878,7 @@
public void HandleF11()
{
- if (HasNotInput(ViewModels.Instance.NotifyValue))
+ if (IsInputIdle(ViewModels.Instance.NotifyValue))
{
ViewModels.Instance.NotifyValue.Toggle();
}
@@ -2972,7 +2974,7 @@
public void HandleShift(bool isInput)
{
- if (HasNotInput())
+ if (IsInputIdle())
{
if (isInput)
{
@@ -3007,7 +3009,7 @@
public void HandleSpace()
{
- if (HasNotInput(ViewModels.Instance.ConfigureValue))
+ if (IsInputIdle(ViewModels.Instance.ConfigureValue))
{
switch (ModeValue)
{
@@ -3022,7 +3024,7 @@
public void HandleEnter()
{
- if (HasNotInput())
+ if (IsInputIdle())
{
switch (ModeValue)
{
@@ -3077,7 +3079,7 @@
public void HandleUndoComment()
{
- if (HasNotInput())
+ if (IsInputIdle())
{
if (ViewModels.Instance.HasSiteViewModel(siteViewModel => siteViewModel.IsNetSite))
{
@@ -3104,7 +3106,7 @@
public void HandleViewComment()
{
- if (HasNotInput())
+ if (IsInputIdle())
{
if (Computer.IsPostableItemMode)
{
@@ -3126,7 +3128,7 @@
public void HandleViewComment(NetItem netItem)
{
- if (netItem.Comment != null && HasNotInput())
+ if (netItem.Comment != null && IsInputIdle())
{
IsCommentMode = false;
var defaultModeComponentValue = Computer.DefaultModeComponentValue ?? ModeComponentValue.Clone();
@@ -3137,7 +3139,7 @@
public void Input(T[][][] inputConfigure, T rawInput, bool isInput, DefaultCompute.InputFlag inputFlag = DefaultCompute.InputFlag.Not, byte inputPower = byte.MaxValue)
{
- if (HasNotInput())
+ if (IsInputIdle())
{
var inputMap = inputConfigure[(int)Computer.InputMode];
for (var i = inputMap.Length - 1; i > 0; --i)
@@ -3152,7 +3154,7 @@
public void PostItem(int postableItemPosition)
{
- if (HasNotInput())
+ if (IsInputIdle())
{
Computer.PostItem(postableItemPosition);
}
@@ -3160,7 +3162,7 @@
public void HandleVeilDrawing()
{
- if (HasNotInput())
+ if (IsInputIdle())
{
Computer.HandleVeilDrawing();
}
@@ -3168,7 +3170,7 @@
public void HandleHalfMultiplier()
{
- if (HasNotInput())
+ if (IsInputIdle())
{
Computer.HandleHalfMultiplier();
}
@@ -3176,7 +3178,7 @@
public void Handle2XMultiplier()
{
- if (HasNotInput())
+ if (IsInputIdle())
{
Computer.Handle2XMultiplier();
}
@@ -3184,7 +3186,7 @@
public void HandleUndo()
{
- if (HasNotInput())
+ if (IsInputIdle())
{
switch (ModeValue)
{
@@ -3778,7 +3780,7 @@
Fade(HandleImpl, defaultComputer, false, 0);
break;
case Mode.Computing:
- Fade(HandleImpl, Computer, true, Computer.FadingViewLayer);
+ Fade(HandleImpl, Computer, true, Computer.QuitModeFadingViewLayer);
break;
case Mode.Quit:
HandleImpl();
diff --git a/Qwilight/ViewModel/NotifyXamlViewModel.cs b/Qwilight/ViewModel/NotifyXamlViewModel.cs
index f148f65..036756a 100644
--- a/Qwilight/ViewModel/NotifyXamlViewModel.cs
+++ b/Qwilight/ViewModel/NotifyXamlViewModel.cs
@@ -10,7 +10,7 @@
{
public ObservableCollection NotifyXamlItemUICollection { get; } = new();
- public List NotifyXamlItemCollection { get; } = new();
+ public LinkedList NotifyXamlItemCollection { get; } = new();
public void OnPointLower(object sender, MouseButtonEventArgs e)
{
@@ -37,10 +37,10 @@
else
{
SetHandler(toNotifyXamlItem);
- NotifyXamlItemUICollection.Add(toNotifyXamlItem);
+ NotifyXamlItemUICollection.Insert(0, toNotifyXamlItem);
lock (NotifyXamlItemCollection)
{
- NotifyXamlItemCollection.Add(toNotifyXamlItem);
+ NotifyXamlItemCollection.AddFirst(toNotifyXamlItem);
}
}