Skip to content
Open
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
27 changes: 27 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.

9 changes: 9 additions & 0 deletions Source/NETworkManager.Localization/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3951,4 +3951,13 @@ If you click Cancel, the profile file will remain unencrypted.</value>
<data name="CouldNotParseX" xml:space="preserve">
<value>Could not parse "{0}".</value>
</data>
<data name="MaximumNumberOfBackups" xml:space="preserve">
<value>Maximum number of backups</value>
</data>
<data name="CreateDailyBackup" xml:space="preserve">
<value>Create daily backup</value>
</data>
<data name="HelpMessage_MaximumNumberOfBackups" xml:space="preserve">
<value>Number of backups that are retained before the oldest one is deleted.</value>
</data>
</root>
1 change: 0 additions & 1 deletion Source/NETworkManager.Models/Network/NetworkInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,6 @@ private static void RemoveIPAddressFromNetworkInterface(NetworkInterfaceConfig c

#endregion


#region Events

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Source/NETworkManager.Profiles/GroupInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,4 @@ public GroupInfo(GroupInfo group) : this(group.Name)
[XmlIgnore] public SecureString SNMP_Auth { get; set; }
public SNMPV3PrivacyProvider SNMP_PrivacyProvider { get; set; } = GlobalStaticConfiguration.SNMP_PrivacyProvider;
[XmlIgnore] public SecureString SNMP_Priv { get; set; }
}
}
1 change: 1 addition & 0 deletions Source/NETworkManager.Profiles/GroupInfoSerializable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public GroupInfoSerializable()

public GroupInfoSerializable(GroupInfo profileGroup) : base(profileGroup)
{

}

/// <summary>
Expand Down
82 changes: 82 additions & 0 deletions Source/NETworkManager.Profiles/ProfileFileData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Text.Json.Serialization;

namespace NETworkManager.Profiles;

/// <summary>
/// Represents the data structure for a profile file, including versioning, backup information, and groups of profiles.
/// </summary>
/// <remarks>This class supports property change notification through the <see cref="INotifyPropertyChanged"/>
/// interface, allowing consumers to track changes to its properties. The <see cref="ProfilesChanged"/> property
/// indicates whether the data has been modified since it was last saved, but is not persisted when serializing the
/// object. Use this class to manage and persist user profile data, including handling schema migrations via the <see
/// cref="Version"/> property.</remarks>
public class ProfileFileData : INotifyPropertyChanged
{
/// <summary>
/// Occurs when a property value changes.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;

/// <summary>
/// Helper method to raise the <see cref="PropertyChanged" /> event and mark data as changed.
/// </summary>
/// <param name="propertyName">Name of the property that changed.</param>
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
ProfilesChanged = true;

PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

/// <summary>
/// Indicates if the profile file data has been modified and needs to be saved.
/// This is not serialized to the file.
/// </summary>
[JsonIgnore]
public bool ProfilesChanged { get; set; }

private int _version = 1;

/// <summary>
/// Schema version for handling future migrations.
/// </summary>
public int Version
{
get => _version;
set
{
if (value == _version)
return;

_version = value;
OnPropertyChanged();
}
}

private DateTime? _lastBackup;

/// <summary>
/// Date of the last backup (used for daily backup tracking).
/// </summary>
public DateTime? LastBackup
{
get => _lastBackup;
set
{
if (value == _lastBackup)
return;

_lastBackup = value;
OnPropertyChanged();
}
}

/// <summary>
/// List of groups containing profiles.
/// </summary>
public List<GroupInfoSerializable> Groups { get; set; } = [];
}
Loading