public async Task BeginInstall(ProgressCallback monitor, CancellationToken cancellationToken)
        {
            CommonInstaller.IsInstal = true;
            string installerName = Path.GetFileNameWithoutExtension(InstallerPath);
            string tempPath      = string.Format("{0}\\{1}Temp", PathManager.TempDirectory, installerName);

            if (Directory.Exists(tempPath))
            {
                Directory.Delete(tempPath, true);
            }
            Directory.CreateDirectory(tempPath);
            Unzip.UnZipFile(InstallerPath, tempPath);
            string  mainJson = File.ReadAllText(tempPath + "\\install_profile.json");
            JObject jObject  = JObject.Parse(mainJson);

            if (jObject.ContainsKey("install") && jObject.ContainsKey("versionInfo"))
            {
                CommonInstaller commonInstaller = new CommonInstaller(InstallerPath, Options);
                await commonInstaller.BeginInstallFromJObject(monitor, cancellationToken, jObject, tempPath);
            }
            else if (jObject.ContainsKey("data") && jObject.ContainsKey("processors") && jObject.ContainsKey("libraries"))
            {
                DataProcessorsForgeInstaller forgeInstaller = new DataProcessorsForgeInstaller(InstallerPath, Options);
                await forgeInstaller.BeginInstallFromJObject(monitor, cancellationToken, jObject, tempPath);
            }
            else
            {
                throw new JsonException("JSON has no matching format");
            }

            Directory.Delete(tempPath, true);
            File.Delete(InstallerPath);
            CommonInstaller.IsInstal = false;
        }
Exemple #2
0
        protected override void Load(ContainerBuilder builder)
        {
            QueryServiceInstaller.ConfigureContainer(builder);

            LogicServiceInstaller.ConfigureContainer(builder);

            // SQlServer
            if (AppSettings.Apply("ConnectionStrings", "SQlServerDB", "Enabled").ToBool())
            {
                RepositoryInstaller.ConfigureContainerForSqlServer(builder);
            }
            // MySqlDB
            if (AppSettings.Apply("ConnectionStrings", "MySqlDB", "Enabled").ToBool())
            {
                RepositoryInstaller.ConfigureContainerForMySql(builder);
            }

            // Sqlite
            if (AppSettings.Apply("ConnectionStrings", "SqliteDB", "Enabled").ToBool())
            {
                RepositoryInstaller.ConfigureContainerForSqllite(builder);
            }

            CommonInstaller.ConfigureContainer(builder);
        }
Exemple #3
0
 internal static Action <IServiceCollection> ConfigureServices()
 {
     return(services =>
     {
         CommonInstaller.ConfigureContainer(services);
         services.AddSingleton <Config, Config>();
     });
 }
Exemple #4
0
 private async Task InstallCommonExtend(string path)
 {
     CommonInstaller installer = new CommonInstaller(path, new CommonInstallOptions()
     {
         GameRootPath = App.Handler.GameRootPath
     });
     await installer.BeginInstallAsync();
 }
Exemple #5
0
 internal static Action <IServiceCollection> ConfigureServices()
 {
     return(services =>
     {
         CommonInstaller.ConfigureContainer(services);
         DataInstaller.ConfigureContainer(services);
         RepositoryInstaller.ConfigureContainer(services);
         MapperInstaller.ConfigureContainer(services);
         QueryServiceInstaller.ConfigureContainer(services);
         DomainServiceInstaller.ConfigureContainer(services);
     });
 }
Exemple #6
0
        private void AppendLiteloaderDownloadTask(Version ver, JWLiteloader liteloader)
        {
            string       liteloaderPath = NsisoLauncherCore.PathManager.TempDirectory + string.Format(@"\Liteloader_{0}-Installer.jar", liteloader.Version);
            DownloadTask dt             = new DownloadTask("liteloader核心",
                                                           string.Format("https://bmclapi2.bangbang93.com/liteloader/download?version={0}", liteloader.Version),
                                                           liteloaderPath);

            dt.Todo = new Func <Exception>(() =>
            {
                try
                {
                    CommonInstaller installer = new CommonInstaller(liteloaderPath, new CommonInstallOptions()
                    {
                        GameRootPath = App.Handler.GameRootPath
                    });
                    installer.BeginInstall();
                    return(null);
                }
                catch (Exception ex)
                { return(ex); }
            });
            App.Downloader.AddDownloadTask(dt);
            App.Downloader.StartDownload();
        }
Exemple #7
0
        private void AppendForgeDownloadTask(Version ver, JWForge forge)
        {
            string       forgePath = NsisoLauncherCore.PathManager.TempDirectory + string.Format(@"\Forge_{0}-Installer.jar", forge.Build);
            DownloadTask dt        = new DownloadTask("forge核心",
                                                      string.Format("https://bmclapi2.bangbang93.com/forge/download/{0}", forge.Build),
                                                      forgePath);

            dt.Todo = new Func <Exception>(() =>
            {
                try
                {
                    CommonInstaller installer = new CommonInstaller(forgePath, new CommonInstallOptions()
                    {
                        GameRootPath = App.Handler.GameRootPath
                    });
                    installer.BeginInstall();
                    return(null);
                }
                catch (Exception ex)
                { return(ex); }
            });
            App.Downloader.AddDownloadTask(dt);
            App.Downloader.StartDownload();
        }