From e80e7a10d49a5fc5cff0ab877ccd81cc66b869f5 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Mon, 11 Jan 2016 20:14:54 +0100 Subject: [PATCH] SNMP MIB Compiler: Resolve MIB files in a case-insensitive way --- .../SharpSnmpLib/Mib/MibResolver.cs | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/apps/snmp/LwipMibCompiler/SharpSnmpLib/Mib/MibResolver.cs b/src/apps/snmp/LwipMibCompiler/SharpSnmpLib/Mib/MibResolver.cs index 0f3dfc61..96978e1a 100644 --- a/src/apps/snmp/LwipMibCompiler/SharpSnmpLib/Mib/MibResolver.cs +++ b/src/apps/snmp/LwipMibCompiler/SharpSnmpLib/Mib/MibResolver.cs @@ -31,24 +31,26 @@ 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) { - try - { - MibDocument md = new MibDocument(matchedFile); - if (md.Modules.Count > 0) - { - return md.Modules[0]; - } - } - catch - { - } + if (Path.GetFileNameWithoutExtension(matchedFile.ToLowerInvariant()) == moduleName.ToLowerInvariant()) + { + try + { + MibDocument md = new MibDocument (matchedFile); + if (md.Modules.Count > 0) + { + return md.Modules [0]; + } + } catch + { + } + } } } }