Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable assembly trimming to fix startup on Windows 10 #510

Merged
merged 7 commits into from
Sep 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions YoutubeDownloader.Core/Tagging/MediaFile.cs
Original file line number Diff line number Diff line change
@@ -21,15 +21,16 @@ public void SetThumbnail(byte[] thumbnailData) =>

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));
}
4 changes: 3 additions & 1 deletion YoutubeDownloader.Core/Tagging/MediaTagInjector.cs
Original file line number Diff line number Diff line change
@@ -86,10 +86,12 @@ public async Task InjectTagsAsync(
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();
}
}
4 changes: 3 additions & 1 deletion YoutubeDownloader/YoutubeDownloader.csproj
Original file line number Diff line number Diff line change
@@ -4,7 +4,9 @@
<OutputType>WinExe</OutputType>
<ApplicationIcon>..\favicon.ico</ApplicationIcon>
<ApplicationManifest>app.manifest</ApplicationManifest>
<PublishTrimmed>true</PublishTrimmed>
<!-- Trimmed builds break support for Windows 10 for some reason -->
<!-- https://github.com/Tyrrrz/YoutubeDownloader/issues/496 -->
<PublishTrimmed>false</PublishTrimmed>
<CopyOutputSymbolsToPublishDirectory>false</CopyOutputSymbolsToPublishDirectory>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>