SNMP MIB Compiler: Resolve MIB files in a case-insensitive way

This commit is contained in:
Dirk Ziegelmeier 2016-01-11 20:14:54 +01:00
parent 8c4d1909f4
commit e80e7a10d4

View File

@ -31,27 +31,29 @@ namespace Lextm.SharpSnmpLib.Mib
{
string[] matchedFiles = Directory.GetFiles(
_path,
moduleName + ".*",
"*",
(_recursive) ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);
if ((matchedFiles != null) && (matchedFiles.Length >= 1))
{
foreach (string matchedFile in matchedFiles)
{
if (Path.GetFileNameWithoutExtension(matchedFile.ToLowerInvariant()) == moduleName.ToLowerInvariant())
{
try
{
MibDocument md = new MibDocument(matchedFile);
MibDocument md = new MibDocument (matchedFile);
if (md.Modules.Count > 0)
{
return md.Modules[0];
return md.Modules [0];
}
}
catch
} catch
{
}
}
}
}
}
return null;
}