Move all localizable strings from Aaru.Checksums project to resources.

This commit is contained in:
2022-11-23 20:55:47 +00:00
parent aa5bbc1f5b
commit 76f21d10a5
6 changed files with 365 additions and 42 deletions

View File

@@ -50,6 +50,11 @@
<Compile Include="CRC32\arm_simd.cs"/>
<Compile Include="CRC32\clmul.cs"/>
<Compile Include="CRC64\clmul.cs"/>
<Compile Include="Localization\Localization.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Localization.resx</DependentUpon>
</Compile>
<Compile Include="Native.cs"/>
<Compile Include="Register.cs"/>
<Compile Include="SpamSumContext.cs"/>
@@ -78,6 +83,10 @@
<EmbeddedResource Include="..\LICENSE">
<Link>LICENSE</Link>
</EmbeddedResource>
<EmbeddedResource Update="Localization\Localization.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Localization.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Aaru.Checksums.Native" Version="6.0.0-alpha6"/>

View File

@@ -508,36 +508,36 @@ public static class CdChecksums
switch(cdSubRwPack1[0])
{
case 0x00:
AaruConsole.DebugWriteLine("CD checksums", "Detected Zero Pack in subchannel");
AaruConsole.DebugWriteLine("CD checksums", Localization.Detected_Zero_Pack_in_subchannel);
break;
case 0x08:
AaruConsole.DebugWriteLine("CD checksums", "Detected Line Graphics Pack in subchannel");
AaruConsole.DebugWriteLine("CD checksums", Localization.Detected_Line_Graphics_Pack_in_subchannel);
break;
case 0x09:
AaruConsole.DebugWriteLine("CD checksums", "Detected CD+G Pack in subchannel");
AaruConsole.DebugWriteLine("CD checksums", Localization.Detected_CD_G_Pack_in_subchannel);
break;
case 0x0A:
AaruConsole.DebugWriteLine("CD checksums", "Detected CD+EG Pack in subchannel");
AaruConsole.DebugWriteLine("CD checksums", Localization.Detected_CD_EG_Pack_in_subchannel);
break;
case 0x14:
AaruConsole.DebugWriteLine("CD checksums", "Detected CD-TEXT Pack in subchannel");
AaruConsole.DebugWriteLine("CD checksums", Localization.Detected_CD_TEXT_Pack_in_subchannel);
break;
case 0x18:
AaruConsole.DebugWriteLine("CD checksums", "Detected CD+MIDI Pack in subchannel");
AaruConsole.DebugWriteLine("CD checksums", Localization.Detected_CD_MIDI_Pack_in_subchannel);
break;
case 0x38:
AaruConsole.DebugWriteLine("CD checksums", "Detected User Pack in subchannel");
AaruConsole.DebugWriteLine("CD checksums", Localization.Detected_User_Pack_in_subchannel);
break;
default:
AaruConsole.DebugWriteLine("CD checksums",
"Detected unknown Pack type in subchannel: mode {0}, item {1}",
Localization.Detected_unknown_Pack_type_in_subchannel_mode_0_item_1,
Convert.ToString(cdSubRwPack1[0] & 0x38, 2),
Convert.ToString(cdSubRwPack1[0] & 0x07, 2));
@@ -551,7 +551,7 @@ public static class CdChecksums
if(qSubChannelCrc != calculatedQcrc)
{
AaruConsole.DebugWriteLine("CD checksums", "Q subchannel CRC 0x{0:X4}, expected 0x{1:X4}", calculatedQcrc,
AaruConsole.DebugWriteLine("CD checksums", Localization.Q_subchannel_CRC_0_expected_1, calculatedQcrc,
qSubChannelCrc);
status = false;
@@ -567,7 +567,7 @@ public static class CdChecksums
if(cdTextPack1Crc != calculatedCdtp1Crc &&
cdTextPack1Crc != 0)
{
AaruConsole.DebugWriteLine("CD checksums", "CD-Text Pack 1 CRC 0x{0:X4}, expected 0x{1:X4}",
AaruConsole.DebugWriteLine("CD checksums", Localization.CD_Text_Pack_one_CRC_0_expected_1,
cdTextPack1Crc, calculatedCdtp1Crc);
status = false;
@@ -581,13 +581,13 @@ public static class CdChecksums
Array.Copy(cdTextPack2, 0, cdTextPack2ForCrc, 0, 16);
ushort calculatedCdtp2Crc = CRC16CCITTContext.Calculate(cdTextPack2ForCrc);
AaruConsole.DebugWriteLine("CD checksums", "Cyclic CDTP2 0x{0:X4}, Calc CDTP2 0x{1:X4}", cdTextPack2Crc,
AaruConsole.DebugWriteLine("CD checksums", Localization.Cyclic_CDTP2_0_Calc_CDTP2_1, cdTextPack2Crc,
calculatedCdtp2Crc);
if(cdTextPack2Crc != calculatedCdtp2Crc &&
cdTextPack2Crc != 0)
{
AaruConsole.DebugWriteLine("CD checksums", "CD-Text Pack 2 CRC 0x{0:X4}, expected 0x{1:X4}",
AaruConsole.DebugWriteLine("CD checksums", Localization.CD_Text_Pack_two_CRC_0_expected_1,
cdTextPack2Crc, calculatedCdtp2Crc);
status = false;
@@ -601,13 +601,13 @@ public static class CdChecksums
Array.Copy(cdTextPack3, 0, cdTextPack3ForCrc, 0, 16);
ushort calculatedCdtp3Crc = CRC16CCITTContext.Calculate(cdTextPack3ForCrc);
AaruConsole.DebugWriteLine("CD checksums", "Cyclic CDTP3 0x{0:X4}, Calc CDTP3 0x{1:X4}", cdTextPack3Crc,
AaruConsole.DebugWriteLine("CD checksums", Localization.Cyclic_CDTP3_0_Calc_CDTP3_1, cdTextPack3Crc,
calculatedCdtp3Crc);
if(cdTextPack3Crc != calculatedCdtp3Crc &&
cdTextPack3Crc != 0)
{
AaruConsole.DebugWriteLine("CD checksums", "CD-Text Pack 3 CRC 0x{0:X4}, expected 0x{1:X4}",
AaruConsole.DebugWriteLine("CD checksums", Localization.CD_Text_Pack_three_CRC_0_expected_1,
cdTextPack3Crc, calculatedCdtp3Crc);
status = false;
@@ -622,14 +622,14 @@ public static class CdChecksums
Array.Copy(cdTextPack4, 0, cdTextPack4ForCrc, 0, 16);
ushort calculatedCdtp4Crc = CRC16CCITTContext.Calculate(cdTextPack4ForCrc);
AaruConsole.DebugWriteLine("CD checksums", "Cyclic CDTP4 0x{0:X4}, Calc CDTP4 0x{1:X4}", cdTextPack4Crc,
AaruConsole.DebugWriteLine("CD checksums", Localization.Cyclic_CDTP4_0_Calc_CDTP4_1, cdTextPack4Crc,
calculatedCdtp4Crc);
if(cdTextPack4Crc == calculatedCdtp4Crc ||
cdTextPack4Crc == 0)
return status;
AaruConsole.DebugWriteLine("CD checksums", "CD-Text Pack 4 CRC 0x{0:X4}, expected 0x{1:X4}", cdTextPack4Crc,
AaruConsole.DebugWriteLine("CD checksums", Localization.CD_Text_Pack_four_CRC_0_expected_1, cdTextPack4Crc,
calculatedCdtp4Crc);
return false;

204
Localization/Localization.Designer.cs generated Normal file
View File

@@ -0,0 +1,204 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Aaru.Checksums {
using System;
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Localization {
private static System.Resources.ResourceManager resourceMan;
private static System.Globalization.CultureInfo resourceCulture;
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Localization() {
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
internal static System.Resources.ResourceManager ResourceManager {
get {
if (object.Equals(null, resourceMan)) {
System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Aaru.Checksums.Localization.Localization", typeof(Localization).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
internal static System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
internal static string Detected_Zero_Pack_in_subchannel {
get {
return ResourceManager.GetString("Detected_Zero_Pack_in_subchannel", resourceCulture);
}
}
internal static string Detected_Line_Graphics_Pack_in_subchannel {
get {
return ResourceManager.GetString("Detected_Line_Graphics_Pack_in_subchannel", resourceCulture);
}
}
internal static string Detected_CD_G_Pack_in_subchannel {
get {
return ResourceManager.GetString("Detected_CD_G_Pack_in_subchannel", resourceCulture);
}
}
internal static string Detected_CD_EG_Pack_in_subchannel {
get {
return ResourceManager.GetString("Detected_CD_EG_Pack_in_subchannel", resourceCulture);
}
}
internal static string Detected_CD_TEXT_Pack_in_subchannel {
get {
return ResourceManager.GetString("Detected_CD_TEXT_Pack_in_subchannel", resourceCulture);
}
}
internal static string Detected_CD_MIDI_Pack_in_subchannel {
get {
return ResourceManager.GetString("Detected_CD_MIDI_Pack_in_subchannel", resourceCulture);
}
}
internal static string Detected_User_Pack_in_subchannel {
get {
return ResourceManager.GetString("Detected_User_Pack_in_subchannel", resourceCulture);
}
}
internal static string Detected_unknown_Pack_type_in_subchannel_mode_0_item_1 {
get {
return ResourceManager.GetString("Detected_unknown_Pack_type_in_subchannel_mode_0_item_1", resourceCulture);
}
}
internal static string Q_subchannel_CRC_0_expected_1 {
get {
return ResourceManager.GetString("Q_subchannel_CRC_0_expected_1", resourceCulture);
}
}
internal static string CD_Text_Pack_one_CRC_0_expected_1 {
get {
return ResourceManager.GetString("CD_Text_Pack_one_CRC_0_expected_1", resourceCulture);
}
}
internal static string Cyclic_CDTP2_0_Calc_CDTP2_1 {
get {
return ResourceManager.GetString("Cyclic_CDTP2_0_Calc_CDTP2_1", resourceCulture);
}
}
internal static string CD_Text_Pack_two_CRC_0_expected_1 {
get {
return ResourceManager.GetString("CD_Text_Pack_two_CRC_0_expected_1", resourceCulture);
}
}
internal static string Cyclic_CDTP3_0_Calc_CDTP3_1 {
get {
return ResourceManager.GetString("Cyclic_CDTP3_0_Calc_CDTP3_1", resourceCulture);
}
}
internal static string CD_Text_Pack_three_CRC_0_expected_1 {
get {
return ResourceManager.GetString("CD_Text_Pack_three_CRC_0_expected_1", resourceCulture);
}
}
internal static string Cyclic_CDTP4_0_Calc_CDTP4_1 {
get {
return ResourceManager.GetString("Cyclic_CDTP4_0_Calc_CDTP4_1", resourceCulture);
}
}
internal static string CD_Text_Pack_four_CRC_0_expected_1 {
get {
return ResourceManager.GetString("CD_Text_Pack_four_CRC_0_expected_1", resourceCulture);
}
}
internal static string m_must_be_between_2_and_16_inclusive {
get {
return ResourceManager.GetString("m_must_be_between_2_and_16_inclusive", resourceCulture);
}
}
internal static string Trying_to_calculate_RS_without_initializing {
get {
return ResourceManager.GetString("Trying_to_calculate_RS_without_initializing", resourceCulture);
}
}
internal static string lambda_is_wrong {
get {
return ResourceManager.GetString("lambda_is_wrong", resourceCulture);
}
}
internal static string Erasure_positions_as_determined_by_roots_of_Eras_Loc_Poly {
get {
return ResourceManager.GetString("Erasure_positions_as_determined_by_roots_of_Eras_Loc_Poly", resourceCulture);
}
}
internal static string Final_error_positions {
get {
return ResourceManager.GetString("Final_error_positions", resourceCulture);
}
}
internal static string ERROR_denominator_equals_zero {
get {
return ResourceManager.GetString("ERROR_denominator_equals_zero", resourceCulture);
}
}
internal static string SpamSum_does_not_have_a_binary_representation {
get {
return ResourceManager.GetString("SpamSum_does_not_have_a_binary_representation", resourceCulture);
}
}
internal static string Assertion_failed {
get {
return ResourceManager.GetString("Assertion_failed", resourceCulture);
}
}
internal static string The_input_exceeds_data_types {
get {
return ResourceManager.GetString("The_input_exceeds_data_types", resourceCulture);
}
}
internal static string Not_yet_implemented {
get {
return ResourceManager.GetString("Not_yet_implemented", resourceCulture);
}
}
}
}

View File

@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8" ?>
<root>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"
xmlns="">
<xsd:element name="root" msdata:IsDataSet="true"></xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<data name="Detected_Zero_Pack_in_subchannel" xml:space="preserve">
<value>Detected Zero Pack in subchannel</value>
</data>
<data name="Detected_Line_Graphics_Pack_in_subchannel" xml:space="preserve">
<value>Detected Line Graphics Pack in subchannel</value>
</data>
<data name="Detected_CD_G_Pack_in_subchannel" xml:space="preserve">
<value>Detected CD+G Pack in subchannel</value>
</data>
<data name="Detected_CD_EG_Pack_in_subchannel" xml:space="preserve">
<value>Detected CD+EG Pack in subchannel</value>
</data>
<data name="Detected_CD_TEXT_Pack_in_subchannel" xml:space="preserve">
<value>Detected CD-TEXT Pack in subchannel</value>
</data>
<data name="Detected_CD_MIDI_Pack_in_subchannel" xml:space="preserve">
<value>Detected CD+MIDI Pack in subchannel</value>
</data>
<data name="Detected_User_Pack_in_subchannel" xml:space="preserve">
<value>Detected User Pack in subchannel</value>
</data>
<data name="Detected_unknown_Pack_type_in_subchannel_mode_0_item_1" xml:space="preserve">
<value>Detected unknown Pack type in subchannel: mode {0}, item {1}</value>
</data>
<data name="Q_subchannel_CRC_0_expected_1" xml:space="preserve">
<value>Q subchannel CRC 0x{0:X4}, expected 0x{1:X4}</value>
</data>
<data name="CD_Text_Pack_one_CRC_0_expected_1" xml:space="preserve">
<value>CD-Text Pack 1 CRC 0x{0:X4}, expected 0x{1:X4}</value>
</data>
<data name="Cyclic_CDTP2_0_Calc_CDTP2_1" xml:space="preserve">
<value>Cyclic CDTP2 0x{0:X4}, Calc CDTP2 0x{1:X4}</value>
</data>
<data name="CD_Text_Pack_two_CRC_0_expected_1" xml:space="preserve">
<value>CD-Text Pack 2 CRC 0x{0:X4}, expected 0x{1:X4}</value>
</data>
<data name="Cyclic_CDTP3_0_Calc_CDTP3_1" xml:space="preserve">
<value>Cyclic CDTP3 0x{0:X4}, Calc CDTP3 0x{1:X4}</value>
</data>
<data name="CD_Text_Pack_three_CRC_0_expected_1" xml:space="preserve">
<value>CD-Text Pack 3 CRC 0x{0:X4}, expected 0x{1:X4}</value>
</data>
<data name="Cyclic_CDTP4_0_Calc_CDTP4_1" xml:space="preserve">
<value>Cyclic CDTP4 0x{0:X4}, Calc CDTP4 0x{1:X4}</value>
</data>
<data name="CD_Text_Pack_four_CRC_0_expected_1" xml:space="preserve">
<value>CD-Text Pack 4 CRC 0x{0:X4}, expected 0x{1:X4}</value>
</data>
<data name="m_must_be_between_2_and_16_inclusive" xml:space="preserve">
<value>m must be between 2 and 16 inclusive</value>
</data>
<data name="Trying_to_calculate_RS_without_initializing" xml:space="preserve">
<value>Trying to calculate RS without initializing!</value>
</data>
<data name="lambda_is_wrong" xml:space="preserve">
<value>
lambda(x) is WRONG
</value>
</data>
<data name="Erasure_positions_as_determined_by_roots_of_Eras_Loc_Poly" xml:space="preserve">
<value>
Erasure positions as determined by roots of Eras Loc Poly:
</value>
</data>
<data name="Final_error_positions" xml:space="preserve">
<value>
Final error positions: </value>
</data>
<data name="ERROR_denominator_equals_zero" xml:space="preserve">
<value>
ERROR: denominator = 0
</value>
</data>
<data name="SpamSum_does_not_have_a_binary_representation" xml:space="preserve">
<value>SpamSum does not have a binary representation.</value>
</data>
<data name="Assertion_failed" xml:space="preserve">
<value>Assertion failed</value>
</data>
<data name="The_input_exceeds_data_types" xml:space="preserve">
<value>The input exceeds data types.</value>
</data>
<data name="Not_yet_implemented" xml:space="preserve">
<value>Not yet implemented.</value>
</data>
</root>

View File

@@ -148,7 +148,7 @@ public class ReedSolomon
{
1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1
},
_ => throw new ArgumentOutOfRangeException(nameof(m), "m must be between 2 and 16 inclusive")
_ => throw new ArgumentOutOfRangeException(nameof(m), Localization.m_must_be_between_2_and_16_inclusive)
};
_mm = m;
@@ -332,7 +332,7 @@ public class ReedSolomon
public int encode_rs(int[] data, out int[] bb)
{
if(!_initialized)
throw new UnauthorizedAccessException("Trying to calculate RS without initializing!");
throw new UnauthorizedAccessException(Localization.Trying_to_calculate_RS_without_initializing);
int i;
bb = new int[_nn - _kk];
@@ -393,7 +393,7 @@ public class ReedSolomon
public int eras_dec_rs(ref int[] data, out int[] erasPos, int noEras)
{
if(!_initialized)
throw new UnauthorizedAccessException("Trying to calculate RS without initializing!");
throw new UnauthorizedAccessException(Localization.Trying_to_calculate_RS_without_initializing);
erasPos = new int[_nn - _kk];
int i, j;
@@ -494,13 +494,13 @@ public class ReedSolomon
if(count != noEras)
{
AaruConsole.DebugWriteLine("Reed Solomon", "\n lambda(x) is WRONG\n");
AaruConsole.DebugWriteLine("Reed Solomon", Localization.lambda_is_wrong);
return -1;
}
AaruConsole.DebugWriteLine("Reed Solomon",
"\n Erasure positions as determined by roots of Eras Loc Poly:\n");
Localization.Erasure_positions_as_determined_by_roots_of_Eras_Loc_Poly);
for(i = 0; i < count; i++)
AaruConsole.DebugWriteLine("Reed Solomon", "{0} ", loc[i]);
@@ -612,7 +612,7 @@ public class ReedSolomon
}
#if DEBUG
AaruConsole.DebugWriteLine("Reed Solomon", "\n Final error positions:\t");
AaruConsole.DebugWriteLine("Reed Solomon", Localization.Final_error_positions);
for(i = 0; i < count; i++)
AaruConsole.DebugWriteLine("Reed Solomon", "{0} ", loc[i]);
@@ -669,7 +669,7 @@ public class ReedSolomon
if(den == 0)
{
AaruConsole.DebugWriteLine("Reed Solomon", "\n ERROR: denominator = 0\n");
AaruConsole.DebugWriteLine("Reed Solomon", Localization.ERROR_denominator_equals_zero);
return -1;
}

View File

@@ -110,7 +110,8 @@ public sealed class SpamSumContext : IChecksum
/// <inheritdoc />
/// <summary>Returns a byte array of the hash value.</summary>
public byte[] Final() => throw new NotImplementedException("SpamSum does not have a binary representation.");
public byte[] Final() =>
throw new NotImplementedException(Localization.SpamSum_does_not_have_a_binary_representation);
/// <inheritdoc />
/// <summary>Returns a base64 representation of the hash value.</summary>
@@ -174,7 +175,7 @@ public sealed class SpamSumContext : IChecksum
case >= NUM_BLOCKHASHES: return;
// assert
case 0: throw new Exception("Assertion failed");
case 0: throw new Exception(Localization.Assertion_failed);
}
uint obh = _self.Bhend - 1;
@@ -191,7 +192,7 @@ public sealed class SpamSumContext : IChecksum
void fuzzy_try_reduce_blockhash()
{
if(_self.Bhstart >= _self.Bhend)
throw new Exception("Assertion failed");
throw new Exception(Localization.Assertion_failed);
if(_self.Bhend - _self.Bhstart < 2)
/* Need at least two working hashes. */
@@ -279,7 +280,7 @@ public sealed class SpamSumContext : IChecksum
/* Verify that our elimination was not overeager. */
if(!(bi == 0 || (ulong)SSDEEP_BS(bi) / 2 * SPAMSUM_LENGTH < _self.TotalSize))
throw new Exception("Assertion failed");
throw new Exception(Localization.Assertion_failed);
/* Initial blocksize guess. */
while((ulong)SSDEEP_BS(bi) * SPAMSUM_LENGTH < _self.TotalSize)
@@ -287,7 +288,7 @@ public sealed class SpamSumContext : IChecksum
++bi;
if(bi >= NUM_BLOCKHASHES)
throw new OverflowException("The input exceeds data types.");
throw new OverflowException(Localization.The_input_exceeds_data_types);
}
/* Adapt blocksize guess to actual digest length. */
@@ -300,17 +301,17 @@ public sealed class SpamSumContext : IChecksum
if(bi > 0 &&
_self.Bh[bi].Dlen < SPAMSUM_LENGTH / 2)
throw new Exception("Assertion failed");
throw new Exception(Localization.Assertion_failed);
sb.AppendFormat("{0}:", SSDEEP_BS(bi));
int i = Encoding.ASCII.GetBytes(sb.ToString()).Length;
if(i <= 0)
/* Maybe snprintf has set errno here? */
throw new OverflowException("The input exceeds data types.");
throw new OverflowException(Localization.The_input_exceeds_data_types);
if(i >= remain)
throw new Exception("Assertion failed");
throw new Exception(Localization.Assertion_failed);
remain -= i;
@@ -321,7 +322,7 @@ public sealed class SpamSumContext : IChecksum
i = (int)_self.Bh[bi].Dlen;
if(i > remain)
throw new Exception("Assertion failed");
throw new Exception(Localization.Assertion_failed);
Array.Copy(_self.Bh[bi].Digest, 0, result, resultOff, i);
resultOff += i;
@@ -330,7 +331,7 @@ public sealed class SpamSumContext : IChecksum
if(h != 0)
{
if(remain <= 0)
throw new Exception("Assertion failed");
throw new Exception(Localization.Assertion_failed);
result[resultOff] = _b64[_self.Bh[bi].H % 64];
@@ -346,7 +347,7 @@ public sealed class SpamSumContext : IChecksum
else if(_self.Bh[bi].Digest[i] != 0)
{
if(remain <= 0)
throw new Exception("Assertion failed");
throw new Exception(Localization.Assertion_failed);
result[resultOff] = _self.Bh[bi].Digest[i];
@@ -361,7 +362,7 @@ public sealed class SpamSumContext : IChecksum
}
if(remain <= 0)
throw new Exception("Assertion failed");
throw new Exception(Localization.Assertion_failed);
result[resultOff++] = 0x3A; // ':'
--remain;
@@ -372,7 +373,7 @@ public sealed class SpamSumContext : IChecksum
i = (int)_self.Bh[bi].Dlen;
if(i > remain)
throw new Exception("Assertion failed");
throw new Exception(Localization.Assertion_failed);
Array.Copy(_self.Bh[bi].Digest, 0, result, resultOff, i);
resultOff += i;
@@ -381,7 +382,7 @@ public sealed class SpamSumContext : IChecksum
if(h != 0)
{
if(remain <= 0)
throw new Exception("Assertion failed");
throw new Exception(Localization.Assertion_failed);
h = _self.Bh[bi].Halfh;
result[resultOff] = _b64[h % 64];
@@ -402,7 +403,7 @@ public sealed class SpamSumContext : IChecksum
if(i != 0)
{
if(remain <= 0)
throw new Exception("Assertion failed");
throw new Exception(Localization.Assertion_failed);
result[resultOff] = (byte)i;
@@ -420,10 +421,10 @@ public sealed class SpamSumContext : IChecksum
else if(h != 0)
{
if(_self.Bh[bi].Dlen != 0)
throw new Exception("Assertion failed");
throw new Exception(Localization.Assertion_failed);
if(remain <= 0)
throw new Exception("Assertion failed");
throw new Exception(Localization.Assertion_failed);
result[resultOff++] = _b64[_self.Bh[bi].H % 64];
/* No need to bother with FUZZY_FLAG_ELIMSEQ, because this
@@ -437,13 +438,13 @@ public sealed class SpamSumContext : IChecksum
/// <summary>Gets the hash of a file</summary>
/// <param name="filename">File path.</param>
public static byte[] File(string filename) =>
throw new NotImplementedException("SpamSum does not have a binary representation.");
throw new NotImplementedException(Localization.SpamSum_does_not_have_a_binary_representation);
/// <summary>Gets the hash of a file in hexadecimal and as a byte array.</summary>
/// <param name="filename">File path.</param>
/// <param name="hash">Byte array of the hash value.</param>
public static string File(string filename, out byte[] hash) =>
throw new NotImplementedException("Not yet implemented.");
throw new NotImplementedException(Localization.Not_yet_implemented);
/// <summary>Gets the hash of the specified data buffer.</summary>
/// <param name="data">Data buffer.</param>