diff --git a/TwitchDownloaderCore/Chat/ChatHtml.cs b/TwitchDownloaderCore/Chat/ChatHtml.cs
index f9b89ecf..f00d51d0 100644
--- a/TwitchDownloaderCore/Chat/ChatHtml.cs
+++ b/TwitchDownloaderCore/Chat/ChatHtml.cs
@@ -41,7 +41,7 @@ public static async Task SerializeAsync(string filePath, ChatRoot chatRoot, ITas
TwitchHelper.CreateDirectory(outputDirectory.FullName);
}
- await using var fs = File.Create(filePath);
+ await using var fs = File.Open(filePath, FileMode.Create, FileAccess.Write, FileShare.Read);
await using var sw = new StreamWriter(fs);
while (!templateReader.EndOfStream)
diff --git a/TwitchDownloaderCore/Chat/ChatJson.cs b/TwitchDownloaderCore/Chat/ChatJson.cs
index 05fe734e..af80a634 100644
--- a/TwitchDownloaderCore/Chat/ChatJson.cs
+++ b/TwitchDownloaderCore/Chat/ChatJson.cs
@@ -171,7 +171,7 @@ private static async Task GetJsonDocumentAsync(Stream stream, stri
}
}
-#pragma warning disable CS0618
+#pragma warning disable CS0618 // Type or member is obsolete
private static async Task UpgradeChatJson(ChatRoot chatRoot)
{
const int MAX_STREAM_LENGTH = 172_800; // 48 hours in seconds. https://help.twitch.tv/s/article/broadcast-guidelines
@@ -239,7 +239,7 @@ private static async Task UpgradeChatJson(ChatRoot chatRoot)
}
}
}
-#pragma warning restore CS0618
+#pragma warning restore CS0618 // Type or member is obsolete
///
/// Asynchronously serializes a chat json file.
@@ -254,7 +254,7 @@ public static async Task SerializeAsync(string filePath, ChatRoot chatRoot, Chat
TwitchHelper.CreateDirectory(outputDirectory.FullName);
}
- await using var fs = File.Create(filePath);
+ await using var fs = File.Open(filePath, FileMode.Create, FileAccess.Write, FileShare.Read);
switch (compression)
{
case ChatCompression.None:
diff --git a/TwitchDownloaderCore/Tools/FfmpegMetadata.cs b/TwitchDownloaderCore/Tools/FfmpegMetadata.cs
index 7633cf5c..023f288e 100644
--- a/TwitchDownloaderCore/Tools/FfmpegMetadata.cs
+++ b/TwitchDownloaderCore/Tools/FfmpegMetadata.cs
@@ -8,7 +8,7 @@
namespace TwitchDownloaderCore.Tools
{
- // https://ffmpeg.org/ffmpeg-formats.html#Metadata-1
+ // https://ffmpeg.org/ffmpeg-formats.html#Metadata-2
public static class FfmpegMetadata
{
private const string LINE_FEED = "\u000A";
@@ -16,7 +16,7 @@ public static class FfmpegMetadata
public static async Task SerializeAsync(string filePath, string streamerName, string videoId, string videoTitle, DateTime videoCreation, int viewCount, string videoDescription = null,
TimeSpan startOffset = default, IEnumerable videoMomentEdges = null, CancellationToken cancellationToken = default)
{
- await using var fs = new FileStream(filePath, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.Read);
+ await using var fs = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.Read);
await using var sw = new StreamWriter(fs) { NewLine = LINE_FEED };
await SerializeGlobalMetadata(sw, streamerName, videoId, videoTitle, videoCreation, viewCount, videoDescription);
diff --git a/TwitchDownloaderWPF/WindowSettings.xaml.cs b/TwitchDownloaderWPF/WindowSettings.xaml.cs
index 33b3b8e5..3116b387 100644
--- a/TwitchDownloaderWPF/WindowSettings.xaml.cs
+++ b/TwitchDownloaderWPF/WindowSettings.xaml.cs
@@ -8,7 +8,6 @@
using TwitchDownloaderWPF.Models;
using TwitchDownloaderWPF.Properties;
using TwitchDownloaderWPF.Services;
-using CheckComboBox = HandyControl.Controls.CheckComboBox;
using CheckComboBoxItem = HandyControl.Controls.CheckComboBoxItem;
namespace TwitchDownloaderWPF
@@ -70,20 +69,11 @@ private void Window_Initialized(object sender, EventArgs e)
}
// Setup culture dropdown
- foreach (var culture in AvailableCultures.All)
- {
- ComboLocale.Items.Add(culture.NativeName);
- }
var currentCulture = Settings.Default.GuiCulture;
- var selectedIndex = AvailableCultures.All.Select((item, index) => (item, index))
- .Where(x => x.item.Code == currentCulture)
- .Select(x => x.index)
- .DefaultIfEmpty(-1)
- .First();
-
- if (selectedIndex > -1)
+ foreach (var (culture, index) in AvailableCultures.All.Select((x, index) => (x, index)))
{
- ComboLocale.SelectedIndex = selectedIndex;
+ ComboLocale.Items.Add(culture.NativeName);
+ if (culture.Code == currentCulture) ComboLocale.SelectedIndex = index;
}
ComboLogLevels.Items.Add(new CheckComboBoxItem { Content = Translations.Strings.LogLevelVerbose, Tag = LogLevel.Verbose });