public void Execute() { // Use the SpssImporter to get a ResourcePackage with all metadata // contained in the SPSS file. var spssImporter = new SpssImporter(); var resourcePackage = spssImporter.Import(fileName, "uk.cls"); // Get a list of all items contained in the ResourcePackage. var gatherer = new ItemGathererVisitor(); resourcePackage.Accept(gatherer); var allItems = gatherer.FoundItems; // Add the items to the repository. WorkingSet.AddRange(allItems); }
public static void Main(string[] args) { MultilingualString.CurrentCulture = "en-GB"; VersionableBase.DefaultAgencyId = "uk.closer"; if (args.Length < 1) { Logger.Instance.Log.ErrorFormat("CLOSER Dataset Documenter requires a config file."); Environment.Exit(1); } var configFile = args[0]; try { var config = ValidateConfig(configFile); var spssImporter = new SpssImporter(); var serializer = new Ddi32Serializer { UseConciseBoundedDescription = false }; foreach (var record in config) { Logger.Instance.Log.InfoFormat("Extracting metadata from {0}", record.Filename); var resourcePackage = spssImporter.Import(record.Filename, record.Agency); var instance = new DdiInstance(); instance.AgencyId = record.Agency; instance.ResourcePackages.Add(resourcePackage); var output = serializer.Serialize(instance); output.Save(record.Scope + ".xml"); } } catch (Exception e) { Logger.Instance.Log.ErrorFormat("Fatal error: {0}", e.Message); } }