forked from BornToBeRoot/NETworkManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOIDValidator.cs
More file actions
25 lines (23 loc) · 751 Bytes
/
Copy pathOIDValidator.cs
File metadata and controls
25 lines (23 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using Lextm.SharpSnmpLib;
using System.Globalization;
using System.Windows.Controls;
namespace NETworkManager.Validators
{
public class OIDValidator : ValidationRule
{
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
{
// Use SharpSNMP new ObjectIdentifiert to validate oid
try
{
// ReSharper disable once UnusedVariable
var oid = new ObjectIdentifier(value as string);
}
catch (System.ArgumentException)
{
return new ValidationResult(false, Localization.Resources.Strings.EnterValidOID);
}
return ValidationResult.ValidResult;
}
}
}