Example #1
0
        public void Ecs_IRomCompatibleWithEcsRom_IsTrue()
        {
            var ecs = new Ecs();
            var programInformationTable = ProgramInformationTable.Initialize(Enumerable.Empty <ProgramInformationTableDescriptor>().ToArray());
            var mindStrikeProgramId     = new ProgramIdentifier(0x9D57498F);
            var mindStrikeInfo          = programInformationTable.FindProgram(mindStrikeProgramId);

            Assert.NotNull(mindStrikeInfo);
            var mindStrikeDescription = new ProgramDescription(mindStrikeProgramId.DataCrc, null, mindStrikeInfo);

            Assert.True(ecs.IsRomCompatible(mindStrikeDescription));
        }
        /// <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);
        }
Example #3
0
        public void ProgramInformationTable_Initialize_()
        {
            IReadOnlyList <string> romPaths;
            var storageAccess     = ProgramInformationTableTestsStorageAccess.Initialize(out romPaths, null);
            var database0FilePath = "/testing/database/user_specified_database_0.xml";

            storageAccess.AddDatabaseFile(database0FilePath, 2);
            var database1FilePath = "/testing/database/user_specified_database_1.xml";

            storageAccess.AddDatabaseFile(database1FilePath, 3);
            var database2FilePath = "/testing/database/user_specified_bogus_database.xml";

            var database = ProgramInformationTable.Initialize(
                new[]
            {
                new ProgramInformationTableDescriptor(database0FilePath, p => UserSpecifiedProgramInformationTable.Initialize(p)),
                new ProgramInformationTableDescriptor(database1FilePath, p => UserSpecifiedProgramInformationTable.Initialize(p)),
                new ProgramInformationTableDescriptor(database2FilePath, p => UserSpecifiedProgramInformationTable.Initialize(p)),
            });

            Assert.NotNull(database);
        }