private bool InstallNextPackage(PackageSourceSettings settings) { foreach (string packageString in Packages) { string[] packageData = packageString.Split('-'); foreach (PackageSource source in settings.PackageSources) { try { PackageGroup neededPackage = source.Packages.First(package => package.Author.Equals(packageData[0]) && package.PackageName.Equals(packageData[1])); if (!neededPackage.Installed) { currentlyInstalling = true; installName = $"{neededPackage.Author}-{neededPackage.PackageName}"; Debug.Log($"Installing {installName}"); Task task = neededPackage.Source.InstallPackage(neededPackage, packageData[2]); task.Wait(); return(false); } } catch (InvalidOperationException) { } } } return(true); }
private void OnEnable() { currentlyInstalling = false; Task.Delay(2000).Wait(); PackageSourceSettings settings = ThunderKitSetting.GetOrCreateSettings <PackageSourceSettings>(); shouldClose = InstallNextPackage(settings); }
private void Update() { if (currentlyInstalling || EditorApplication.isCompiling) { return; } PackageSourceSettings settings = ThunderKitSetting.GetOrCreateSettings <PackageSourceSettings>(); shouldClose = InstallNextPackage(settings); }
private static async Task MainAsync(string[] args) { var configurationBuilder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.dev.json", optional: false); var configuration = configurationBuilder.Build(); var packageSourceSettings = new PackageSourceSettings(); configuration.Bind(packageSourceSettings); var options = Options.Create(packageSourceSettings); var packageSourceProvider = new PackageSourceProvider(options); var packageReader = new PackageReader(); var testData = TestData.InitializeFromRepository(); var httpClientHandler = new HttpClientHandler(); var loggerFactory = new LoggerFactory(); var parser = new Parser(); var mapper = new Mapper(); loggerFactory.AddConsole(); var loggingHttpHandler = new LoggingHttpHandler(httpClientHandler, loggerFactory.CreateLogger <LoggingHttpHandler>()); using (var httpClient = new HttpClient(loggingHttpHandler)) { var protocol = new Protocol(httpClient, parser); var client = new Client(protocol, packageReader); /* * var sources = packageSourceProvider.GetPackageSources(); * foreach (var source in sources) * { * using (var package = testData.PackageUnlisted) * { * await client.PushAndUnlistPackageIfNotExistsAsync(source, package); * } * } */ /* * var schemaComparisonTest = new SchemaComparisonTest(packageSourceProvider, client); * var schemaComparison = await schemaComparisonTest.ExecuteAsync(); * * var propertyComparisonTest = new PropertyComparisonTest(packageSourceProvider, packageReader, testData, client, mapper); * var propertyComparison = await propertyComparisonTest.ExecuteAsync(); * * var propertyConsistencyTest = new PropertyConsistencyTest(packageSourceProvider, client, testData, packageReader); * var propertyConsistency = await propertyConsistencyTest.ExecuteAsync(); * * Console.WriteLine(JsonConvert.SerializeObject( * new * { * SchemaComparison = schemaComparison, * PropertyComparison = propertyComparison, * PropertyConsistency = propertyConsistency, * }, * new JsonSerializerSettings * { * Formatting = Formatting.Indented, * Converters = new[] * { * new StringEnumConverter(), * }, * })); */ /* * var abbreviation = new Abbreviations(); * var markdownTableWriter = new MarkdownTableWriter(); * var report = new SchemaComparisonWriter(abbreviation, markdownTableWriter); * var sb = new StringBuilder(); * report.Write(sb, schemaComparison); * * Console.WriteLine(sb.ToString()); */ } }