-
Notifications
You must be signed in to change notification settings - Fork 693
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
0580c22
commit d13cf29
Showing
37 changed files
with
652 additions
and
484 deletions.
There are no files selected for viewing
187 changes: 93 additions & 94 deletions
187
Source/NETworkManager.Localization/Resources/StaticStrings.Designer.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,29 +1,26 @@ | ||
using NETworkManager.Utilities; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text.RegularExpressions; | ||
using System.Windows.Controls; | ||
|
||
namespace NETworkManager.Validators; | ||
|
||
public class SNMPOIDValidator : ValidationRule | ||
public class SnmpOidValidator : ValidationRule | ||
{ | ||
public SNMPOIDDependencyObjectWrapper Wrapper { get; set; } | ||
|
||
public override ValidationResult Validate(object value, CultureInfo cultureInfo) | ||
{ | ||
var oidValue = (value as string).Replace(" ", ""); | ||
var oidValue = (value as string)!.Replace(" ", ""); | ||
|
||
if (Wrapper.Mode == Models.Network.SNMPMode.Get && oidValue.Contains(';')) | ||
{ | ||
foreach (var oid in oidValue.Split(';')) | ||
{ | ||
if (!Regex.IsMatch(oid, RegexHelper.SNMOIODRegex)) | ||
return new ValidationResult(false, Localization.Resources.Strings.EnterValidOID); | ||
} | ||
|
||
return ValidationResult.ValidResult; | ||
} | ||
|
||
return Regex.IsMatch(oidValue, RegexHelper.SNMOIODRegex) ? ValidationResult.ValidResult : new ValidationResult(false, Localization.Resources.Strings.EnterValidOID); | ||
if (Wrapper.Mode != Models.Network.SNMPMode.Get || !oidValue.Contains(';')) | ||
return Regex.IsMatch(oidValue, RegexHelper.SnmpOidRegex) | ||
? ValidationResult.ValidResult | ||
: new ValidationResult(false, Localization.Resources.Strings.EnterValidOID); | ||
|
||
return oidValue.Split(';').Any(oid => !Regex.IsMatch(oid, RegexHelper.SnmpOidRegex)) ? | ||
new ValidationResult(false, Localization.Resources.Strings.EnterValidOID) : | ||
ValidationResult.ValidResult; | ||
} | ||
} |
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
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
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
Oops, something went wrong.