public override PackagesLock ReadJson(JsonReader reader, Type objectType, PackagesLock existingValue,
                                              bool hasExistingValue, JsonSerializer serializer)
        {
            var result = serializer.Deserialize <Dictionary <string, Dictionary <string, string> > >(reader);

            return(new PackagesLock(result.ToDictionary(x => PackageIdentityConvert.ToPackageIdentity(x.Key),
                                                        x => (IImmutableList <PackageIdentity>)x.Value
                                                        .Select(y => new PackageIdentity(y.Key, NuGetVersion.Parse(y.Value))).ToImmutableList())));
        }
Exemple #2
0
        public override PackageIdentity ReadJson(JsonReader reader, Type objectType, PackageIdentity existingValue,
            bool hasExistingValue,
            JsonSerializer serializer)
        {
            if (reader.TokenType == JsonToken.Null)
                return null;

            var token = serializer.Deserialize<string>(reader);
            return PackageIdentityConvert.ToPackageIdentity(token);
        }
Exemple #3
0
        public async Task <IActionResult> RemoveModule([FromQuery] string package, [FromServices] IVirtualModuleManager moduleManager)
        {
            var packageIdentity = PackageIdentityConvert.ToPackageIdentity(package);

            if (string.IsNullOrWhiteSpace(packageIdentity?.Id))
            {
                return(BadRequest());
            }

            moduleManager.UninstallPackage(packageIdentity);

            await _hubContext.Clients.All.SendAsync(HubEventNames.ModuleUninstalled, package);

            return(Ok());
        }
Exemple #4
0
        public MazeProject(IModuleProjectConfig config, IModulesConfig modulesConfig, IModulesLock modulesLock)
        {
            var providers = Repository.Provider.GetCoreV3();

            PrimarySources = config.PrimarySources
                             .Select(x => new SourceRepository(new PackageSource(x.AbsoluteUri), providers)).ToImmutableList();
            DependencySources = config.DependencySources
                                .Select(x => new SourceRepository(new PackageSource(x.AbsoluteUri), providers)).ToImmutableList();

            ModulesDirectory      = new ModulesDirectory(new VersionFolderPathResolver(config.Directory));
            LocalSourceRepository = new SourceRepository(ModulesDirectory.PackageSource, providers);

            _modulesConfig     = modulesConfig;
            ModulesLock        = modulesLock;
            FrameworkLibraries = config.Frameworks.ToDictionary(x => NuGetFramework.Parse(x.Key),
                                                                x => PackageIdentityConvert.ToPackageIdentity(x.Value));

            Architecture    = Environment.Is64BitProcess ? Architecture.x64 : Architecture.x86;
            Runtime         = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Runtime.Windows : Runtime.Linux;
            PrimaryPackages = modulesConfig.Modules; //very important because the file may change while the packages must consist
        }