2025-01-07 09:40:39 +01:00
// Copyright (C) 2025, The Duplicati Team
// https://duplicati.com, hello@duplicati.com
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2024-10-03 14:13:44 +02:00
// DEALINGS IN THE SOFTWARE.
2015-11-17 22:24:11 +01:00
using Duplicati.Library.Localization.Short ;
using System ;
2024-10-03 14:13:44 +02:00
namespace Duplicati.Library.Utility.Strings
{
internal static class Sizeparser
{
2015-11-17 22:24:11 +01:00
public static string InvalidSizeValueError ( string value ) { return LC . L ( @"Invalid size value: {0}" , value ); }
}
2024-10-03 14:13:44 +02:00
internal static class SslCertificateValidator
{
2015-11-17 22:24:11 +01:00
public static string InvalidCallSequence { get { return LC . L ( @"The SSL certificate validator was called in an incorrect order" ); } }
2024-07-29 05:49:04 -04:00
public static string VerifyCertificateException ( System . Net . Security . SslPolicyErrors error , string hash ) { return LC . L ( @"The server certificate had the error {0} and the hash {1}{2}If you trust this certificate, use the commandline option --{3}={1} to accept the server certificate anyway.{2}You can also attempt to import the server certificate into your operating systems trust pool." , error , hash , Environment . NewLine , "accept-specified-ssl-hash" ); }
2016-10-30 22:07:13 +01:00
public static string VerifyCertificateHashError ( System . Exception exception , System . Net . Security . SslPolicyErrors error ) { return LC . L ( @"Failed while validating certificate hash, error message: {0}, SSL error name: {1}" , exception , error ); }
2015-11-17 22:24:11 +01:00
}
2024-10-03 14:13:44 +02:00
internal static class TempFolder
{
2015-11-17 22:24:11 +01:00
public static string TempFolderDoesNotExistError ( string path ) { return LC . L ( @"Temporary folder does not exist: {0}" , path ); }
}
2024-10-03 14:13:44 +02:00
internal static class Timeparser
{
2015-11-17 22:24:11 +01:00
public static string InvalidIntegerError ( string segment ) { return LC . L ( @"Failed to parse the segment: {0}, invalid integer" , segment ); }
public static string InvalidSpecifierError ( char specifier ) { return LC . L ( @"Invalid specifier: {0}" , specifier ); }
public static string UnparsedDataFragmentError ( string data ) { return LC . L ( @"Unparsed data: {0}" , data ); }
}
2024-10-03 14:13:44 +02:00
internal static class Uri
{
2015-11-17 22:24:11 +01:00
public static string UriParseError ( string uri ) { return LC . L ( @"The Uri is invalid: {0}" , uri ); }
public static string NoHostname ( string uri ) { return LC . L ( @"The Uri is missing a hostname: {0}" , uri ); }
}
2024-10-03 14:13:44 +02:00
internal static class Utility
{
2015-11-17 22:24:11 +01:00
public static string FormatStringB ( long size ) { return LC . L ( @"{0} bytes" , size ); }
2025-01-10 09:25:40 +01:00
public static string FormatStringGB ( double size ) { return LC . L ( @"{0:N} GiB" , size ); }
public static string FormatStringKB ( double size ) { return LC . L ( @"{0:N} KiB" , size ); }
public static string FormatStringMB ( double size ) { return LC . L ( @"{0:N} MiB" , size ); }
public static string FormatStringTB ( double size ) { return LC . L ( @"{0:N} TiB" , size ); }
2015-11-17 22:24:11 +01:00
public static string InvalidDateError ( string data ) { return LC . L ( @"The string ""{0}"" could not be parsed into a date" , data ); }
}
2024-10-03 14:13:44 +02:00
internal static class HashCalculatingStream
{
2015-12-05 11:26:34 +01:00
public static string IncorrectUsageError { get { return LC . L ( @"Cannot read and write on the same stream" ); } }
}
2024-10-03 14:13:44 +02:00
internal static class Filters
{
2018-03-05 22:27:16 +01:00
public static string UnknownFilterGroup ( string filterSet ) { return LC . L ( @"The string {0} does not represent a known filter group name. Valid values are: {1}" , filterSet , string . Join ( ", " , Enum . GetNames ( typeof ( FilterGroup )))); }
2017-09-13 22:21:12 -07:00
}
2015-11-17 22:24:11 +01:00
}