This commit is contained in:
Tyrrrz
2021-04-16 23:09:08 +03:00
parent 2fea455c64
commit 511af1e35c
38 changed files with 173 additions and 377 deletions

View File

@@ -15,7 +15,7 @@ namespace DiscordChatExporter.Gui.Converters
if (value is ExportFormat exportFormatValue)
return exportFormatValue.GetDisplayName();
return default(string);
return default(string?);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) =>

View File

@@ -1,27 +0,0 @@
using DiscordChatExporter.Core.Exporting;
using DiscordChatExporter.Gui.Internal;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows.Data;
namespace DiscordChatExporter.Gui.Converters
{
[ValueConversion(typeof(ExportFormat), typeof(string))]
public class PartitionFormatToStringConverter : IValueConverter
{
public static PartitionFormatToStringConverter Instance { get; } = new();
public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is PartitionFormat partitionFormatValue)
return partitionFormatValue.GetDisplayName();
return default(string);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) =>
throw new NotSupportedException();
}
}

View File

@@ -1,33 +0,0 @@
using DiscordChatExporter.Gui.Internal;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows.Data;
namespace DiscordChatExporter.Gui.Converters
{
[ValueConversion(typeof(DateTimeOffset?), typeof(DateTime?))]
public class PartitionFormatToTextBoxHintConverter : IValueConverter
{
public static PartitionFormatToTextBoxHintConverter Instance { get; } = new();
public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is PartitionFormat partitionFormat)
return partitionFormat switch
{
PartitionFormat.FileSize => "MB per partition",
PartitionFormat.MessageCount => "Messages per partition",
_ => default(string)
};
return default(DateTime?);
}
public object? ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}

View File

@@ -1,33 +0,0 @@
using DiscordChatExporter.Gui.Internal;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows.Data;
namespace DiscordChatExporter.Gui.Converters
{
[ValueConversion(typeof(DateTimeOffset?), typeof(DateTime?))]
public class PartitionFormatToTooltipConverter : IValueConverter
{
public static PartitionFormatToTextBoxHintConverter Instance { get; } = new();
public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is PartitionFormat partitionFormat)
return partitionFormat switch
{
PartitionFormat.FileSize => "Split output into partitions close to this file size",
PartitionFormat.MessageCount => "Split output into partitions limited to this number of messages",
_ => default(string)
};
return default(DateTime?);
}
public object? ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}