2018-04-09 18:53:37 -02:30
|
|
|
using System;
|
2018-04-12 11:16:57 +02:00
|
|
|
using Duplicati.Library.Localization.Short;
|
2018-04-09 18:53:37 -02:30
|
|
|
|
|
|
|
|
namespace Duplicati.Library.Modules.Builtin.ResultSerialization
|
|
|
|
|
{
|
2018-04-12 11:16:57 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Factory class to provide result serialization
|
|
|
|
|
/// </summary>
|
2018-04-09 18:53:37 -02:30
|
|
|
public static class ResultFormatSerializerProvider
|
|
|
|
|
{
|
|
|
|
|
public static IResultFormatSerializer GetSerializer(ResultExportFormat format) {
|
|
|
|
|
switch (format)
|
|
|
|
|
{
|
|
|
|
|
case ResultExportFormat.Duplicati:
|
2018-04-12 11:16:57 +02:00
|
|
|
return new DuplicatiFormatSerializer();
|
2018-04-09 18:53:37 -02:30
|
|
|
case ResultExportFormat.Json:
|
2018-04-12 11:16:57 +02:00
|
|
|
return new JsonFormatSerializer();
|
2018-04-09 18:53:37 -02:30
|
|
|
default:
|
2018-04-12 11:16:57 +02:00
|
|
|
throw new Interface.UserInformationException(LC.L("The format is not supported: {0}", format), "SerializationFormatNotSupported");
|
2018-04-09 18:53:37 -02:30
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|