コード例 #1
0
ファイル: Penumbra.cs プロジェクト: xivdev/Penumbra
    public Penumbra(CharacterUtility characterUtility)
    {
        CharacterUtility = characterUtility;

        Framework = new FrameworkManager();
        Backup.CreateBackup(PenumbraBackupFiles());
        Config = Configuration.Load();

        MusicManager = new MusicManager();
        if (Config.DisableSoundStreaming)
        {
            MusicManager.DisableStreaming();
        }

        ResidentResources = new ResidentResourceManager();
        Redirects         = new SimpleRedirectManager();
        MetaFileManager   = new MetaFileManager();
        ResourceLoader    = new ResourceLoader(this);
        ResourceLogger    = new ResourceLogger(ResourceLoader);
        ModManager        = new Mod.Manager(Config.ModDirectory);
        ModManager.DiscoverMods();
        CollectionManager = new ModCollection.Manager(ModManager);
        ModFileSystem     = ModFileSystem.Load();
        ObjectReloader    = new ObjectReloader();
        PathResolver      = new PathResolver(ResourceLoader);

        Dalamud.Commands.AddHandler(CommandName, new CommandInfo(OnCommand)
        {
            HelpMessage = "/penumbra - toggle ui\n/penumbra reload - reload mod file lists & discover any new mods",
        });

        ResidentResources.Reload();

        SetupInterface(out _configWindow, out _launchButton, out _windowSystem);

        if (Config.EnableHttpApi)
        {
            CreateWebServer();
        }

        ResourceLoader.EnableHooks();
        if (Config.EnableMods)
        {
            ResourceLoader.EnableReplacements();
            PathResolver.Enable();
        }

        if (Config.DebugMode)
        {
            ResourceLoader.EnableDebug();
            _configWindow.IsOpen = true;
        }

        if (Config.EnableFullResourceLogging)
        {
            ResourceLoader.EnableFullLogging();
        }

        ResidentResources.Reload();

        Api = new PenumbraApi(this);
        Ipc = new PenumbraIpc(Dalamud.PluginInterface, Api);
        SubscribeItemLinks();
        if (ImcExceptions > 0)
        {
            PluginLog.Error($"{ImcExceptions} IMC Exceptions thrown. Please repair your game files.");
        }
        else
        {
            PluginLog.Information($"Penumbra Version {Version}, Commit #{CommitHash} successfully Loaded.");
        }
    }