public void SetPackageConfiguration(IPackageConfiguration packageConfiguration, IEnumerable <string> files, IEnumerable <string> dependencies) { RemovePackageConfiguration(packageConfiguration.Id); Packages.Add(packageConfiguration); var info = new ProductPackageInfo(); info.Files.AddRange(files); info.Dependencies.AddRange(dependencies); ProductPackagesInfo.Add(packageConfiguration.Id.ToString(), info); }
private void TryParseConfiguration() { if (!File.Exists(_configPath)) { return; } using (var stream = File.OpenText(_configPath)) { var reader = new JsonTextReader(stream); _jsonObject = JObject.Load(reader); JToken token; if (_jsonObject.TryGetValue(_packagesTag, out token)) { foreach (var package in token.Children()) { var packageProp = (JProperty)package; var packageObject = (JObject)packageProp.Value; var packageId = new PackageId(packageProp.Name); var info = new ProductPackageInfo(); if (packageObject.TryGetValue(_packageTag, out token)) { var packageConfigObject = (JObject)token; Packages.Add(new PackageConfiguration(packageId, packageConfigObject)); if (packageObject.TryGetValue(_filesTag, out token) && token.HasValues) { var array = (JArray)token; info.Files.AddRange(array.Select(x => x.ToString())); } if (packageObject.TryGetValue(_dependenciesTag, out token) && token.HasValues) { var array = (JArray)token; info.Dependencies.AddRange(array.Select(x => x.ToString())); } ProductPackagesInfo.Add(packageId.ToString(), info); } } IsProductConfigured = true; } } }