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

Move WPF version to AssemblyInfo #1183

Merged
merged 2 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions TwitchDownloaderWPF/Extensions/VersionExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace TwitchDownloaderWPF.Extensions
{
public static class VersionExtensions
{
public static Version StripRevisionIfDefault(this Version version) => version.Revision < 1 ? new Version(version.Major, version.Minor, version.Build) : version;
}
}
5 changes: 4 additions & 1 deletion TwitchDownloaderWPF/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Interop;
using TwitchDownloaderWPF.Extensions;
using TwitchDownloaderWPF.Properties;
using TwitchDownloaderWPF.Services;
using Xabe.FFmpeg;
Expand Down Expand Up @@ -88,7 +90,8 @@ private async void Window_Loaded(object sender, RoutedEventArgs e)
// it will sometimes start behind other windows, usually (but not always) due to the user's actions.
FlashTaskbarIconIfNotForeground(TimeSpan.FromSeconds(3));

var currentVersion = Version.Parse("1.55.0");
// Despite not specifying a revision in the AssemblyVersion, the compiler still adds one. We don't want that.
var currentVersion = Assembly.GetExecutingAssembly().GetName().Version!.StripRevisionIfDefault();
#if DEBUG
Title = $"Twitch Downloader v{currentVersion} - DEBUG";
#else
Expand Down
3 changes: 1 addition & 2 deletions TwitchDownloaderWPF/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,4 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.55.0")]
Loading