private void AddDataFromColumns(XmlRomInformation source, IProgramRomInformationBuilder programInformationBuilder) { foreach (var column in source.RomInfoDatabaseColumns) { try { switch (column.Name.ToXmlRomInformationDatabaseColumnName()) { case XmlRomInformationDatabaseColumnName.title: programInformationBuilder.WithTitle(StringConverter.Instance.Convert(column.Value)); programInformationBuilder.WithLongName(StringConverter.Instance.Convert(column.Value, 60)); break; case XmlRomInformationDatabaseColumnName.vendor: programInformationBuilder.WithVendor(StringConverter.Instance.Convert(column.Value)); break; case XmlRomInformationDatabaseColumnName.release_date: programInformationBuilder.WithYear(StringToMetadataDateTimeConverter.Instance.Convert(column.Value).Date.Year); break; case XmlRomInformationDatabaseColumnName.short_name: programInformationBuilder.WithShortName(StringConverter.Instance.Convert(column.Value, 18)); break; case XmlRomInformationDatabaseColumnName.name: programInformationBuilder.WithVariantName(StringConverter.Instance.Convert(column.Value)); break; case XmlRomInformationDatabaseColumnName.platform: // enum('Intellivision') // Throw if it's not Intellivision? break; case XmlRomInformationDatabaseColumnName.variant: // this is variant number of the ROM, not the name of the variant case XmlRomInformationDatabaseColumnName.origin: // set('INTV Funhouse','Intellivision Lives','manual entry','e-mail','intvname','ROM','CFG','LUIGI','Catalog','other') NOT NULL COMMENT '', case XmlRomInformationDatabaseColumnName.box_variant: case XmlRomInformationDatabaseColumnName.screenshot: case XmlRomInformationDatabaseColumnName.preview: case XmlRomInformationDatabaseColumnName.get_rom: break; default: break; } } catch (FormatException) { } catch (ArgumentException) { } } }
private void AddBasicData(IProgramRomInformationBuilder programInformationBuilder, string title, string vendor, string yearString, string shortName) { try { programInformationBuilder.WithTitle(title); } catch (InvalidOperationException) { } programInformationBuilder.WithVendor(vendor); int year; if (int.TryParse(yearString, out year)) { programInformationBuilder.WithYear(year); } if (!string.IsNullOrEmpty(shortName)) { programInformationBuilder.WithShortName(shortName); } }