diff --git a/DiscordChatExporter/Services/ExportService.cs b/DiscordChatExporter/Services/ExportService.cs
index eb75abc..1810a13 100644
--- a/DiscordChatExporter/Services/ExportService.cs
+++ b/DiscordChatExporter/Services/ExportService.cs
@@ -20,8 +20,6 @@ namespace DiscordChatExporter.Services
private async Task ExportAsTextAsync(string filePath, ChannelChatLog log)
{
- var dateFormat = _settingsService.DateFormat;
-
using (var writer = new StreamWriter(filePath, false, Encoding.UTF8, 128 * 1024))
{
// Generation info
@@ -39,7 +37,7 @@ namespace DiscordChatExporter.Services
// Chat log
foreach (var group in log.MessageGroups)
{
- var timeStampFormatted = group.TimeStamp.ToString(dateFormat);
+ var timeStampFormatted = group.TimeStamp.ToString(_settingsService.DateFormat);
await writer.WriteLineAsync($"{group.Author} [{timeStampFormatted}]");
// Messages
@@ -66,8 +64,6 @@ namespace DiscordChatExporter.Services
private async Task ExportAsHtmlAsync(string filePath, ChannelChatLog log, string css)
{
- var dateFormat = _settingsService.DateFormat;
-
using (var writer = new StreamWriter(filePath, false, Encoding.UTF8, 128 * 1024))
{
// Generation info
@@ -113,7 +109,7 @@ namespace DiscordChatExporter.Services
await writer.WriteAsync($"");
await writer.WriteAsync(HtmlEncode(group.Author.Name));
await writer.WriteLineAsync("");
- var timeStampFormatted = HtmlEncode(group.TimeStamp.ToString(dateFormat));
+ var timeStampFormatted = HtmlEncode(group.TimeStamp.ToString(_settingsService.DateFormat));
await writer.WriteLineAsync($"{timeStampFormatted}");
// Messages
@@ -130,7 +126,7 @@ namespace DiscordChatExporter.Services
if (message.EditedTimeStamp != null)
{
var editedTimeStampFormatted =
- HtmlEncode(message.EditedTimeStamp.Value.ToString(dateFormat));
+ HtmlEncode(message.EditedTimeStamp.Value.ToString(_settingsService.DateFormat));
await writer.WriteAsync(
$"(edited)");
}
diff --git a/DiscordChatExporter/Services/MessageGroupService.cs b/DiscordChatExporter/Services/MessageGroupService.cs
index bb5218c..7559f01 100644
--- a/DiscordChatExporter/Services/MessageGroupService.cs
+++ b/DiscordChatExporter/Services/MessageGroupService.cs
@@ -15,7 +15,6 @@ namespace DiscordChatExporter.Services
public IReadOnlyList GroupMessages(IReadOnlyList messages)
{
- var groupLimit = _settingsService.MessageGroupLimit;
var result = new List();
// Group adjacent messages by timestamp and author
@@ -31,7 +30,7 @@ namespace DiscordChatExporter.Services
message.Author.Id != groupFirst.Author.Id ||
(message.TimeStamp - groupFirst.TimeStamp).TotalHours > 1 ||
message.TimeStamp.Hour != groupFirst.TimeStamp.Hour ||
- groupBuffer.Count >= groupLimit
+ groupBuffer.Count >= _settingsService.MessageGroupLimit
);
// If condition is true - flush buffer
diff --git a/DiscordChatExporter/Views/MainWindow.ammy b/DiscordChatExporter/Views/MainWindow.ammy
index f2ae3af..3e7fd9c 100644
--- a/DiscordChatExporter/Views/MainWindow.ammy
+++ b/DiscordChatExporter/Views/MainWindow.ammy
@@ -20,6 +20,9 @@ Window "DiscordChatExporter.Views.MainWindow" {
DialogHost {
DockPanel {
+ IsEnabled: bind IsBusy
+ convert (bool b) => b ? false : true
+
// Toolbar
Border {
DockPanel.Dock: Top
@@ -100,8 +103,6 @@ Window "DiscordChatExporter.Views.MainWindow" {
Grid {
DockPanel {
Background: resource dyn "MaterialDesignCardBackground"
- IsEnabled: bind IsBusy
- convert (bool b) => b ? false : true
Visibility: bind IsDataAvailable
convert (bool b) => b ? Visibility.Visible : Visibility.Hidden