public ImportTable Clone()
        {
            ImportTable copy = new ImportTable();

            CopyTo(copy);

            return(copy);
        }
        public ImportTable GetOrCreateTable()
        {
            if (_table == null)
            {
                _table = new ImportTable();
            }

            return(_table);
        }
 protected void CopyTo(ImportTable copy)
 {
     foreach (var childNode in _list)
     {
         var copyChildNode = childNode.Clone();
         copy._list.Add(copyChildNode);
         copyChildNode._parent = this;
     }
 }
        private static void Load(IBinaryAccessor accessor, PEImage image, ImportTable table)
        {
            while (true)
            {
                var module = ImportModuleTable.Load(accessor, image);
                if (module == null)
                {
                    break;
                }

                module._parent = table;
                table._list.Add(module);
            }
        }
        public static ImportTable Load(PEImage image)
        {
            if (image == null)
            {
                return(null);
            }

            var dd = image.Directories[DataDirectories.ImportTable];

            if (dd.IsNull)
            {
                return(null);
            }

            var table = new ImportTable();

            using (var accessor = image.OpenImageToSectionData(dd.RVA))
            {
                Load(accessor, image, table);
            }

            return(table);
        }