diff --git a/Qwilight/Compiler/BaseCompiler.cs b/Qwilight/Compiler/BaseCompiler.cs index 79a0344..6a8d988 100644 --- a/Qwilight/Compiler/BaseCompiler.cs +++ b/Qwilight/Compiler/BaseCompiler.cs @@ -14,7 +14,7 @@ PMSFile pmsFile => new PMSCompiler(pmsFile, setCancelCompiler), BMSONFile bmsonFile => new BMSONCompiler(bmsonFile, setCancelCompiler), BMSFile bmsFile => new BMSCompiler(bmsFile, setCancelCompiler), - _ => default + _ => throw new ArgumentException(noteFile.ToString()) }; public Component.InputMode InputMode { get; set; } diff --git a/Qwilight/Compute/DefaultCompute.cs b/Qwilight/Compute/DefaultCompute.cs index 5476d65..3d51f80 100644 --- a/Qwilight/Compute/DefaultCompute.cs +++ b/Qwilight/Compute/DefaultCompute.cs @@ -1174,30 +1174,15 @@ { _isPaused = true; } - if (_sentIOAvatarIDs.Count > 0) - { - TwilightSystem.Instance.SendParallel(Event.Types.EventID.IoPause, new - { - avatarIDs = _sentIOAvatarIDs, - handlerID = HandlerID, - isPaused = true - }); - } } } public void Unpause() { IsPausingWindowOpened = false; - SetPause = false; - if (_sentIOAvatarIDs.Count > 0) + if (CanPause) { - TwilightSystem.Instance.SendParallel(Event.Types.EventID.IoPause, new - { - avatarIDs = _sentIOAvatarIDs, - handlerID = HandlerID, - isPaused = false - }); + SetPause = false; } } @@ -1205,7 +1190,7 @@ { ModeComponent.AutoMode.Default => true, ModeComponent.AutoMode.Autoable => Array.IndexOf(Component.AutoableInputs[(int)InputMode], input) == -1, - _ => default, + _ => throw new ArgumentException(ModeComponentValue.AutoModeValue.ToString()) }; public virtual bool IsSuitableAsHwInput(int input) => IsSuitableAsInput(input); @@ -1214,7 +1199,7 @@ { ModeComponent.AutoMode.Default => false, ModeComponent.AutoMode.Autoable => Component.AutoableInputs[(int)InputMode].Contains(input), - _ => default, + _ => throw new ArgumentException(ModeComponentValue.AutoModeValue.ToString()) }; public void PostItem(int postableItemPosition) @@ -1835,6 +1820,15 @@ AudioSystem.Instance.Pause(this, true); MediaSystem.Instance.Pause(this, true); IsPausing = true; + if (_sentIOAvatarIDs.Count > 0) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.IoPause, new + { + avatarIDs = _sentIOAvatarIDs, + handlerID = HandlerID, + isPaused = true + }); + } } var millisLoopUnit = _valueComponent.MillisLoopUnit; @@ -2262,6 +2256,15 @@ AudioSystem.Instance.Pause(this, false); MediaSystem.Instance.Pause(this, false); IsPausing = false; + if (_sentIOAvatarIDs.Count > 0) + { + TwilightSystem.Instance.SendParallel(Event.Types.EventID.IoPause, new + { + avatarIDs = _sentIOAvatarIDs, + handlerID = HandlerID, + isPaused = false + }); + } } } } diff --git a/Qwilight/ModeComponent.cs b/Qwilight/ModeComponent.cs index 700ffb0..1cce999 100644 --- a/Qwilight/ModeComponent.cs +++ b/Qwilight/ModeComponent.cs @@ -174,7 +174,7 @@ PutCopyNotes.Copy => LanguageSystem.Instance.CopyPutCopyNotesText, PutCopyNotes.P1Symmetric => LanguageSystem.Instance.P1SymmetricCopyNotesText, PutCopyNotes.P2Symmetric => LanguageSystem.Instance.P2SymmetricCopyNotesText, - _ => default + _ => throw new ArgumentException(PutCopyNotesValueV2.ToString()) }; public bool IsDefaultHandled => CanBeTwilightComment && diff --git a/Qwilight/Modifier/MultiplyModifier.cs b/Qwilight/Modifier/MultiplyModifier.cs index 2c78f50..631faac 100644 --- a/Qwilight/Modifier/MultiplyModifier.cs +++ b/Qwilight/Modifier/MultiplyModifier.cs @@ -9,7 +9,7 @@ { double valueFloat64 => valueFloat64 * (double)parameter, int valueInt => valueInt * (double)parameter, - _ => default, + _ => throw new ArgumentException(value.ToString()) }; public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => null; diff --git a/Qwilight/PostableItem.cs b/Qwilight/PostableItem.cs index 79b5afe..7dfbcb7 100644 --- a/Qwilight/PostableItem.cs +++ b/Qwilight/PostableItem.cs @@ -191,7 +191,7 @@ Variety.LowerAudioMultiplier => "🌐 SLOWER", Variety.HigherAudioMultiplier => "🌐 FASTER", Variety.Pause => "🌐 PAUSE", - _ => default + _ => throw new ArgumentException(VarietyValue.ToString()) }; } } diff --git a/Qwilight/System/AudioSystem/AudioSystem.cs b/Qwilight/System/AudioSystem/AudioSystem.cs index 7dd73f0..68d1cc6 100644 --- a/Qwilight/System/AudioSystem/AudioSystem.cs +++ b/Qwilight/System/AudioSystem/AudioSystem.cs @@ -257,7 +257,7 @@ { OUTPUTTYPE.WASAPI => Configure.Instance.LastWASAPIAudioValueID, OUTPUTTYPE.ASIO => Configure.Instance.LastASIOAudioValueID, - _ => default + _ => throw new ArgumentException(Configure.Instance.AudioVariety.ToString()) }); }); return RESULT.OK; diff --git a/Qwilight/System/Configure/Configure.cs b/Qwilight/System/Configure/Configure.cs index b61e01e..4ed597c 100644 --- a/Qwilight/System/Configure/Configure.cs +++ b/Qwilight/System/Configure/Configure.cs @@ -530,7 +530,7 @@ NVLLMode.Not => LanguageSystem.Instance.NVLLModeNotText, NVLLMode.Standard => LanguageSystem.Instance.NVLLModeOKText, NVLLMode.Unlimited => LanguageSystem.Instance.NVLLModeUnlimitedText, - _ => default, + _ => throw new ArgumentException(NVLLModeValue.ToString()) }; public double NVLLFramerate @@ -1027,7 +1027,7 @@ DefaultAudioVariety.Not => LanguageSystem.Instance.NotDefaultAudioVarietyText, DefaultAudioVariety.UI => LanguageSystem.Instance.UIDefaultAudioVarietyText, DefaultAudioVariety.Favor => LanguageSystem.Instance.FavorDefaultAudioVarietyText, - _ => default + _ => throw new ArgumentException(DefaultAudioVarietyValue.ToString()) }; public Brush DefaultAudioVarietyPaint => Paints.PointPaints[DefaultAudioVarietyValue != DefaultAudioVariety.Not ? 1 : 0]; @@ -1294,7 +1294,7 @@ ControllerSystem.VibrationMode.Not => LanguageSystem.Instance.NotVibrationModeText, ControllerSystem.VibrationMode.Input => LanguageSystem.Instance.InputVibrationModeText, ControllerSystem.VibrationMode.Failed => LanguageSystem.Instance.FailedVibrationModeText, - _ => default, + _ => throw new ArgumentException(VibrationModeValue.ToString()) }; public string GetCipher() @@ -1394,7 +1394,7 @@ { WantBanned.Total => LanguageSystem.Instance.WantTotalBannedText, WantBanned.NotBanned => LanguageSystem.Instance.WantNotBannedText, - _ => default, + _ => throw new ArgumentException(WantBannedValue.ToString()) }; public bool AutoHighlight @@ -3549,7 +3549,7 @@ AudioVisualizerMode.AudioVisualizerMode0 => 0.0, AudioVisualizerMode.AudioVisualizerMode1 => (audioVisualizerHeight - value) / 2, AudioVisualizerMode.AudioVisualizerMode2 => audioVisualizerHeight - value, - _ => default + _ => throw new ArgumentException(AudioVisualizerModeValue.ToString()) }; public override void NotifyModel() diff --git a/Qwilight/System/ControllerSystem/ControllerSystem.cs b/Qwilight/System/ControllerSystem/ControllerSystem.cs index c5366a5..4e4962e 100644 --- a/Qwilight/System/ControllerSystem/ControllerSystem.cs +++ b/Qwilight/System/ControllerSystem/ControllerSystem.cs @@ -827,16 +827,14 @@ BatteryType.Alkaline => LanguageSystem.Instance.Power00, BatteryType.Disconnected => LanguageSystem.Instance.Power01, BatteryType.Nimh => LanguageSystem.Instance.Power02, - BatteryType.Unknown => LanguageSystem.Instance.Power03, BatteryType.Wired => LanguageSystem.Instance.Power04, - _ => default + _ => LanguageSystem.Instance.Power03 }, mainControllerPower.BatteryLevel switch { BatteryLevel.Low => (200.0 / 3), BatteryLevel.Medium => (100.0 / 3), BatteryLevel.Full => 100.0, - BatteryLevel.Empty => 0.0, - _ => default + _ => 0.0 }); } } @@ -1208,8 +1206,7 @@ BatteryStatus.Charging => LanguageSystem.Instance.Power10, BatteryStatus.Discharging => LanguageSystem.Instance.Power11, BatteryStatus.Idle => LanguageSystem.Instance.Power12, - BatteryStatus.NotPresent => LanguageSystem.Instance.Power13, - _ => default + _ => LanguageSystem.Instance.Power13 }, 100.0 * mainControllerPower.RemainingCapacityInMilliwattHours / mainControllerPower.FullChargeCapacityInMilliwattHours); } } diff --git a/Qwilight/System/DrawingSystem/DrawingSystem.cs b/Qwilight/System/DrawingSystem/DrawingSystem.cs index 539c739..23b807f 100644 --- a/Qwilight/System/DrawingSystem/DrawingSystem.cs +++ b/Qwilight/System/DrawingSystem/DrawingSystem.cs @@ -973,7 +973,7 @@ BPMVariety.BPM => defaultComputer.HandlingBPM, BPMVariety.AudioMultiplier => defaultComputer.HandlingBPM * defaultComputer.AudioMultiplier, BPMVariety.Multiplier => defaultComputer.HandlingBPM * defaultComputer.AudioMultiplier * defaultComputer.ModeComponentValue.Multiplier, - _ => default + _ => throw new ArgumentException(Configure.Instance.BPMVarietyValue.Data.ToString()), })), int.MaxValue)); var bpmPosition0 = drawingComponent.bpmPosition0; var bpmPosition1 = drawingComponent.bpmPosition1; @@ -2339,7 +2339,7 @@ DefaultCompute.WaitingTwilight.Net => LanguageSystem.Instance.WaitingNetContents, DefaultCompute.WaitingTwilight.WaitIO => LanguageSystem.Instance.WaitingIOContents, DefaultCompute.WaitingTwilight.CallIO => LanguageSystem.Instance.CallingIOContents, - _ => default + _ => throw new ArgumentException(waitingTwilightLevel.ToString()) }, pauseNotify0Position0, pauseNotify0Position1, PauseNotifyFont, Colors.White) + Levels.StandardMarginFloat32; } @@ -2759,20 +2759,20 @@ MoveStatus(drawingComponent.statusSliderPosition0, drawingComponent.statusSliderPosition1, drawingComponent.statusSliderLength, drawingComponent.statusSliderHeight, drawingComponent.statusSliderSystem, drawingComponent.altStatusSlider); } - bool MoveStatus(float position0, float position1, float length, float height, int system, int alt) + bool MoveStatus(float statusPosition0, float statusPosition1, float statusLength, float statusHeight, int statusSystem, int altStatus) { - for (var i = alt >> 1; i >= alt % 2; --i) + for (var i = altStatus >> 1; i >= altStatus % 2; --i) { var distance = i == 1 && has2P ? distance2P : 0F; - if (lastPointedPositionX >= position0 + distance && lastPointedPositionX < position0 + distance + length && lastPointedPositionY >= position1 && lastPointedPositionY < position1 + height) + if (lastPointedPositionX >= statusPosition0 + distance && lastPointedPositionX < statusPosition0 + distance + statusLength && lastPointedPositionY >= statusPosition1 && lastPointedPositionY < statusPosition1 + statusHeight) { - defaultComputer.LevyingWait = lastPointed.Item2 ? -Component.LevyingWait : system switch + defaultComputer.LevyingWait = lastPointed.Item2 ? -Component.LevyingWait : statusSystem switch { - 0 => defaultComputer.Length * (1 - (lastPointedPositionY - position1) / height), - 1 => defaultComputer.Length * (lastPointedPositionY - position1) / height, - 2 => defaultComputer.Length * (1 - (lastPointedPositionX - position0 - distance) / length), - 3 => defaultComputer.Length * (lastPointedPositionX - position0 - distance) / length, - _ => default, + 0 => defaultComputer.Length * (1 - (lastPointedPositionY - statusPosition1) / statusHeight), + 1 => defaultComputer.Length * (lastPointedPositionY - statusPosition1) / statusHeight, + 2 => defaultComputer.Length * (1 - (lastPointedPositionX - statusPosition0 - distance) / statusLength), + 3 => defaultComputer.Length * (lastPointedPositionX - statusPosition0 - distance) / statusLength, + _ => throw new ArgumentException(statusSystem.ToString()) }; defaultComputer.SetUndoValue = DefaultCompute.SetUndo.Just; return true; @@ -3631,14 +3631,14 @@ 0 => CanvasHorizontalAlignment.Right, 1 => CanvasHorizontalAlignment.Left, 2 => CanvasHorizontalAlignment.Center, - _ => default, + _ => throw new ArgumentException(fontSystem0.ToString()) }; font.VerticalAlignment = fontSystem1 switch { 0 => CanvasVerticalAlignment.Top, 1 => CanvasVerticalAlignment.Bottom, 2 => CanvasVerticalAlignment.Center, - _ => default, + _ => throw new ArgumentException(fontSystem1.ToString()) }; } diff --git a/Qwilight/System/NotifySystem.cs b/Qwilight/System/NotifySystem.cs index a65f3fb..34c51df 100644 --- a/Qwilight/System/NotifySystem.cs +++ b/Qwilight/System/NotifySystem.cs @@ -92,7 +92,7 @@ NotifyVariety.Info => Paints.PaintInfo, NotifyVariety.Fault => Paints.PaintFault, NotifyVariety.Warning => Paints.PaintWarning, - _ => default + _ => throw new ArgumentException(toNotifyVariety.ToString()) }, Color = toNotifyVariety switch { @@ -100,7 +100,7 @@ NotifyVariety.Info => Paints.ColorInfo, NotifyVariety.Fault => Paints.ColorFault, NotifyVariety.Warning => Paints.ColorWarning, - _ => default + _ => throw new ArgumentException(toNotifyVariety.ToString()) }, Contents = toNotify, OnHandle = onHandle, diff --git a/Qwilight/System/TwilightSystem.cs b/Qwilight/System/TwilightSystem.cs index c736ae7..1dc5605 100644 --- a/Qwilight/System/TwilightSystem.cs +++ b/Qwilight/System/TwilightSystem.cs @@ -438,7 +438,7 @@ BundleItem.BundleVariety.UI => valueUIBundleItems, BundleItem.BundleVariety.Qwilight => qwilightBundleItems, BundleItem.BundleVariety.EventNote => eventNoteBundleItems, - _ => default + _ => throw new ArgumentException(bundleDataItem.bundleVariety.ToString()) })?.Add(new(new() { Data = bundleDataItem.bundleCompetence @@ -1046,7 +1046,7 @@ { "MD5" => DB.EventNoteVariety.MD5, "Qwilight" => DB.EventNoteVariety.Qwilight, - _ => default + _ => throw new ArgumentException(twilightSavedBundle.etc.ToString()) }; var date = DateTime.Now; DB.Instance.SetEventNote(eventNoteID, eventNoteName, date, eventNoteVariety); diff --git a/Qwilight/UIComponent/AutoEnterSite.cs b/Qwilight/UIComponent/AutoEnterSite.cs index 91c2d4d..4c420bb 100644 --- a/Qwilight/UIComponent/AutoEnterSite.cs +++ b/Qwilight/UIComponent/AutoEnterSite.cs @@ -19,7 +19,7 @@ AutoEnter => LanguageSystem.Instance.AutoEnterContents, AutoEnterLoggedIn => LanguageSystem.Instance.AutoEnterLoggedInContents, WaitSite => LanguageSystem.Instance.WaitSiteContents, - _ => default + _ => throw new ArgumentException(Data.ToString()) }; public static bool operator ==(AutoEnterSite left, AutoEnterSite right) => left.Equals(right); diff --git a/Qwilight/UIComponent/BPMVariety.cs b/Qwilight/UIComponent/BPMVariety.cs index 7784594..93fcd16 100644 --- a/Qwilight/UIComponent/BPMVariety.cs +++ b/Qwilight/UIComponent/BPMVariety.cs @@ -19,7 +19,7 @@ BPM => "BPM", AudioMultiplier => LanguageSystem.Instance.BPMVarietyAudioMultiplierText, Multiplier => LanguageSystem.Instance.BPMVarietyMultiplierText, - _ => default + _ => throw new ArgumentException(Data.ToString()) }; public static bool operator ==(BPMVariety left, BPMVariety right) => left.Equals(right); diff --git a/Qwilight/UIComponent/BundleCompetence.cs b/Qwilight/UIComponent/BundleCompetence.cs index c2a97ee..83da689 100644 --- a/Qwilight/UIComponent/BundleCompetence.cs +++ b/Qwilight/UIComponent/BundleCompetence.cs @@ -15,7 +15,7 @@ BundleAvatar => Paints.Paint3, BundleUbuntu => Paints.Paint2, BundleVoid => Paints.Paint1, - _ => default + _ => throw new ArgumentException(Data.ToString()) }; public int Data { get; init; } @@ -32,7 +32,7 @@ BundleAvatar => LanguageSystem.Instance.BundleAvatarContents, BundleUbuntu => LanguageSystem.Instance.BundleUbuntuContents, BundleVoid => LanguageSystem.Instance.BundleVoidContents, - _ => default + _ => throw new ArgumentException(Data.ToString()) }; public static bool operator ==(BundleCompetence left, BundleCompetence right) => left.Equals(right); diff --git a/Qwilight/UIComponent/FitMode.cs b/Qwilight/UIComponent/FitMode.cs index 979782f..77d40a6 100644 --- a/Qwilight/UIComponent/FitMode.cs +++ b/Qwilight/UIComponent/FitMode.cs @@ -37,7 +37,7 @@ EntryPath => BaseUI.Instance.EntryPathFitDrawing, HitPointsValue => BaseUI.Instance.HitPointsValueFitDrawing, Handled => BaseUI.Instance.HandledFitDrawing, - _ => default, + _ => throw new ArgumentException(Mode.ToString()) }; public int Mode { get; init; } diff --git a/Qwilight/UIComponent/HunterVariety.cs b/Qwilight/UIComponent/HunterVariety.cs index decf949..95ee317 100644 --- a/Qwilight/UIComponent/HunterVariety.cs +++ b/Qwilight/UIComponent/HunterVariety.cs @@ -23,7 +23,7 @@ HunterVarietyLower => LanguageSystem.Instance.HunterVarietyLowerText, HunterVarietyFavor => LanguageSystem.Instance.HunterVarietyFavorText, HunterVarietyMe => LanguageSystem.Instance.HunterVarietyMeText, - _ => default + _ => throw new ArgumentException(Mode.ToString()) }; public static bool operator ==(HunterVariety left, HunterVariety right) => left.Equals(right); diff --git a/Qwilight/UIComponent/IOCompetence.cs b/Qwilight/UIComponent/IOCompetence.cs index a008642..c13968a 100644 --- a/Qwilight/UIComponent/IOCompetence.cs +++ b/Qwilight/UIComponent/IOCompetence.cs @@ -21,7 +21,7 @@ IOAvatar => LanguageSystem.Instance.IOAvatarContents, IOUbuntu => LanguageSystem.Instance.IOUbuntuContents, IOVoid => LanguageSystem.Instance.IOVoidContents, - _ => default + _ => throw new ArgumentException(Data.ToString()) }; public static bool operator ==(IOCompetence left, IOCompetence right) => left.Equals(right); diff --git a/Qwilight/UIComponent/NotifySaveBundleCompetence.cs b/Qwilight/UIComponent/NotifySaveBundleCompetence.cs index a0c7d0f..7e1fd70 100644 --- a/Qwilight/UIComponent/NotifySaveBundleCompetence.cs +++ b/Qwilight/UIComponent/NotifySaveBundleCompetence.cs @@ -21,7 +21,7 @@ NotifySaveBundleAvatar => LanguageSystem.Instance.NotifySaveBundleAvatarContents, NotifySaveBundleUbuntu => LanguageSystem.Instance.NotifySaveBundleUbuntuContents, NotifySaveBundleVoid => LanguageSystem.Instance.NotifySaveBundleVoidContents, - _ => default + _ => throw new ArgumentException(Data.ToString()) }; public static bool operator ==(NotifySaveBundleCompetence left, NotifySaveBundleCompetence right) => left.Equals(right); diff --git a/Qwilight/UIComponent/NotifyUbuntuCompetence.cs b/Qwilight/UIComponent/NotifyUbuntuCompetence.cs index b71655b..2eba5e7 100644 --- a/Qwilight/UIComponent/NotifyUbuntuCompetence.cs +++ b/Qwilight/UIComponent/NotifyUbuntuCompetence.cs @@ -17,7 +17,7 @@ { NotifyUbuntu => LanguageSystem.Instance.NotifyUbuntuContents, NotNotifyUbuntu => LanguageSystem.Instance.NotNotifyUbuntuContents, - _ => default + _ => throw new ArgumentException(Data.ToString()) }; public static bool operator ==(NotifyUbuntuCompetence left, NotifyUbuntuCompetence right) => left.Equals(right); diff --git a/Qwilight/UIComponent/SilentSiteCompetence.cs b/Qwilight/UIComponent/SilentSiteCompetence.cs index 47e3ed0..8329dc4 100644 --- a/Qwilight/UIComponent/SilentSiteCompetence.cs +++ b/Qwilight/UIComponent/SilentSiteCompetence.cs @@ -21,7 +21,7 @@ SilentSiteAvatar => LanguageSystem.Instance.SilentSiteAvatarContents, SilentSiteUbuntu => LanguageSystem.Instance.SilentSiteUbuntuContents, SilentSiteVoid => LanguageSystem.Instance.SilentSiteVoidContents, - _ => default + _ => throw new ArgumentException(Data.ToString()) }; public static bool operator ==(SilentSiteCompetence left, SilentSiteCompetence right) => left.Equals(right); diff --git a/Qwilight/UIComponent/UbuntuItem.cs b/Qwilight/UIComponent/UbuntuItem.cs index c0fa4cd..2798f20 100644 --- a/Qwilight/UIComponent/UbuntuItem.cs +++ b/Qwilight/UIComponent/UbuntuItem.cs @@ -57,7 +57,7 @@ UbuntuSituation.QuitMode => string.Format(LanguageSystem.Instance.QuitComputingSituationContents, SituationText), UbuntuSituation.NetComputing => string.Format(LanguageSystem.Instance.NetComputingSituationContents, SituationText), UbuntuSituation.IOComputing => string.Format(LanguageSystem.Instance.IOComputingSituationContents, SituationText), - _ => default, + _ => throw new ArgumentException(UbuntuSituationValue.ToString()) }; public override bool Equals(object obj) => obj is UbuntuItem ubuntuItem && AvatarID == ubuntuItem.AvatarID; diff --git a/Qwilight/UIComponent/ViewItem.cs b/Qwilight/UIComponent/ViewItem.cs index dafeb47..8f474f5 100644 --- a/Qwilight/UIComponent/ViewItem.cs +++ b/Qwilight/UIComponent/ViewItem.cs @@ -19,7 +19,7 @@ Always => LanguageSystem.Instance.AlwaysViewContents, NotAutoCompute => LanguageSystem.Instance.NotAutoComputeViewContents, Not => LanguageSystem.Instance.NotViewContents, - _ => default + _ => throw new ArgumentException(Data.ToString()) }; public static bool operator ==(ViewItem left, ViewItem right) => left.Equals(right); diff --git a/Qwilight/View/EdgePanel.xaml.cs b/Qwilight/View/EdgePanel.xaml.cs index 7df6bb3..d9bc03f 100644 --- a/Qwilight/View/EdgePanel.xaml.cs +++ b/Qwilight/View/EdgePanel.xaml.cs @@ -10,7 +10,7 @@ [INotifyPropertyChanged] public partial class EdgePanel { - public static readonly DependencyProperty InitWwwProperty = DependencyProperty.Register(nameof(InitWww), typeof(string), typeof(EdgePanel), new FrameworkPropertyMetadata(default(string), FrameworkPropertyMetadataOptions.None, (d, e) => + public static readonly DependencyProperty InitWwwProperty = DependencyProperty.Register(nameof(InitWww), typeof(string), typeof(EdgePanel), new FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.None, (d, e) => { (d as EdgePanel).OnInit(); })); diff --git a/Qwilight/View/QwilightClass.xaml.cs b/Qwilight/View/QwilightClass.xaml.cs index 76c1e98..d0e05f3 100644 --- a/Qwilight/View/QwilightClass.xaml.cs +++ b/Qwilight/View/QwilightClass.xaml.cs @@ -57,13 +57,11 @@ try { - using (var r = Registry.LocalMachine.OpenSubKey("SOFTWARE")?.OpenSubKey("WOW6432Node")?.OpenSubKey("Microsoft")?.OpenSubKey("EdgeUpdate")?.OpenSubKey("Clients")?.OpenSubKey("{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}")) + using var r = Registry.LocalMachine.OpenSubKey("SOFTWARE")?.OpenSubKey("WOW6432Node")?.OpenSubKey("Microsoft")?.OpenSubKey("EdgeUpdate")?.OpenSubKey("Clients")?.OpenSubKey("{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"); + if (string.IsNullOrEmpty(r?.GetValue("pv") as string)) { - if (string.IsNullOrEmpty(r?.GetValue("pv") as string)) - { - using var exe = Process.Start(Path.Combine(QwilightComponent.AssetsEntryPath, "MicrosoftEdgeWebview2Setup.exe")); - exe.WaitForExit(); - } + using var exe = Process.Start(Path.Combine(QwilightComponent.AssetsEntryPath, "MicrosoftEdgeWebview2Setup.exe")); + exe.WaitForExit(); } } catch diff --git a/Qwilight/ViewModel/InputStandardControllerViewModel.cs b/Qwilight/ViewModel/InputStandardControllerViewModel.cs index 7952f81..3295764 100644 --- a/Qwilight/ViewModel/InputStandardControllerViewModel.cs +++ b/Qwilight/ViewModel/InputStandardControllerViewModel.cs @@ -174,7 +174,7 @@ VeilDrawing => LanguageSystem.Instance.VeilDrawingContents, HalfMultiplier => LanguageSystem.Instance.HalfMultiplierContents, _2XMultiplier => LanguageSystem.Instance._2XMultiplierContents, - _ => default + _ => throw new ArgumentException(inputPosition.ToString()) }, input); OnPropertyChanged(nameof(Inputs)); } diff --git a/Qwilight/ViewModel/InputStandardViewModel.cs b/Qwilight/ViewModel/InputStandardViewModel.cs index 335842b..f0abc29 100644 --- a/Qwilight/ViewModel/InputStandardViewModel.cs +++ b/Qwilight/ViewModel/InputStandardViewModel.cs @@ -230,7 +230,7 @@ VeilDrawing => LanguageSystem.Instance.VeilDrawingContents, HalfMultiplier => LanguageSystem.Instance.HalfMultiplierContents, _2XMultiplier => LanguageSystem.Instance._2XMultiplierContents, - _ => default + _ => throw new ArgumentException(inputPosition.ToString()) }, defaultInputText); OnPropertyChanged(nameof(Inputs)); if (inputPosition == PostItem0 || inputPosition == PostItem1) diff --git a/Qwilight/ViewModel/MainViewModel.cs b/Qwilight/ViewModel/MainViewModel.cs index fb2796f..51542dc 100644 --- a/Qwilight/ViewModel/MainViewModel.cs +++ b/Qwilight/ViewModel/MainViewModel.cs @@ -310,7 +310,7 @@ Mode.NoteFile => AutoComputer, Mode.Computing => Computer, Mode.Quit => AutoComputer?.IsHandling == true ? AutoComputer : Computer, - _ => default + _ => throw new ArgumentException(ModeValue.ToString()) }; public bool IsPausing => AutoComputer?.IsPausing ?? _pausableAudioHandler.IsPausing; @@ -993,13 +993,14 @@ var statusPosition1 = statusPoint[1]; var statusLength = statusPoint[2]; var statusHeight = statusPoint[3]; - MoveStatus(isAlt ? -Component.LevyingWait : statusPoint[4] switch + var statusSystem = statusPoint[4]; + MoveStatus(isAlt ? -Component.LevyingWait : statusSystem switch { 0 => 1 - (pointPositionY - statusPosition1) / statusHeight, 1 => (pointPositionY - statusPosition1) / statusHeight, 2 => 1 - (pointPositionX - statusPosition0) / statusLength, 3 => (pointPositionX - statusPosition0) / statusLength, - _ => default, + _ => throw new ArgumentException(statusSystem.ToString()) }, e.ClickCount >= 2); } else if (inputNoteCountViewPoint?.Length >= 4 && new Bound(inputNoteCountViewPoint).IsPoint(pointPosition)) @@ -1733,7 +1734,7 @@ { DB.EventNoteVariety.Qwilight => NoteID512s, DB.EventNoteVariety.MD5 => NoteID128s, - _ => default, + _ => throw new ArgumentException(eventNoteVariety.ToString()), }; var entryItem = new EntryItem { diff --git a/Qwilight/ViewModel/ModifyModeComponentViewModel.cs b/Qwilight/ViewModel/ModifyModeComponentViewModel.cs index 645766c..e2a2649 100644 --- a/Qwilight/ViewModel/ModifyModeComponentViewModel.cs +++ b/Qwilight/ViewModel/ModifyModeComponentViewModel.cs @@ -51,24 +51,6 @@ { OnPropertyChanged(nameof(IsHitPointsMode)); ModeComponentItems = ModifyModeComponentItems[value]; - var targetModeValue = value switch - { - AutoModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.AutoModeValue, - NoteSaltModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.NoteSaltModeValue, - FaintNoteModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.FaintNoteModeValue, - JudgmentModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.JudgmentModeValue, - HitPointsModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.HitPointsModeValue, - NoteMobilityModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.NoteMobilityModeValue, - LongNoteModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.LongNoteModeValue, - InputFavorModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.InputFavorModeValue, - NoteModifyModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.NoteModifyModeValue, - BPMModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.BPMModeValue, - WaveModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.WaveModeValue, - SetNoteModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.SetNoteModeValue, - LowestJudgmentConditionModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.LowestJudgmentConditionModeValue, - _ => default - }; - ModeComponentItem = ModeComponentItems.Single(modeComponentItem => modeComponentItem.Value == targetModeValue); } } } @@ -848,6 +830,29 @@ }); } + public override void OnOpened() + { + base.OnOpened(); + var targetModeValue = ModeComponentVariety switch + { + AutoModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.AutoModeValue, + NoteSaltModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.NoteSaltModeValue, + FaintNoteModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.FaintNoteModeValue, + JudgmentModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.JudgmentModeValue, + HitPointsModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.HitPointsModeValue, + NoteMobilityModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.NoteMobilityModeValue, + LongNoteModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.LongNoteModeValue, + InputFavorModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.InputFavorModeValue, + NoteModifyModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.NoteModifyModeValue, + BPMModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.BPMModeValue, + WaveModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.WaveModeValue, + SetNoteModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.SetNoteModeValue, + LowestJudgmentConditionModeVariety => (int)ViewModels.Instance.MainValue.ModeComponentValue.LowestJudgmentConditionModeValue, + _ => throw new ArgumentException(ModeComponentVariety.ToString()) + }; + ModeComponentItem = ModeComponentItems.Single(modeComponentItem => modeComponentItem.Value == targetModeValue); + } + public override void OnCollapsed() { base.OnCollapsed(); diff --git a/Qwilight/ViewModel/NoteFileViewModel.cs b/Qwilight/ViewModel/NoteFileViewModel.cs index 15526d9..8e50176 100644 --- a/Qwilight/ViewModel/NoteFileViewModel.cs +++ b/Qwilight/ViewModel/NoteFileViewModel.cs @@ -341,7 +341,7 @@ { DB.EventNoteVariety.MD5 => "MD5", DB.EventNoteVariety.Qwilight => "Qwilight", - _ => default + _ => throw new ArgumentException(EntryItemValue.EventNoteVariety.ToString()) } }); } diff --git a/Qwilight/ViewModel/SiteViewModel.cs b/Qwilight/ViewModel/SiteViewModel.cs index e9658f2..f1efd59 100644 --- a/Qwilight/ViewModel/SiteViewModel.cs +++ b/Qwilight/ViewModel/SiteViewModel.cs @@ -492,7 +492,7 @@ 0 => LanguageSystem.Instance.StandValidHunterModeText, 1 => LanguageSystem.Instance.PointValidHunterModeText, 2 => LanguageSystem.Instance.BandValidHunterModeText, - _ => default, + _ => throw new ArgumentException(ValidHunterMode.ToString()) }; public string BundleName