public static void importWSUSFiles() { using (updateDB db = new updateDB(connstr, dbName)) { int updateIndexInBatch = 0; wsusUpdate[] updates = new wsusUpdate[400]; foreach (IUpdate update in getUpdates()) { foreach (IInstallableItem item in update.GetInstallableItems()) { foreach (UpdateFile f in item.Files) { if (f.Type == FileType.Express || f.OriginUri.ToString().EndsWith(".txt")) { continue; } wsusUpdate upd = new wsusUpdate(f); updates[updateIndexInBatch++] = upd; if (updateIndexInBatch == updates.Length) { db.insert_noconcurrency(updates); updateIndexInBatch = 0; } } } } wsusUpdate[] updatesFinalBatch = new wsusUpdate[updateIndexInBatch]; Array.Copy(updates, updatesFinalBatch, updateIndexInBatch); if (updateIndexInBatch == updates.Length) { db.insert_noconcurrency(updatesFinalBatch); } db.removeDuplicateWsusFiles(); } }