3 // Copyright (c) Microsoft Corporation. All rights reserved.
7 namespace System.Globalization {
9 using System.Reflection;
10 using System.Collections;
11 using System.Collections.Generic;
12 using System.Threading;
13 using System.Security;
14 using System.Security.Principal;
15 using System.Security.Permissions;
16 using System.Runtime.CompilerServices;
17 using System.Runtime.ConstrainedExecution;
18 using System.Runtime.Versioning;
20 using System.Diagnostics.Contracts;
23 /*=================================GlobalizationAssembly==========================
25 ** This class provides the table loading wrapper that calls GetManifestResourceStream
27 ** It used to provide an idea for sort versioning, but that proved to not work
29 ============================================================================*/
30 internal sealed class GlobalizationAssembly
32 // ----------------------------------------------------------------------------------------------------
34 // Instance data members and instance methods.
36 // ----------------------------------------------------------------------------------------------------
37 [System.Security.SecurityCritical] // auto-generated
38 [ResourceExposure(ResourceScope.Process)]
39 [ResourceConsumption(ResourceScope.Machine, ResourceScope.Process)]
40 internal unsafe static byte* GetGlobalizationResourceBytePtr(Assembly assembly, String tableName) {
41 Contract.Assert(assembly != null, "assembly can not be null. This should be generally the mscorlib.dll assembly.");
42 Contract.Assert(tableName != null, "table name can not be null");
44 Stream stream = assembly.GetManifestResourceStream(tableName);
45 UnmanagedMemoryStream bytesStream = stream as UnmanagedMemoryStream;
46 if (bytesStream != null) {
47 byte* bytes = bytesStream.PositionPointer;
56 CultureInfo.CurrentCulture,
57 "Didn't get the resource table {0} for System.Globalization from {1}",
61 // We can not continue if we can't get the resource.
62 throw new InvalidOperationException();