Пример #1
0
        public async Task Run()
        {
            _logger.LogInformation("Sm5sh.CLI v.02");
            _logger.LogInformation("--------------------");
            _logger.LogInformation("research: soneek");
            _logger.LogInformation("prcEditor: https://github.com/BenHall-7/paracobNET");
            _logger.LogInformation("msbtEditor: https://github.com/IcySon55/3DLandMSBTeditor");
            _logger.LogInformation("nus3audio:  https://github.com/jam1garner/nus3audio-rs");
            _logger.LogInformation("bgm-property:  https://github.com/jam1garner/smash-bgm-property");
            _logger.LogInformation("VGAudio:  https://github.com/Thealexbarney/VGAudio");
            _logger.LogInformation("--------------------");

            await Task.Delay(1000);

            //Init State Manager
            _state.Init();

            //Init workspace
            if (!_workspace.Init())
            {
                return;
            }

            //Load Mods
            var mods = _serviceProvider.GetServices <ISm5shMod>();

            //Step that initialize a mod
            //Execute different checks to ensure the mod can run
            //Load resource files
            //Load existing mods
            _logger.LogInformation("--------------------");
            var initMods = new List <ISm5shMod>();

            foreach (var mod in mods)
            {
                _logger.LogInformation("{ModeName}: Initialize mod", mod.ModName);
                if (mod.Init())
                {
                    initMods.Add(mod);
                }
            }

            //Step to activate an eventual build step for a mod.
            //In UI, this would represent a user building a mod for ARC
            //Note: All resources managed by State Manager will be build at the end of this phase
            _logger.LogInformation("--------------------");
            foreach (var mod in initMods)
            {
                _logger.LogInformation("{ModeName}; Build mod changes", mod.ModName);
                mod.Build();
            }

            //Generate Output mod
            //All resources managed by State Manager are built
            _logger.LogInformation("--------------------");
            _logger.LogInformation("Starting State Manager Mod Generation");
            _state.WriteChanges();
            _logger.LogInformation("COMPLETE - Please check the logs for any error.");
            _logger.LogInformation("--------------------");
        }
Пример #2
0
        public async Task Run()
        {
            _logger.LogInformation("Sm5shMusic v.01");
            _logger.LogInformation("--------------------");
            _logger.LogInformation("research: soneek");
            _logger.LogInformation("prcEditor: https://github.com/BenHall-7/paracobNET");
            _logger.LogInformation("msbtEditor: https://github.com/IcySon55/3DLandMSBTeditor");
            _logger.LogInformation("nus3audio:  https://github.com/jam1garner/nus3audio-rs");
            _logger.LogInformation("bgm-property:  https://github.com/jam1garner/smash-bgm-property");
            _logger.LogInformation("VGAudio:  https://github.com/Thealexbarney/VGAudio");
            _logger.LogInformation("--------------------");

            await Task.Delay(1000);

            _logger.LogInformation("AudioCache: {AudioCache}", _settings.EnableAudioCaching ? "Enabled" : "Disabled");
            _logger.LogInformation("MusicModPath: {MusicModPath}", _settings.MusicModPath);

            //Check proper resources exist
            if (!CheckApplicationFolders())
            {
                return;
            }

            //Init workspace
            if (!_workspace.Init())
            {
                return;
            }

            //Load Music Mods
            _logger.LogInformation("Loading Music Mods");
            var musicMods = new List <IMusicModManager>();

            foreach (var musicModFolder in Directory.GetDirectories(_settings.MusicModPath))
            {
                var newMusicMod = ActivatorUtilities.CreateInstance <Managers.MusicModManager>(_serviceProvider, musicModFolder);
                if (newMusicMod.Init())
                {
                    musicMods.Add(newMusicMod);
                }
            }

            //Generate Output mod
            _logger.LogInformation("--------------------");
            _logger.LogInformation("Starting Arc Mod Generation");
            var bgmEntries = musicMods.SelectMany(p => p.BgmEntries).ToDictionary(p => p.Key, p => p.Value);

            _arcModGeneratorService.GenerateArcMod(bgmEntries.Values.ToList());

            _logger.LogInformation("COMPLETE - Please check the logs for any error.");
            _logger.LogInformation("--------------------");
        }