public IModule GetModule(string strModuleName) { MibModule module = null; if (!_loaded.TryGetValue(strModuleName, out module)) { _pendings.TryGetValue(strModuleName, out module); } return(module); }
private bool CanParse(MibModule module) { if (!MibModule.AllDependentsAvailable(module, _loaded)) { return(false); } bool exists = _loaded.ContainsKey(module.Name); // FIXME: don't parse the same module twice now. if (!exists) { _loaded.Add(module.Name, module); } return(true); }
private void Import(MibModule module) { if (module == null) { throw new ArgumentNullException("module"); } if (LoadedModules.Contains(module.Name) || PendingModules.Contains(module.Name)) { Logger.InfoFormat(CultureInfo.InvariantCulture, "{0} ignored", module.Name); } else { _pendings.Add(module.Name, module); } }
public ModuleLoader(TextReader reader, string moduleName) { _nodes = new List <Definition>(); _dependents = new List <string>(); string line; while ((line = reader.ReadLine()) != null) { if (line.StartsWith("#", StringComparison.Ordinal)) { _dependents.AddRange(ParseDependents(line)); continue; } _nodes.Add(ParseLine(line, moduleName)); } _module = new MibModule(moduleName, _dependents); }
internal static bool AllDependentsAvailable(MibModule module, IDictionary <string, MibModule> modules) { return(module.Dependents.All(dependent => DependentFound(dependent, modules))); }