Skip to content

Commit 895e9e3

Browse files
committed
move strings to resx
1 parent 6f6fb74 commit 895e9e3

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/libraries/System.IO.Compression.ZStandard/src/Resources/Strings.resx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,13 @@
9090
<data name="ZStandardStream_ConcurrentRWOperation" xml:space="preserve">
9191
<value>Only one pending read/write operation is supported.</value>
9292
</data>
93+
<data name="ZStandardDictionary_EmptyBuffer" xml:space="preserve">
94+
<value>Buffer cannot be empty.</value>
95+
</data>
96+
<data name="ZStandardDictionary_CreateCompressionFailed" xml:space="preserve">
97+
<value>Failed to create ZStandard compression dictionary.</value>
98+
</data>
99+
<data name="ZStandardDictionary_CreateDecompressionFailed" xml:space="preserve">
100+
<value>Failed to create ZStandard decompression dictionary.</value>
101+
</data>
93102
</root>

src/libraries/System.IO.Compression.ZStandard/src/System/IO/Compression/ZstandardDictionary.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private ZStandardDictionary(SafeZStdCDictHandle? compressionDict, SafeZStdDDictH
2828
public static ZStandardDictionary Create(ReadOnlyMemory<byte> buffer)
2929
{
3030
if (buffer.IsEmpty)
31-
throw new ArgumentException("Buffer cannot be empty.", nameof(buffer));
31+
throw new ArgumentException(SR.ZStandardDictionary_EmptyBuffer, nameof(buffer));
3232

3333
byte[] dictionaryData = buffer.ToArray();
3434

@@ -41,7 +41,7 @@ public static ZStandardDictionary Create(ReadOnlyMemory<byte> buffer)
4141
// Create only decompression dictionary since no quality level is specified
4242
SafeZStdDDictHandle decompressionDict = Interop.Zstd.ZSTD_createDDict(dictData, (nuint)dictionaryData.Length);
4343
if (decompressionDict.IsInvalid)
44-
throw new InvalidOperationException("Failed to create ZStandard decompression dictionary.");
44+
throw new InvalidOperationException(SR.ZStandardDictionary_CreateDecompressionFailed);
4545

4646
return new ZStandardDictionary(null, decompressionDict, dictionaryData);
4747
}
@@ -56,7 +56,7 @@ public static ZStandardDictionary Create(ReadOnlyMemory<byte> buffer)
5656
public static ZStandardDictionary Create(ReadOnlyMemory<byte> buffer, int quality)
5757
{
5858
if (buffer.IsEmpty)
59-
throw new ArgumentException("Buffer cannot be empty.", nameof(buffer));
59+
throw new ArgumentException(SR.ZStandardDictionary_EmptyBuffer, nameof(buffer));
6060

6161
byte[] dictionaryData = buffer.ToArray();
6262

@@ -69,14 +69,14 @@ public static ZStandardDictionary Create(ReadOnlyMemory<byte> buffer, int qualit
6969
// Create both compression and decompression dictionaries
7070
SafeZStdCDictHandle compressionDict = Interop.Zstd.ZSTD_createCDict(dictData, (nuint)dictionaryData.Length, quality);
7171
if (compressionDict.IsInvalid)
72-
throw new InvalidOperationException("Failed to create ZStandard compression dictionary.");
72+
throw new InvalidOperationException(SR.ZStandardDictionary_CreateCompressionFailed);
7373
compressionDict.Quality = quality;
7474

7575
SafeZStdDDictHandle decompressionDict = Interop.Zstd.ZSTD_createDDict(dictData, (nuint)dictionaryData.Length);
7676
if (decompressionDict.IsInvalid)
7777
{
7878
compressionDict.Dispose();
79-
throw new InvalidOperationException("Failed to create ZStandard decompression dictionary.");
79+
throw new InvalidOperationException(SR.ZStandardDictionary_CreateDecompressionFailed);
8080
}
8181

8282
return new ZStandardDictionary(compressionDict, decompressionDict, dictionaryData);

0 commit comments

Comments
 (0)