//----------------------------------- private static void FillListeTables( CEasyQuerySource laBase, IDefinition definition, List <ITableDefinition> lstToFill, CEasyQuerySourceFolder folderRacine) { foreach (IDefinition children in definition.Children) { if (children.Type == DefinitionType.Table) { CTableDefinitionSNMP table = FromDefinition(laBase, children, folderRacine); if (table != null) { lstToFill.Add(table); laBase.AddTable(table); } } else if (children.Type == DefinitionType.OidValueAssignment || children.Type == DefinitionType.Scalar) { CEasyQuerySourceFolder folder = folderRacine.GetSubFolderWithCreate(children.Name); if (folder != null && children.GetNumericalForm().Length > 0) { folder.SetExtendedProperty(c_strExtendedPropertyOID, ObjectIdentifier.Convert(children.GetNumericalForm())); } if (children.Type == DefinitionType.Scalar) { folder.SetExtendedProperty(c_strExtendedPropertyValue, new CValeurExtendedProprieteFolderSnmpScalar(ObjectIdentifier.Convert(children.GetNumericalForm()))); folder.ImageKey = CValeurExtendedProprieteFolderSnmpScalar.c_strImageScalar; } FillListeTables(laBase, children, lstToFill, folder); } } }
//----------------------------------- public static IEnumerable <ITableDefinition> FromMib( CEasyQuerySource laBase, ObjectRegistryBase mibBase, CEasyQuerySourceFolder folderRacine) { List <ITableDefinition> lst = new List <ITableDefinition>(); if (laBase.Tables.FirstOrDefault(t => t.GetType() == typeof(CTableDefinitionStructureSNMP)) == null) { CTableDefinitionStructureSNMP table = new CTableDefinitionStructureSNMP(); if (folderRacine != null) { table.FolderId = folderRacine.Id; } lst.Add(table); table.Fill(mibBase); laBase.AddTable(table); } FillListeTables(laBase, mibBase.Tree.Root, lst, folderRacine); return(lst.AsReadOnly()); }