public void CollectionToAbstractConfigurationNodeIniSerializer_Test()
        {
            var configuration =
                new ConfigurationCollection <ExampleConfigurationCollection>(new ConfigurationValueCollection());

            var    fs   = new PhysicalFileSystem();
            var    temp = Path.GetTempPath();
            var    pfs  = fs.GetOrCreateSubFileSystem(fs.ConvertPathFromInternal(temp));
            string test = Path.GetRandomFileName();
            var    dir  = new FS.Directory(test, pfs, pfs.GetDirectoryEntry("/"));

            dir.OpenDirectory("program")
            .OpenFile("RMGE01.wbfs").OpenStream().Close();
            configuration.Configuration.ExampleConfiguration.FullscreenResolution = FullscreenResolution.Resolution1152X648;
            var context = new ConfigurationTraversalContext(("game", dir));

            var list = context.TraverseCollection(configuration);
            IAbstractConfigurationNode dolphinList = list["#dolphin"];

            var    iniSerializer = new SimpleIniConfigurationSerializer();
            string outputIni     = iniSerializer.Visit(dolphinList);
            var    parser        = new IniDataParser();
            var    data          = parser.Parse(outputIni);

            Assert.NotEmpty(data.Sections);
        }
        public void InputTemplateToAbstractConfigurationNodeIniSerializer_Test()
        {
            var mapcol = new ControllerElementMappingProfile("Keyboard",
                                                             "TEST_CONTROLLER",
                                                             InputDriver.Keyboard,
                                                             IDeviceEnumerator.VirtualVendorID,
                                                             new XInputDeviceInstance(0).DefaultLayout);
            IDeviceInputMapping mapping = new TestInputMapping();
            var input =
                new InputTemplate <IRetroArchInput>(mapcol).Template;


            var fs   = new PhysicalFileSystem();
            var temp = Path.GetTempPath();
            var pfs  = fs.GetOrCreateSubFileSystem(fs.ConvertPathFromInternal(temp));
            var dir  = new FS.Directory("test", pfs, pfs.GetDirectoryEntry("/"));

            var context = new ConfigurationTraversalContext();

            var list = context.TraverseInputTemplate(input, mapping, 0);

            var    iniSerializer = new SimpleIniConfigurationSerializer();
            string outputIni     = iniSerializer.Transform(list);
            var    parser        = new IniDataParser();
            var    data          = parser.Parse(outputIni);

            Assert.NotEmpty(data.Sections);
        }
Пример #3
0
        public void InputTemplateToAbstractConfigurationNodeIniSerializer_Test()
        {
            var testmappings = new StoneProvider().Controllers["XBOX_CONTROLLER"];
            var realmapping  =
                JsonConvert.DeserializeObject <ControllerLayout>(
                    TestUtilities.GetStringResource("InputMappings.xinput_device.json"));
            var           mapcol   = ControllerElementMappings.GetDefaultMappings(realmapping, testmappings);
            string        _mapping = TestUtilities.GetStringResource("InputMappings.DirectInput.XINPUT_DEVICE.json");
            IInputMapping mapping  = JsonConvert.DeserializeObject <InputMapping>(_mapping);
            var           input    =
                new InputTemplate <IRetroArchInput>(mapcol).Template;


            var fs   = new PhysicalFileSystem();
            var temp = Path.GetTempPath();
            var pfs  = fs.GetOrCreateSubFileSystem(fs.ConvertPathFromInternal(temp));
            var dir  = new FS.Directory("test", pfs, pfs.GetDirectoryEntry("/"));

            var context = new ConfigurationTraversalContext();

            var list = context.TraverseInputTemplate(input, mapping, 0);

            var    iniSerializer = new SimpleIniConfigurationSerializer();
            string outputIni     = iniSerializer.Transform(list);
            var    parser        = new IniDataParser();
            var    data          = parser.Parse(outputIni);

            Assert.NotEmpty(data.Sections);
        }