private Definition CreateExtraNodes(MibModule module, string longParent)
        {
            string[]   content = longParent.Split('.');
            Definition node    = Find(ExtractName(content[0]));

            uint[] rootId = node.GetNumericalForm();
            var    all    = new uint[content.Length + rootId.Length - 1];

            for (int j = rootId.Length - 1; j >= 0; j--)
            {
                all[j] = rootId[j];
            }

            // change all to numerical
            for (int i = 1; i < content.Length; i++)
            {
                uint value;
                bool numberFound   = uint.TryParse(content[i], out value);
                int  currentCursor = rootId.Length + i - 1;
                if (numberFound)
                {
                    all[currentCursor] = value;
                    node = Find(ExtractParent(all, currentCursor + 1));
                    if (node != null)
                    {
                        continue;
                    }

                    IDefinition subroot = Find(ExtractParent(all, currentCursor));

                    // if not, create Prefix node.
                    var prefix = new ObjectIdentifierType(module.Name, subroot.Name + "_" + value.ToString(CultureInfo.InvariantCulture), subroot.Name, value);
#if !MA && !MT
                    Logger.Info(module.ReportImplicitObjectIdentifier(prefix));
#endif
                    node = CreateSelf(prefix);
                    AddToTable(node);
                }
                else
                {
                    string self   = content[i];
                    string parent = content[i - 1];
                    var    extra  = new ObjectIdentifierType(module.Name, ExtractName(self), ExtractName(parent), ExtractValue(self));
                    node = CreateSelf(extra);
                    if (node != null)
                    {
#if !MA && !MT
                        Logger.Info(module.ReportImplicitObjectIdentifier(extra));
#endif
                        AddToTable(node);
                        all[currentCursor] = node.Value;
                    }
                    else
                    {
#if !MA && !MT
                        Logger.Info(module.ReportIgnoredImplicitEntity(longParent));
#endif
                    }
                }
            }

            return(node);
        }
Exemple #2
0
        private Definition CreateExtraNodes(MibModule module, string longParent)
        {
            string[] content = longParent.Split('.');
            Definition node = Find(ExtractName(content[0]));
            uint[] rootId = node.GetNumericalForm();
            var all = new uint[content.Length + rootId.Length - 1];
            for (int j = rootId.Length - 1; j >= 0; j--)
            {
                all[j] = rootId[j];
            }
            
            // change all to numerical
            for (int i = 1; i < content.Length; i++)
            {
                uint value;
                bool numberFound = UInt32.TryParse(content[i], out value);
                int currentCursor = rootId.Length + i - 1;
                if (numberFound)
                {
                    all[currentCursor] = value;
                    node = Find(ExtractParent(all, currentCursor + 1));
                    if (node != null)
                    {
                        continue;
                    }

                    IDefinition subroot = Find(ExtractParent(all, currentCursor));
                    
                    // if not, create Prefix node.
                    var prefix = new ObjectIdentifierType(module.Name, subroot.Name + "_" + value.ToString(CultureInfo.InvariantCulture), subroot.Name, value);
#if !MA
                    Logger.Info(module.ReportImplicitObjectIdentifier(prefix));
#endif
                    node = CreateSelf(prefix);
                    AddToTable(node);
                }
                else
                {
                    string self = content[i];
                    string parent = content[i - 1];
                    var extra = new ObjectIdentifierType(module.Name, ExtractName(self), ExtractName(parent), ExtractValue(self));
                    node = CreateSelf(extra);
                    if (node != null)
                    {
#if !MA
                        Logger.Info(module.ReportImplicitObjectIdentifier(extra));
#endif
                        AddToTable(node);
                        all[currentCursor] = node.Value;
                    }
                    else
                    {
#if !MA
                        Logger.Info(module.ReportIgnoredImplicitEntity(longParent));
#endif
                    }
                }
            }

            return node;
        }