From 22896e5e75821a84eddbb4c89e8b327f1fc1ea7c Mon Sep 17 00:00:00 2001
From: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com>
Date: Sat, 21 Sep 2024 18:56:30 +0300
Subject: [PATCH] Disable assembly trimming to fix startup on Windows 10 (#510)
---
YoutubeDownloader.Core/Tagging/MediaFile.cs | 7 ++++---
YoutubeDownloader.Core/Tagging/MediaTagInjector.cs | 4 +++-
YoutubeDownloader/YoutubeDownloader.csproj | 4 +++-
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/YoutubeDownloader.Core/Tagging/MediaFile.cs b/YoutubeDownloader.Core/Tagging/MediaFile.cs
index c65a79c..2bac099 100644
--- a/YoutubeDownloader.Core/Tagging/MediaFile.cs
+++ b/YoutubeDownloader.Core/Tagging/MediaFile.cs
@@ -21,15 +21,16 @@ internal partial class MediaFile(TagFile file) : IDisposable
public void SetComment(string comment) => file.Tag.Comment = comment;
- public void Dispose()
+ public void Save()
{
file.Tag.DateTagged = DateTime.Now;
file.Save();
- file.Dispose();
}
+
+ public void Dispose() => file.Dispose();
}
internal partial class MediaFile
{
- public static MediaFile Create(string filePath) => new(TagFile.Create(filePath));
+ public static MediaFile Open(string filePath) => new(TagFile.Create(filePath));
}
diff --git a/YoutubeDownloader.Core/Tagging/MediaTagInjector.cs b/YoutubeDownloader.Core/Tagging/MediaTagInjector.cs
index 21fd7a9..72ec561 100644
--- a/YoutubeDownloader.Core/Tagging/MediaTagInjector.cs
+++ b/YoutubeDownloader.Core/Tagging/MediaTagInjector.cs
@@ -86,10 +86,12 @@ public class MediaTagInjector
CancellationToken cancellationToken = default
)
{
- using var mediaFile = MediaFile.Create(filePath);
+ using var mediaFile = MediaFile.Open(filePath);
InjectMiscMetadata(mediaFile, video);
await InjectMusicMetadataAsync(mediaFile, video, cancellationToken);
await InjectThumbnailAsync(mediaFile, video, cancellationToken);
+
+ mediaFile.Save();
}
}
diff --git a/YoutubeDownloader/YoutubeDownloader.csproj b/YoutubeDownloader/YoutubeDownloader.csproj
index 19b7f76..2590925 100644
--- a/YoutubeDownloader/YoutubeDownloader.csproj
+++ b/YoutubeDownloader/YoutubeDownloader.csproj
@@ -4,7 +4,9 @@
WinExe
..\favicon.ico
app.manifest
- true
+
+
+ false
false
true
true