/// <inheritdoc /> public void OnImportsSatisfied() { var initializedCoreStreamUtils = INTV.Core.Utility.StreamUtilities.Initialize(new StorageAccess()); if (initializedCoreStreamUtils) { INTV.Core.Utility.StringUtilities.RegisterHtmlDecoder(StringUtilities.HtmlDecode); INTV.Core.Utility.StringUtilities.RegisterHtmlEncoder(StringUtilities.HtmlEncode); } System.Diagnostics.Debug.Assert(initializedCoreStreamUtils, "Failed to initialize stream utilities!"); Core.Model.IRomHelpers.InitializeCallbacks(GetIntvNameData); var documentFolderName = SingleInstanceApplication.AppInfo.DocumentFolderName; _applicationDocumentsPath = Path.Combine(PathUtils.GetDocumentsDirectory(), documentFolderName); if (!Directory.Exists(_applicationDocumentsPath)) { Directory.CreateDirectory(_applicationDocumentsPath); } BackupDataDirectory = System.IO.Path.Combine(_applicationDocumentsPath, BackupDataArea); ErrorLogDirectory = Path.Combine(_applicationDocumentsPath, ErrorLogDir); RomsDirectory = Path.Combine(_applicationDocumentsPath, RomsDir); ManualsDirectory = Path.Combine(_applicationDocumentsPath, ManualsDir); BoxesDirectory = Path.Combine(_applicationDocumentsPath, BoxesDir); OverlaysDirectory = Path.Combine(_applicationDocumentsPath, OverlaysDir); LabelsDirectory = Path.Combine(_applicationDocumentsPath, LabelsDir); var directories = new[] { _applicationDocumentsPath, RomsDirectory, ManualsDirectory, BoxesDirectory, OverlaysDirectory, LabelsDirectory, BackupDataDirectory, ErrorLogDirectory }; FileUtilities.EnsureDirectoriesExist(directories); RomFilesPath = Path.Combine(_applicationDocumentsPath, RomsFile); var localInfoTables = new ProgramInformationTableDescriptor[] { new ProgramInformationTableDescriptor(Path.Combine(_applicationDocumentsPath, LocalRomDefintions), UserSpecifiedProgramInformationTable.Initialize) }; ProgramInfoTable = ProgramInformationTable.Initialize(localInfoTables); }
/// <summary> /// Merges another IProgramInformationTable into an existing one, based on the CRC entries of each table. /// </summary> /// <param name="tableToMerge">The table to merge into this one.</param> /// <returns>An enumerable of any conflicting entries. The keys are the entries from tableToMerge, while the value entries are the preexisting ones in this table.</returns> internal List <KeyValuePair <IProgramInformation, IProgramInformation> > MergeTable(IProgramInformationTable tableToMerge) { List <KeyValuePair <IProgramInformation, IProgramInformation> > conflictingEntries = new List <KeyValuePair <IProgramInformation, IProgramInformation> >(); if (tableToMerge != null) { foreach (var programInfo in tableToMerge.Programs) { foreach (var crcEntry in programInfo.Crcs) { if (_programs.ContainsKey(crcEntry.Crc)) { conflictingEntries.Add(new KeyValuePair <IProgramInformation, IProgramInformation>(programInfo, _programs[crcEntry.Crc])); } else { _programs[crcEntry.Crc] = programInfo; } } } } return(conflictingEntries); }
/// <summary> /// Creates an instance of the converter that will attempt to locate information that is not available via a program information table. /// </summary> /// <param name="defaultInformationSource">The program information table to use to locate missing information.</param> /// <returns>An instance of the converter.</returns> /// <remarks>First, <paramref name="defaultInformationSource"/> will be searched for initial values for ROM information. Values supplied directly from the ROM /// being converted will override those from the initial source.</remarks> public static XmlRomInformationToProgramRomInformationConverter Create(IProgramInformationTable defaultInformationSource) { return(Create(defaultInformationSource, null)); }
/// <summary> /// Creates an instance of the converter that will attempt to locate information that is not available via a program information table and list of program descriptions. /// </summary> /// <param name="initialInformationSource">The program information table to use to locate missing information.</param> /// <param name="initialDescriptionsSource">A collection of program descriptions to use to locate information not directly provided in the ROM information being converted.</param> /// <returns>An instance of the converter.</returns> /// <remarks>First, <paramref name="initialDescriptionsSource"/> will be searched, then <paramref name="initialInformationSource"/>, for initial values for ROM information. Values /// supplied directly from the ROM being converted will override those from the initial source.</remarks> public static XmlRomInformationToProgramRomInformationConverter Create(IProgramInformationTable initialInformationSource, IEnumerable <IProgramDescription> initialDescriptionsSource) { return(new XmlRomInformationToProgramRomInformationConverter(initialInformationSource, initialDescriptionsSource)); }
private XmlRomInformationToProgramRomInformationConverter(IProgramInformationTable defaultInformationSource, IEnumerable <IProgramDescription> defaultDescriptionsSource) { DefaultDescriptionsSource = defaultDescriptionsSource; DefaultInformationSource = defaultInformationSource; }