Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,16 @@ namespace System.Resources
// default file format.
//

internal struct ResourceLocator
internal readonly struct ResourceLocator
{
internal object? _value; // Can be null.
internal int _dataPos;

internal ResourceLocator(int dataPos, object? value)
{
_dataPos = dataPos;
_value = value;
DataPosition = dataPos;
Value = value;
}

internal int DataPosition => _dataPos;

// Allows adding in profiling data in a future version, or a special
// resource profiling build. We could also use WeakReference.
internal object? Value
{
get => _value;
set => _value = value;
}
internal int DataPosition { get; }
internal object? Value { get; }

internal static bool CanCache(ResourceTypeCode value)
{
Expand Down Expand Up @@ -800,8 +790,12 @@ private void _ReadResources()
// Read RuntimeResourceSet header
// Do file version check
int version = _store.ReadInt32();
if (version != RuntimeResourceSet.Version && version != 1)
throw new ArgumentException(SR.Format(SR.Arg_ResourceFileUnsupportedVersion, RuntimeResourceSet.Version, version));

// File format version number
const int CurrentVersion = 2;

if (version != CurrentVersion && version != 1)
throw new ArgumentException(SR.Format(SR.Arg_ResourceFileUnsupportedVersion, CurrentVersion, version));
_version = version;

_numResources = _store.ReadInt32();
Expand Down
Loading