diff --git a/Common.ruleset b/Common.ruleset index f2f168e4ed..c163bab2b8 100644 --- a/Common.ruleset +++ b/Common.ruleset @@ -183,7 +183,7 @@ - + diff --git a/ExternalProjects/BizHawk.SrcGen.ReflectionCache/ReflectionCacheGenerator.cs b/ExternalProjects/BizHawk.SrcGen.ReflectionCache/ReflectionCacheGenerator.cs index da91f2b4a9..a99ee1ba80 100644 --- a/ExternalProjects/BizHawk.SrcGen.ReflectionCache/ReflectionCacheGenerator.cs +++ b/ExternalProjects/BizHawk.SrcGen.ReflectionCache/ReflectionCacheGenerator.cs @@ -33,7 +33,7 @@ namespace BizHawk.SrcGen.ReflectionCache // black magic wizardry to find common prefix https://stackoverflow.com/a/35081977 var ns = new string(_namespaces[0] .Substring(0, _namespaces.Min(s => s.Length)) - .TakeWhile((c, i) => _namespaces.All(s => s[i] == c)) + .TakeWhile((c, i) => _namespaces.TrueForAll(s => s[i] == c)) .ToArray()); return ns[ns.Length - 1] == '.' ? ns.Substring(0, ns.Length - 1) : ns; // trim trailing '.' (can't use BizHawk.Common from Source Generators) } diff --git a/ExternalToolProjects/DATParser/NOINTROParser.cs b/ExternalToolProjects/DATParser/NOINTROParser.cs index 70e3a0b4ba..32a4e18a5b 100644 --- a/ExternalToolProjects/DATParser/NOINTROParser.cs +++ b/ExternalToolProjects/DATParser/NOINTROParser.cs @@ -234,9 +234,7 @@ namespace BizHawk.DATTool { "alpha", "beta", "preview", "pre-release", "proto" }; - - bool b = DS.Any(s.Contains); - return b; + return DS.Exists(s.Contains); } public static bool IsCopyrightStatus(string s) @@ -245,9 +243,7 @@ namespace BizHawk.DATTool { "CW", "CW-R", "FW", "GW", "GW-R", "LW", "PD", "SW", "SW-R" }; - - bool b = CS.Any(s.Contains); - return b; + return CS.Exists(s.Contains); } public static bool IsLanguageFlag(string s) @@ -270,7 +266,7 @@ namespace BizHawk.DATTool } } - //b = LC.Any(s.Contains); +// b = LC.Exists(s.Contains); } return b; @@ -297,7 +293,7 @@ namespace BizHawk.DATTool } } - //b = CC.Any(s.Contains); +// b = CC.Exists(s.Contains); } return b; diff --git a/ExternalToolProjects/DATParser/TOSECParser.cs b/ExternalToolProjects/DATParser/TOSECParser.cs index 061939e82b..72f89051e4 100644 --- a/ExternalToolProjects/DATParser/TOSECParser.cs +++ b/ExternalToolProjects/DATParser/TOSECParser.cs @@ -284,9 +284,7 @@ namespace BizHawk.DATTool { "alpha", "beta", "preview", "pre-release", "proto" }; - - bool b = DS.Any(s.Contains); - return b; + return DS.Exists(s.Contains); } public static bool IsCopyrightStatus(string s) @@ -295,9 +293,7 @@ namespace BizHawk.DATTool { "CW", "CW-R", "FW", "GW", "GW-R", "LW", "PD", "SW", "SW-R" }; - - bool b = CS.Any(s.Contains); - return b; + return CS.Exists(s.Contains); } public static bool IsLanguageFlag(string s) @@ -323,7 +319,7 @@ namespace BizHawk.DATTool } } - //b = LC.Any(s.Contains); +// b = LC.Exists(s.Contains); } return b; @@ -353,7 +349,7 @@ namespace BizHawk.DATTool } } - //b = CC.Any(s.Contains); +// b = CC.Exists(s.Contains); } return b; diff --git a/References/BizHawk.SrcGen.ReflectionCache.dll b/References/BizHawk.SrcGen.ReflectionCache.dll index 921544ba31..40d9ae6117 100644 Binary files a/References/BizHawk.SrcGen.ReflectionCache.dll and b/References/BizHawk.SrcGen.ReflectionCache.dll differ diff --git a/src/BizHawk.Client.Common/Controller.cs b/src/BizHawk.Client.Common/Controller.cs index 331745d73c..df66988c53 100644 --- a/src/BizHawk.Client.Common/Controller.cs +++ b/src/BizHawk.Client.Common/Controller.cs @@ -44,11 +44,8 @@ namespace BizHawk.Client.Common public bool this[string button] => IsPressed(button); // Looks for bindings which are activated by the supplied physical button. - public List SearchBindings(string button) => - _bindings - .Where(b => b.Value.Any(v => v == button)) - .Select(b => b.Key) - .ToList(); + public List SearchBindings(string button) + => _bindings.Where(b => b.Value.Contains(button)).Select(static b => b.Key).ToList(); // Searches bindings for the controller and returns true if this binding is mapped somewhere in this controller public bool HasBinding(string button) => diff --git a/src/BizHawk.Client.Common/config/PathEntryCollection.cs b/src/BizHawk.Client.Common/config/PathEntryCollection.cs index 2d9505a26e..792319e0eb 100644 --- a/src/BizHawk.Client.Common/config/PathEntryCollection.cs +++ b/src/BizHawk.Client.Common/config/PathEntryCollection.cs @@ -127,7 +127,7 @@ namespace BizHawk.Client.Common private PathEntry TryGetDebugPath(string system, string type) { - if (Paths.Any(p => p.IsSystem(system))) + if (Paths.Exists(p => p.IsSystem(system))) { // we have the system, but not the type. don't attempt to add an unknown type return null; @@ -144,7 +144,7 @@ namespace BizHawk.Client.Common // Add missing entries foreach (var defaultPath in Defaults.Value) { - if (!Paths.Any(p => p.System == defaultPath.System && p.Type == defaultPath.Type)) Paths.Add(defaultPath); + if (!Paths.Exists(p => p.System == defaultPath.System && p.Type == defaultPath.Type)) Paths.Add(defaultPath); } var entriesToRemove = new List(); diff --git a/src/BizHawk.Client.Common/movie/tasproj/TasMovie.History.cs b/src/BizHawk.Client.Common/movie/tasproj/TasMovie.History.cs index ffa3579bf1..bc2401f70f 100644 --- a/src/BizHawk.Client.Common/movie/tasproj/TasMovie.History.cs +++ b/src/BizHawk.Client.Common/movie/tasproj/TasMovie.History.cs @@ -199,13 +199,7 @@ namespace BizHawk.Client.Common UndoIndex--; _recordingBatch = false; - - if (batch.All(a => a.GetType() == typeof(MovieActionMarker))) - { - return _movie.InputLogLength; - } - - return PreviousUndoFrame; + return batch.TrueForAll(static a => a is MovieActionMarker) ? _movie.InputLogLength : PreviousUndoFrame; } /// @@ -227,13 +221,7 @@ namespace BizHawk.Client.Common } _recordingBatch = false; - - if (batch.All(a => a.GetType() == typeof(MovieActionMarker))) - { - return _movie.InputLogLength; - } - - return PreviousRedoFrame; + return batch.TrueForAll(static a => a is MovieActionMarker) ? _movie.InputLogLength : PreviousRedoFrame; } public bool CanUndo => UndoIndex > -1; @@ -511,7 +499,7 @@ namespace BizHawk.Client.Common } } - public class MovieActionMarker : IMovieAction + public sealed class MovieActionMarker : IMovieAction { public int FirstFrame { get; } public int LastFrame { get; } diff --git a/src/BizHawk.Client.Common/tools/CheatList.cs b/src/BizHawk.Client.Common/tools/CheatList.cs index f20edda1da..0d92d13823 100644 --- a/src/BizHawk.Client.Common/tools/CheatList.cs +++ b/src/BizHawk.Client.Common/tools/CheatList.cs @@ -47,7 +47,7 @@ namespace BizHawk.Client.Common public int ActiveCount => _cheatList.Count(c => c.Enabled); public bool AnyActive - => _cheatList.Any(static c => c.Enabled); + => _cheatList.Exists(static c => c.Enabled); public bool Changes { @@ -144,7 +144,7 @@ namespace BizHawk.Client.Common public void Insert(int index, Cheat cheat) { cheat.Changed += CheatChanged; - if (_cheatList.Any(c => c.Domain == cheat.Domain && c.Address == cheat.Address)) + if (_cheatList.Exists(c => c.Domain == cheat.Domain && c.Address == cheat.Address)) { _cheatList.First(c => c.Domain == cheat.Domain && c.Address == cheat.Address).Enable(); } @@ -183,9 +183,7 @@ namespace BizHawk.Client.Common } public bool Contains(Cheat cheat) - { - return _cheatList.Any(c => c == cheat); - } + => _cheatList.Exists(c => c == cheat); public void CopyTo(Cheat[] array, int arrayIndex) { @@ -227,13 +225,7 @@ namespace BizHawk.Client.Common } public bool IsActive(MemoryDomain domain, long address) - { - return _cheatList.Any(cheat => - !cheat.IsSeparator && - cheat.Enabled && - cheat.Domain == domain - && cheat.Contains(address)); - } + => _cheatList.Exists(cheat => !cheat.IsSeparator && cheat.Enabled && cheat.Domain == domain && cheat.Contains(address)); public void SaveOnClose() { diff --git a/src/BizHawk.Client.EmuHawk/CoreFeatureAnalysis.cs b/src/BizHawk.Client.EmuHawk/CoreFeatureAnalysis.cs index 08b45ab08d..011bd0228a 100644 --- a/src/BizHawk.Client.EmuHawk/CoreFeatureAnalysis.cs +++ b/src/BizHawk.Client.EmuHawk/CoreFeatureAnalysis.cs @@ -78,7 +78,7 @@ namespace BizHawk.Client.EmuHawk { Functions.Add(new FunctionInfo(method, service)); } - Complete = Functions.All(f => f.Complete); + Complete = Functions.TrueForAll(static f => f.Complete); } } diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs b/src/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs index d728ecadf0..f34fbb1887 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs @@ -310,7 +310,7 @@ namespace BizHawk.Client.EmuHawk var cheats = CheatList.Where(static c => !c.IsSeparator).ToList(); if (cheats.Count is 0) break; var firstWasEnabled = cheats[0].Enabled; - var kind = cheats.All(c => c.Enabled == firstWasEnabled) + var kind = cheats.TrueForAll(c => c.Enabled == firstWasEnabled) ? firstWasEnabled ? "off" : "on" diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index 37c082354d..5190f6cb54 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -1184,10 +1184,7 @@ namespace BizHawk.Client.EmuHawk hotkeyCoalescer.Receive(ie); // Check for hotkeys that may not be handled through CheckHotkey() method, reject controller input mapped to these - if (!triggers.Any(IsInternalHotkey)) - { - finalHostController.Receive(ie); - } + if (!triggers.Exists(IsInternalHotkey)) finalHostController.Receive(ie); } break; diff --git a/src/BizHawk.Client.EmuHawk/config/PathConfig.cs b/src/BizHawk.Client.EmuHawk/config/PathConfig.cs index 3799c91352..5681de6602 100644 --- a/src/BizHawk.Client.EmuHawk/config/PathConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/PathConfig.cs @@ -161,7 +161,7 @@ namespace BizHawk.Client.EmuHawk .Select(tuple => tuple.SysID) .Distinct().ToList(); releasedCoreSysIDs.Add(VSystemID.Raw.Libretro); // core not actually marked as released, but we still want to show it - systems.RemoveAll(tuple => !releasedCoreSysIDs.Any(sysID => PathEntryCollection.InGroup(sysID, tuple.SysGroup))); + systems.RemoveAll(tuple => !releasedCoreSysIDs.Exists(sysID => PathEntryCollection.InGroup(sysID, tuple.SysGroup))); } foreach (var (sys, dispName) in systems) AddTabPageForSystem(sys, dispName); diff --git a/src/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs b/src/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs index 36a57f144a..9057baf30d 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs @@ -162,12 +162,7 @@ namespace BizHawk.Client.EmuHawk private void Cheats_Load(object sender, EventArgs e) { - // Hack for previous config settings - if (Settings.Columns.Any(c => string.IsNullOrWhiteSpace(c.Text))) - { - Settings = new CheatsSettings(); - } - + if (Settings.Columns.Exists(static c => string.IsNullOrWhiteSpace(c.Text))) Settings = new(); //HACK for previous config settings CheatEditor.MemoryDomains = Core; LoadConfigSettings(); CheatsMenu.Items.Add(CheatListView.ToColumnsMenu(ColumnToggleCallback)); diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs index b5acbbcf24..85e34c3b70 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs @@ -157,11 +157,7 @@ namespace BizHawk.Client.EmuHawk private void LuaConsole_Load(object sender, EventArgs e) { - // Hack for previous config settings - if (Settings.Columns.Any(c => c.Text == null)) - { - Settings = new LuaConsoleSettings(); - } + if (Settings.Columns.Exists(static c => c.Text is null)) Settings = new(); //HACK for previous config settings if (Config.RecentLuaSession.AutoLoad && !Config.RecentLuaSession.Empty) { diff --git a/src/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs b/src/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs index ab53e44396..5a848c22c1 100644 --- a/src/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs +++ b/src/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs @@ -211,10 +211,7 @@ namespace BizHawk.Client.EmuHawk throw new Exception("Xml Filename can not be blank"); } - if (names.Any(string.IsNullOrWhiteSpace)) - { - throw new Exception("Rom Names can not be blank"); - } + if (names.Exists(string.IsNullOrWhiteSpace)) throw new Exception("Rom Names can not be blank"); var system = SystemDropDown.SelectedItem?.ToString(); diff --git a/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs b/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs index 1408b8d805..cbd977ebc5 100644 --- a/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs +++ b/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs @@ -465,14 +465,12 @@ namespace BizHawk.Client.EmuHawk /// /// Type of tool to check public bool Has() where T : IToolForm - { - return _tools.Any(t => t is T && t.IsActive); - } + => _tools.Exists(static t => t is T && t.IsActive); /// iff a tool of the given is active public bool Has(Type toolType) => typeof(IToolForm).IsAssignableFrom(toolType) - && _tools.Any(t => toolType.IsInstanceOfType(t) && t.IsActive); + && _tools.Exists(t => toolType.IsInstanceOfType(t) && t.IsActive); /// /// Gets the instance of T, or creates and returns a new instance diff --git a/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs b/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs index 2a2100d9be..9dbd06d11c 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs @@ -139,11 +139,7 @@ namespace BizHawk.Client.EmuHawk private void RamSearch_Load(object sender, EventArgs e) { - // Hack for previous config settings - if (Settings.Columns.Any(c => string.IsNullOrWhiteSpace(c.Text))) - { - Settings = new RamSearchSettings(); - } + if (Settings.Columns.Exists(static c => string.IsNullOrWhiteSpace(c.Text))) Settings = new(); //HACK for previous config settings RamSearchMenu.Items.Add(WatchListView.ToColumnsMenu(ColumnToggleCallback)); diff --git a/src/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs b/src/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs index ceb47cdfff..7be875bae6 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs @@ -1015,12 +1015,7 @@ namespace BizHawk.Client.EmuHawk private void RamWatch_Load(object sender, EventArgs e) { - // Hack for previous config settings - if (Settings.Columns.Any(c => string.IsNullOrWhiteSpace(c.Text))) - { - Settings = new RamWatchSettings(); - } - + if (Settings.Columns.Exists(static c => string.IsNullOrWhiteSpace(c.Text))) Settings = new(); //HACK for previous config settings _watches = new WatchList(MemoryDomains, Emu.SystemId); LoadConfigSettings(); RamWatchMenu.Items.Add(WatchListView.ToColumnsMenu(ColumnToggleCallback)); diff --git a/src/BizHawk.Client.EmuHawk/tools/Watch/WatchEditor.cs b/src/BizHawk.Client.EmuHawk/tools/Watch/WatchEditor.cs index 327c1c4bdf..54f1ab9a5f 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Watch/WatchEditor.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Watch/WatchEditor.cs @@ -173,22 +173,15 @@ namespace BizHawk.Client.EmuHawk { if (Watches.Count > 1) { - // Aggregate state - var hasBig = Watches.Any(x => x.BigEndian); - var hasLittle = Watches.Any(x => x.BigEndian == false); - - if (hasBig && hasLittle) + var firstWasBE = Watches[0].BigEndian; + if (Watches.TrueForAll(w => w.BigEndian == firstWasBE)) { - BigEndianCheckBox.Checked = true; - BigEndianCheckBox.CheckState = CheckState.Indeterminate; - } - else if (hasBig) - { - BigEndianCheckBox.Checked = true; + BigEndianCheckBox.Checked = firstWasBE; } else { - BigEndianCheckBox.Checked = false; + BigEndianCheckBox.Checked = true; + BigEndianCheckBox.CheckState = CheckState.Indeterminate; } } else if (Watches.Count == 1) diff --git a/src/BizHawk.Emulation.Common/Base Implementations/ControllerDefinition.cs b/src/BizHawk.Emulation.Common/Base Implementations/ControllerDefinition.cs index 8e14326c07..c9c5e54206 100644 --- a/src/BizHawk.Emulation.Common/Base Implementations/ControllerDefinition.cs +++ b/src/BizHawk.Emulation.Common/Base Implementations/ControllerDefinition.cs @@ -147,7 +147,7 @@ namespace BizHawk.Emulation.Common } // Hack for things like gameboy/ti-83 as opposed to genesis with no controllers plugged in - return allNames.Any(b => b.StartsWith("Up")) ? 1 : 0; + return allNames.Exists(static b => b.StartsWith("Up")) ? 1 : 0; } } diff --git a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/SoundProviderMixer.cs b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/SoundProviderMixer.cs index eda39bce9e..de5823ed8d 100644 --- a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/SoundProviderMixer.cs +++ b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/SoundProviderMixer.cs @@ -142,8 +142,8 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC } // are all the sample lengths the same? - var firstEntry = SoundProviders[0]; - bool sameCount = SoundProviders.All(s => s.NSamp == firstEntry.NSamp); + var firstEntry = SoundProviders[0].NSamp; + var sameCount = SoundProviders.TrueForAll(s => s.NSamp == firstEntry); if (!sameCount) { diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAMemoryCallbackSystem.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAMemoryCallbackSystem.cs index abe0de6abf..9e53625099 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAMemoryCallbackSystem.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAMemoryCallbackSystem.cs @@ -29,21 +29,23 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA public string[] AvailableScopes { get; } = { "System Bus" }; public bool ExecuteCallbacksAvailable => true; - public bool HasReads => _callbacks.Any(c => c.Callback.Type == MemoryCallbackType.Read); - public bool HasWrites => _callbacks.Any(c => c.Callback.Type == MemoryCallbackType.Write); - public bool HasExecutes => _callbacks.Any(c => c.Callback.Type == MemoryCallbackType.Execute); + public bool HasReads + => _callbacks.Exists(static c => c.Callback.Type is MemoryCallbackType.Read); - public bool HasReadsForScope(string scope) => - _callbacks.Any(c => c.Callback.Scope == scope - && c.Callback.Type == MemoryCallbackType.Read); + public bool HasWrites + => _callbacks.Exists(static c => c.Callback.Type is MemoryCallbackType.Write); - public bool HasWritesForScope(string scope) => - _callbacks.Any(c => c.Callback.Scope == scope - && c.Callback.Type == MemoryCallbackType.Write); + public bool HasExecutes + => _callbacks.Exists(static c => c.Callback.Type is MemoryCallbackType.Execute); - public bool HasExecutesForScope(string scope) => - _callbacks.Any(c => c.Callback.Scope == scope - && c.Callback.Type == MemoryCallbackType.Execute); + public bool HasReadsForScope(string scope) + => _callbacks.Exists(c => c.Callback.Type is MemoryCallbackType.Read && c.Callback.Scope == scope); + + public bool HasWritesForScope(string scope) + => _callbacks.Exists(c => c.Callback.Type is MemoryCallbackType.Write && c.Callback.Scope == scope); + + public bool HasExecutesForScope(string scope) + => _callbacks.Exists(c => c.Callback.Type is MemoryCallbackType.Execute && c.Callback.Scope == scope); public void Add(IMemoryCallback callback) { diff --git a/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Settings.ComponentModel.cs b/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Settings.ComponentModel.cs index 2567e69e01..49fc20db8b 100644 --- a/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Settings.ComponentModel.cs +++ b/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Settings.ComponentModel.cs @@ -342,18 +342,10 @@ namespace BizHawk.Emulation.Cores.Waterbox public override void SetValue(object component, object value) { - if ((string)value == Port.DefaultSettingsValue) - { - ResetValue(component); - } - else if (!Port.AllowedDevices.Any(d => d.SettingValue == (string)value)) - { - // does not validate - } - else - { - ((NymaSyncSettings)component).PortDevices[PortIndex] = (string)value; - } + var str = (string) value; + if (str == Port.DefaultSettingsValue) ResetValue(component); + else if (Port.AllowedDevices.Exists(d => d.SettingValue == str)) ((NymaSyncSettings) component).PortDevices[PortIndex] = str; + // else does not validate } public override bool ShouldSerializeValue(object component)