Merge branch 'feature/improve_size_multiplier_handling'

This commit is contained in:
Kenneth Skovhede
2018-08-09 09:14:49 +02:00
5 changed files with 16 additions and 4 deletions
+3
View File
@@ -1027,6 +1027,9 @@ namespace Duplicati.Library.Main
{
return Strings.Controller.UnsupportedSizeValue(optionname, value);
}
if (!string.IsNullOrWhiteSpace(value) && char.IsDigit(value.Last()))
return Strings.Controller.NonQualifiedSizeValue(optionname, value);
}
else if (arg.Type == Duplicati.Library.Interface.CommandLineArgument.ArgumentType.Timespan)
{
+1
View File
@@ -28,6 +28,7 @@ namespace Duplicati.Library.Main.Strings
public static string FailedForceLocaleError(string exMsg) { return LC.L(@"Failed to apply 'force-locale' setting. Please try to update .NET-Framework. Exception was: ""{0}"" ", exMsg); }
public static string SourceVolumeNameInvalidError(string filename) { return LC.L(@"The source {0} uses an invalid volume name, aborting backup", filename); }
public static string SourceVolumeNameNotFoundError(string filename, Guid volumeGuid) { return LC.L(@"The source {0} is on volume {1}, which could not be found, aborting backup", filename, volumeGuid); }
public static string NonQualifiedSizeValue(string optionname, string value) { return LC.L(@"The size ""{1}"" supplied to --{0} does not have a multiplier (b, kb, mb, etc). A multiplier is recommended to avoid unexpected changes if the program is updated.", optionname, value); }
}
internal static class Options
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Duplicati.Library.Interface;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
@@ -42,7 +43,8 @@ namespace Duplicati.Library.Modules.Builtin.ResultSerialization
{
return base
.CreateProperties(type, memberSerialization)
.Where(x => !m_excludes.Contains(x.PropertyName))
.Where(x => !m_excludes.Contains(x.PropertyName))
.Where(x => !typeof(Task).IsAssignableFrom(x.PropertyType))
.ToList();
}
}
@@ -70,7 +72,8 @@ namespace Duplicati.Library.Modules.Builtin.ResultSerialization
ContractResolver = new DynamicContractResolver(
nameof(IBasicResults.Warnings),
nameof(IBasicResults.Errors),
nameof(IBasicResults.Messages)
nameof(IBasicResults.Messages),
"TaskReader"
),
Converters = new List<JsonConverter>()
{
+5
View File
@@ -1445,6 +1445,11 @@ namespace Duplicati.Library.Utility
writer.Write("{0}{1}: ", indentstring, p.Name);
PrintSerializeIfPrimitive(p.GetValue(item, null), writer);
}
else if (typeof(Task).IsAssignableFrom(p.PropertyType) || p.Name == "TaskReader")
{
// Ignore Task items
continue;
}
else if (typeof(System.Collections.IEnumerable).IsAssignableFrom(p.PropertyType))
{
var enumerable = (System.Collections.IEnumerable)p.GetValue(item, null);
@@ -78,7 +78,7 @@ backupApp.service('AppUtils', function($rootScope, $timeout, $cookies, DialogSer
function reloadTexts() {
apputils.fileSizeMultipliers = [
{name: gettextCatalog.getString('byte'), value: ''},
{name: gettextCatalog.getString('byte'), value: 'b'},
{name: gettextCatalog.getString('KByte'), value: 'KB'},
{name: gettextCatalog.getString('MByte'), value: 'MB'},
{name: gettextCatalog.getString('GByte'), value: 'GB'},
@@ -111,7 +111,7 @@ backupApp.service('AppUtils', function($rootScope, $timeout, $cookies, DialogSer
];
apputils.speedMultipliers = [
{name: gettextCatalog.getString('byte/s'), value: ''},
{name: gettextCatalog.getString('byte/s'), value: 'b'},
{name: gettextCatalog.getString('KByte/s'), value: 'KB'},
{name: gettextCatalog.getString('MByte/s'), value: 'MB'},
{name: gettextCatalog.getString('GByte/s'), value: 'GB'},