static async Task OnChangePlayModeAsync(PlayModeStateChange playMode) { if (playMode != PlayModeStateChange.EnteredPlayMode) { return; } await PackageListRepository.UpdatePackageList(); XRSettings.enabled = SwitchUseVR.EnabledVR(); }
static async void AsyncInitialize() { await PackageListRepository.UpdatePackageList(); var packageStates = new PackageStates( PackageListRepository.Contain("timeline"), PackageListRepository.Contain("textmeshpro"), PackageListRepository.Contain("postprocessing"), PackageListRepository.Contain("openvr") ); PackageInstallerWindow.ShowWithState(packageStates); }
public void Execute(string[] args) { string packageId; Version packageVersion; string packageSource; string applicationInstallationDir; switch (args[1]) { case "--filepath": packageSource = Path.GetDirectoryName(args[2]); string nugetPackage = Path.GetFileNameWithoutExtension(args[2]); var match = System.Text.RegularExpressions.Regex.Match(nugetPackage, @"(.*)\.([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)*)"); packageId = match.Groups[1].Value; packageVersion = new Version(match.Groups[2].Value); try { applicationInstallationDir = args[3]; } catch (IndexOutOfRangeException e) { throw new InvalidOperationException("Target directory was not specified. it will be read from registry later but now you have to add an argument for it :)", e); } break; default: packageId = args[1]; packageVersion = new Version(args[2]); packageSource = args[3]; try { applicationInstallationDir = args[4]; } catch (IndexOutOfRangeException e) { throw new InvalidOperationException("Target directory was not specified. it will be read from registry later but now you have to add an argument for it :)", e); } break; } HoneyInstallLocation honeyInstallLocation = new HoneyInstallLocation(); IDeploymentComponentFactory deploymentComponentFactory = new DeploymentComponentFactory(honeyInstallLocation, new PathInstallLocation(applicationInstallationDir)); INugetPackageRepository nugetPackageRepository = new NugetPackageRepository(new NugetPackageRepositoryConfig(honeyInstallLocation), new PackageSourceRepositoryFactory()); IPackageListRepository packageListRepository = new PackageListRepository(new HoneyInstallLocation(), null); IDeploymentController deploymentController = new DeploymentController(logger, deploymentComponentFactory, nugetPackageRepository, packageListRepository); deploymentController.Upgrade(packageId, packageVersion, packageSource); }
public void Execute(string[] args) { // no logger needed IPackageListRepository packageListRepository = new PackageListRepository(new HoneyInstallLocation(), null); IListController listController = new ListController(packageListRepository); // limitOutput is more for programms, programms can easy add arguments, dont bother people to do that ListMode listMode = ListMode.Full; // TODO implement limitOutput option if (args.Any(x => x.Equals("--LimitOutput", StringComparison.OrdinalIgnoreCase))) { listMode = ListMode.LimitOutput; } MatchMode matchMode = MatchMode.All; string searchPattern = null; if (args.Length > 1) { if (!args[1].StartsWith("--")) { // TODO implement correct parameter parsing here :) matchMode = MatchMode.IdContains; searchPattern = args[1]; } } var packageInfos = listController.GetPackageInfo(searchPattern, listMode, matchMode); if (packageInfos != null) { StringBuilder output = new StringBuilder(); switch (listMode) { case ListMode.Full: var first = true; foreach (var packageInfo in packageInfos) { if (!first) { output.AppendLine(); } output.AppendLine($@"{nameof(packageInfo.PackageId)}: {packageInfo.PackageId} {nameof(packageInfo.PackageVersion)}: {packageInfo.PackageVersion} {nameof(packageInfo.LockedByAction)}: {packageInfo.LockedByAction} {nameof(packageInfo.LockedByProcess)}: {packageInfo.LockedByProcess} {nameof(packageInfo.Created)}: {packageInfo.Created} {nameof(packageInfo.LastUpdated)}: {packageInfo.LastUpdated}"); first = false; } break; case ListMode.LimitOutput: foreach (var packageInfo in packageInfos) { output.AppendLine($"{packageInfo.PackageId}|{packageInfo.PackageVersion}"); } break; default: throw new ArgumentOutOfRangeException(nameof(listMode)); } Console.Write(output); } else { // TODO Exception Console.WriteLine($"No package where id contains '{searchPattern}' found"); } }
public PackageListService(PackageListRepository packageListRepository) { _packageListRepository = packageListRepository; }