Skip to content

Commit

Permalink
Disable assembly trimming to fix startup on Windows 10 (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz authored Sep 21, 2024
1 parent 0b30001 commit 22896e5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 4 additions & 3 deletions YoutubeDownloader.Core/Tagging/MediaFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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>
Expand Down

0 comments on commit 22896e5

Please sign in to comment.