diff options
author | Matt Ward <ward.matt@gmail.com> | 2015-02-02 16:17:19 +0300 |
---|---|---|
committer | Matt Ward <ward.matt@gmail.com> | 2015-02-02 16:17:19 +0300 |
commit | 5c126b4342bd00e2a8befd7ccab4dbc6caa2f39c (patch) | |
tree | 347814b34a113b7a55c4e2fe85b13cf837a038a0 /main/src/addins/MonoDevelop.PackageManagement | |
parent | cf6bd957a5273178527b3d75a81bead7bb7c8714 (diff) |
[NuGet] Update to NuGet 2.8.3
Diffstat (limited to 'main/src/addins/MonoDevelop.PackageManagement')
3 files changed, 33 insertions, 59 deletions
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSettings.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSettings.cs index 52c9f2358f..769caa8028 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSettings.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSettings.cs @@ -40,17 +40,17 @@ namespace MonoDevelop.PackageManagement.Tests.Helpers /// </summary>
public class FakeSettings : ISettings
{
- public List<KeyValuePair<string, string>> PackageSources
- = new List<KeyValuePair<string, string>> ();
+ public List<SettingValue> PackageSources
+ = new List<SettingValue> ();
- public List<KeyValuePair<string, string>> DisabledPackageSources
- = new List<KeyValuePair<string, string>> ();
+ public List<SettingValue> DisabledPackageSources
+ = new List<SettingValue> ();
- public List<KeyValuePair<string, string>> ActivePackageSourceSettings =
- new List<KeyValuePair<string, string>> ();
+ public List<SettingValue> ActivePackageSourceSettings =
+ new List<SettingValue> ();
- public Dictionary<string, IList<KeyValuePair<string, string>>> Sections
- = new Dictionary<string, IList<KeyValuePair<string, string>>> ();
+ public Dictionary<string, IList<SettingValue>> Sections
+ = new Dictionary<string, IList<SettingValue>> ();
public const string PackageSourcesSectionName = "packageSources";
public const string DisabledPackageSourcesSectionName = "disabledPackageSources";
@@ -63,28 +63,23 @@ namespace MonoDevelop.PackageManagement.Tests.Helpers Sections.Add (DisabledPackageSourcesSectionName, DisabledPackageSources);
}
- public string GetValue (string section, string key)
+ public string GetValue (string section, string key, bool isPath)
{
- if (!Sections.ContainsKey (section))
- return null;
-
- IList<KeyValuePair<string, string>> values = Sections [section];
- foreach (KeyValuePair<string, string> keyPair in values) {
- if (keyPair.Key == key) {
- return keyPair.Value;
- }
+ if (Sections.ContainsKey (section)) {
+ var matchedSection = Sections [section];
+ return matchedSection.FirstOrDefault (item => item.Key == key).Value;
}
return null;
}
- public IList<KeyValuePair<string, string>> GetValues (string section)
+ public IList<SettingValue> GetValues (string section, bool isPath)
{
return Sections [section];
}
public void AddFakePackageSource (PackageSource packageSource)
{
- var valuePair = new KeyValuePair<string, string> (packageSource.Name, packageSource.Source);
+ var valuePair = new SettingValue (packageSource.Name, packageSource.Source, false);
PackageSources.Add (valuePair);
}
@@ -150,8 +145,8 @@ namespace MonoDevelop.PackageManagement.Tests.Helpers public void SetFakeActivePackageSource (PackageSource packageSource)
{
ActivePackageSourceSettings.Clear ();
- var valuePair = new KeyValuePair<string, string> (packageSource.Name, packageSource.Source);
- ActivePackageSourceSettings.Add (valuePair);
+ var setting = new SettingValue (packageSource.Name, packageSource.Source, false);
+ ActivePackageSourceSettings.Add (setting);
}
public void MakeActivePackageSourceSectionNull ()
@@ -173,9 +168,9 @@ namespace MonoDevelop.PackageManagement.Tests.Helpers }
}
- public IList<KeyValuePair<string, string>> GetNestedValues (string section, string key)
+ public IList<SettingValue> GetNestedValues (string section, string key)
{
- return new List<KeyValuePair<string, string>> ();
+ return new List<SettingValue> ();
}
public void SetNestedValues (string section, string key, IList<KeyValuePair<string, string>> values)
@@ -185,8 +180,8 @@ namespace MonoDevelop.PackageManagement.Tests.Helpers public void AddDisabledPackageSource (PackageSource packageSource)
{
- var valuePair = new KeyValuePair<string, string> (packageSource.Name, packageSource.Source);
- DisabledPackageSources.Add (valuePair);
+ var setting = new SettingValue (packageSource.Name, packageSource.Source, false);
+ DisabledPackageSources.Add (setting);
}
public IList<KeyValuePair<string, string>> GetValuesPassedToSetValuesForDisabledPackageSourcesSection ()
@@ -202,8 +197,8 @@ namespace MonoDevelop.PackageManagement.Tests.Helpers public void SetPackageRestoreSetting (bool enabled)
{
- var items = new List<KeyValuePair<string, string>> ();
- items.Add (new KeyValuePair<string, string> ("enabled", enabled.ToString ()));
+ var items = new List<SettingValue> ();
+ items.Add (new SettingValue ("enabled", enabled.ToString (), false));
Sections.Add ("packageRestore", items);
}
@@ -220,31 +215,10 @@ namespace MonoDevelop.PackageManagement.Tests.Helpers public void SetRepositoryPathSetting (string fullPath)
{
- var items = new List<KeyValuePair<string, string>> ();
- items.Add (new KeyValuePair<string, string> ("repositoryPath", fullPath));
+ var items = new List<SettingValue> ();
+ items.Add (new SettingValue ("repositoryPath", fullPath, false));
Sections.Add (ConfigSectionName, items);
}
-
- public string GetValue (string section, string key, bool isPath)
- {
- if (Sections.ContainsKey (section)) {
- var matchedSection = Sections [section];
- return matchedSection.FirstOrDefault (item => item.Key == key).Value;
- }
- return null;
- }
-
- public IList<KeyValuePair<string, string>> GetValues (string section, bool isPath)
- {
- throw new NotImplementedException ();
- }
-
- public IList<SettingValue> GetSettingValues (string section, bool isPath)
- {
- return Sections [section]
- .Select (item => new SettingValue (item.Key, item.Value, false))
- .ToList ();
- }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSourceConverter.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSourceConverter.cs index 9b37f47f60..26cd738f41 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSourceConverter.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSourceConverter.cs @@ -35,16 +35,16 @@ namespace ICSharpCode.PackageManagement {
public static class PackageSourceConverter
{
- public static IEnumerable<PackageSource> ConvertFromKeyValuePairs(IEnumerable<KeyValuePair<string, string>> packageSources)
+ public static IEnumerable<PackageSource> ConvertFromSettings(IEnumerable<SettingValue> packageSources)
{
if (HasAny(packageSources)) {
- foreach (KeyValuePair<string, string> packageSource in packageSources) {
- yield return CreatePackageSourceFromKeyValuePair(packageSource);
+ foreach (SettingValue packageSource in packageSources) {
+ yield return CreatePackageSourceFromSetting(packageSource);
}
}
}
- static bool HasAny(IEnumerable<KeyValuePair<string, string>> packageSources)
+ static bool HasAny(IEnumerable<SettingValue> packageSources)
{
if (packageSources != null) {
return packageSources.Any();
@@ -52,17 +52,17 @@ namespace ICSharpCode.PackageManagement return false;
}
- static PackageSource CreatePackageSourceFromKeyValuePair(KeyValuePair<string, string> savedPackageSource)
+ static PackageSource CreatePackageSourceFromSetting(SettingValue savedPackageSource)
{
string source = savedPackageSource.Value;
string name = savedPackageSource.Key;
return new PackageSource(source, name);
}
- public static PackageSource ConvertFromFirstKeyValuePair(IEnumerable<KeyValuePair<string, string>> packageSources)
+ public static PackageSource ConvertFromFirstSetting(IEnumerable<SettingValue> packageSources)
{
if (HasAny(packageSources)) {
- return CreatePackageSourceFromKeyValuePair(packageSources.First());
+ return CreatePackageSourceFromSetting(packageSources.First());
}
return null;
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourceSettings.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourceSettings.cs index 7405f2c7dc..8369605e22 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourceSettings.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourceSettings.cs @@ -84,8 +84,8 @@ namespace ICSharpCode.PackageManagement void ReadActivePackageSource()
{
- IList<KeyValuePair<string, string>> packageSources = settings.GetValues(ActivePackageSourceSectionName);
- activePackageSource = PackageSourceConverter.ConvertFromFirstKeyValuePair(packageSources);
+ IList<SettingValue> packageSources = settings.GetValues(ActivePackageSourceSectionName, false);
+ activePackageSource = PackageSourceConverter.ConvertFromFirstSetting(packageSources);
}
public RegisteredPackageSources PackageSources {
|