diff --git a/Aaru.Filters/Aaru.Filters.csproj b/Aaru.Filters/Aaru.Filters.csproj index 5c6778419..4fcc0662a 100644 --- a/Aaru.Filters/Aaru.Filters.csproj +++ b/Aaru.Filters/Aaru.Filters.csproj @@ -43,6 +43,12 @@ true + + + True + True + Localization.resx + @@ -61,6 +67,10 @@ LICENSE.LGPL + + ResXFileCodeGenerator + Localization.Designer.cs + diff --git a/Aaru.Filters/Aaru.Filters.csproj.DotSettings b/Aaru.Filters/Aaru.Filters.csproj.DotSettings new file mode 100644 index 000000000..68a94f578 --- /dev/null +++ b/Aaru.Filters/Aaru.Filters.csproj.DotSettings @@ -0,0 +1,5 @@ + + True \ No newline at end of file diff --git a/Aaru.Filters/AppleDouble.cs b/Aaru.Filters/AppleDouble.cs index 99edb2707..05814f622 100644 --- a/Aaru.Filters/AppleDouble.cs +++ b/Aaru.Filters/AppleDouble.cs @@ -81,11 +81,11 @@ public sealed class AppleDouble : IFilter Entry _rsrcFork; /// - public string Name => "AppleDouble"; + public string Name => Localization.AppleDouble_Name; /// public Guid Id => new("1B2165EE-C9DF-4B21-BBBB-9E5892B2DF4D"); /// - public string Author => "Natalia Portillo"; + public string Author => Authors.NataliaPortillo; /// public void Close() {} diff --git a/Aaru.Filters/AppleSingle.cs b/Aaru.Filters/AppleSingle.cs index eb64273e6..f5f6f28f4 100644 --- a/Aaru.Filters/AppleSingle.cs +++ b/Aaru.Filters/AppleSingle.cs @@ -83,11 +83,11 @@ public sealed class AppleSingle : IFilter Stream _stream; /// - public string Name => "AppleSingle"; + public string Name => Localization.AppleSingle_Name; /// public Guid Id => new("A69B20E8-F4D3-42BB-BD2B-4A7263394A05"); /// - public string Author => "Natalia Portillo"; + public string Author => Authors.NataliaPortillo; /// public void Close() diff --git a/Aaru.Filters/Authors.cs b/Aaru.Filters/Authors.cs new file mode 100644 index 000000000..e3d1f38a6 --- /dev/null +++ b/Aaru.Filters/Authors.cs @@ -0,0 +1,37 @@ +// /*************************************************************************** +// Aaru Data Preservation Suite +// ---------------------------------------------------------------------------- +// +// Filename : Authors.cs +// Author(s) : Natalia Portillo +// +// Component : Filters. +// +// --[ License ] -------------------------------------------------------------- +// +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 2.1 of the +// License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, see . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2022 Natalia Portillo +// ****************************************************************************/ + +using System.Diagnostics.CodeAnalysis; + +namespace Aaru.Filters; + +[SuppressMessage("ReSharper", "InconsistentNaming")] +static class Authors +{ + internal const string NataliaPortillo = "Natalia Portillo"; +} \ No newline at end of file diff --git a/Aaru.Filters/BZip2.cs b/Aaru.Filters/BZip2.cs index 64c69fe11..18cf33471 100644 --- a/Aaru.Filters/BZip2.cs +++ b/Aaru.Filters/BZip2.cs @@ -47,11 +47,11 @@ public class BZip2 : IFilter Stream _innerStream; /// - public string Name => "BZip2"; + public string Name => Localization.BZip2_Name; /// public Guid Id => new("FCCFB0C3-32EF-40D8-9714-2333F6AC72A9"); /// - public string Author => "Natalia Portillo"; + public string Author => Authors.NataliaPortillo; /// public void Close() diff --git a/Aaru.Filters/ForcedSeekStream.cs b/Aaru.Filters/ForcedSeekStream.cs index d334afc92..4be2106a3 100644 --- a/Aaru.Filters/ForcedSeekStream.cs +++ b/Aaru.Filters/ForcedSeekStream.cs @@ -213,14 +213,14 @@ public sealed class ForcedSeekStream : Stream where T : Stream { case SeekOrigin.Begin: if(offset < 0) - throw new IOException("Cannot seek before stream start."); + throw new IOException(Localization.Cannot_seek_before_stream_start); SetPosition(offset); break; case SeekOrigin.End: if(offset > 0) - throw new IOException("Cannot seek after stream end."); + throw new IOException(Localization.Cannot_seek_after_stream_end); if(_streamLength == 0) CalculateLength(); diff --git a/Aaru.Filters/GZip.cs b/Aaru.Filters/GZip.cs index 01a8d9628..a65cff1aa 100644 --- a/Aaru.Filters/GZip.cs +++ b/Aaru.Filters/GZip.cs @@ -48,11 +48,11 @@ public sealed class GZip : IFilter Stream _zStream; /// - public string Name => "GZip"; + public string Name => Localization.GZip_Name; /// public Guid Id => new("F4996661-4A29-42C9-A2C7-3904EF40F3B0"); /// - public string Author => "Natalia Portillo"; + public string Author => Authors.NataliaPortillo; /// public void Close() diff --git a/Aaru.Filters/LZip.cs b/Aaru.Filters/LZip.cs index 13ad62d98..82ef01bb4 100644 --- a/Aaru.Filters/LZip.cs +++ b/Aaru.Filters/LZip.cs @@ -48,11 +48,11 @@ public sealed class LZip : IFilter Stream _innerStream; /// - public string Name => "LZip"; + public string Name => Localization.LZip_Name; /// public Guid Id => new("09D715E9-20C0-48B1-A8D9-D8897CEC57C9"); /// - public string Author => "Natalia Portillo"; + public string Author => Authors.NataliaPortillo; /// public void Close() diff --git a/Aaru.Filters/Localization/Localization.Designer.cs b/Aaru.Filters/Localization/Localization.Designer.cs new file mode 100644 index 000000000..61f90c77c --- /dev/null +++ b/Aaru.Filters/Localization/Localization.Designer.cs @@ -0,0 +1,186 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Aaru.Filters { + 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.Filters.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 AppleDouble_Name { + get { + return ResourceManager.GetString("AppleDouble_Name", resourceCulture); + } + } + + internal static string AppleSingle_Name { + get { + return ResourceManager.GetString("AppleSingle_Name", resourceCulture); + } + } + + internal static string BZip2_Name { + get { + return ResourceManager.GetString("BZip2_Name", resourceCulture); + } + } + + internal static string Cannot_seek_before_stream_start { + get { + return ResourceManager.GetString("Cannot_seek_before_stream_start", resourceCulture); + } + } + + internal static string Cannot_seek_after_stream_end { + get { + return ResourceManager.GetString("Cannot_seek_after_stream_end", resourceCulture); + } + } + + internal static string GZip_Name { + get { + return ResourceManager.GetString("GZip_Name", resourceCulture); + } + } + + internal static string LZip_Name { + get { + return ResourceManager.GetString("LZip_Name", resourceCulture); + } + } + + internal static string MacBinary_Name { + get { + return ResourceManager.GetString("MacBinary_Name", resourceCulture); + } + } + + internal static string Start_cant_be_a_negative_number { + get { + return ResourceManager.GetString("Start_cant_be_a_negative_number", resourceCulture); + } + } + + internal static string End_cant_be_a_negative_number { + get { + return ResourceManager.GetString("End_cant_be_a_negative_number", resourceCulture); + } + } + + internal static string End_is_after_stream_end { + get { + return ResourceManager.GetString("End_is_after_stream_end", resourceCulture); + } + } + + internal static string Cannot_set_position_past_stream_end { + get { + return ResourceManager.GetString("Cannot_set_position_past_stream_end", resourceCulture); + } + } + + internal static string Cannot_read_past_stream_end { + get { + return ResourceManager.GetString("Cannot_read_past_stream_end", resourceCulture); + } + } + + internal static string Cannot_write_past_stream_end { + get { + return ResourceManager.GetString("Cannot_write_past_stream_end", resourceCulture); + } + } + + internal static string Cannot_seek_past_stream_end { + get { + return ResourceManager.GetString("Cannot_seek_past_stream_end", resourceCulture); + } + } + + internal static string Growing_OffsetStream_is_not_supported { + get { + return ResourceManager.GetString("Growing_OffsetStream_is_not_supported", resourceCulture); + } + } + + internal static string PcExchange_Name { + get { + return ResourceManager.GetString("PcExchange_Name", resourceCulture); + } + } + + internal static string Non_seekable_streams_are_not_supported { + get { + return ResourceManager.GetString("Non_seekable_streams_are_not_supported", resourceCulture); + } + } + + internal static string Non_readable_streams_are_not_supported { + get { + return ResourceManager.GetString("Non_readable_streams_are_not_supported", resourceCulture); + } + } + + internal static string Asynchronous_IO_is_not_supported { + get { + return ResourceManager.GetString("Asynchronous_IO_is_not_supported", resourceCulture); + } + } + + internal static string This_stream_is_read_only { + get { + return ResourceManager.GetString("This_stream_is_read_only", resourceCulture); + } + } + + internal static string XZ_Name { + get { + return ResourceManager.GetString("XZ_Name", resourceCulture); + } + } + + internal static string ZZZNoFilter_Name { + get { + return ResourceManager.GetString("ZZZNoFilter_Name", resourceCulture); + } + } + } +} diff --git a/Aaru.Filters/Localization/Localization.resx b/Aaru.Filters/Localization/Localization.resx new file mode 100644 index 000000000..4132489f8 --- /dev/null +++ b/Aaru.Filters/Localization/Localization.resx @@ -0,0 +1,93 @@ + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + + AppleDouble + + + AppleSingle + + + BZip2 + + + Cannot seek before stream start. + + + Cannot seek after stream end. + + + GZip + + + LZip + + + MacBinary + + + Start can't be a negative number. + + + End can't be a negative number. + + + End is after stream end. + + + Cannot set position past stream end. + + + Cannot read past stream end. + + + Cannot write past stream end. + + + Cannot seek past stream end. + + + Growing OffsetStream is not supported. + + + PCExchange + + + Non-seekable streams are not supported + + + Non-readable streams are not supported + + + Asynchronous I/O is not supported. + + + This stream is read-only + + + XZ + + + No filter + + \ No newline at end of file diff --git a/Aaru.Filters/MacBinary.cs b/Aaru.Filters/MacBinary.cs index 34a6e52b6..696249970 100644 --- a/Aaru.Filters/MacBinary.cs +++ b/Aaru.Filters/MacBinary.cs @@ -55,11 +55,11 @@ public sealed class MacBinary : IFilter Stream _stream; /// - public string Name => "MacBinary"; + public string Name => Localization.MacBinary_Name; /// public Guid Id => new("D7C321D3-E51F-45DF-A150-F6BFDF0D7704"); /// - public string Author => "Natalia Portillo"; + public string Author => Authors.NataliaPortillo; /// public void Close() diff --git a/Aaru.Filters/OffsetStream.cs b/Aaru.Filters/OffsetStream.cs index 45a3ced2c..c346902ab 100644 --- a/Aaru.Filters/OffsetStream.cs +++ b/Aaru.Filters/OffsetStream.cs @@ -60,10 +60,10 @@ namespace Aaru.Filters public OffsetStream(Stream stream, long start, long end) { if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number); if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_cant_be_a_negative_number); _streamStart = start; _streamEnd = end; @@ -71,7 +71,7 @@ namespace Aaru.Filters _baseStream = stream; if(end > _baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_is_after_stream_end); _baseStream.Position = start; } @@ -103,10 +103,10 @@ namespace Aaru.Filters FileOptions options, long start, long end) { if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number); if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_cant_be_a_negative_number); _streamStart = start; _streamEnd = end; @@ -114,7 +114,7 @@ namespace Aaru.Filters _baseStream = new FileStream(path, mode, access, share, bufferSize, options); if(end > _baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_is_after_stream_end); _baseStream.Position = start; } @@ -135,10 +135,10 @@ namespace Aaru.Filters public OffsetStream(SafeFileHandle handle, FileAccess access, long start, long end) { if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number); if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_cant_be_a_negative_number); _streamStart = start; _streamEnd = end; @@ -146,7 +146,7 @@ namespace Aaru.Filters _baseStream = new FileStream(handle, access); if(end > _baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_is_after_stream_end); _baseStream.Position = start; } @@ -171,10 +171,10 @@ namespace Aaru.Filters public OffsetStream(SafeFileHandle handle, FileAccess access, int bufferSize, long start, long end) { if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number); if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_cant_be_a_negative_number); _streamStart = start; _streamEnd = end; @@ -182,7 +182,7 @@ namespace Aaru.Filters _baseStream = new FileStream(handle, access, bufferSize); if(end > _baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_is_after_stream_end); _baseStream.Position = start; } @@ -209,10 +209,10 @@ namespace Aaru.Filters long end) { if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number); if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_cant_be_a_negative_number); _streamStart = start; _streamEnd = end; @@ -220,7 +220,7 @@ namespace Aaru.Filters _baseStream = new FileStream(handle, access, bufferSize, isAsync); if(end > _baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_is_after_stream_end); _baseStream.Position = start; } @@ -252,10 +252,10 @@ namespace Aaru.Filters bool useAsync, long start, long end) { if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number); if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_cant_be_a_negative_number); _streamStart = start; _streamEnd = end; @@ -263,7 +263,7 @@ namespace Aaru.Filters _baseStream = new FileStream(path, mode, access, share, bufferSize, useAsync); if(end > _baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_is_after_stream_end); _baseStream.Position = start; } @@ -294,10 +294,10 @@ namespace Aaru.Filters long end) { if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number); if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_cant_be_a_negative_number); _streamStart = start; _streamEnd = end; @@ -305,7 +305,7 @@ namespace Aaru.Filters _baseStream = new FileStream(path, mode, access, share, bufferSize); if(end > _baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_is_after_stream_end); _baseStream.Position = start; } @@ -331,10 +331,10 @@ namespace Aaru.Filters public OffsetStream(string path, FileMode mode, FileAccess access, FileShare share, long start, long end) { if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number); if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_cant_be_a_negative_number); _streamStart = start; _streamEnd = end; @@ -342,7 +342,7 @@ namespace Aaru.Filters _baseStream = new FileStream(path, mode, access, share); if(end > _baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_is_after_stream_end); _baseStream.Position = start; } @@ -364,10 +364,10 @@ namespace Aaru.Filters public OffsetStream(string path, FileMode mode, FileAccess access, long start, long end) { if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number); if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_cant_be_a_negative_number); _streamStart = start; _streamEnd = end; @@ -375,7 +375,7 @@ namespace Aaru.Filters _baseStream = new FileStream(path, mode, access); if(end > _baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_is_after_stream_end); _baseStream.Position = start; } @@ -393,10 +393,10 @@ namespace Aaru.Filters public OffsetStream(string path, FileMode mode, long start, long end) { if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number); if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_cant_be_a_negative_number); _streamStart = start; _streamEnd = end; @@ -404,7 +404,7 @@ namespace Aaru.Filters _baseStream = new FileStream(path, mode); if(end > _baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_is_after_stream_end); _baseStream.Position = start; } @@ -426,10 +426,10 @@ namespace Aaru.Filters long end) { if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number); if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_cant_be_a_negative_number); _streamStart = start; _streamEnd = end; @@ -437,7 +437,7 @@ namespace Aaru.Filters _baseStream = new MemoryStream(buffer, index, count, writable, publiclyVisible); if(end > _baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_is_after_stream_end); _baseStream.Position = start; } @@ -457,10 +457,10 @@ namespace Aaru.Filters public OffsetStream(byte[] buffer, int index, int count, bool writable, long start, long end) { if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number); if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_cant_be_a_negative_number); _streamStart = start; _streamEnd = end; @@ -468,7 +468,7 @@ namespace Aaru.Filters _baseStream = new MemoryStream(buffer, index, count, writable); if(end > _baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_is_after_stream_end); _baseStream.Position = start; } @@ -487,10 +487,10 @@ namespace Aaru.Filters public OffsetStream(byte[] buffer, int index, int count, long start, long end) { if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number); if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_cant_be_a_negative_number); _streamStart = start; _streamEnd = end; @@ -498,7 +498,7 @@ namespace Aaru.Filters _baseStream = new MemoryStream(buffer, index, count); if(end > _baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_is_after_stream_end); _baseStream.Position = start; } @@ -516,10 +516,10 @@ namespace Aaru.Filters public OffsetStream(byte[] buffer, bool writable, long start, long end) { if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number); if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_cant_be_a_negative_number); _streamStart = start; _streamEnd = end; @@ -527,7 +527,7 @@ namespace Aaru.Filters _baseStream = new MemoryStream(buffer, writable); if(end > _baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_is_after_stream_end); _baseStream.Position = start; } @@ -544,10 +544,10 @@ namespace Aaru.Filters public OffsetStream(byte[] buffer, long start, long end) { if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number); if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_cant_be_a_negative_number); _streamStart = start; _streamEnd = end; @@ -555,7 +555,7 @@ namespace Aaru.Filters _baseStream = new MemoryStream(buffer); if(end > _baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + throw new ArgumentOutOfRangeException(nameof(end), Localization.End_is_after_stream_end); _baseStream.Position = start; } @@ -580,7 +580,7 @@ namespace Aaru.Filters set { if(value + _streamStart > _streamEnd) - throw new IOException("Cannot set position past stream end."); + throw new IOException(Localization.Cannot_set_position_past_stream_end); _baseStream.Position = value + _streamStart; } @@ -597,7 +597,7 @@ namespace Aaru.Filters object state) { if(_baseStream.Position + count > _streamEnd) - throw new IOException("Cannot read past stream end."); + throw new IOException(Localization.Cannot_read_past_stream_end); return _baseStream.BeginRead(buffer, offset, count, callback, state); } @@ -607,7 +607,7 @@ namespace Aaru.Filters object state) { if(_baseStream.Position + count > _streamEnd) - throw new IOException("Cannot write past stream end."); + throw new IOException(Localization.Cannot_write_past_stream_end); return _baseStream.BeginWrite(buffer, offset, count, callback, state); } @@ -628,7 +628,7 @@ namespace Aaru.Filters public override void WriteByte(byte value) { if(_baseStream.Position + 1 > _streamEnd) - throw new IOException("Cannot write past stream end."); + throw new IOException(Localization.Cannot_write_past_stream_end); _baseStream.WriteByte(value); } @@ -640,7 +640,7 @@ namespace Aaru.Filters public override int Read(byte[] buffer, int offset, int count) { if(_baseStream.Position + count > _streamEnd + 1) - throw new IOException("Cannot read past stream end."); + throw new IOException(Localization.Cannot_read_past_stream_end); return _baseStream.EnsureRead(buffer, offset, count); } @@ -652,17 +652,17 @@ namespace Aaru.Filters { case SeekOrigin.Begin: if(offset + _streamStart > _streamEnd) - throw new IOException("Cannot seek past stream end."); + throw new IOException(Localization.Cannot_seek_past_stream_end); return _baseStream.Seek(offset + _streamStart, SeekOrigin.Begin) - _streamStart; case SeekOrigin.End: if(offset - (_baseStream.Length - _streamEnd) < _streamStart) - throw new IOException("Cannot seek before stream start."); + throw new IOException(Localization.Cannot_seek_before_stream_start); return _baseStream.Seek(offset - (_baseStream.Length - _streamEnd), SeekOrigin.End) - _streamStart; default: if(offset + _baseStream.Position > _streamEnd) - throw new IOException("Cannot seek past stream end."); + throw new IOException(Localization.Cannot_seek_past_stream_end); return _baseStream.Seek(offset, SeekOrigin.Current) - _streamStart; } @@ -670,13 +670,13 @@ namespace Aaru.Filters /// public override void SetLength(long value) => - throw new NotSupportedException("Growing OffsetStream is not supported."); + throw new NotSupportedException(Localization.Growing_OffsetStream_is_not_supported); /// public override void Write(byte[] buffer, int offset, int count) { if(_baseStream.Position + count > _streamEnd) - throw new IOException("Cannot write past stream end."); + throw new IOException(Localization.Cannot_write_past_stream_end); _baseStream.Write(buffer, offset, count); } diff --git a/Aaru.Filters/PCExchange.cs b/Aaru.Filters/PCExchange.cs index ab3a3b032..6ad6a1d5c 100644 --- a/Aaru.Filters/PCExchange.cs +++ b/Aaru.Filters/PCExchange.cs @@ -56,11 +56,11 @@ public sealed class PcExchange : IFilter string _rsrcPath; /// - public string Name => "PCExchange"; + public string Name => Localization.PcExchange_Name; /// public Guid Id => new("9264EB9F-D634-4F9B-BE12-C24CD44988C6"); /// - public string Author => "Natalia Portillo"; + public string Author => Authors.NataliaPortillo; /// public void Close() {} diff --git a/Aaru.Filters/SplitJoinStream.cs b/Aaru.Filters/SplitJoinStream.cs index a301edd3c..132e83132 100644 --- a/Aaru.Filters/SplitJoinStream.cs +++ b/Aaru.Filters/SplitJoinStream.cs @@ -46,7 +46,7 @@ public class SplitJoinStream : Stream set { if(value >= _streamLength) - throw new IOException("Cannot set position past stream end."); + throw new IOException(Localization.Cannot_set_position_past_stream_end); _position = value; } @@ -61,10 +61,10 @@ public class SplitJoinStream : Stream public void Add(Stream stream) { if(!stream.CanSeek) - throw new ArgumentException("Non-seekable streams are not supported"); + throw new ArgumentException(Localization.Non_seekable_streams_are_not_supported); if(!stream.CanRead) - throw new ArgumentException("Non-readable streams are not supported"); + throw new ArgumentException(Localization.Non_readable_streams_are_not_supported); _baseStreams[_streamLength] = stream; _streamLength += stream.Length; @@ -259,12 +259,12 @@ public class SplitJoinStream : Stream /// public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) => - throw new NotSupportedException("Asynchronous I/O is not supported."); + throw new NotSupportedException(Localization.Asynchronous_IO_is_not_supported); /// public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) => - throw new NotSupportedException("Asynchronous I/O is not supported."); + throw new NotSupportedException(Localization.Asynchronous_IO_is_not_supported); /// public override void Close() @@ -278,11 +278,11 @@ public class SplitJoinStream : Stream /// public override int EndRead(IAsyncResult asyncResult) => - throw new NotSupportedException("Asynchronous I/O is not supported."); + throw new NotSupportedException(Localization.Asynchronous_IO_is_not_supported); /// public override void EndWrite(IAsyncResult asyncResult) => - throw new NotSupportedException("Asynchronous I/O is not supported."); + throw new NotSupportedException(Localization.Asynchronous_IO_is_not_supported); /// public override int ReadByte() @@ -302,7 +302,7 @@ public class SplitJoinStream : Stream } /// - public override void WriteByte(byte value) => throw new ReadOnlyException("This stream is read-only"); + public override void WriteByte(byte value) => throw new ReadOnlyException(Localization.This_stream_is_read_only); /// public override void Flush() {} @@ -342,21 +342,21 @@ public class SplitJoinStream : Stream { case SeekOrigin.Begin: if(offset >= _streamLength) - throw new IOException("Cannot seek past stream end."); + throw new IOException(Localization.Cannot_seek_past_stream_end); _position = offset; break; case SeekOrigin.End: if(_position - offset < 0) - throw new IOException("Cannot seek before stream start."); + throw new IOException(Localization.Cannot_seek_before_stream_start); _position -= offset; break; default: if(_position + offset >= _streamLength) - throw new IOException("Cannot seek past stream end."); + throw new IOException(Localization.Cannot_seek_past_stream_end); _position += offset; @@ -367,9 +367,9 @@ public class SplitJoinStream : Stream } /// - public override void SetLength(long value) => throw new ReadOnlyException("This stream is read-only"); + public override void SetLength(long value) => throw new ReadOnlyException(Localization.This_stream_is_read_only); /// public override void Write(byte[] buffer, int offset, int count) => - throw new ReadOnlyException("This stream is read-only"); + throw new ReadOnlyException(Localization.This_stream_is_read_only); } \ No newline at end of file diff --git a/Aaru.Filters/XZ.cs b/Aaru.Filters/XZ.cs index 01e17093f..2669c7b2a 100644 --- a/Aaru.Filters/XZ.cs +++ b/Aaru.Filters/XZ.cs @@ -47,11 +47,11 @@ public sealed class XZ : IFilter Stream _innerStream; /// - public string Name => "XZ"; + public string Name => Localization.XZ_Name; /// public Guid Id => new("666A8617-0444-4C05-9F4F-DF0FD758D0D2"); /// - public string Author => "Natalia Portillo"; + public string Author => Authors.NataliaPortillo; /// public void Close() diff --git a/Aaru.Filters/ZZZNoFilter.cs b/Aaru.Filters/ZZZNoFilter.cs index 3fe57eaaa..83fb212f3 100644 --- a/Aaru.Filters/ZZZNoFilter.cs +++ b/Aaru.Filters/ZZZNoFilter.cs @@ -44,11 +44,11 @@ public sealed class ZZZNoFilter : IFilter Stream _dataStream; /// - public string Name => "No filter"; + public string Name => Localization.ZZZNoFilter_Name; /// public Guid Id => new("12345678-AAAA-BBBB-CCCC-123456789000"); /// - public string Author => "Natalia Portillo"; + public string Author => Authors.NataliaPortillo; /// public void Close() diff --git a/Aaru.Helpers b/Aaru.Helpers index cfe81b890..25b15c9c3 160000 --- a/Aaru.Helpers +++ b/Aaru.Helpers @@ -1 +1 @@ -Subproject commit cfe81b8905f2407a8e2f1d67482a44612f95b0be +Subproject commit 25b15c9c3368026554fe4ccfd00f9e629c81de90