diff options
author | Jan Kotas <jkotas@microsoft.com> | 2017-01-04 22:04:08 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2017-01-06 21:03:35 +0300 |
commit | 9e5768435542c23b11a6d6c4b8fddfe625330a85 (patch) | |
tree | 81a0221944c89db91da3a64cadb306018d62a7b3 /src | |
parent | 05c59737a2c7ada9d07a67d68cb899c19fef3699 (diff) |
Add ResourceManager to CoreLib build
Diffstat (limited to 'src')
11 files changed, 125 insertions, 12 deletions
diff --git a/src/System.Private.CoreLib/src/Resources/Strings.resx b/src/System.Private.CoreLib/src/Resources/Strings.resx index bc292c8a5..2e1ecbe88 100644 --- a/src/System.Private.CoreLib/src/Resources/Strings.resx +++ b/src/System.Private.CoreLib/src/Resources/Strings.resx @@ -2053,4 +2053,46 @@ <data name="IndexOutOfRange_IORaceCondition" xml:space="preserve"> <value>Probable I/O race condition detected while copying memory. The I/O package is not thread safe by default. In multithreaded applications, a stream must be accessed in a thread-safe way, such as a thread-safe wrapper returned by TextReader's or TextWriter's Synchronized methods. This also applies to classes like StreamWriter and StreamReader.</value> </data> + <data name="Argument_StreamNotSeekable" xml:space="preserve"> + <value>Stream was not seekable.</value> + </data> + <data name="Arg_ResourceFileUnsupportedVersion" xml:space="preserve"> + <value>The ResourceReader class does not know how to read this version of .resources files.</value> + </data> + <data name="Resources_StreamNotValid" xml:space="preserve"> + <value>Stream is not a valid resource file.</value> + </data> + <data name="BadImageFormat_ResourcesHeaderCorrupted" xml:space="preserve"> + <value>Corrupt .resources file. Unable to read resources from this file because of invalid header information. Try regenerating the .resources file.</value> + </data> + <data name="Argument_StreamNotReadable" xml:space="preserve"> + <value>Stream was not readable.</value> + </data> + <data name="BadImageFormat_NegativeStringLength" xml:space="preserve"> + <value>Corrupt .resources file. String length must be non-negative.</value> + </data> + <data name="BadImageFormat_ResourcesNameInvalidOffset" xml:space="preserve"> + <value>Corrupt .resources file. The Invalid offset into name section is .</value> + </data> + <data name="BadImageFormat_TypeMismatch" xml:space="preserve"> + <value>Corrupt .resources file. The specified type doesn't match the available data in the stream.</value> + </data> + <data name="BadImageFormat_ResourceNameCorrupted_NameIndex" xml:space="preserve"> + <value>Corrupt .resources file. The resource name for name index that extends past the end of the stream is </value> + </data> + <data name="BadImageFormat_ResourcesDataInvalidOffset" xml:space="preserve"> + <value>Corrupt .resources file. Invalid offset into data section is </value> + </data> + <data name="Format_Bad7BitInt32" xml:space="preserve"> + <value>Too many bytes in what should have been a 7 bit encoded Int32.</value> + </data> + <data name="BadImageFormat_InvalidType" xml:space="preserve"> + <value>Corrupt .resources file. The specified type doesn't exist.</value> + </data> + <data name="ResourceReaderIsClosed" xml:space="preserve"> + <value>ResourceReader is closed.</value> + </data> + <data name="Arg_MissingManifestResourceException" xml:space="preserve"> + <value>Unable to find manifest resource.</value> + </data> </root>
\ No newline at end of file diff --git a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj index d65f71892..398d26291 100644 --- a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj +++ b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj @@ -17,7 +17,7 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|arm'" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|arm'" /> <PropertyGroup> - <SkipCommonResourcesIncludes>true</SkipCommonResourcesIncludes> + <SkipCommonResourcesIncludes Condition="'$(IsProjectNLibrary)' == 'true'">true</SkipCommonResourcesIncludes> <ExcludeMscorlibFacade>true</ExcludeMscorlibFacade> <ExcludeAssemblyInfoPartialFile>true</ExcludeAssemblyInfoPartialFile> <UseSyncTable>true</UseSyncTable> @@ -50,7 +50,7 @@ <Compile Include="..\..\Common\src\TypeSystem\Common\ExceptionStringID.cs"> <Link>ExceptionStringID.cs</Link> </Compile> - <Compile Include="..\..\Common\src\System\SR.Core.cs"> + <Compile Include="..\..\Common\src\System\SR.Core.cs" Condition="'$(IsProjectNLibrary)' == 'true'"> <Link>Resources\Common</Link> </Compile> <Compile Include="..\..\Common\src\System\Threading\Tasks\TaskToApm.cs"> @@ -196,6 +196,12 @@ <Compile Include="System\Reflection\TypeInfo.cs" /> <Compile Include="System\Reflection\TypeInfo.Workaround.cs" /> <Compile Include="System\Reflection\Runtime\CustomAttributes\RuntimeImplementedCustomAttributeData.cs" /> + <!-- TODO: Enable ResourceManager in ProjectN TFS build --> + <Compile Include="System\Resources\MissingManifestResourceException.cs" Condition="'$(IsProjectNLibrary)' != 'true'" /> + <Compile Include="System\Resources\NeutralResourcesLanguageAttribute.cs" Condition="'$(IsProjectNLibrary)' != 'true'" /> + <Compile Include="System\Resources\ResourceManager.cs" Condition="'$(IsProjectNLibrary)' != 'true'" /> + <Compile Include="System\Resources\ResourceReader.cs" Condition="'$(IsProjectNLibrary)' != 'true'" /> + <Compile Include="System\Resources\StreamExtensions.cs" Condition="'$(IsProjectNLibrary)' != 'true'" /> <Compile Include="System\__Canon.cs" /> <Compile Include="System\AccessViolationException.cs" /> <Compile Include="System\Action.cs" /> diff --git a/src/System.Private.CoreLib/src/System/Resources/MissingManifestResourceException.cs b/src/System.Private.CoreLib/src/System/Resources/MissingManifestResourceException.cs index aedea3dd8..ebfefb528 100644 --- a/src/System.Private.CoreLib/src/System/Resources/MissingManifestResourceException.cs +++ b/src/System.Private.CoreLib/src/System/Resources/MissingManifestResourceException.cs @@ -12,19 +12,19 @@ namespace System.Resources public MissingManifestResourceException() : base(SR.Arg_MissingManifestResourceException) { - HResult = HResults.COR_E_MISSINGMANIFESTRESOURCE; + HResult = __HResults.COR_E_MISSINGMANIFESTRESOURCE; } public MissingManifestResourceException(string message) : base(message) { - HResult = HResults.COR_E_MISSINGMANIFESTRESOURCE; + HResult = __HResults.COR_E_MISSINGMANIFESTRESOURCE; } public MissingManifestResourceException(string message, Exception inner) : base(message, inner) { - HResult = HResults.COR_E_MISSINGMANIFESTRESOURCE; + HResult = __HResults.COR_E_MISSINGMANIFESTRESOURCE; } protected MissingManifestResourceException(SerializationInfo info, StreamingContext context) : base(info, context) diff --git a/src/System.Private.CoreLib/src/System/Resources/ResourceManager.cs b/src/System.Private.CoreLib/src/System/Resources/ResourceManager.cs new file mode 100644 index 000000000..a3337d6a3 --- /dev/null +++ b/src/System.Private.CoreLib/src/System/Resources/ResourceManager.cs @@ -0,0 +1,65 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Globalization; +using System.Reflection; + +namespace System.Resources +{ + public class ResourceManager + { + protected Assembly MainAssembly; + + public ResourceManager(Type resourceSource) + { + if (null == resourceSource) + { + throw new ArgumentNullException(nameof(resourceSource)); + } + + // TODO: NS2.0 ResourceManager + } + + public ResourceManager(string baseName, Assembly assembly) + { + if (null == baseName) + { + throw new ArgumentNullException(nameof(baseName)); + } + if (null == assembly) + { + throw new ArgumentNullException(nameof(assembly)); + } + + MainAssembly = assembly; + + // TODO: NS2.0 ResourceManager + } + + public ResourceManager(string resourcesName) + { + // TODO: NS2.0 ResourceManager + } + + public string GetString(string name) + { + return GetString(name, null); + } + + // Looks up a resource value for a particular name. Looks in the + // specified CultureInfo, and if not found, all parent CultureInfos. + // Returns null if the resource wasn't found. + // + public virtual string GetString(string name, CultureInfo culture) + { + if (null == name) + { + throw new ArgumentNullException(nameof(name)); + } + + // TODO: NS2.0 ResourceManager + return name; + } + } +} diff --git a/src/System.Private.DeveloperExperience.Console/src/System.Private.DeveloperExperience.Console.csproj b/src/System.Private.DeveloperExperience.Console/src/System.Private.DeveloperExperience.Console.csproj index 87acfa00f..5cf519665 100644 --- a/src/System.Private.DeveloperExperience.Console/src/System.Private.DeveloperExperience.Console.csproj +++ b/src/System.Private.DeveloperExperience.Console/src/System.Private.DeveloperExperience.Console.csproj @@ -25,7 +25,7 @@ <ReferencePath Include="$(AotPackageReferencePath)\System.Collections.dll" /> <ReferencePath Include="$(AotPackageReferencePath)\System.Console.dll" /> <ReferencePath Include="$(AotPackageReferencePath)\System.IO.dll" /> - <ReferencePath Include="$(AotPackageReferencePath)\System.Resources.ResourceManager.dll" /> + <ReferencePath Include="$(AotPackageReferencePath)\System.Resources.ResourceManager.dll" Condition="'$(IsProjectNLibrary)' == 'true'" /> <ProjectReference Include="..\..\System.Private.StackTraceGenerator\src\System.Private.StackTraceGenerator.csproj" /> </ItemGroup> diff --git a/src/System.Private.Interop/src/System.Private.Interop.csproj b/src/System.Private.Interop/src/System.Private.Interop.csproj index 562be688f..a9c433f0d 100644 --- a/src/System.Private.Interop/src/System.Private.Interop.csproj +++ b/src/System.Private.Interop/src/System.Private.Interop.csproj @@ -32,7 +32,7 @@ <ReferencePath Include="$(AotPackageReferencePath)\System.Collections.dll" > <Aliases>CoreFX_Collections</Aliases> </ReferencePath> - <ReferencePath Include="$(AotPackageReferencePath)\System.Resources.ResourceManager.dll" /> + <ReferencePath Include="$(AotPackageReferencePath)\System.Resources.ResourceManager.dll" Condition="'$(IsProjectNLibrary)' == 'true'" /> <ReferencePath Include="$(AotPackageReferencePath)\System.Reflection.dll" /> <ReferencePath Include="$(AotPackageReferencePath)\System.Diagnostics.Tracing.dll" /> <ReferencePath Include="$(AotPackageReferencePath)\System.Diagnostics.Contracts.dll" /> diff --git a/src/System.Private.Reflection.Core/src/System.Private.Reflection.Core.csproj b/src/System.Private.Reflection.Core/src/System.Private.Reflection.Core.csproj index 27a115ef2..8062256a4 100644 --- a/src/System.Private.Reflection.Core/src/System.Private.Reflection.Core.csproj +++ b/src/System.Private.Reflection.Core/src/System.Private.Reflection.Core.csproj @@ -24,7 +24,7 @@ </ProjectReference> <ReferencePath Include="$(AotPackageReferencePath)\System.Runtime.dll" /> <ReferencePath Include="$(AotPackageReferencePath)\System.Diagnostics.Tracing.dll" /> - <ReferencePath Include="$(AotPackageReferencePath)\System.Resources.ResourceManager.dll" /> + <ReferencePath Include="$(AotPackageReferencePath)\System.Resources.ResourceManager.dll" Condition="'$(IsProjectNLibrary)' == 'true'" /> <ReferencePath Include="$(AotPackageReferencePath)\System.Collections.Immutable.dll" /> <ReferencePath Include="$(AotPackageReferencePath)\System.Reflection.Metadata.dll" /> </ItemGroup> diff --git a/src/System.Private.Reflection.Execution/src/System.Private.Reflection.Execution.csproj b/src/System.Private.Reflection.Execution/src/System.Private.Reflection.Execution.csproj index 484fdb832..b7e021510 100644 --- a/src/System.Private.Reflection.Execution/src/System.Private.Reflection.Execution.csproj +++ b/src/System.Private.Reflection.Execution/src/System.Private.Reflection.Execution.csproj @@ -25,7 +25,7 @@ <ReferencePath Include="$(AotPackageReferencePath)\System.Runtime.dll" /> <ReferencePath Include="$(AotPackageReferencePath)\System.Runtime.Extensions.dll" Condition="'$(IsProjectNLibrary)' == 'true'" /> - <ReferencePath Include="$(AotPackageReferencePath)\System.Resources.ResourceManager.dll" /> + <ReferencePath Include="$(AotPackageReferencePath)\System.Resources.ResourceManager.dll" Condition="'$(IsProjectNLibrary)' == 'true'" /> <ReferencePath Include="$(AotPackageReferencePath)\System.Reflection.dll" Condition="'$(IsProjectNLibrary)' == 'true'" /> </ItemGroup> diff --git a/src/System.Private.Reflection/src/System.Private.Reflection.csproj b/src/System.Private.Reflection/src/System.Private.Reflection.csproj index 37b95974d..645c7e84c 100644 --- a/src/System.Private.Reflection/src/System.Private.Reflection.csproj +++ b/src/System.Private.Reflection/src/System.Private.Reflection.csproj @@ -18,7 +18,7 @@ <ProjectReference Include="..\..\System.Private.CoreLib\src\System.Private.CoreLib.csproj" /> </ItemGroup> <PropertyGroup> - <SkipCommonResourcesIncludes>true</SkipCommonResourcesIncludes> + <SkipCommonResourcesIncludes Condition="'$(IsProjectNLibrary)' == 'true'">true</SkipCommonResourcesIncludes> </PropertyGroup> <ItemGroup> <Compile Include="Internal\Reflection\Augments\TypeForwarders.cs" /> diff --git a/src/System.Private.Threading/src/System.Private.Threading.csproj b/src/System.Private.Threading/src/System.Private.Threading.csproj index 4b13a1c41..a7ad6759f 100644 --- a/src/System.Private.Threading/src/System.Private.Threading.csproj +++ b/src/System.Private.Threading/src/System.Private.Threading.csproj @@ -23,7 +23,7 @@ <ReferencePath Include="$(AotPackageReferencePath)\System.Runtime.Extensions.dll" /> <ReferencePath Include="$(AotPackageReferencePath)\System.Diagnostics.Tracing.dll" /> <ReferencePath Include="$(AotPackageReferencePath)\System.Collections.dll" /> - <ReferencePath Include="$(AotPackageReferencePath)\System.Resources.ResourceManager.dll" /> + <ReferencePath Include="$(AotPackageReferencePath)\System.Resources.ResourceManager.dll" Condition="'$(IsProjectNLibrary)' == 'true'" /> </ItemGroup> <ItemGroup> <Compile Include="Internal\Threading\SpinLockTraceCallbacksImplementation.cs" /> diff --git a/src/System.Private.TypeLoader/src/System.Private.TypeLoader.csproj b/src/System.Private.TypeLoader/src/System.Private.TypeLoader.csproj index 67f777405..d1c371050 100644 --- a/src/System.Private.TypeLoader/src/System.Private.TypeLoader.csproj +++ b/src/System.Private.TypeLoader/src/System.Private.TypeLoader.csproj @@ -23,7 +23,7 @@ </ProjectReference> <ReferencePath Include="$(AotPackageReferencePath)\System.Runtime.dll" /> <ReferencePath Include="$(AotPackageReferencePath)\System.Runtime.Extensions.dll" /> - <ReferencePath Include="$(AotPackageReferencePath)\System.Resources.ResourceManager.dll" /> + <ReferencePath Include="$(AotPackageReferencePath)\System.Resources.ResourceManager.dll" Condition="'$(IsProjectNLibrary)' == 'true'" /> <ReferencePath Include="$(AotPackageReferencePath)\System.Collections.dll" /> <ReferencePath Include="$(AotPackageReferencePath)\System.Collections.Immutable.dll" /> <ReferencePath Include="$(AotPackageReferencePath)\System.Reflection.Metadata.dll" /> |