Fix #195: Separate platform specific configuration source implementations into their own packages

This commit is contained in:
Kirthi Krishnamraju 2015-05-19 16:41:38 -07:00
Родитель 5d217eb284
Коммит b5b318dcea
35 изменённых файлов: 859 добавлений и 275 удалений

Просмотреть файл

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22710.0
VisualStudioVersion = 14.0.22823.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F141E2D0-F9B8-4ADB-A19A-7B6FF4CA19A1}"
EndProject
@ -25,6 +25,18 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.Configu
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.ConfigurationModel.Test.Common", "test\Microsoft.Framework.ConfigurationModel.Test.Common\Microsoft.Framework.ConfigurationModel.Test.Common.xproj", "{29C120E5-F682-4BFB-826B-040A594802CA}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.ConfigurationModel.CommandLine", "src\Microsoft.Framework.ConfigurationModel.CommandLine\Microsoft.Framework.ConfigurationModel.CommandLine.xproj", "{D4B7CF9B-4229-44DC-800F-CC39150CEAB2}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.ConfigurationModel.Ini", "src\Microsoft.Framework.ConfigurationModel.Ini\Microsoft.Framework.ConfigurationModel.Ini.xproj", "{C555C5D5-BF4A-451E-AB43-EBF4DE885EC7}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.ConfigurationModel.EnvironmentVariables", "src\Microsoft.Framework.ConfigurationModel.EnvironmentVariables\Microsoft.Framework.ConfigurationModel.EnvironmentVariables.xproj", "{A6A2C665-E5A4-4FD3-AD0C-E33E6CFFCB88}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.ConfigurationModel.CommandLine.Test", "test\Microsoft.Framework.ConfigurationModel.CommandLine.Test\Microsoft.Framework.ConfigurationModel.CommandLine.Test.xproj", "{CE9C8903-AA8A-40E6-B03D-32A08A4A39AF}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.ConfigurationModel.Ini.Test", "test\Microsoft.Framework.ConfigurationModel.Ini.Test\Microsoft.Framework.ConfigurationModel.Ini.Test.xproj", "{80A8F10C-E9A6-4677-919D-FE5DB320FEDF}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.ConfigurationModel.EnvironmentVariables.Test", "test\Microsoft.Framework.ConfigurationModel.EnvironmentVariables.Test\Microsoft.Framework.ConfigurationModel.EnvironmentVariables.Test.xproj", "{7D0F805B-ADFF-4C47-A90C-24DD74416821}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -129,6 +141,78 @@ Global
{29C120E5-F682-4BFB-826B-040A594802CA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{29C120E5-F682-4BFB-826B-040A594802CA}.Release|x86.ActiveCfg = Release|Any CPU
{29C120E5-F682-4BFB-826B-040A594802CA}.Release|x86.Build.0 = Release|Any CPU
{D4B7CF9B-4229-44DC-800F-CC39150CEAB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D4B7CF9B-4229-44DC-800F-CC39150CEAB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D4B7CF9B-4229-44DC-800F-CC39150CEAB2}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D4B7CF9B-4229-44DC-800F-CC39150CEAB2}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D4B7CF9B-4229-44DC-800F-CC39150CEAB2}.Debug|x86.ActiveCfg = Debug|Any CPU
{D4B7CF9B-4229-44DC-800F-CC39150CEAB2}.Debug|x86.Build.0 = Debug|Any CPU
{D4B7CF9B-4229-44DC-800F-CC39150CEAB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D4B7CF9B-4229-44DC-800F-CC39150CEAB2}.Release|Any CPU.Build.0 = Release|Any CPU
{D4B7CF9B-4229-44DC-800F-CC39150CEAB2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D4B7CF9B-4229-44DC-800F-CC39150CEAB2}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D4B7CF9B-4229-44DC-800F-CC39150CEAB2}.Release|x86.ActiveCfg = Release|Any CPU
{D4B7CF9B-4229-44DC-800F-CC39150CEAB2}.Release|x86.Build.0 = Release|Any CPU
{C555C5D5-BF4A-451E-AB43-EBF4DE885EC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C555C5D5-BF4A-451E-AB43-EBF4DE885EC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C555C5D5-BF4A-451E-AB43-EBF4DE885EC7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{C555C5D5-BF4A-451E-AB43-EBF4DE885EC7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{C555C5D5-BF4A-451E-AB43-EBF4DE885EC7}.Debug|x86.ActiveCfg = Debug|Any CPU
{C555C5D5-BF4A-451E-AB43-EBF4DE885EC7}.Debug|x86.Build.0 = Debug|Any CPU
{C555C5D5-BF4A-451E-AB43-EBF4DE885EC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C555C5D5-BF4A-451E-AB43-EBF4DE885EC7}.Release|Any CPU.Build.0 = Release|Any CPU
{C555C5D5-BF4A-451E-AB43-EBF4DE885EC7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{C555C5D5-BF4A-451E-AB43-EBF4DE885EC7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{C555C5D5-BF4A-451E-AB43-EBF4DE885EC7}.Release|x86.ActiveCfg = Release|Any CPU
{C555C5D5-BF4A-451E-AB43-EBF4DE885EC7}.Release|x86.Build.0 = Release|Any CPU
{A6A2C665-E5A4-4FD3-AD0C-E33E6CFFCB88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A6A2C665-E5A4-4FD3-AD0C-E33E6CFFCB88}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6A2C665-E5A4-4FD3-AD0C-E33E6CFFCB88}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{A6A2C665-E5A4-4FD3-AD0C-E33E6CFFCB88}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{A6A2C665-E5A4-4FD3-AD0C-E33E6CFFCB88}.Debug|x86.ActiveCfg = Debug|Any CPU
{A6A2C665-E5A4-4FD3-AD0C-E33E6CFFCB88}.Debug|x86.Build.0 = Debug|Any CPU
{A6A2C665-E5A4-4FD3-AD0C-E33E6CFFCB88}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6A2C665-E5A4-4FD3-AD0C-E33E6CFFCB88}.Release|Any CPU.Build.0 = Release|Any CPU
{A6A2C665-E5A4-4FD3-AD0C-E33E6CFFCB88}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{A6A2C665-E5A4-4FD3-AD0C-E33E6CFFCB88}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{A6A2C665-E5A4-4FD3-AD0C-E33E6CFFCB88}.Release|x86.ActiveCfg = Release|Any CPU
{A6A2C665-E5A4-4FD3-AD0C-E33E6CFFCB88}.Release|x86.Build.0 = Release|Any CPU
{CE9C8903-AA8A-40E6-B03D-32A08A4A39AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE9C8903-AA8A-40E6-B03D-32A08A4A39AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE9C8903-AA8A-40E6-B03D-32A08A4A39AF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{CE9C8903-AA8A-40E6-B03D-32A08A4A39AF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{CE9C8903-AA8A-40E6-B03D-32A08A4A39AF}.Debug|x86.ActiveCfg = Debug|Any CPU
{CE9C8903-AA8A-40E6-B03D-32A08A4A39AF}.Debug|x86.Build.0 = Debug|Any CPU
{CE9C8903-AA8A-40E6-B03D-32A08A4A39AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE9C8903-AA8A-40E6-B03D-32A08A4A39AF}.Release|Any CPU.Build.0 = Release|Any CPU
{CE9C8903-AA8A-40E6-B03D-32A08A4A39AF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{CE9C8903-AA8A-40E6-B03D-32A08A4A39AF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{CE9C8903-AA8A-40E6-B03D-32A08A4A39AF}.Release|x86.ActiveCfg = Release|Any CPU
{CE9C8903-AA8A-40E6-B03D-32A08A4A39AF}.Release|x86.Build.0 = Release|Any CPU
{80A8F10C-E9A6-4677-919D-FE5DB320FEDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{80A8F10C-E9A6-4677-919D-FE5DB320FEDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80A8F10C-E9A6-4677-919D-FE5DB320FEDF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{80A8F10C-E9A6-4677-919D-FE5DB320FEDF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{80A8F10C-E9A6-4677-919D-FE5DB320FEDF}.Debug|x86.ActiveCfg = Debug|Any CPU
{80A8F10C-E9A6-4677-919D-FE5DB320FEDF}.Debug|x86.Build.0 = Debug|Any CPU
{80A8F10C-E9A6-4677-919D-FE5DB320FEDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{80A8F10C-E9A6-4677-919D-FE5DB320FEDF}.Release|Any CPU.Build.0 = Release|Any CPU
{80A8F10C-E9A6-4677-919D-FE5DB320FEDF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{80A8F10C-E9A6-4677-919D-FE5DB320FEDF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{80A8F10C-E9A6-4677-919D-FE5DB320FEDF}.Release|x86.ActiveCfg = Release|Any CPU
{80A8F10C-E9A6-4677-919D-FE5DB320FEDF}.Release|x86.Build.0 = Release|Any CPU
{7D0F805B-ADFF-4C47-A90C-24DD74416821}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7D0F805B-ADFF-4C47-A90C-24DD74416821}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D0F805B-ADFF-4C47-A90C-24DD74416821}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{7D0F805B-ADFF-4C47-A90C-24DD74416821}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{7D0F805B-ADFF-4C47-A90C-24DD74416821}.Debug|x86.ActiveCfg = Debug|Any CPU
{7D0F805B-ADFF-4C47-A90C-24DD74416821}.Debug|x86.Build.0 = Debug|Any CPU
{7D0F805B-ADFF-4C47-A90C-24DD74416821}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D0F805B-ADFF-4C47-A90C-24DD74416821}.Release|Any CPU.Build.0 = Release|Any CPU
{7D0F805B-ADFF-4C47-A90C-24DD74416821}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{7D0F805B-ADFF-4C47-A90C-24DD74416821}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{7D0F805B-ADFF-4C47-A90C-24DD74416821}.Release|x86.ActiveCfg = Release|Any CPU
{7D0F805B-ADFF-4C47-A90C-24DD74416821}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -143,5 +227,11 @@ Global
{EAC77F15-F12E-496B-9184-1B1DA89BFFE9} = {B54371FF-B920-46C8-8D55-6B19DBB43EBF}
{3F1CB08E-9FBD-4CAE-A78A-4AC43F24FC49} = {F141E2D0-F9B8-4ADB-A19A-7B6FF4CA19A1}
{29C120E5-F682-4BFB-826B-040A594802CA} = {B54371FF-B920-46C8-8D55-6B19DBB43EBF}
{D4B7CF9B-4229-44DC-800F-CC39150CEAB2} = {F141E2D0-F9B8-4ADB-A19A-7B6FF4CA19A1}
{C555C5D5-BF4A-451E-AB43-EBF4DE885EC7} = {F141E2D0-F9B8-4ADB-A19A-7B6FF4CA19A1}
{A6A2C665-E5A4-4FD3-AD0C-E33E6CFFCB88} = {F141E2D0-F9B8-4ADB-A19A-7B6FF4CA19A1}
{CE9C8903-AA8A-40E6-B03D-32A08A4A39AF} = {B54371FF-B920-46C8-8D55-6B19DBB43EBF}
{80A8F10C-E9A6-4677-919D-FE5DB320FEDF} = {B54371FF-B920-46C8-8D55-6B19DBB43EBF}
{7D0F805B-ADFF-4C47-A90C-24DD74416821} = {B54371FF-B920-46C8-8D55-6B19DBB43EBF}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,25 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
namespace Microsoft.Framework.ConfigurationModel.CommandLine
{
public static class CommandLineConfigurationExtension
{
public static IConfigurationBuilder AddCommandLine(this IConfigurationBuilder configuration, string[] args)
{
configuration.Add(new CommandLineConfigurationSource(args));
return configuration;
}
public static IConfigurationBuilder AddCommandLine(
this IConfigurationBuilder configuration,
string[] args,
IDictionary<string, string> switchMappings)
{
configuration.Add(new CommandLineConfigurationSource(args, switchMappings));
return configuration;
}
}
}

Просмотреть файл

@ -3,9 +3,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.Framework.ConfigurationModel
namespace Microsoft.Framework.ConfigurationModel.CommandLine
{
public class CommandLineConfigurationSource : ConfigurationSource
{

Просмотреть файл

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>d4b7cf9b-4229-44dc-800f-cc39150ceab2</ProjectGuid>
<RootNamespace>Microsoft.Framework.Configuration.CommandLine</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

Просмотреть файл

@ -0,0 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.Framework.ConfigurationModel.CommandLine.Test")]
[assembly: AssemblyMetadata("Serviceable", "True")]

Просмотреть файл

@ -0,0 +1,110 @@
// <auto-generated />
namespace Microsoft.Framework.ConfigurationModel.CommandLine
{
using System.Globalization;
using System.Reflection;
using System.Resources;
internal static class Resources
{
private static readonly ResourceManager _resourceManager
= new ResourceManager("Microsoft.Framework.ConfigurationModel.CommandLine.Resources", typeof(Resources).GetTypeInfo().Assembly);
/// <summary>
/// Keys in switch mappings are case-insensitive. A duplicated key '{0}' was found.
/// </summary>
internal static string Error_DuplicatedKeyInSwitchMappings
{
get { return GetString("Error_DuplicatedKeyInSwitchMappings"); }
}
/// <summary>
/// Keys in switch mappings are case-insensitive. A duplicated key '{0}' was found.
/// </summary>
internal static string FormatError_DuplicatedKeyInSwitchMappings(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_DuplicatedKeyInSwitchMappings"), p0);
}
/// <summary>
/// The switch mappings contain an invalid switch '{0}'.
/// </summary>
internal static string Error_InvalidSwitchMapping
{
get { return GetString("Error_InvalidSwitchMapping"); }
}
/// <summary>
/// The switch mappings contain an invalid switch '{0}'.
/// </summary>
internal static string FormatError_InvalidSwitchMapping(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_InvalidSwitchMapping"), p0);
}
/// <summary>
/// The short switch '{0}' is not defined in the switch mappings.
/// </summary>
internal static string Error_ShortSwitchNotDefined
{
get { return GetString("Error_ShortSwitchNotDefined"); }
}
/// <summary>
/// The short switch '{0}' is not defined in the switch mappings.
/// </summary>
internal static string FormatError_ShortSwitchNotDefined(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_ShortSwitchNotDefined"), p0);
}
/// <summary>
/// Unrecognized argument format: '{0}'.
/// </summary>
internal static string Error_UnrecognizedArgumentFormat
{
get { return GetString("Error_UnrecognizedArgumentFormat"); }
}
/// <summary>
/// Unrecognized argument format: '{0}'.
/// </summary>
internal static string FormatError_UnrecognizedArgumentFormat(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_UnrecognizedArgumentFormat"), p0);
}
/// <summary>
/// Value for switch '{0}' is missing.
/// </summary>
internal static string Error_ValueIsMissing
{
get { return GetString("Error_ValueIsMissing"); }
}
/// <summary>
/// Value for switch '{0}' is missing.
/// </summary>
internal static string FormatError_ValueIsMissing(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_ValueIsMissing"), p0);
}
private static string GetString(string name, params string[] formatterNames)
{
var value = _resourceManager.GetString(name);
System.Diagnostics.Debug.Assert(value != null);
if (formatterNames != null)
{
for (var i = 0; i < formatterNames.Length; i++)
{
value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}");
}
}
return value;
}
}
}

Просмотреть файл

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Error_DuplicatedKeyInSwitchMappings" xml:space="preserve">
<value>Keys in switch mappings are case-insensitive. A duplicated key '{0}' was found.</value>
</data>
<data name="Error_InvalidSwitchMapping" xml:space="preserve">
<value>The switch mappings contain an invalid switch '{0}'.</value>
</data>
<data name="Error_ShortSwitchNotDefined" xml:space="preserve">
<value>The short switch '{0}' is not defined in the switch mappings.</value>
</data>
<data name="Error_UnrecognizedArgumentFormat" xml:space="preserve">
<value>Unrecognized argument format: '{0}'.</value>
</data>
<data name="Error_ValueIsMissing" xml:space="preserve">
<value>Value for switch '{0}' is missing.</value>
</data>
</root>

Просмотреть файл

@ -0,0 +1,13 @@
{
"version": "1.0.0-*",
"description": "Command line configuration source for the Configuration package.",
"dependencies": {
"Microsoft.Framework.ConfigurationModel": "1.0.0-*",
"Microsoft.Framework.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" }
},
"frameworks": {
"net45": { },
"dnx451": { },
"dnxcore50": { }
}
}

Просмотреть файл

@ -6,7 +6,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.Framework.ConfigurationModel
namespace Microsoft.Framework.ConfigurationModel.EnvironmentVariables
{
public class EnvironmentVariablesConfigurationSource : ConfigurationSource
{

Просмотреть файл

@ -0,0 +1,22 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.Framework.ConfigurationModel.EnvironmentVariables
{
public static class EnvironmentVariablesExtension
{
public static IConfigurationBuilder AddEnvironmentVariables(this IConfigurationBuilder configuration)
{
configuration.Add(new EnvironmentVariablesConfigurationSource());
return configuration;
}
public static IConfigurationBuilder AddEnvironmentVariables(
this IConfigurationBuilder configuration,
string prefix)
{
configuration.Add(new EnvironmentVariablesConfigurationSource(prefix));
return configuration;
}
}
}

Просмотреть файл

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>a6a2c665-e5a4-4fd3-ad0c-e33e6cffcb88</ProjectGuid>
<RootNamespace>Microsoft.Framework.Configuration.EnvironmentVariables</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

Просмотреть файл

@ -0,0 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.Framework.ConfigurationModel.EnvironmentVariables.Test")]
[assembly: AssemblyMetadata("Serviceable", "True")]

Просмотреть файл

@ -0,0 +1,13 @@
{
"version": "1.0.0-*",
"description": "Environment variables configuration source for the Configuration package.",
"dependencies": {
"Microsoft.Framework.ConfigurationModel": "1.0.0-*",
"Microsoft.Framework.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" }
},
"frameworks": {
"net45": { },
"dnx451": { },
"dnxcore50": { }
}
}

Просмотреть файл

@ -1,15 +1,14 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Framework.ConfigurationModel.Helper;
using Microsoft.Framework.Internal;
namespace Microsoft.Framework.ConfigurationModel
namespace Microsoft.Framework.ConfigurationModel.Ini
{
public static class ConfigurationExtensions
public static class IniConfigurationExtension
{
#if NET45 || DNX451 || DNXCORE50
/// <summary>
@ -56,34 +55,5 @@ namespace Microsoft.Framework.ConfigurationModel
return configuration;
}
#endif
public static IConfigurationBuilder AddCommandLine(this IConfigurationBuilder configuration, string[] args)
{
configuration.Add(new CommandLineConfigurationSource(args));
return configuration;
}
public static IConfigurationBuilder AddCommandLine(
this IConfigurationBuilder configuration,
string[] args,
IDictionary<string, string> switchMappings)
{
configuration.Add(new CommandLineConfigurationSource(args, switchMappings));
return configuration;
}
public static IConfigurationBuilder AddEnvironmentVariables(this IConfigurationBuilder configuration)
{
configuration.Add(new EnvironmentVariablesConfigurationSource());
return configuration;
}
public static IConfigurationBuilder AddEnvironmentVariables(
this IConfigurationBuilder configuration,
string prefix)
{
configuration.Add(new EnvironmentVariablesConfigurationSource(prefix));
return configuration;
}
}
}

Просмотреть файл

@ -6,7 +6,7 @@ using System;
using System.Collections.Generic;
using System.IO;
namespace Microsoft.Framework.ConfigurationModel
namespace Microsoft.Framework.ConfigurationModel.Ini
{
/// <summary>
/// An INI file based <see cref="ConfigurationSource"/>.

Просмотреть файл

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>c555c5d5-bf4a-451e-ab43-ebf4de885ec7</ProjectGuid>
<RootNamespace>Microsoft.Framework.Configuration.Ini</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

Просмотреть файл

@ -0,0 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.Framework.ConfigurationModel.Ini.Test")]
[assembly: AssemblyMetadata("Serviceable", "True")]

Просмотреть файл

@ -0,0 +1,94 @@
// <auto-generated />
namespace Microsoft.Framework.ConfigurationModel.Ini
{
using System.Globalization;
using System.Reflection;
using System.Resources;
internal static class Resources
{
private static readonly ResourceManager _resourceManager
= new ResourceManager("Microsoft.Framework.ConfigurationModel.Ini.Resources", typeof(Resources).GetTypeInfo().Assembly);
/// <summary>
/// The configuration file '{0}' was not found and is not optional.
/// </summary>
internal static string Error_FileNotFound
{
get { return GetString("Error_FileNotFound"); }
}
/// <summary>
/// The configuration file '{0}' was not found and is not optional.
/// </summary>
internal static string FormatError_FileNotFound(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_FileNotFound"), p0);
}
/// <summary>
/// File path must be a non-empty string.
/// </summary>
internal static string Error_InvalidFilePath
{
get { return GetString("Error_InvalidFilePath"); }
}
/// <summary>
/// File path must be a non-empty string.
/// </summary>
internal static string FormatError_InvalidFilePath()
{
return GetString("Error_InvalidFilePath");
}
/// <summary>
/// A duplicate key '{0}' was found.
/// </summary>
internal static string Error_KeyIsDuplicated
{
get { return GetString("Error_KeyIsDuplicated"); }
}
/// <summary>
/// A duplicate key '{0}' was found.
/// </summary>
internal static string FormatError_KeyIsDuplicated(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_KeyIsDuplicated"), p0);
}
/// <summary>
/// Unrecognized line format: '{0}'.
/// </summary>
internal static string Error_UnrecognizedLineFormat
{
get { return GetString("Error_UnrecognizedLineFormat"); }
}
/// <summary>
/// Unrecognized line format: '{0}'.
/// </summary>
internal static string FormatError_UnrecognizedLineFormat(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_UnrecognizedLineFormat"), p0);
}
private static string GetString(string name, params string[] formatterNames)
{
var value = _resourceManager.GetString(name);
System.Diagnostics.Debug.Assert(value != null);
if (formatterNames != null)
{
for (var i = 0; i < formatterNames.Length; i++)
{
value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}");
}
}
return value;
}
}
}

Просмотреть файл

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Error_FileNotFound" xml:space="preserve">
<value>The configuration file '{0}' was not found and is not optional.</value>
</data>
<data name="Error_InvalidFilePath" xml:space="preserve">
<value>File path must be a non-empty string.</value>
</data>
<data name="Error_KeyIsDuplicated" xml:space="preserve">
<value>A duplicate key '{0}' was found.</value>
</data>
<data name="Error_UnrecognizedLineFormat" xml:space="preserve">
<value>Unrecognized line format: '{0}'.</value>
</data>
</root>

Просмотреть файл

@ -0,0 +1,13 @@
{
"version": "1.0.0-*",
"description": "Ini configuration source for the Configuration package.",
"dependencies": {
"Microsoft.Framework.ConfigurationModel": "1.0.0-*",
"Microsoft.Framework.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" }
},
"frameworks": {
"net45": { },
"dnx451": { },
"dnxcore50": { }
}
}

Просмотреть файл

@ -10,54 +10,6 @@ namespace Microsoft.Framework.ConfigurationModel
private static readonly ResourceManager _resourceManager
= new ResourceManager("Microsoft.Framework.ConfigurationModel.Resources", typeof(Resources).GetTypeInfo().Assembly);
/// <summary>
/// Unable to commit because the following keys are missing from the configuration file: {0}.
/// </summary>
internal static string Error_CommitWhenKeyMissing
{
get { return GetString("Error_CommitWhenKeyMissing"); }
}
/// <summary>
/// Unable to commit because the following keys are missing from the configuration file: {0}.
/// </summary>
internal static string FormatError_CommitWhenKeyMissing(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_CommitWhenKeyMissing"), p0);
}
/// <summary>
/// Unable to commit because a new key was added to the configuration file after last load operation. The newly added key is '{0}'.
/// </summary>
internal static string Error_CommitWhenNewKeyFound
{
get { return GetString("Error_CommitWhenNewKeyFound"); }
}
/// <summary>
/// Unable to commit because a new key was added to the configuration file after last load operation. The newly added key is '{0}'.
/// </summary>
internal static string FormatError_CommitWhenNewKeyFound(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_CommitWhenNewKeyFound"), p0);
}
/// <summary>
/// Keys in switch mappings are case-insensitive. A duplicated key '{0}' was found.
/// </summary>
internal static string Error_DuplicatedKeyInSwitchMappings
{
get { return GetString("Error_DuplicatedKeyInSwitchMappings"); }
}
/// <summary>
/// Keys in switch mappings are case-insensitive. A duplicated key '{0}' was found.
/// </summary>
internal static string FormatError_DuplicatedKeyInSwitchMappings(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_DuplicatedKeyInSwitchMappings"), p0);
}
/// <summary>
/// Cannot create instance of type '{0}' because it is either abstract or an interface.
/// </summary>
@ -106,70 +58,6 @@ namespace Microsoft.Framework.ConfigurationModel
return string.Format(CultureInfo.CurrentCulture, GetString("Error_FailedToActivate"), p0);
}
/// <summary>
/// The configuration file '{0}' was not found and is not optional.
/// </summary>
internal static string Error_FileNotFound
{
get { return GetString("Error_FileNotFound"); }
}
/// <summary>
/// The configuration file '{0}' was not found and is not optional.
/// </summary>
internal static string FormatError_FileNotFound(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_FileNotFound"), p0);
}
/// <summary>
/// File path must be a non-empty string.
/// </summary>
internal static string Error_InvalidFilePath
{
get { return GetString("Error_InvalidFilePath"); }
}
/// <summary>
/// File path must be a non-empty string.
/// </summary>
internal static string FormatError_InvalidFilePath()
{
return GetString("Error_InvalidFilePath");
}
/// <summary>
/// The switch mappings contain an invalid switch '{0}'.
/// </summary>
internal static string Error_InvalidSwitchMapping
{
get { return GetString("Error_InvalidSwitchMapping"); }
}
/// <summary>
/// The switch mappings contain an invalid switch '{0}'.
/// </summary>
internal static string FormatError_InvalidSwitchMapping(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_InvalidSwitchMapping"), p0);
}
/// <summary>
/// A duplicate key '{0}' was found.
/// </summary>
internal static string Error_KeyIsDuplicated
{
get { return GetString("Error_KeyIsDuplicated"); }
}
/// <summary>
/// A duplicate key '{0}' was found.
/// </summary>
internal static string FormatError_KeyIsDuplicated(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_KeyIsDuplicated"), p0);
}
/// <summary>
/// Unable to resolve path '{0}'; construct this {1} with a non-null {2}.
/// </summary>
@ -202,22 +90,6 @@ namespace Microsoft.Framework.ConfigurationModel
return string.Format(CultureInfo.CurrentCulture, GetString("Error_MissingParameterlessConstructor"), p0);
}
/// <summary>
/// No registered configuration source is capable of committing changes.
/// </summary>
internal static string Error_NoCommitableSource
{
get { return GetString("Error_NoCommitableSource"); }
}
/// <summary>
/// No registered configuration source is capable of committing changes.
/// </summary>
internal static string FormatError_NoCommitableSource()
{
return GetString("Error_NoCommitableSource");
}
/// <summary>
/// A configuration source is not registered. Please register one before setting a value.
/// </summary>
@ -234,70 +106,6 @@ namespace Microsoft.Framework.ConfigurationModel
return GetString("Error_NoSources");
}
/// <summary>
/// The short switch '{0}' is not defined in the switch mappings.
/// </summary>
internal static string Error_ShortSwitchNotDefined
{
get { return GetString("Error_ShortSwitchNotDefined"); }
}
/// <summary>
/// The short switch '{0}' is not defined in the switch mappings.
/// </summary>
internal static string FormatError_ShortSwitchNotDefined(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_ShortSwitchNotDefined"), p0);
}
/// <summary>
/// Unrecognized argument format: '{0}'.
/// </summary>
internal static string Error_UnrecognizedArgumentFormat
{
get { return GetString("Error_UnrecognizedArgumentFormat"); }
}
/// <summary>
/// Unrecognized argument format: '{0}'.
/// </summary>
internal static string FormatError_UnrecognizedArgumentFormat(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_UnrecognizedArgumentFormat"), p0);
}
/// <summary>
/// Unrecognized line format: '{0}'.
/// </summary>
internal static string Error_UnrecognizedLineFormat
{
get { return GetString("Error_UnrecognizedLineFormat"); }
}
/// <summary>
/// Unrecognized line format: '{0}'.
/// </summary>
internal static string FormatError_UnrecognizedLineFormat(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_UnrecognizedLineFormat"), p0);
}
/// <summary>
/// Value for switch '{0}' is missing.
/// </summary>
internal static string Error_ValueIsMissing
{
get { return GetString("Error_ValueIsMissing"); }
}
/// <summary>
/// Value for switch '{0}' is missing.
/// </summary>
internal static string FormatError_ValueIsMissing(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_ValueIsMissing"), p0);
}
private static string GetString(string name, params string[] formatterNames)
{
var value = _resourceManager.GetString(name);

Просмотреть файл

@ -117,15 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Error_CommitWhenKeyMissing" xml:space="preserve">
<value>Unable to commit because the following keys are missing from the configuration file: {0}.</value>
</data>
<data name="Error_CommitWhenNewKeyFound" xml:space="preserve">
<value>Unable to commit because a new key was added to the configuration file after last load operation. The newly added key is '{0}'.</value>
</data>
<data name="Error_DuplicatedKeyInSwitchMappings" xml:space="preserve">
<value>Keys in switch mappings are case-insensitive. A duplicated key '{0}' was found.</value>
</data>
<data name="Error_CannotActivateAbstractOrInterface" xml:space="preserve">
<value>Cannot create instance of type '{0}' because it is either abstract or an interface.</value>
</data>
@ -135,40 +126,13 @@
<data name="Error_FailedToActivate" xml:space="preserve">
<value>Failed to create instance of type '{0}'.</value>
</data>
<data name="Error_FileNotFound" xml:space="preserve">
<value>The configuration file '{0}' was not found and is not optional.</value>
</data>
<data name="Error_InvalidFilePath" xml:space="preserve">
<value>File path must be a non-empty string.</value>
</data>
<data name="Error_InvalidSwitchMapping" xml:space="preserve">
<value>The switch mappings contain an invalid switch '{0}'.</value>
</data>
<data name="Error_KeyIsDuplicated" xml:space="preserve">
<value>A duplicate key '{0}' was found.</value>
</data>
<data name="Error_MissingBasePath" xml:space="preserve">
<value>Unable to resolve path '{0}'; construct this {1} with a non-null {2}.</value>
</data>
<data name="Error_MissingParameterlessConstructor" xml:space="preserve">
<value>Cannot create instance of type '{0}' because it is missing a public parameterless constructor.</value>
</data>
<data name="Error_NoCommitableSource" xml:space="preserve">
<value>No registered configuration source is capable of committing changes.</value>
</data>
<data name="Error_NoSources" xml:space="preserve">
<value>A configuration source is not registered. Please register one before setting a value.</value>
</data>
<data name="Error_ShortSwitchNotDefined" xml:space="preserve">
<value>The short switch '{0}' is not defined in the switch mappings.</value>
</data>
<data name="Error_UnrecognizedArgumentFormat" xml:space="preserve">
<value>Unrecognized argument format: '{0}'.</value>
</data>
<data name="Error_UnrecognizedLineFormat" xml:space="preserve">
<value>Unrecognized line format: '{0}'.</value>
</data>
<data name="Error_ValueIsMissing" xml:space="preserve">
<value>Value for switch '{0}' is missing.</value>
</data>
</root>

Просмотреть файл

@ -3,9 +3,10 @@
using System;
using System.Collections.Generic;
using Microsoft.Framework.ConfigurationModel.Test;
using Xunit;
namespace Microsoft.Framework.ConfigurationModel.Test
namespace Microsoft.Framework.ConfigurationModel.CommandLine.Test
{
public class CommandLineConfigurationSourceTest
{

Просмотреть файл

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>ce9c8903-aa8a-40e6-b03d-32a08a4a39af</ProjectGuid>
<RootNamespace>Microsoft.Framework.Configuration.CommandLine.Test</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

Просмотреть файл

@ -0,0 +1,14 @@
{
"dependencies": {
"Microsoft.Framework.ConfigurationModel.CommandLine": "1.0.0-*",
"Microsoft.Framework.ConfigurationModel.Test.Common": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
"commands": {
"test": "xunit.runner.aspnet"
}
}

Просмотреть файл

@ -3,9 +3,10 @@
using System;
using System.Collections;
using Microsoft.Framework.ConfigurationModel.Test;
using Xunit;
namespace Microsoft.Framework.ConfigurationModel.Test
namespace Microsoft.Framework.ConfigurationModel.EnvironmentVariables.Test
{
public class EnvironmentVariablesConfigurationSourceTest
{

Просмотреть файл

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>7d0f805b-adff-4c47-a90c-24dd74416821</ProjectGuid>
<RootNamespace>Microsoft.Framework.Configuration.EnvironmentVariables.Test</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

Просмотреть файл

@ -0,0 +1,14 @@
{
"dependencies": {
"Microsoft.Framework.ConfigurationModel.EnvironmentVariables": "1.0.0-*",
"Microsoft.Framework.ConfigurationModel.Test.Common": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
"commands": {
"test": "xunit.runner.aspnet"
}
}

Просмотреть файл

@ -4,6 +4,7 @@
using System;
using System.IO;
using System.Linq;
using Microsoft.Framework.ConfigurationModel.Ini;
using Xunit;
namespace Microsoft.Framework.ConfigurationModel.FunctionalTests

Просмотреть файл

@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Framework.ConfigurationModel.Ini;
using Xunit;
namespace Microsoft.Framework.ConfigurationModel.Test

Просмотреть файл

@ -1,5 +1,6 @@
{
"dependencies": {
"Microsoft.Framework.ConfigurationModel.Ini": "1.0.0-*",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-*",
"Microsoft.Framework.ConfigurationModel.Test.Common": "1.0.0-*",
"Microsoft.Framework.ConfigurationModel.Xml": "1.0.0-*",

Просмотреть файл

@ -1,13 +1,13 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using Xunit;
namespace Microsoft.Framework.ConfigurationModel.Test
namespace Microsoft.Framework.ConfigurationModel.Ini.Test
{
public class ConfigurationExtensionsTest
public class IniConfigurationExtensionTest
{
[Theory]
[InlineData(null)]
@ -18,7 +18,8 @@ namespace Microsoft.Framework.ConfigurationModel.Test
var configurationSource = new Configuration();
// Act and Assert
var ex = Assert.Throws<ArgumentException>(() => ConfigurationExtensions.AddIniFile(configurationSource, path));
var ex = Assert.Throws<ArgumentException>(
() => IniConfigurationExtension.AddIniFile(configurationSource, path));
Assert.Equal("path", ex.ParamName);
Assert.StartsWith("File path must be a non-empty string.", ex.Message);
}
@ -31,7 +32,8 @@ namespace Microsoft.Framework.ConfigurationModel.Test
var configurationSource = new Configuration();
// Act and Assert
var ex = Assert.Throws<FileNotFoundException>(() => ConfigurationExtensions.AddIniFile(configurationSource, path));
var ex = Assert.Throws<FileNotFoundException>(
() => IniConfigurationExtension.AddIniFile(configurationSource, path));
Assert.Equal($"The configuration file '{path}' was not found and is not optional.", ex.Message);
}
}

Просмотреть файл

@ -3,9 +3,10 @@
using System;
using System.IO;
using Microsoft.Framework.ConfigurationModel.Test;
using Xunit;
namespace Microsoft.Framework.ConfigurationModel.Test
namespace Microsoft.Framework.ConfigurationModel.Ini.Test
{
public class IniFileConfigurationSourceTest
{

Просмотреть файл

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>80a8f10c-e9a6-4677-919d-fe5db320fedf</ProjectGuid>
<RootNamespace>Microsoft.Framework.Configuration.Ini.Test</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

Просмотреть файл

@ -0,0 +1,14 @@
{
"dependencies": {
"Microsoft.Framework.ConfigurationModel.Ini": "1.0.0-*",
"Microsoft.Framework.ConfigurationModel.Test.Common": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
"commands": {
"test": "xunit.runner.aspnet"
}
}