Skip to content

Commit

Permalink
change: simplify version getter
Browse files Browse the repository at this point in the history
  • Loading branch information
emako committed Sep 29, 2024
1 parent 1856e60 commit 3b5a93d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 59 deletions.
21 changes: 1 addition & 20 deletions build/MicaSetup.Tools/MakeIcon/ViewModels/AboutViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Reflection;
using System.Text;

namespace MakeIcon.ViewModels;

public partial class AboutViewModel : ObservableObject
{
[ObservableProperty]
private string version = $"v{Assembly.GetCallingAssembly().GetAssemblyVersion()}";
}

file static class AssemblyExtensions
{
public static string GetAssemblyVersion(this Assembly assembly)
{
Version version = assembly.GetName().Version;
StringBuilder sb = new();

sb.Append(version.Major);
sb.Append(".");
sb.Append(version.Minor);
sb.Append(".");
sb.Append(version.Build);

return sb.ToString();
}
private string version = $"v{Assembly.GetCallingAssembly().GetName().Version.ToString(3)}";
}
21 changes: 1 addition & 20 deletions build/MicaSetup.Tools/MakeMica/ViewModels/AboutViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Reflection;
using System.Text;

namespace MakeMica.ViewModels;

public partial class AboutViewModel : ObservableObject
{
[ObservableProperty]
private string version = $"v{Assembly.GetCallingAssembly().GetAssemblyVersion()}";
}

file static class AssemblyExtensions
{
public static string GetAssemblyVersion(this Assembly assembly)
{
Version version = assembly.GetName().Version;
StringBuilder sb = new();

sb.Append(version.Major);
sb.Append(".");
sb.Append(version.Minor);
sb.Append(".");
sb.Append(version.Build);

return sb.ToString();
}
private string version = $"v{Assembly.GetCallingAssembly().GetName().Version.ToString(3)}";
}
20 changes: 1 addition & 19 deletions build/MicaSetup.Tools/MakeMui/ViewModels/AboutViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
using CommunityToolkit.Mvvm.ComponentModel;
using System.Reflection;
using System.Text;

namespace MakeMui.ViewModels;

public partial class AboutViewModel : ObservableObject
{
[ObservableProperty]
private string version = $"v{Assembly.GetCallingAssembly().GetAssemblyVersion()}";
}

file static class AssemblyExtensions
{
public static string GetAssemblyVersion(this Assembly assembly)
{
Version version = assembly.GetName().Version;
StringBuilder sb = new();

sb.Append(version.Major);
sb.Append(".");
sb.Append(version.Minor);
sb.Append(".");
sb.Append(version.Build);

return sb.ToString();
}
private string version = $"v{Assembly.GetCallingAssembly().GetName().Version.ToString(3)}";
}

0 comments on commit 3b5a93d

Please sign in to comment.