Skip to content
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
4 changes: 2 additions & 2 deletions Source/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("2025.5.22.0")]
[assembly: AssemblyFileVersion("2025.5.22.0")]
[assembly: AssemblyVersion("2025.6.13.0")]
[assembly: AssemblyFileVersion("2025.6.13.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -203,5 +203,10 @@ public enum DocumentationIdentifier
/// <summary>
/// Command line arguments.
/// </summary>
CommandLineArguments
CommandLineArguments,

/// <summary>
/// Changelog base documentation page.
/// </summary>
ChangelogBase
}
22 changes: 11 additions & 11 deletions Source/NETworkManager.Documentation/DocumentationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,12 @@ public static class DocumentationManager
@"Documentation/profiles"),

new DocumentationInfo(DocumentationIdentifier.CommandLineArguments,
@"docs/commandline-arguments")
@"docs/commandline-arguments"),

new DocumentationInfo(DocumentationIdentifier.ChangelogBase,
@"docs/changelog")
];

/// <summary>
/// Command to open a documentation page based on <see cref="DocumentationIdentifier" />.
/// </summary>
public static ICommand OpenDocumentationCommand => new RelayCommand(OpenDocumentationAction);

/// <summary>
/// Method to create the documentation url from <see cref="DocumentationIdentifier" />.
/// </summary>
Expand Down Expand Up @@ -179,13 +177,15 @@ public static void OpenDocumentation(DocumentationIdentifier documentationIdenti
}

/// <summary>
/// Method to open a documentation page based on <see cref="DocumentationIdentifier" />.
/// Method to open the current changelog in the default web browser.
/// </summary>
/// <param name="documentationIdentifier"></param>
private static void OpenDocumentationAction(object documentationIdentifier)
public static void OpenChangelog()
{
if (documentationIdentifier != null)
OpenDocumentation((DocumentationIdentifier)documentationIdentifier);
var url = CreateUrl(DocumentationIdentifier.ChangelogBase);

url += $"/{AssemblyManager.Current.Version.ToString().Replace('.', '-')}";

ExternalProcessStarter.OpenUrl(url);
}

/// <summary>
Expand Down
36 changes: 36 additions & 0 deletions Source/NETworkManager.Localization/Resources/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Source/NETworkManager.Localization/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3918,4 +3918,16 @@ Right-click for more options.</value>
<data name="RetryingInXSecondsDots" xml:space="preserve">
<value>Retrying in {0} seconds...</value>
</data>
<data name="WhatsNew" xml:space="preserve">
<value>What's new?</value>
</data>
<data name="Changelog" xml:space="preserve">
<value>Changelog</value>
</data>
<data name="UpgradedToXXX" xml:space="preserve">
<value>Upgraded to {0}</value>
</data>
<data name="WhatsNewMessage" xml:space="preserve">
<value>This release includes new features, improvements, and bug fixes. Check out the changelog for all the details!</value>
</data>
</root>
2 changes: 1 addition & 1 deletion Source/NETworkManager.Settings/ConfigurationInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public ConfigurationInfo(bool isAdmin, string executionPath, string applicationF
/// <summary>
/// Indicates that the application is running as administrator.
/// </summary>
public bool IsAdmin { get; set; }
public bool IsAdmin { get; }

/// <summary>
/// Execution path of the application like "C:\Program Files\NETworkManager".
Expand Down
15 changes: 8 additions & 7 deletions Source/NETworkManager.Settings/ConfigurationManager.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.IO;
using NETworkManager.Models;
using System.IO;
using System.Security.Principal;
using NETworkManager.Models;

namespace NETworkManager.Settings;

Expand All @@ -26,11 +26,12 @@ public static class ConfigurationManager
static ConfigurationManager()
{
Current = new ConfigurationInfo(
new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator),
AssemblyManager.Current.Location,
Path.Combine(AssemblyManager.Current.Location, AssemblyManager.Current.Name + ".exe"),
AssemblyManager.Current.Name,
File.Exists(Path.Combine(AssemblyManager.Current.Location, $"{IsPortableFileName}.{IsPortableExtension}")));
isAdmin: new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator),
executionPath: AssemblyManager.Current.Location,
applicationFullName: Path.Combine(AssemblyManager.Current.Location, AssemblyManager.Current.Name + ".exe"),
applicationName: AssemblyManager.Current.Name,
isPortable: File.Exists(Path.Combine(AssemblyManager.Current.Location, $"{IsPortableFileName}.{IsPortableExtension}"))
);
}

/// <summary>
Expand Down
45 changes: 45 additions & 0 deletions Source/NETworkManager.Settings/SettingsInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,18 @@ namespace NETworkManager.Settings;

public class SettingsInfo : INotifyPropertyChanged
{
/// <summary>
/// Occurs when a property value changes.
/// </summary>
/// <remarks>This event is typically used to notify subscribers that a property value has been updated. It
/// is commonly implemented in classes that support data binding or need to signal changes to property
/// values.</remarks>
public event PropertyChangedEventHandler PropertyChanged;

/// <summary>
/// Helper method to raise the <see cref="PropertyChanged" /> event.
/// </summary>
/// <param name="propertyName">Name of the property that changed.</param>
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
SettingsChanged = true;
Expand All @@ -35,8 +45,14 @@ private void OnPropertyChanged([CallerMemberName] string propertyName = null)

[XmlIgnore] public bool SettingsChanged { get; set; }

/// <summary>
/// Private field for the <see cref="WelcomeDialog_Show" /> property.
/// </summary>
private bool _welcomeDialog_Show = true;

/// <summary>
/// Determines if the welcome dialog should be shown on application start.
/// </summary>
public bool WelcomeDialog_Show
{
get => _welcomeDialog_Show;
Expand All @@ -50,8 +66,37 @@ public bool WelcomeDialog_Show
}
}

/// <summary>
/// Private field for the <see cref="UpgradeDialog_Show" /> property.
/// </summary>
private bool _upgradeDialog_Show;

/// <summary>
/// Indicates if the update dialog should be shown on application start.
/// Usually this is set to true if the application has been updated to a new version.
/// </summary>
public bool UpgradeDialog_Show
{
get => _upgradeDialog_Show;
set
{
if (value == _upgradeDialog_Show)
return;

_upgradeDialog_Show = value;
OnPropertyChanged();
}
}

/// <summary>
/// Private field for the <see cref="Version" /> property.
/// </summary>
private string _version;

/// <summary>
/// Version of the settings file. Should be identical to the version of the application.
/// It is used to determine if the settings file needs to be updated.
/// </summary>
public string Version
{
get => _version;
Expand Down
3 changes: 2 additions & 1 deletion Source/NETworkManager.Settings/SettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ public static void Upgrade(Version fromVersion, Version toVersion)
if (fromVersion < new Version(2023, 11, 28, 0))
UpgradeTo_2023_11_28_0();


// 2024.11.11.0
if (fromVersion < new Version(2024, 11, 11, 0))
UpgradeTo_2024_11_11_0();
Expand All @@ -196,7 +195,9 @@ public static void Upgrade(Version fromVersion, Version toVersion)
UpgradeToLatest(toVersion);

// Update to the latest version and save
Current.UpgradeDialog_Show = true;
Current.Version = toVersion.ToString();

Save();

Log.Info("Settings upgrade finished!");
Expand Down
31 changes: 26 additions & 5 deletions Source/NETworkManager/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public ProfileFileInfo SelectedProfileFile
{
if (!_isProfileFileUpdating)
LoadProfile(value);

ConfigurationManager.Current.ProfileManagerShowUnlock = value.IsEncrypted && !value.IsPasswordValid;
SettingsManager.Current.Profiles_LastSelected = value.Name;
}
Expand Down Expand Up @@ -513,6 +513,27 @@ await this.ShowMessageAsync(Strings.SettingsHaveBeenReset,

await this.ShowChildWindowAsync(childWindow);
}
else if (SettingsManager.Current.UpgradeDialog_Show)
{
var childWindow = new UpgradeChildWindow();

var viewModel = new UpgradeViewModel(instance =>
{
childWindow.IsOpen = false;

SettingsManager.Current.UpgradeDialog_Show = false;

SettingsManager.Save();

Load();
});

childWindow.DataContext = viewModel;

ConfigurationManager.Current.IsChildWindowOpen = true;

await this.ShowChildWindowAsync(childWindow);
}
else
{
Load();
Expand Down Expand Up @@ -826,11 +847,11 @@ private void OnApplicationViewVisible(ApplicationName name, bool fromSettings =
ContentControlApplication.Content = _sntpLookupHostView;
break;
case ApplicationName.HostsFileEditor:
if(_hostsFileEditorView == null)
if (_hostsFileEditorView == null)
_hostsFileEditorView = new HostsFileEditorView();
else
_hostsFileEditorView.OnViewVisible();

ContentControlApplication.Content = _hostsFileEditorView;
break;
case ApplicationName.DiscoveryProtocol:
Expand Down Expand Up @@ -913,7 +934,7 @@ private void OnApplicationViewVisible(ApplicationName name, bool fromSettings =

ContentControlApplication.Content = _arpTableView;
break;

default:
Log.Error("Cannot show unknown application view: " + name);
break;
Expand Down Expand Up @@ -1387,7 +1408,7 @@ private void LoadProfiles()
.FirstOrDefault(x => x.Name == SettingsManager.Current.Profiles_LastSelected);
SelectedProfileFile ??= ProfileFiles.SourceCollection.Cast<ProfileFileInfo>().FirstOrDefault();
}

private async void LoadProfile(ProfileFileInfo info, bool showWrongPassword = false)
{
// Disable profile management while switching profiles
Expand Down
33 changes: 33 additions & 0 deletions Source/NETworkManager/ViewModels/UpgradeViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using NETworkManager.Documentation;
using NETworkManager.Settings;
using NETworkManager.Utilities;
using System;
using System.Windows.Input;

namespace NETworkManager.ViewModels;

public class UpgradeViewModel : ViewModelBase
{
public static string Title => string.Format(Localization.Resources.Strings.UpgradedToXXX, AssemblyManager.Current.Version);

public UpgradeViewModel(Action<UpgradeViewModel> continueCommand)
{
ContinueCommand = new RelayCommand(_ => continueCommand(this));
}

public ICommand OpenWebsiteCommand => new RelayCommand(OpenWebsiteAction);

private static void OpenWebsiteAction(object url)
{
ExternalProcessStarter.OpenUrl((string)url);
}

public ICommand OpenChangelogCommand => new RelayCommand(OpenChangelogAction);

private void OpenChangelogAction(object obj)
{
DocumentationManager.OpenChangelog();
}

public ICommand ContinueCommand { get; }
}
Loading