summaryrefslogtreecommitdiff
path: root/src/mscorlib/shared/System/Resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/shared/System/Resources')
-rw-r--r--src/mscorlib/shared/System/Resources/IResourceReader.cs30
-rw-r--r--src/mscorlib/shared/System/Resources/MissingManifestResourceException.cs36
-rw-r--r--src/mscorlib/shared/System/Resources/MissingSatelliteAssemblyException.cs63
-rw-r--r--src/mscorlib/shared/System/Resources/NeutralResourcesLanguageAttribute.cs33
-rw-r--r--src/mscorlib/shared/System/Resources/ResourceTypeCode.cs58
-rw-r--r--src/mscorlib/shared/System/Resources/SatelliteContractVersionAttribute.cs31
-rw-r--r--src/mscorlib/shared/System/Resources/UltimateResourceFallbackLocation.cs25
7 files changed, 276 insertions, 0 deletions
diff --git a/src/mscorlib/shared/System/Resources/IResourceReader.cs b/src/mscorlib/shared/System/Resources/IResourceReader.cs
new file mode 100644
index 0000000000..543a5a67de
--- /dev/null
+++ b/src/mscorlib/shared/System/Resources/IResourceReader.cs
@@ -0,0 +1,30 @@
+// 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.
+
+/*============================================================
+**
+**
+**
+**
+**
+** Purpose: Abstraction to read streams of resources.
+**
+**
+===========================================================*/
+
+using System;
+using System.Collections;
+
+namespace System.Resources
+{
+ public interface IResourceReader : IEnumerable, IDisposable
+ {
+ // Interface does not need to be marked with the serializable attribute
+ // Closes the ResourceReader, releasing any resources associated with it.
+ // This could close a network connection, a file, or do nothing.
+ void Close();
+
+ new IDictionaryEnumerator GetEnumerator();
+ }
+}
diff --git a/src/mscorlib/shared/System/Resources/MissingManifestResourceException.cs b/src/mscorlib/shared/System/Resources/MissingManifestResourceException.cs
new file mode 100644
index 0000000000..70f41f4d9e
--- /dev/null
+++ b/src/mscorlib/shared/System/Resources/MissingManifestResourceException.cs
@@ -0,0 +1,36 @@
+// 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;
+using System.Runtime.Serialization;
+
+namespace System.Resources
+{
+ [Serializable]
+ public class MissingManifestResourceException : SystemException
+ {
+ public MissingManifestResourceException()
+ : base(SR.Arg_MissingManifestResourceException)
+ {
+ HResult = System.__HResults.COR_E_MISSINGMANIFESTRESOURCE;
+ }
+
+ public MissingManifestResourceException(string message)
+ : base(message)
+ {
+ HResult = System.__HResults.COR_E_MISSINGMANIFESTRESOURCE;
+ }
+
+ public MissingManifestResourceException(string message, Exception inner)
+ : base(message, inner)
+ {
+ HResult = System.__HResults.COR_E_MISSINGMANIFESTRESOURCE;
+ }
+
+ protected MissingManifestResourceException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
+}
diff --git a/src/mscorlib/shared/System/Resources/MissingSatelliteAssemblyException.cs b/src/mscorlib/shared/System/Resources/MissingSatelliteAssemblyException.cs
new file mode 100644
index 0000000000..b343e0cfbc
--- /dev/null
+++ b/src/mscorlib/shared/System/Resources/MissingSatelliteAssemblyException.cs
@@ -0,0 +1,63 @@
+// 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.
+
+/*============================================================
+**
+**
+**
+**
+**
+** Purpose: Exception for a missing satellite assembly needed
+** for ultimate resource fallback. This usually
+** indicates a setup and/or deployment problem.
+**
+**
+===========================================================*/
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Resources
+{
+ [Serializable]
+ public class MissingSatelliteAssemblyException : SystemException
+ {
+ private String _cultureName;
+
+ public MissingSatelliteAssemblyException()
+ : base(SR.MissingSatelliteAssembly_Default)
+ {
+ HResult = System.__HResults.COR_E_MISSINGSATELLITEASSEMBLY;
+ }
+
+ public MissingSatelliteAssemblyException(string message)
+ : base(message)
+ {
+ HResult = System.__HResults.COR_E_MISSINGSATELLITEASSEMBLY;
+ }
+
+ public MissingSatelliteAssemblyException(string message, String cultureName)
+ : base(message)
+ {
+ HResult = System.__HResults.COR_E_MISSINGSATELLITEASSEMBLY;
+ _cultureName = cultureName;
+ }
+
+ public MissingSatelliteAssemblyException(string message, Exception inner)
+ : base(message, inner)
+ {
+ HResult = System.__HResults.COR_E_MISSINGSATELLITEASSEMBLY;
+ }
+
+ protected MissingSatelliteAssemblyException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+
+ public String CultureName
+ {
+ get { return _cultureName; }
+ }
+ }
+}
diff --git a/src/mscorlib/shared/System/Resources/NeutralResourcesLanguageAttribute.cs b/src/mscorlib/shared/System/Resources/NeutralResourcesLanguageAttribute.cs
new file mode 100644
index 0000000000..495c5205b2
--- /dev/null
+++ b/src/mscorlib/shared/System/Resources/NeutralResourcesLanguageAttribute.cs
@@ -0,0 +1,33 @@
+// 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.
+
+namespace System.Resources
+{
+ [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
+ public sealed class NeutralResourcesLanguageAttribute : Attribute
+ {
+ public NeutralResourcesLanguageAttribute(string cultureName)
+ {
+ if (cultureName == null)
+ throw new ArgumentNullException(nameof(cultureName));
+
+ CultureName = cultureName;
+ Location = UltimateResourceFallbackLocation.MainAssembly;
+ }
+
+ public NeutralResourcesLanguageAttribute(string cultureName, UltimateResourceFallbackLocation location)
+ {
+ if (cultureName == null)
+ throw new ArgumentNullException(nameof(cultureName));
+ if (!Enum.IsDefined(typeof(UltimateResourceFallbackLocation), location))
+ throw new ArgumentException(SR.Format(SR.Arg_InvalidNeutralResourcesLanguage_FallbackLoc, location));
+
+ CultureName = cultureName;
+ Location = location;
+ }
+
+ public string CultureName { get; }
+ public UltimateResourceFallbackLocation Location { get; }
+ }
+}
diff --git a/src/mscorlib/shared/System/Resources/ResourceTypeCode.cs b/src/mscorlib/shared/System/Resources/ResourceTypeCode.cs
new file mode 100644
index 0000000000..b0ceb61df4
--- /dev/null
+++ b/src/mscorlib/shared/System/Resources/ResourceTypeCode.cs
@@ -0,0 +1,58 @@
+// 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.
+
+/*============================================================
+**
+**
+**
+**
+**
+** Purpose: Marker for types in .resources files
+**
+**
+===========================================================*/
+
+namespace System.Resources
+{
+ /* An internal implementation detail for .resources files, describing
+ what type an object is.
+ Ranges:
+ 0 - 0x1F Primitives and reserved values
+ 0x20 - 0x3F Specially recognized types, like byte[] and Streams
+
+ Note this data must be included in any documentation describing the
+ internals of .resources files.
+ */
+ internal enum ResourceTypeCode
+ {
+ // Primitives
+ Null = 0,
+ String = 1,
+ Boolean = 2,
+ Char = 3,
+ Byte = 4,
+ SByte = 5,
+ Int16 = 6,
+ UInt16 = 7,
+ Int32 = 8,
+ UInt32 = 9,
+ Int64 = 0xa,
+ UInt64 = 0xb,
+ Single = 0xc,
+ Double = 0xd,
+ Decimal = 0xe,
+ DateTime = 0xf,
+ TimeSpan = 0x10,
+
+ // A meta-value - change this if you add new primitives
+ LastPrimitive = TimeSpan,
+
+ // Types with a special representation, like byte[] and Stream
+ ByteArray = 0x20,
+ Stream = 0x21,
+
+ // User types - serialized using the binary formatter.
+ StartOfUserTypes = 0x40
+ }
+}
diff --git a/src/mscorlib/shared/System/Resources/SatelliteContractVersionAttribute.cs b/src/mscorlib/shared/System/Resources/SatelliteContractVersionAttribute.cs
new file mode 100644
index 0000000000..0707447677
--- /dev/null
+++ b/src/mscorlib/shared/System/Resources/SatelliteContractVersionAttribute.cs
@@ -0,0 +1,31 @@
+// 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.
+
+/*============================================================
+**
+**
+**
+**
+**
+** Purpose: Specifies which version of a satellite assembly
+** the ResourceManager should ask for.
+**
+**
+===========================================================*/
+
+namespace System.Resources
+{
+ [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
+ public sealed class SatelliteContractVersionAttribute : Attribute
+ {
+ public SatelliteContractVersionAttribute(String version)
+ {
+ if (version == null)
+ throw new ArgumentNullException(nameof(version));
+ Version = version;
+ }
+
+ public String Version { get; }
+ }
+}
diff --git a/src/mscorlib/shared/System/Resources/UltimateResourceFallbackLocation.cs b/src/mscorlib/shared/System/Resources/UltimateResourceFallbackLocation.cs
new file mode 100644
index 0000000000..83640ec9fe
--- /dev/null
+++ b/src/mscorlib/shared/System/Resources/UltimateResourceFallbackLocation.cs
@@ -0,0 +1,25 @@
+// 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.
+
+/*============================================================
+**
+**
+**
+**
+** Purpose: Tells the ResourceManager where to find the
+** ultimate fallback resources for your assembly.
+**
+**
+===========================================================*/
+
+using System;
+
+namespace System.Resources
+{
+ public enum UltimateResourceFallbackLocation
+ {
+ MainAssembly,
+ Satellite
+ }
+}