Skip to content

Commit 78f21ef

Browse files
authored
Chore: Remove migrate-profile & some refactoring (BornToBeRoot#2388)
* Feature: Remove migrate-profile & some refactoring * Docs: Add class documentation * Chore: Docs & refactoring * Docs: BornToBeRoot#2388
1 parent 44be6b5 commit 78f21ef

14 files changed

Lines changed: 100 additions & 173 deletions

File tree

Source/NETworkManager.Localization/Resources/Strings.Designer.cs

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/NETworkManager.Localization/Resources/Strings.resx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2755,9 +2755,13 @@ $$hostname$$ --&gt; Hostname</value>
27552755
<value>Profile could not be loaded!</value>
27562756
</data>
27572757
<data name="ProfileCouldNotBeLoadedMessage" xml:space="preserve">
2758-
<value>If this happened after an update, you may need to migrate the profiles to a newer version. When you click "Migrate", a PowerShell window opens with the migration script. Check the path and press Enter.
2758+
<value>The profile file could not be loaded and may be corrupted. You can try to restore the file from a backup or delete it.
27592759

2760-
Otherwise, the profile may be corrupted and you want to report the issue on GitHub.</value>
2760+
If this happens unexpectedly or after an update, please report the error on GitHub.
2761+
2762+
2763+
Error message:
2764+
"{0}"</value>
27612765
</data>
27622766
<data name="EditGroupDots" xml:space="preserve">
27632767
<value>Edit group...</value>

Source/NETworkManager.Profiles/NETworkManager.Profiles.csproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,9 @@
1515
<ItemGroup>
1616
<FrameworkReference Update="Microsoft.WindowsDesktop.App;Microsoft.WindowsDesktop.App.WPF;Microsoft.WindowsDesktop.App.WindowsForms" TargetingPackVersion="6.0.0" />
1717
</ItemGroup>
18-
<ItemGroup>
19-
<None Remove="Resources\Migrate-Profiles.ps1" />
20-
</ItemGroup>
2118
<ItemGroup>
2219
<Compile Include="..\GlobalAssemblyInfo.cs" Link="Properties\GlobalAssemblyInfo.cs" />
2320
</ItemGroup>
24-
<ItemGroup>
25-
<Content Include="Resources\Migrate-Profiles.ps1">
26-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
27-
</Content>
28-
</ItemGroup>
2921
<ItemGroup>
3022
<PackageReference Include="MahApps.Metro" Version="2.4.9" />
3123
<PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.11.0" />

Source/NETworkManager.Profiles/ProfileManager.cs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,9 @@ public static void Unload(bool saveLoadedProfiles = true)
469469

470470
LoadedProfileFile = null;
471471

472-
Reset();
472+
Groups.Clear();
473+
474+
ProfilesUpdated();
473475
}
474476

475477
/// <summary>
@@ -775,7 +777,6 @@ public static void ReplaceProfile(ProfileInfo oldProfile, ProfileInfo newProfile
775777

776778
Groups.First(x => x.Name.Equals(newProfile.Group)).Profiles.Add(newProfile);
777779

778-
// Notify
779780
ProfilesUpdated();
780781
}
781782

@@ -802,16 +803,4 @@ public static void RemoveProfiles(IList<ProfileInfo> profiles)
802803
ProfilesUpdated();
803804
}
804805
#endregion
805-
806-
#region Helper
807-
/// <summary>
808-
/// Method to reset the profiles.
809-
/// </summary>
810-
public static void Reset()
811-
{
812-
Groups.Clear();
813-
814-
ProfilesUpdated();
815-
}
816-
#endregion
817806
}

Source/NETworkManager.Profiles/Resources/Migrate-Profiles.ps1

Lines changed: 0 additions & 116 deletions
This file was deleted.

Source/NETworkManager.Settings/AssemblyInfo.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,34 @@
22

33
namespace NETworkManager.Settings;
44

5+
/// <summary>
6+
/// Class contains information about the current executing assembly.
7+
/// </summary>
58
public class AssemblyInfo
69
{
7-
public string Title { get; set; }
10+
/// <summary>
11+
/// Version of the current executing assembly.
12+
/// Like "2022.12.24.0".
13+
/// </summary>
814
public Version Version { get; set; }
15+
16+
/// <summary>
17+
/// Location of the current executing assembly.
18+
/// Like "C:\Program Files\NETworkManager\NETworkManager.exe".
19+
/// </summary>
920
public string Location { get; set; }
21+
22+
/// <summary>
23+
/// Name of the current executing assembly.
24+
/// Like "NETworkManager".
25+
/// </summary>
1026
public string Name { get; set; }
1127

28+
/// <summary>
29+
/// Creates a new instance of the <see cref="AssemblyInfo"/> class.
30+
/// </summary>
1231
public AssemblyInfo()
1332
{
1433

1534
}
16-
}
35+
}

Source/NETworkManager.Settings/AssemblyManager.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,20 @@
33

44
namespace NETworkManager.Settings;
55

6+
/// <summary>
7+
/// Class contains information about the current executing assembly.
8+
/// </summary>
69
public static class AssemblyManager
710
{
11+
/// <summary>
12+
/// Current executing assembly.
13+
/// </summary>
814
public static AssemblyInfo Current { get; set; }
915

16+
/// <summary>
17+
/// Creates a new instance of the <see cref="AssemblyManager"/> class and
18+
/// sets the <see cref="Current"/> property on the first call.
19+
/// </summary>
1020
static AssemblyManager()
1121
{
1222
var assembly = Assembly.GetEntryAssembly();

Source/NETworkManager.Settings/AutostartManager.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@
33

44
namespace NETworkManager.Settings;
55

6+
/// <summary>
7+
/// Class to manage the autostart of the application
8+
/// </summary>
69
public class AutostartManager
710
{
811
// Key where the autorun entries for the current user are stored
912
private const string RunKeyCurrentUser = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
1013

14+
/// <summary>
15+
/// Indicates if the application autostart is enabled.
16+
/// </summary>
1117
public static bool IsEnabled
1218
{
1319
get
@@ -18,11 +24,18 @@ public static bool IsEnabled
1824
}
1925
}
2026

27+
/// <summary>
28+
/// Enable the autostart of the application async.
29+
/// </summary>
30+
/// <returns><see cref="Task"/> to wait for.</returns>
2131
public static Task EnableAsync()
2232
{
2333
return Task.Run(() => Enable());
2434
}
2535

36+
/// <summary>
37+
/// Enable the autostart of the application.
38+
/// </summary>
2639
public static void Enable()
2740
{
2841
var registryKey = Registry.CurrentUser.OpenSubKey(RunKeyCurrentUser, true);
@@ -36,11 +49,18 @@ public static void Enable()
3649
registryKey.Close();
3750
}
3851

52+
/// <summary>
53+
/// Disable the autostart of the application async.
54+
/// </summary>
55+
/// <returns><see cref="Task"/> to wait for.</returns>
3956
public static Task DisableAsync()
4057
{
4158
return Task.Run(() => Disable());
4259
}
4360

61+
/// <summary>
62+
/// Disable the autostart of the application.
63+
/// </summary>
4464
public static void Disable()
4565
{
4666
var registryKey = Registry.CurrentUser.OpenSubKey(RunKeyCurrentUser, true);

Source/NETworkManager.Settings/BaseColorInfo.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ namespace NETworkManager.Settings;
77
/// </summary>
88
public abstract class BaseColorInfo
99
{
10+
/// <summary>
11+
/// Gets or sets the name of the theme/accent.
12+
/// </summary>
1013
public string Name { get; set; }
14+
15+
/// <summary>
16+
/// Gets or sets the color of the theme/accent.
17+
/// </summary>
1118
public Brush Color { get; set; }
1219
}

Source/NETworkManager.Settings/ConfigurationInfo.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,15 @@ public bool FixAirspace
9898

9999
#region Constructor
100100
/// <summary>
101-
/// Create a new instance of <see cref="ConfigurationInfo"/>.
101+
/// Create a new instance of <see cref="ConfigurationInfo"/> with static configuration.
102102
/// </summary>
103-
public ConfigurationInfo()
103+
public ConfigurationInfo(bool isAdmin, string executionPath, string applicationFullName, string applicationName, bool isPortable)
104104
{
105-
105+
IsAdmin = isAdmin;
106+
ExecutionPath = executionPath;
107+
ApplicationFullName = applicationFullName;
108+
ApplicationName = applicationName;
109+
IsPortable = isPortable;
106110
}
107111
#endregion
108112
}

0 commit comments

Comments
 (0)