예제 #1
0
        public IModule GetModule(string strModuleName)
        {
            MibModule module = null;

            if (!_loaded.TryGetValue(strModuleName, out module))
            {
                _pendings.TryGetValue(strModuleName, out module);
            }
            return(module);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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);
        }
예제 #5
0
파일: MibModule.cs 프로젝트: ykebaili/Timos
 internal static bool AllDependentsAvailable(MibModule module, IDictionary <string, MibModule> modules)
 {
     return(module.Dependents.All(dependent => DependentFound(dependent, modules)));
 }