Skip to content

Commit 8ddab9d

Browse files
authored
Merge pull request #140 from nutdotnet/135-setup-enhancements
Fix Application Settings not carrying over on upgrade/update
2 parents 1d888ba + da9b79b commit 8ddab9d

9 files changed

+56
-58
lines changed

WinNUT_V2/.editorconfig

+11-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ root = true
66
# All files
77
[*]
88
indent_style = space
9-
file_header_template = WinNUT-Client is a NUT windows client for monitoring your ups hooked up to your favorite linux server.\nCopyright (C) 2019-2021 Gawindx (Decaux Nicolas)\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the\nGNU General Public License as published by the Free Software Foundation, either version 3 of the\nLicense, or any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\neven the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with this program.\nIf not, see https://www.gnu.org/licenses/.\n
109
# Code files
1110
[*.{cs,csx,vb,vbx}]
1211
indent_size = 4
@@ -67,14 +66,16 @@ tab_width = 4
6766
end_of_line = crlf
6867
dotnet_style_allow_multiple_blank_lines_experimental = true:silent
6968
dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
69+
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
70+
dotnet_code_quality_unused_parameters = all:suggestion
7071
###############################
7172
# C# Coding Conventions #
7273
###############################
7374
[*.cs]
7475
# var preferences
75-
csharp_style_var_for_built_in_types = true:silent
76-
csharp_style_var_when_type_is_apparent = true:silent
77-
csharp_style_var_elsewhere = true:silent
76+
csharp_style_var_for_built_in_types = false:silent
77+
csharp_style_var_when_type_is_apparent = false:silent
78+
csharp_style_var_elsewhere = false:silent
7879
# Expression-bodied members
7980
csharp_style_expression_bodied_methods = false:silent
8081
csharp_style_expression_bodied_constructors = false:silent
@@ -149,6 +150,12 @@ csharp_style_prefer_readonly_struct_member = true:suggestion
149150
csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
150151
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent
151152
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
153+
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
154+
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
155+
csharp_style_prefer_switch_expression = true:suggestion
156+
csharp_style_prefer_pattern_matching = true:silent
157+
csharp_style_prefer_not_pattern = true:suggestion
158+
csharp_style_prefer_extended_property_pattern = true:suggestion
152159
###############################
153160
# VB Coding Conventions #
154161
###############################

WinNUT_V2/Setup/Setup.vdproj

+5-5
Original file line numberDiff line numberDiff line change
@@ -9379,7 +9379,7 @@
93799379
{
93809380
"AssemblyRegister" = "3:1"
93819381
"AssemblyIsInGAC" = "11:FALSE"
9382-
"AssemblyAsmDisplayName" = "8:AGauge, Version=2.1.8824.26289, Culture=neutral, processorArchitecture=MSIL"
9382+
"AssemblyAsmDisplayName" = "8:AGauge, Version=2.1.8834.24289, Culture=neutral, processorArchitecture=MSIL"
93839383
"ScatterAssemblies"
93849384
{
93859385
"_7643B2E01E55816C8BA2265FF9E9B786"
@@ -11434,7 +11434,7 @@
1143411434
{
1143511435
"AssemblyRegister" = "3:1"
1143611436
"AssemblyIsInGAC" = "11:FALSE"
11437-
"AssemblyAsmDisplayName" = "8:WinNUT-Client_Common, Version=2.3.8824.26289, Culture=neutral, processorArchitecture=MSIL"
11437+
"AssemblyAsmDisplayName" = "8:WinNUT-Client_Common, Version=2.3.8834.24289, Culture=neutral, processorArchitecture=MSIL"
1143811438
"ScatterAssemblies"
1143911439
{
1144011440
"_CB7240238DDFA669FCF3046E48D0A447"
@@ -12788,15 +12788,15 @@
1278812788
{
1278912789
"Name" = "8:Microsoft Visual Studio"
1279012790
"ProductName" = "8:WinNUT Client"
12791-
"ProductCode" = "8:{ED2181E2-D5FB-43AE-B50E-A0D019730CEB}"
12792-
"PackageCode" = "8:{5AAB5E2D-D11E-46D6-906F-F0F7385AFB42}"
12791+
"ProductCode" = "8:{AAAE0531-0B77-4CE7-A034-1583EA07BD87}"
12792+
"PackageCode" = "8:{8DFC349A-62F6-4FF2-BB1F-7C42432D8772}"
1279312793
"UpgradeCode" = "8:{7EA17151-76E7-4E29-8F6A-621C1B4144C2}"
1279412794
"AspNetVersion" = "8:2.0.50727.0"
1279512795
"RestartWWWService" = "11:FALSE"
1279612796
"RemovePreviousVersions" = "11:TRUE"
1279712797
"DetectNewerInstalledVersion" = "11:TRUE"
1279812798
"InstallAllUsers" = "11:FALSE"
12799-
"ProductVersion" = "8:2.3.8824"
12799+
"ProductVersion" = "8:2.3.8834"
1280012800
"Manufacturer" = "8:NUTDotNet"
1280112801
"ARPHELPTELEPHONE" = "8:"
1280212802
"ARPHELPLINK" = "8:https://github.com/nutdotnet/WinNUT-Client/issues"

WinNUT_V2/SharedAssemblyInfo.vb

+1-27
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,10 @@
1-
' WinNUT-Client is a NUT windows client for monitoring your ups hooked up to your favorite linux server.
2-
' Copyright (C) 2019-2021 Gawindx (Decaux Nicolas)
3-
'
4-
' This program is free software: you can redistribute it and/or modify it under the terms of the
5-
' GNU General Public License as published by the Free Software Foundation, either version 3 of the
6-
' License, or any later version.
7-
'
8-
' This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY
9-
1+
Imports System.Reflection
102
Imports System.Resources
11-
Imports System.Reflection
12-
13-
' Les informations générales relatives à un assembly dépendent de
14-
' l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
15-
' associées à un assembly.
16-
17-
' Vérifiez les valeurs des attributs de l'assembly
183

194
<Assembly: AssemblyCompany("NUTDotNet")>
205
<Assembly: AssemblyProduct("WinNUT Client")>
216
<Assembly: AssemblyCopyright("NUTDotNet contributors © 2019-2024")>
227
<Assembly: AssemblyTrademark("https://github.com/nutdotnet/WinNUT-Client")>
238

24-
' Les informations de version pour un assembly se composent des quatre valeurs suivantes :
25-
'
26-
' Version principale
27-
' Version secondaire
28-
' Numéro de build
29-
' Révision
30-
'
31-
' Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
32-
' en utilisant '*', comme indiqué ci-dessous :
33-
' <Assembly: AssemblyVersion("1.0.*")>
34-
359
<Assembly: AssemblyVersion("2.3.*")>
3610
<Assembly: NeutralResourcesLanguage("en-US")>

WinNUT_V2/WinNUT-Client/App.config

+3
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@
157157
<setting name="CAL_BattVMax" serializeAs="String">
158158
<value>18</value>
159159
</setting>
160+
<setting name="IsFirstRun" serializeAs="String">
161+
<value>True</value>
162+
</setting>
160163
</WinNUT_Client.My.MySettings>
161164
</userSettings>
162165
</configuration>

WinNUT_V2/WinNUT-Client/ApplicationEvents.vb

+17
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,24 @@ Namespace My
4040
Private Sub MyApplication_Startup(sender As Object, e As StartupEventArgs) Handles Me.Startup
4141
' Uncomment below and comment out Handles line for _UnhandledException sub when debugging unhandled exceptions.
4242
' AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf AppDomainUnhandledException
43+
4344
Init_Globals()
45+
46+
' If first run indicated by Settings, attempt upgrade in case older version is present.
47+
' Only necessary when deploying MSI. Remove once using pure ClickOnce.
48+
If Settings.IsFirstRun Then
49+
Try
50+
Settings.Upgrade()
51+
LogFile.LogTracing("Settings upgrade completed without exception.", LogLvl.LOG_NOTICE, Me)
52+
Catch ex As ConfigurationErrorsException
53+
LogFile.LogTracing("Error encountered while trying to upgrade Settings:", LogLvl.LOG_ERROR, Me)
54+
LogFile.LogException(ex, Me)
55+
End Try
56+
57+
Settings.IsFirstRun = False
58+
Settings.Save()
59+
End If
60+
4461
LogFile.LogTracing("MyApplication_Startup complete.", LogLvl.LOG_DEBUG, Me)
4562
End Sub
4663

Original file line numberDiff line numberDiff line change
@@ -1,26 +1,7 @@
1-
Imports System.Resources
2-
' WinNUT-Client is a NUT windows client for monitoring your ups hooked up to your favorite linux server.
3-
' Copyright (C) 2019-2021 Gawindx (Decaux Nicolas)
4-
'
5-
' This program is free software: you can redistribute it and/or modify it under the terms of the
6-
' GNU General Public License as published by the Free Software Foundation, either version 3 of the
7-
' License, or any later version.
8-
'
9-
' This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY
10-
11-
Imports System.Reflection
1+
Imports System.Reflection
122
Imports System.Runtime.InteropServices
133

14-
' Les informations générales relatives à un assembly dépendent de
15-
' l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
16-
' associées à un assembly.
17-
18-
' Vérifiez les valeurs des attributs de l'assembly
19-
204
<Assembly: AssemblyTitle("WinNUT Client")>
21-
<Assembly: AssemblyDescription("")>
22-
5+
<Assembly: AssemblyDescription("WinForms-based client for monitoring your Uninterruptible Power Supply (UPS) connected to a Network UPS Tools (NUT) server.")>
236
<Assembly: ComVisible(False)>
24-
25-
'Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
267
<Assembly: Guid("00424259-e020-4e5c-a70a-5660aa21cb0b")>

WinNUT_V2/WinNUT-Client/My Project/Settings.Designer.vb

+13-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WinNUT_V2/WinNUT-Client/My Project/Settings.settings

+3
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,8 @@
116116
<Setting Name="CAL_BattVMax" Type="System.Int32" Scope="User">
117117
<Value Profile="(Default)">18</Value>
118118
</Setting>
119+
<Setting Name="IsFirstRun" Type="System.Boolean" Scope="User">
120+
<Value Profile="(Default)">True</Value>
121+
</Setting>
119122
</Settings>
120123
</SettingsFile>

WinNUT_V2/WinNUT-Client/WinNUT-client.vbproj

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
</PropertyGroup>
113113
<ItemGroup>
114114
<Reference Include="System" />
115+
<Reference Include="System.Configuration" />
115116
<Reference Include="System.Data" />
116117
<Reference Include="System.Deployment" />
117118
<Reference Include="System.Drawing" />

0 commit comments

Comments
 (0)