private static void CleanEmptyFields(bool cleanEmptyFields, IMLSection section) { if (!cleanEmptyFields) return; //Importer.CurrentProgress++; MainImportingEngine.ThisProgress.Progress (MainImportingEngine.CurrentProgress, "Cleaning empty library fields..."); //Thread.Sleep(800); string[] tagNames = section.GetTagNames(); section.BeginUpdate(); foreach (string tagName in tagNames) { bool allTagValuesAreEmpty = true; //Importer.thisProgress.Progress(100, TagName); //Thread.Sleep(1000); if (tagName == "ToDelete") { } if (section.GetTagValues(tagName) == null) continue; string[] TagValues = section.GetTagValues(tagName); foreach (string tagvalue in TagValues.Where(tagvalue => !String.IsNullOrEmpty(tagvalue))) allTagValuesAreEmpty = false; if (allTagValuesAreEmpty) section.DeleteTag(tagName); } section.EndUpdate(); section.BeginUpdate(); //Importer.CurrentProgress++; MainImportingEngine.ThisProgress.Progress (MainImportingEngine.CurrentProgress, "Removing items marked for deletion..."); Thread.Sleep(800); IMLItemList itemsToDelete = section.SearchByTag("ToDelete", "true"); foreach (IMLItem t in itemsToDelete) section.DeleteItem(t); section.EndUpdate(); }