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,12 +31,14 @@ namespace Lextm.SharpSnmpLib.Mib
{ {
string[] matchedFiles = Directory.GetFiles( string[] matchedFiles = Directory.GetFiles(
_path, _path,
moduleName + ".*", "*",
(_recursive) ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly); (_recursive) ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);
if ((matchedFiles != null) && (matchedFiles.Length >= 1)) if ((matchedFiles != null) && (matchedFiles.Length >= 1))
{ {
foreach (string matchedFile in matchedFiles) foreach (string matchedFile in matchedFiles)
{
if (Path.GetFileNameWithoutExtension(matchedFile.ToLowerInvariant()) == moduleName.ToLowerInvariant())
{ {
try try
{ {
@ -45,13 +47,13 @@ namespace Lextm.SharpSnmpLib.Mib
{ {
return md.Modules [0]; return md.Modules [0];
} }
} } catch
catch
{ {
} }
} }
} }
} }
}
return null; return null;
} }