-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b014929
commit a94b0e7
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
OngekiFumenEditor/Modules/FumenCheckerListViewer/Base/OgkrImpl/ColorIdCheckRule.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using OngekiFumenEditor.Base; | ||
using OngekiFumenEditor.Base.OngekiObjects; | ||
using OngekiFumenEditor.Base.OngekiObjects.ConnectableObject; | ||
using OngekiFumenEditor.Base.OngekiObjects.Lane; | ||
using OngekiFumenEditor.Modules.FumenCheckerListViewer.Base.DefaultNavigateBehaviorImpl; | ||
using OngekiFumenEditor.Modules.FumenVisualEditor.ViewModels; | ||
using OngekiFumenEditor.Parser.DefaultImpl.Ogkr.Rules; | ||
using OngekiFumenEditor.Properties; | ||
using OngekiFumenEditor.Utils; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.Composition; | ||
using System.Linq; | ||
|
||
namespace OngekiFumenEditor.Modules.FumenCheckerListViewer.Base.DefaultRulesImpl | ||
{ | ||
[Export(typeof(IFumenCheckRule))] | ||
[Export(typeof(IOngekiFumenCheckRule))] | ||
internal class ColorIdCheckRule : IOngekiFumenCheckRule | ||
{ | ||
public IEnumerable<ICheckResult> CheckRule(OngekiFumen fumen, FumenVisualEditorViewModel fumenHostViewModel) | ||
{ | ||
IEnumerable<ICheckResult> CheckList(IEnumerable<ColorfulLaneStart> objs) | ||
{ | ||
const string RuleName = "[Ongeki] ColorIdInvaild"; | ||
|
||
foreach (var obj in objs.Where(x => !ColorIdConst.AllColors.Any(t => t.Id == x.ColorId.Id))) | ||
{ | ||
yield return new CommonCheckResult() | ||
{ | ||
Severity = RuleSeverity.Error, | ||
Description = "Invalid ColorId: {0}".Format(obj.ColorId.ToString()), | ||
LocationDescription = $"{obj.XGrid} {obj.TGrid}", | ||
NavigateBehavior = new NavigateToTGridBehavior(obj.TGrid), | ||
RuleName = RuleName, | ||
}; | ||
} | ||
} | ||
|
||
foreach (var result in CheckList(fumen.GetAllDisplayableObjects().OfType<ColorfulLaneStart>())) | ||
yield return result; | ||
} | ||
} | ||
} | ||
|