本文整理汇总了C#中ObjectIdentifier.ToNumerical方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectIdentifier.ToNumerical方法的具体用法?C# ObjectIdentifier.ToNumerical怎么用?C# ObjectIdentifier.ToNumerical使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectIdentifier
的用法示例。
在下文中一共展示了ObjectIdentifier.ToNumerical方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestConstructor
public void TestConstructor()
{
ObjectIdentifier oid = new ObjectIdentifier(new byte[] { 0x2B, 0x06, 0x99, 0x37 });
Assert.AreEqual(new uint[] { 1, 3, 6, 3255 }, oid.ToNumerical());
var o = ObjectIdentifier.Create(new uint[] {1, 3, 6}, 3255);
Assert.AreEqual(oid, o);
}
示例2: ValidateTable
/// <summary>
/// Validates if an <see cref="ObjectIdentifier"/> is a table.
/// </summary>
/// <param name="identifier">The object identifier.</param>
/// <returns></returns>
public bool ValidateTable(ObjectIdentifier identifier)
{
if (identifier == null)
{
throw new ArgumentNullException("identifier");
}
return IsTableId(identifier.ToNumerical());
}
示例3: TestConstructor2
public void TestConstructor2()
{
ObjectIdentifier oid = new ObjectIdentifier(new byte[] { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x90, 0x72, 0x87, 0x68, 0x02 });
Assert.AreEqual(new uint[] { 1, 3, 6, 1, 4, 1, 2162, 1000, 2 }, oid.ToNumerical());
}
示例4: GetStringOf
public static string GetStringOf(ObjectIdentifier id, IObjectRegistry objects)
{
if (id == null)
{
throw new ArgumentNullException("id");
}
if (objects == null)
{
return id.ToString();
}
string result = objects.Tree.Search(id.ToNumerical()).AlternativeText;
return string.IsNullOrEmpty(result) ? id.ToString() : result;
}
示例5: GetTextual
public static string GetTextual(ObjectIdentifier id, IObjectRegistry registry)
{
if (id == null)
{
throw new ArgumentNullException("id");
}
IObjectRegistry objects = registry ?? ObjectRegistry.Default;
return objects.Translate(id.ToNumerical());
}
示例6: ValidateTable
/// <summary>
/// Validates if an <see cref="ObjectIdentifier"/> is a table.
/// </summary>
/// <param name="identifier">The object identifier.</param>
/// <returns></returns>
public bool ValidateTable(ObjectIdentifier identifier)
{
if (identifier == null)
{
throw new ArgumentNullException("identifier");
}
try
{
return IsTableId(identifier.ToNumerical());
}
catch (ArgumentOutOfRangeException)
{
// if no matching definition found, refuse to continue.
return false;
}
}