diff --git a/WinNUT_V2/WinNUT-Client/About_Gui.vb b/WinNUT_V2/WinNUT-Client/About_Gui.vb index b0163f9..86c71bd 100644 --- a/WinNUT_V2/WinNUT-Client/About_Gui.vb +++ b/WinNUT_V2/WinNUT-Client/About_Gui.vb @@ -11,7 +11,7 @@ Imports WinNUT_Client_Common Public Class About_Gui Private Sub About_Gui_Load(sender As Object, e As EventArgs) Handles MyBase.Load - Lbl_ProgNameVersion.Text = LongProgramName & vbNewLine & "Version " & ProgramVersion + Lbl_ProgNameVersion.Text = ProgramName & vbNewLine & "Version " & ProgramVersion Lbl_Copyright_2019.Text = Replace(Copyright, "©", vbNewLine & "©") LkLbl_Github.Text = GitHubURL Icon = WinNUT.Icon diff --git a/WinNUT_V2/WinNUT-Client/App.config b/WinNUT_V2/WinNUT-Client/App.config index 7cd79ec..2afa4ac 100644 --- a/WinNUT_V2/WinNUT-Client/App.config +++ b/WinNUT_V2/WinNUT-Client/App.config @@ -83,7 +83,7 @@ 0 - + 30 diff --git a/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-Client.zh-TW.xlf b/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-Client.zh-TW.xlf index c20e3ff..ffa639f 100644 --- a/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-Client.zh-TW.xlf +++ b/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-Client.zh-TW.xlf @@ -1742,9 +1742,10 @@ Accepted value: Numeric value from 0 to 100. 除錯 - Time between each update of UPS data (default = 5). -Accepted value: Numerical value from 1 to 60 seconds. - UPS 資料更新頻率 (預設值 5 秒)。範圍:1-60 秒。 + Milliseconds between data updates from NUT server. +Min: 100, Max: 60 000. + UPS 資料更新頻率 (預設值 5 秒)。範圍:1-60 秒。 + Please verify the translation’s accuracy as the source string was updated after it was translated. NoControl diff --git a/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-client.de-DE.xlf b/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-client.de-DE.xlf index 2e8c791..27448fa 100644 --- a/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-client.de-DE.xlf +++ b/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-client.de-DE.xlf @@ -1235,9 +1235,10 @@ 17, 17 - Time between each update of UPS data (default = 5). -Accepted value: Numerical value from 1 to 60 seconds. - Zeit zwischen jeder Aktualisierung der USV-Daten (Standard = 5).Wertebereich: Numerischer Wert von 1 bis 60 Sekunden. + Milliseconds between data updates from NUT server. +Min: 100, Max: 60 000. + Zeit zwischen jeder Aktualisierung der USV-Daten (Standard = 5).Wertebereich: Numerischer Wert von 1 bis 60 Sekunden. + Please verify the translation’s accuracy as the source string was updated after it was translated. UPS name to monitor. diff --git a/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-client.fr-FR.xlf b/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-client.fr-FR.xlf index 6be50b0..5a690e2 100644 --- a/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-client.fr-FR.xlf +++ b/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-client.fr-FR.xlf @@ -1238,10 +1238,11 @@ inférieur à 17, 17 - Time between each update of UPS data (default = 5). -Accepted value: Numerical value from 1 to 60 seconds. - Temps entre chaque mise à jour des données UPS (par défaut = 5). + Milliseconds between data updates from NUT server. +Min: 100, Max: 60 000. + Temps entre chaque mise à jour des données UPS (par défaut = 5). Valeur acceptée: valeur numérique de 1 à 60 secondes. + Please verify the translation’s accuracy as the source string was updated after it was translated. UPS name to monitor. diff --git a/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-client.ru-RU.xlf b/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-client.ru-RU.xlf index 584371f..2030c24 100644 --- a/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-client.ru-RU.xlf +++ b/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-client.ru-RU.xlf @@ -1274,10 +1274,11 @@ along with this program. If not, see https://www.gnu.org/licenses/. 12 - Time between each update of UPS data (default = 5). -Accepted value: Numerical value from 1 to 60 seconds. - Время между обновлениями данных ИБП (по умолчанию = 5). + Milliseconds between data updates from NUT server. +Min: 100, Max: 60 000. + Время между обновлениями данных ИБП (по умолчанию = 5). Число от 1 до 60 секунд. + Please verify the translation’s accuracy as the source string was updated after it was translated. 154, 71 diff --git a/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-client.zh-CN.xlf b/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-client.zh-CN.xlf index 6e20a84..3eb4082 100644 --- a/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-client.zh-CN.xlf +++ b/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-client.zh-CN.xlf @@ -1438,10 +1438,11 @@ Accepted value: Numeric value from 0 to 999. 12 - Time between each update of UPS data (default = 5). -Accepted value: Numerical value from 1 to 60 seconds. - 每次更新UPS数据之间的时间(默认= 5)。 + Milliseconds between data updates from NUT server. +Min: 100, Max: 60 000. + 每次更新UPS数据之间的时间(默认= 5)。 接受值:1到60秒之间的数值。 + Please verify the translation’s accuracy as the source string was updated after it was translated. 154, 71 diff --git a/WinNUT_V2/WinNUT-Client/My Project/Resources.Designer.vb b/WinNUT_V2/WinNUT-Client/My Project/Resources.Designer.vb index f06cc79..57b121c 100644 --- a/WinNUT_V2/WinNUT-Client/My Project/Resources.Designer.vb +++ b/WinNUT_V2/WinNUT-Client/My Project/Resources.Designer.vb @@ -688,6 +688,24 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Old preferences were not detected in your system.. + ''' + Public ReadOnly Property ManageOldPrefsToolstripMenuItem_Disabled_TooltipText() As String + Get + Return ResourceManager.GetString("ManageOldPrefsToolstripMenuItem_Disabled_TooltipText", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Old preferences detected. Click to run the import wizard.. + ''' + Public ReadOnly Property ManageOldPrefsToolstripMenuItem_Enabled_TooltipText() As String + Get + Return ResourceManager.GetString("ManageOldPrefsToolstripMenuItem_Enabled_TooltipText", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized resource of type System.Drawing.Bitmap. ''' @@ -793,6 +811,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Unavailable. + ''' + Public ReadOnly Property VariableUnavailable() As String + Get + Return ResourceManager.GetString("VariableUnavailable", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized resource of type System.Drawing.Bitmap. ''' diff --git a/WinNUT_V2/WinNUT-Client/My Project/Resources.resx b/WinNUT_V2/WinNUT-Client/My Project/Resources.resx index e336888..8786915 100644 --- a/WinNUT_V2/WinNUT-Client/My Project/Resources.resx +++ b/WinNUT_V2/WinNUT-Client/My Project/Resources.resx @@ -321,6 +321,14 @@ Cancel to Save Msi and Install Later Stop condition imposed by the NUT server + + Old preferences were not detected in your system. + Similar to _Enabled tooltip, except that the preferences were not detected. + + + Old preferences detected. Click to run the import wizard. + Tooltip of the "manage old prefs" menu item, explaining that the old preferences were detected and that clicking will open the wizard dialog. + ..\Resources\regedit.exe_14_100-0.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -367,6 +375,10 @@ Please correct the error, or cancel the upgrade dialog to continue with the defa ..\Resources\ups_104x104.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + Unavailable + Indicate that a variable is unavailable + ..\Resources\ViewLogFile_24x24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/WinNUT_V2/WinNUT-Client/My Project/Settings.Designer.vb b/WinNUT_V2/WinNUT-Client/My Project/Settings.Designer.vb index 0ceacf9..571af38 100644 --- a/WinNUT_V2/WinNUT-Client/My Project/Settings.Designer.vb +++ b/WinNUT_V2/WinNUT-Client/My Project/Settings.Designer.vb @@ -15,7 +15,7 @@ Option Explicit On Namespace My _ Partial Friend NotInheritable Class MySettings Inherits Global.System.Configuration.ApplicationSettingsBase diff --git a/WinNUT_V2/WinNUT-Client/Pref_Gui.resx b/WinNUT_V2/WinNUT-Client/Pref_Gui.resx index d1eba9b..791eb36 100644 --- a/WinNUT_V2/WinNUT-Client/Pref_Gui.resx +++ b/WinNUT_V2/WinNUT-Client/Pref_Gui.resx @@ -117,6 +117,26 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 154, 191 + + + + * + + + 162, 20 + + + 17 + + + 17, 17 + + + NUT server login password + Tb_Pwd_Nut @@ -129,6 +149,18 @@ 0 + + 154, 161 + + + 162, 20 + + + 15 + + + NUT server connection identifier + Tb_Login_Nut @@ -141,6 +173,25 @@ 1 + + True + + + + NoControl + + + 6, 132 + + + 300, 13 + + + 13 + + + Login credentials to the Nut server (leave blank if not required) + Label3 @@ -153,6 +204,24 @@ 2 + + True + + + NoControl + + + 6, 192 + + + 53, 13 + + + 16 + + + Password + Lbl_Pwd_Nut @@ -165,6 +234,24 @@ 3 + + True + + + NoControl + + + 6, 162 + + + 33, 13 + + + 14 + + + Login + Lbl_Login_Nut @@ -177,6 +264,19 @@ 4 + + 154, 101 + + + 162, 20 + + + 12 + + + Milliseconds between data updates from NUT server. +Min: 100, Max: 60 000. + Tb_Delay_Com @@ -189,6 +289,19 @@ 5 + + 154, 71 + + + 162, 20 + + + 10 + + + UPS name to monitor. +Accepted Value: Name of the UPS configured in the Nut server. + Tb_UPS_Name @@ -201,6 +314,22 @@ 6 + + 154, 41 + + + 5 + + + 162, 20 + + + 8 + + + Nut Server Port Number (default = 3493). +Accepted value: Numeric value from 1 to 65535. + Tb_Port @@ -213,6 +342,19 @@ 7 + + 154, 11 + + + 162, 20 + + + 6 + + + Nut server address. +Accepted value: IPV4 / IPV6 / FQDN address. + Tb_Server_IP @@ -225,6 +367,30 @@ 8 + + True + + + 66, 213 + + + 250, 0 + + + Yes + + + 250, 17 + + + 18 + + + Re-establish connection + + + Activate automatic connection / reconnection + Cb_Reconnect @@ -237,6 +403,21 @@ 9 + + True + + + 6, 102 + + + 76, 13 + + + 11 + + + Polling Interval + Lbl_Delay_Com @@ -249,6 +430,21 @@ 10 + + True + + + 6, 72 + + + 60, 13 + + + 9 + + + UPS Name + Lbl_Name_UPS @@ -261,6 +457,21 @@ 11 + + True + + + 6, 42 + + + 52, 13 + + + 7 + + + NUT Port + Lbl_Port @@ -273,6 +484,24 @@ 12 + + True + + + 6, 12 + + + 53, 13 + + + 5 + + + NUT host + + + MiddleCenter + Lbl_Server_IP @@ -285,18 +514,15 @@ 13 - 4, 22 - 3, 3, 3, 3 322, 234 - 0 @@ -333,9 +559,6 @@ 11 - - 17, 17 - Sets the input frequency if not supplied by the UPS. @@ -675,971 +898,136 @@ Accepted value: Numeric value from 0 to 999. True - 6, 132 - - - 78, 13 - - - 15 - - - Output Voltage - - - Lbl_OutputV - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Calibrage - - - 13 - - - True - - - 6, 103 - - - 84, 13 - - - 12 - - - Input Frequency - - - Lbl_InputF - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Calibrage - - - 14 - - - True - - - 6, 73 - - - 92, 13 - - - 10 - - - Frequency Supply - - - Lbl_PowerF - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Calibrage - - - 15 - - - True - - - 6, 42 - - - 70, 13 - - - 7 - - - Input Voltage - - - Lbl_InputV - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Calibrage - - - 16 - - - 4, 22 - - - 3, 3, 3, 3 - - - 322, 234 - - - 1 - - - Calibration - - - Tab_Calibrage - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabControl_Options - - - 1 - - - Cbx_LogLevel - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Miscellanous - - - 0 - - - Btn_DeleteLog - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Miscellanous - - - 1 - - - Btn_ViewLog - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Miscellanous - - - 2 - - - Lbl_LevelLog - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Miscellanous - - - 3 - - - CB_Use_Logfile - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Miscellanous - - - 4 - - - CB_Start_W_Win - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Miscellanous - - - 5 - - - CB_Close_Tray - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Miscellanous - - - 6 - - - CB_Start_Mini - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Miscellanous - - - 7 - - - CB_Systray - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Miscellanous - - - 8 - - - 4, 22 - - - 322, 234 - - - 3 - - - Miscellanous - - - Tab_Miscellanous - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabControl_Options - - - 2 - - - CB_Follow_FSD - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Shutdown - - - 0 - - - Lbl_Percent - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Shutdown - - - 1 - - - Tb_GraceTime - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Shutdown - - - 2 - - - Cb_ExtendTime - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Shutdown - - - 3 - - - Tb_Delay_Stop - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Shutdown - - - 4 - - - Cbx_TypeStop - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Shutdown - - - 5 - - - Cb_ImmediateStop - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Shutdown - - - 6 - - - Tb_BattLimit_Time - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Shutdown - - - 7 - - - Tb_BattLimit_Load - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Shutdown - - - 8 - - - Lbl_GraceTime - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Shutdown - - - 9 - - - Lbl_Delay_Stop - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Shutdown - - - 10 - - - Lbl_StopType - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Shutdown - - - 11 - - - Lbl_BattLimit_Time - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Shutdown - - - 12 - - - Lbl_BattLimit_Load - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Shutdown - - - 13 - - - 4, 22 - - - 0, 0, 0, 0 - - - 322, 234 - - - 2 - - - Shutdown Options - - - Tab_Shutdown - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabControl_Options - - - 3 - - - Cbx_Branch_Update - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Update - - - 0 - - - Cbx_Delay_Verif - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Update - - - 1 - - - Lbl_Branch_Update - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Update - - - 2 - - - Lbl_Delay_Verif - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Update - - - 3 - - - Cb_Update_At_Start - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Update - - - 4 - - - Cb_Verify_Update - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Update - - - 5 - - - 4, 22 - - - 322, 234 - - - 4 - - - Update - - - Tab_Update - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabControl_Options - - - 4 - - - 12, 12 - - - 330, 260 - - - 4 - - - TabControl_Options - - - System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 3 - - - 154, 191 - - - * - - - 162, 20 - - - 17 - - - NUT server login password - - - Tb_Pwd_Nut - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Connexion - - - 0 - - - 154, 161 - - - 162, 20 - - - 15 - - - NUT server connection identifier - - - Tb_Login_Nut - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Connexion - - - 1 - - - True - - - NoControl - - - 6, 132 - - - 300, 13 - - - 13 - - - Login credentials to the Nut server (leave blank if not required) - - - Label3 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Connexion - - - 2 - - - True - - - NoControl - - - 6, 192 - - - 53, 13 - - - 16 - - - Password - - - Lbl_Pwd_Nut - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Connexion - - - 3 - - - True - - - NoControl - - - 6, 162 - - - 33, 13 - - - 14 - - - Login - - - Lbl_Login_Nut - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Connexion - - - 4 - - - 154, 101 - - - 162, 20 - - - 12 - - - Time between each update of UPS data (default = 5). -Accepted value: Numerical value from 1 to 60 seconds. - - - Tb_Delay_Com - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Connexion - - - 5 - - - 154, 71 - - - 162, 20 - - - 10 - - - UPS name to monitor. -Accepted Value: Name of the UPS configured in the Nut server. - - - Tb_UPS_Name - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Connexion - - - 6 - - - 154, 41 - - - 5 - - - 162, 20 - - - 8 - - - Nut Server Port Number (default = 3493). -Accepted value: Numeric value from 1 to 65535. - - - Tb_Port - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Connexion - - - 7 - - - 154, 11 - - - 162, 20 - - - 6 - - - Nut server address. -Accepted value: IPV4 / IPV6 / FQDN address. - - - Tb_Server_IP - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tab_Connexion - - - 8 - - - True - - - 66, 213 - - - 250, 0 - - - Yes - - - 250, 17 + 6, 132 - - 18 + + 78, 13 - - Re-establish connection + + 15 - - Activate automatic connection / reconnection + + Output Voltage - - Cb_Reconnect + + Lbl_OutputV - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Tab_Connexion + + Tab_Calibrage - - 9 + + 13 - + True - - 6, 102 + + 6, 103 - - 76, 13 + + 84, 13 - - 11 + + 12 - - Polling Interval + + Input Frequency - - Lbl_Delay_Com + + Lbl_InputF - + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Tab_Connexion + + Tab_Calibrage - - 10 + + 14 - + True - - 6, 72 + + 6, 73 - - 60, 13 + + 92, 13 - - 9 + + 10 - - UPS Name + + Frequency Supply - - Lbl_Name_UPS + + Lbl_PowerF - + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Tab_Connexion + + Tab_Calibrage - - 11 + + 15 - + True - + 6, 42 - - 52, 13 + + 70, 13 - + 7 - - NUT Port + + Input Voltage - - Lbl_Port + + Lbl_InputV - + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Tab_Connexion - - - 12 + + Tab_Calibrage - - True + + 16 - - 6, 12 + + 4, 22 - - 53, 13 + + 3, 3, 3, 3 - - 5 + + 322, 234 - - NUT host + + 1 - - MiddleCenter + + Calibration - - Lbl_Server_IP + + Tab_Calibrage - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Tab_Connexion + + TabControl_Options - - 13 + + 1 Notice @@ -1950,6 +1338,30 @@ Accepted value: IPV4 / IPV6 / FQDN address. 8 + + 4, 22 + + + 322, 234 + + + 3 + + + Miscellanous + + + Tab_Miscellanous + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabControl_Options + + + 2 + True @@ -2358,6 +1770,33 @@ Accepted value: Numeric value from 0 to 100. 13 + + 4, 22 + + + 0, 0, 0, 0 + + + 322, 234 + + + 2 + + + Shutdown Options + + + Tab_Shutdown + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabControl_Options + + + 3 + Stable @@ -2547,6 +1986,51 @@ Accepted value: Numeric value from 0 to 100. 5 + + 4, 22 + + + 322, 234 + + + 4 + + + Update + + + Tab_Update + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabControl_Options + + + 4 + + + 12, 12 + + + 330, 260 + + + 4 + + + TabControl_Options + + + System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 3 + 105, 278 diff --git a/WinNUT_V2/WinNUT-Client/Pref_Gui.vb b/WinNUT_V2/WinNUT-Client/Pref_Gui.vb index 4c050a4..6075603 100644 --- a/WinNUT_V2/WinNUT-Client/Pref_Gui.vb +++ b/WinNUT_V2/WinNUT-Client/Pref_Gui.vb @@ -241,8 +241,8 @@ Public Class Pref_Gui LogFile.LogTracing(String.Format("Check that the value of {0} for {1} is correct.", sender.Text, sender.Name), LogLvl.LOG_DEBUG, Me) Select Case sender.Name Case "Tb_Delay_Com" - MinValue = 1 - MaxValue = 60 + MinValue = 100 + MaxValue = 60000 Case "Tb_Port" MinValue = 1 MaxValue = 65536 @@ -338,10 +338,10 @@ Public Class Pref_Gui Private Sub Btn_ViewLog_Click(sender As Object, e As EventArgs) Handles Btn_ViewLog.Click LogFile.LogTracing("Show LogFile", LogLvl.LOG_DEBUG, Me) - If File.Exists(LogFile.LogFilePath) Then + If LogFile IsNot Nothing AndAlso File.Exists(LogFile.LogFilePath) Then Process.Start(LogFile.LogFilePath) Else - LogFile.LogTracing("LogFile does not exists", LogLvl.LOG_WARNING, Me) + LogFile.LogTracing("LogFile does not exists", LogLvl.LOG_ERROR, Me) Btn_ViewLog.Enabled = False Btn_DeleteLog.Enabled = False End If @@ -368,14 +368,14 @@ Public Class Pref_Gui ''' Enable or disable controls to view and delete log data if it's available. ''' Private Sub SetLogControlsStatus() - If My.Settings.LG_LogToFile Then ' Directory.Exists(Logger.LogFolder) + LogFile.LogTracing("Setting LogControl statuses.", LogLvl.LOG_DEBUG, Me) + + If LogFile.IsWritingToFile Then Btn_ViewLog.Enabled = True Btn_DeleteLog.Enabled = True Else Btn_ViewLog.Enabled = False Btn_DeleteLog.Enabled = False End If - - LogFile.LogTracing("Setting LogControl statuses.", LogLvl.LOG_DEBUG, Me) End Sub End Class diff --git a/WinNUT_V2/WinNUT-Client/WinNUT.resx b/WinNUT_V2/WinNUT-Client/WinNUT.resx index 39f6841..37ea6c8 100644 --- a/WinNUT_V2/WinNUT-Client/WinNUT.resx +++ b/WinNUT_V2/WinNUT-Client/WinNUT.resx @@ -124,22 +124,6 @@ 364, 17 - - 145, 110 - - - ContextMenu_Systray - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - NotifyIcon1 - - - - True - 144, 22 @@ -173,6 +157,22 @@ Exit + + 145, 110 + + + ContextMenu_Systray + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + NotifyIcon1 + + + + True + 248, 17 @@ -186,47 +186,14 @@ None - - 0, 0 - - - 0, 24 - - - 231, 24 - - - 0 - - - MenuStrip1 - - - Main_Menu - - - System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 9 - - - 37, 20 - - - File - - 177, 22 + 180, 22 UPS Variable - 177, 22 + 180, 22 Exit @@ -238,19 +205,16 @@ - 177, 22 + 180, 22 Manage Old Prefs... - - Previous old preferences detected. Continue to begin the dialog. - - - 81, 20 + + 37, 20 - - Connection + + File 133, 22 @@ -264,18 +228,18 @@ Disconnect + + 81, 20 + + + Connection + 61, 20 Settings - - 44, 20 - - - Help - 144, 22 @@ -291,257 +255,47 @@ Verify Update - - True - - - Left + + 44, 20 - - None + + Help - - Lbl_VSerial + + 0, 0 - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 0, 24 - - GB_Status + + 351, 24 - + 0 - - Lbl_VFirmware - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_Status - - - 1 - - - Lbl_VName - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_Status - - - 2 - - - Lbl_VMfr - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_Status - - - 3 - - - Lbl_VRTime - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_Status - - - 4 - - - Lbl_VOB - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_Status - - - 5 - - - Lbl_VOLoad - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_Status - - - 6 - - - Lbl_VBL - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_Status - - - 7 - - - Lbl_VOL - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_Status - - - 8 + + MenuStrip1 - - Lbl_Firmware + + Main_Menu - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - GB_Status + + $this - + 9 - - Lbl_Serial - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_Status - - - 10 - - - Lbl_Name - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_Status - - - 11 - - - Lbl_Mfr - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_Status - - - 12 - - - Lbl_RTime - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_Status - - - 13 - - - Lbl_BL - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_Status - - - 14 - - - Lbl_OLoad - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_Status - - - 15 - - - Lbl_OB - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_Status - - - 16 - - - Lbl_OL - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_Status - - - 17 - - - 12, 27 - - - 180, 320 - - - 180, 320 - - - 180, 320 - - - 1 - - - GB_Status - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this + + True + + + Left - - 7 + + None Microsoft Sans Serif, 8.25pt, style=Bold @@ -1158,56 +912,38 @@ 17 - - True - - - Left - - - AG_InV - - - System.Windows.Forms.AGauge, AGauge, Version=2.1.8800.22772, Culture=neutral, PublicKeyToken=null - - - GB_InV_Dial - - - 0 + + 12, 27 - - Lbl_InV_Dial + + 180, 320 - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 180, 320 - - GB_InV_Dial + + 180, 320 - + 1 - - 200, 27 - - - 160, 160 - - - 4 - - - GB_InV_Dial + + GB_Status - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - - 3 + + 7 + + + True + + + Left 6, 26 @@ -1222,7 +958,7 @@ AG_InV - System.Windows.Forms.AGauge, AGauge, Version=2.1.8800.22772, Culture=neutral, PublicKeyToken=null + System.Windows.Forms.AGauge, AGauge, Version=2.1.8814.30445, Culture=neutral, PublicKeyToken=null GB_InV_Dial @@ -1269,56 +1005,32 @@ 1 - - True - - - Left - - - AG_OutV - - - System.Windows.Forms.AGauge, AGauge, Version=2.1.8800.22772, Culture=neutral, PublicKeyToken=null - - - GB_OutV_Dial - - - 0 - - - Lbl_OutV_Dial - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_OutV_Dial - - - 1 - - - 532, 27 + + 200, 27 - + 160, 160 - + 4 - - GB_OutV_Dial + + GB_InV_Dial - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - - 6 + + 3 + + + True + + + Left 6, 26 @@ -1339,7 +1051,7 @@ AG_OutV - System.Windows.Forms.AGauge, AGauge, Version=2.1.8800.22772, Culture=neutral, PublicKeyToken=null + System.Windows.Forms.AGauge, AGauge, Version=2.1.8814.30445, Culture=neutral, PublicKeyToken=null GB_OutV_Dial @@ -1356,98 +1068,62 @@ 4, 10 - - 152, 13 - - - 152, 13 - - - 152, 13 - - - 0 - - - Output Voltage - - - MiddleCenter - - - Lbl_OutV_Dial - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_OutV_Dial - - - 1 - - - True - - - Left - - - PBox_Battery_State - - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_BattCh_Dial - - - 0 + + 152, 13 - - Lbl_BattCh_Dial + + 152, 13 - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 152, 13 - - GB_BattCh_Dial + + 0 - - 1 + + Output Voltage - - AG_BattCh + + MiddleCenter - - System.Windows.Forms.AGauge, AGauge, Version=2.1.8800.22772, Culture=neutral, PublicKeyToken=null + + Lbl_OutV_Dial - - GB_BattCh_Dial + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 2 + + GB_OutV_Dial - - 200, 188 + + 1 - + + 532, 27 + + 160, 160 - - 3 + + 4 - - GB_BattCh_Dial + + GB_OutV_Dial - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - - 8 + + 6 + + + True + + + Left NoControl @@ -1531,7 +1207,7 @@ AG_BattCh - System.Windows.Forms.AGauge, AGauge, Version=2.1.8800.22772, Culture=neutral, PublicKeyToken=null + System.Windows.Forms.AGauge, AGauge, Version=2.1.8814.30445, Culture=neutral, PublicKeyToken=null GB_BattCh_Dial @@ -1539,56 +1215,32 @@ 2 - - True - - - Left - - - AG_Load - - - System.Windows.Forms.AGauge, AGauge, Version=2.1.8800.22772, Culture=neutral, PublicKeyToken=null - - - GB_Load_Dial - - - 0 - - - Lbl_Load_Dial - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_Load_Dial - - - 1 - - - 366, 188 + + 200, 188 - + 160, 160 - - 4 + + 3 - - GB_Load_Dial + + GB_BattCh_Dial - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - - 5 + + 8 + + + True + + + Left 6, 26 @@ -1609,7 +1261,7 @@ AG_Load - System.Windows.Forms.AGauge, AGauge, Version=2.1.8800.22772, Culture=neutral, PublicKeyToken=null + System.Windows.Forms.AGauge, AGauge, Version=2.1.8814.30445, Culture=neutral, PublicKeyToken=null GB_Load_Dial @@ -1656,56 +1308,32 @@ 1 - - True - - - Left - - - AG_BattV - - - System.Windows.Forms.AGauge, AGauge, Version=2.1.8800.22772, Culture=neutral, PublicKeyToken=null - - - GB_BattV_Dial - - - 0 - - - Lbl_BattV_Dial - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_BattV_Dial - - - 1 - - - 532, 188 + + 366, 188 - + 160, 160 - - 5 + + 4 - - GB_BattV_Dial + + GB_Load_Dial - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - - 4 + + 5 + + + True + + + Left 6, 26 @@ -1726,7 +1354,7 @@ AG_BattV - System.Windows.Forms.AGauge, AGauge, Version=2.1.8800.22772, Culture=neutral, PublicKeyToken=null + System.Windows.Forms.AGauge, AGauge, Version=2.1.8814.30445, Culture=neutral, PublicKeyToken=null GB_BattV_Dial @@ -1773,56 +1401,32 @@ 1 - - True - - - Left - - - AG_InF - - - System.Windows.Forms.AGauge, AGauge, Version=2.1.8800.22772, Culture=neutral, PublicKeyToken=null - - - GB_InF_Dial - - - 0 - - - Lbl_InF_Dial - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - GB_InF_Dial - - - 1 - - - 366, 27 + + 532, 188 - + 160, 160 - + 5 - - GB_InF_Dial + + GB_BattV_Dial - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - - 2 + + 4 + + + True + + + Left 6, 26 @@ -1843,7 +1447,7 @@ AG_InF - System.Windows.Forms.AGauge, AGauge, Version=2.1.8800.22772, Culture=neutral, PublicKeyToken=null + System.Windows.Forms.AGauge, AGauge, Version=2.1.8814.30445, Culture=neutral, PublicKeyToken=null GB_InF_Dial @@ -1890,6 +1494,27 @@ 1 + + 366, 27 + + + 160, 160 + + + 5 + + + GB_InF_Dial + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + True diff --git a/WinNUT_V2/WinNUT-Client/WinNUT.vb b/WinNUT_V2/WinNUT-Client/WinNUT.vb index fc2dccb..40c7664 100644 --- a/WinNUT_V2/WinNUT-Client/WinNUT.vb +++ b/WinNUT_V2/WinNUT-Client/WinNUT.vb @@ -32,6 +32,12 @@ Public Class WinNUT End Set End Property + Private ReadOnly Property OldPrefsExist As Boolean + Get + Return OldParams.WinNUT_Params.RegistryKeyRoot IsNot Nothing + End Get + End Property + #End Region Private WithEvents LogFile As Logger = WinNUT_Globals.LogFile @@ -133,7 +139,7 @@ Public Class WinNUT StrLog.Insert(AppResxStr.STR_LOG_NUT_FSD, My.Resources.Log_Str_12) 'Init Systray - NotifyIcon.Text = LongProgramName & " - " & ShortProgramVersion + NotifyIcon.Text = ProgramName & " - " & ShortProgramVersion NotifyIcon.Visible = False LogFile.LogTracing("NotifyIcons Initialised", LogLvl.LOG_DEBUG, Me) @@ -234,14 +240,13 @@ Public Class WinNUT LogFile.LogTracing("Update Icon at Startup", LogLvl.LOG_DEBUG, Me) ' Start_Tray_Icon = Nothing - If OldParams.WinNUT_Params.RegistryKeyRoot IsNot Nothing Then + ' If this is the first time WinNUT has been launched with the Settings system, check if old preferences exist + ' and prompt the user to upgrade. + If Not My.Settings.UpgradePrefsCompleted AndAlso OldPrefsExist Then LogFile.LogTracing("Previous preferences data detected in the Registry.", LogLvl.LOG_NOTICE, Me, My.Resources.DetectedPreviousPrefsData) - ManageOldPrefsToolStripMenuItem.Enabled = True - If Not My.Settings.UpgradePrefsCompleted Then - RunRegPrefsUpgrade() - End If + RunRegPrefsUpgrade() End If 'Run Update @@ -382,11 +387,27 @@ Public Class WinNUT End If End Select End Sub + + ''' + ''' Updates the Manage old prefs File menu item status depending on the presence of old preferences. + ''' + Private Sub UpdateManageOldPrefsMenuItemStatus() + If OldParams.WinNUT_Params.RegistryKeyRoot IsNot Nothing Then + + ManageOldPrefsToolStripMenuItem.Enabled = True + ManageOldPrefsToolStripMenuItem.ToolTipText = My.Resources.ManageOldPrefsToolstripMenuItem_Enabled_TooltipText + Else + ManageOldPrefsToolStripMenuItem.Enabled = False + ManageOldPrefsToolStripMenuItem.ToolTipText = My.Resources.ManageOldPrefsToolstripMenuItem_Disabled_TooltipText + End If + End Sub + Private Sub RunRegPrefsUpgrade() LogFile.LogTracing("Starting Upgrade dialog.", LogLvl.LOG_NOTICE, Me) Dim upPrefsDg As New Forms.UpgradePrefsDialog() upPrefsDg.ShowDialog() + UpdateManageOldPrefsMenuItemStatus() WinNUT_PrefsChanged(True) End Sub @@ -576,7 +597,7 @@ Public Class WinNUT If Me.WindowState = System.Windows.Forms.FormWindowState.Minimized And NotifyIcon.Visible = False Then Text = FormText Else - Text = LongProgramName + Text = ProgramName End If Me.FormText = FormText @@ -584,7 +605,6 @@ Public Class WinNUT End Sub Private Sub Event_UpdateBatteryState(Optional Reason As String = Nothing) Handles Me.UpdateBatteryState - Static Dim Old_Battery_Value As Integer = UPS_BattCh Dim Status As String = "Unknown" Select Case Reason Case Nothing, "Deconnected", "Lost Connect" @@ -606,7 +626,6 @@ Public Class WinNUT End If End If End Select - Old_Battery_Value = UPS_BattCh LogFile.LogTracing("Battery Status => " & Status, LogLvl.LOG_DEBUG, Me) End Sub @@ -688,21 +707,23 @@ Public Class WinNUT Lbl_VOB.BackColor = Color.Green ActualAppIconIdx = 0 - If Not ShutdownStatus Then - If .Batt_Charge <= My.Settings.PW_BattChrgFloor Or - .Batt_Runtime <= My.Settings.PW_RuntimeFloor Then - LogFile.LogTracing("UPS battery has dropped below stop condition limits.", - LogLvl.LOG_NOTICE, Me, StrLog.Item(AppResxStr.STR_LOG_SHUT_START)) - Shutdown_Event() - Else - LogFile.LogTracing(String.Format("UPS charge ({0}%) or Runtime ({1}) have not met shutdown conditions {2} or {3}.", - .Batt_Charge, .Batt_Runtime, My.Settings.PW_BattChrgFloor, My.Settings.PW_RuntimeFloor), - LogLvl.LOG_DEBUG, Me) + If .Batt_Charge = -1 AndAlso .Batt_Runtime = -1 Then + LogFile.LogTracing("Battery properties unavailable, unable to validate shutdown conditions.", LogLvl.LOG_WARNING, Me) + ElseIf Not ShutdownStatus Then + If .Batt_Charge <= My.Settings.PW_BattChrgFloor Or + .Batt_Runtime <= My.Settings.PW_RuntimeFloor Then + LogFile.LogTracing("UPS battery has dropped below stop condition limits.", + LogLvl.LOG_NOTICE, Me, StrLog.Item(AppResxStr.STR_LOG_SHUT_START)) + Shutdown_Event() + Else + LogFile.LogTracing(String.Format("UPS charge ({0}%) or Runtime ({1}) have not met shutdown conditions {2} or {3}.", + .Batt_Charge, .Batt_Runtime, My.Settings.PW_BattChrgFloor, My.Settings.PW_RuntimeFloor), + LogLvl.LOG_DEBUG, Me) + End If End If End If - End If - If .UPS_Status.HasFlag(UPS_States.OVER) Then + If .UPS_Status.HasFlag(UPS_States.OVER) Then Lbl_VOLoad.BackColor = Color.Red Else Lbl_VOLoad.BackColor = Color.White @@ -732,16 +753,20 @@ Public Class WinNUT End Select ' Calculate and display estimated remaining time on battery. - Dim iSpan As TimeSpan = TimeSpan.FromSeconds(UPS_BattRuntime) - LogFile.LogTracing("Calculated estimated remaining battery time: " & iSpan.ToString(), LogLvl.LOG_DEBUG, Me) - - ' Format the TimeSpan using a standard format (g = 0:00:00) - ' https://docs.microsoft.com/en-us/dotnet/api/system.timespan.tostring - Lbl_VRTime.Text = iSpan.ToString("g") - 'Lbl_VRTime.Text = iSpan.Hours.ToString.PadLeft(2, "0"c) & ":" & - 'iSpan.Minutes.ToString.PadLeft(2, "0"c) & ":" & - 'iSpan.Seconds.ToString.PadLeft(2, "0"c) - 'End If + If UPS_BattRuntime >= 0 AndAlso UPS_BattRuntime <= 86400 Then + Dim iSpan As TimeSpan = TimeSpan.FromSeconds(UPS_BattRuntime) + LogFile.LogTracing("Calculated estimated remaining battery time: " & iSpan.ToString(), LogLvl.LOG_DEBUG, Me) + + ' Format the TimeSpan using a standard format (g = 0:00:00) + ' https://docs.microsoft.com/en-us/dotnet/api/system.timespan.tostring + Lbl_VRTime.Text = iSpan.ToString("g") + 'Lbl_VRTime.Text = iSpan.Hours.ToString.PadLeft(2, "0"c) & ":" & + 'iSpan.Minutes.ToString.PadLeft(2, "0"c) & ":" & + 'iSpan.Seconds.ToString.PadLeft(2, "0"c) + 'End If + Else + Lbl_VRTime.Text = My.Resources.VariableUnavailable + End If LogFile.LogTracing("Update Dial", LogLvl.LOG_DEBUG, Me) AG_InV.Value1 = UPS_InputV @@ -1034,6 +1059,13 @@ Public Class WinNUT LogFile.LogTracing("Windows going down, WinNUT will disconnect.", LogLvl.LOG_NOTICE, Me, StrLog.Item(AppResxStr.STR_MAIN_GOTOSLEEP)) UPSDisconnect() + ' Stub out stop action when debugging. +#If DEBUG Then + If Debugger.IsAttached Then + LogFile.LogTracing("Aborting stopAction " & stopAction & " due to attached debugger.", LogLvl.LOG_NOTICE, Me) + Return + End If +#Else Select Case stopAction Case 0 Process.Start("C:\WINDOWS\system32\Shutdown.exe", "-f -s -t 0") @@ -1042,6 +1074,7 @@ Public Class WinNUT Case 2 Application.SetSuspendState(PowerState.Hibernate, False, True) End Select +#End If End Sub Private Sub Menu_Update_Click(sender As Object, e As EventArgs) Handles Menu_Update.Click diff --git a/WinNUT_V2/WinNUT-Client_Common/Logger.vb b/WinNUT_V2/WinNUT-Client_Common/Logger.vb index 181eb43..86dfceb 100644 --- a/WinNUT_V2/WinNUT-Client_Common/Logger.vb +++ b/WinNUT_V2/WinNUT-Client_Common/Logger.vb @@ -9,6 +9,7 @@ Imports System.Globalization Imports System.IO +Imports System.Text Imports Microsoft.VisualBasic.Logging Public Class Logger @@ -129,7 +130,7 @@ Public Class Logger LogFile.CustomLocation = baseDataFolder End If - LogTracing(String.Format("{0} {1} Log file init", LongProgramName, ProgramVersion), LogLvl.LOG_NOTICE, Me) + LogTracing(String.Format("{0} {1} Log file init", ProgramName, ProgramVersion), LogLvl.LOG_NOTICE, Me) If LastEventsList.Count > 0 Then ' Fill new file with the LastEventsList buffer @@ -204,6 +205,22 @@ Public Class Logger End If End Sub + Public Sub LogException(ex As Exception, sender As Object) + Dim sb As New StringBuilder + sb.AppendLine(ex.GetType().ToString() & " thrown in " & ex.Source) + sb.AppendLine("Message: " & ex.Message) + sb.AppendLine(ex.StackTrace) + + LogTracing(sb.ToString(), LogLvl.LOG_ERROR, sender) + + If ex.InnerException IsNot Nothing Then + LogTracing("Inner exception present:", LogLvl.LOG_ERROR, sender) + LogException(ex.InnerException, ex) + End If + + LogTracing("Exception report complete.", LogLvl.LOG_NOTICE, Me) + End Sub + Private Function FormatLogLine(message As String, logLvl As LogLvl, Optional sender As Object = Nothing) Dim Pid = TEventCache.ProcessId Dim SenderName = "Nothing" diff --git a/WinNUT_V2/WinNUT-Client_Common/UPS_Device.vb b/WinNUT_V2/WinNUT-Client_Common/UPS_Device.vb index 7802e35..516bcbe 100644 --- a/WinNUT_V2/WinNUT-Client_Common/UPS_Device.vb +++ b/WinNUT_V2/WinNUT-Client_Common/UPS_Device.vb @@ -264,7 +264,7 @@ Public Class UPS_Device End Try ' Other constant values for UPS calibration. - freshData.UPS_Value.Batt_Capacity = Double.Parse(GetUPSVar("battery.capacity", 7), INVARIANT_CULTURE) + freshData.UPS_Value.Batt_Capacity = Double.Parse(GetUPSVar("battery.capacity", -1), INVARIANT_CULTURE) Freq_Fallback = Double.Parse(GetUPSVar("output.frequency.nominal", Freq_Fallback), INVARIANT_CULTURE) LogFile.LogTracing("Completed retrieval of basic UPS product information.", LogLvl.LOG_NOTICE, Me) @@ -280,11 +280,11 @@ Public Class UPS_Device If IsConnected Then With UPS_Datas.UPS_Value - .Batt_Charge = Double.Parse(GetUPSVar("battery.charge", 255), INVARIANT_CULTURE) - .Batt_Voltage = Double.Parse(GetUPSVar("battery.voltage", 12), INVARIANT_CULTURE) - .Batt_Runtime = Double.Parse(GetUPSVar("battery.runtime", 86400), INVARIANT_CULTURE) + .Batt_Charge = Double.Parse(GetUPSVar("battery.charge", -1), INVARIANT_CULTURE) + .Batt_Voltage = Double.Parse(GetUPSVar("battery.voltage", -1), INVARIANT_CULTURE) + .Batt_Runtime = Double.Parse(GetUPSVar("battery.runtime", -1), INVARIANT_CULTURE) .Power_Frequency = Double.Parse(GetUPSVar("input.frequency", Double.Parse(GetUPSVar("output.frequency", Freq_Fallback), INVARIANT_CULTURE)), INVARIANT_CULTURE) - .Input_Voltage = Double.Parse(GetUPSVar("input.voltage", 220), INVARIANT_CULTURE) + .Input_Voltage = Double.Parse(GetUPSVar("input.voltage", -1), INVARIANT_CULTURE) .Output_Voltage = Double.Parse(GetUPSVar("output.voltage", .Input_Voltage), INVARIANT_CULTURE) .Load = Double.Parse(GetUPSVar("ups.load", 0), INVARIANT_CULTURE) @@ -317,24 +317,36 @@ Public Class UPS_Device .Output_Power = parsedValue End If - ' Handle cases of UPSs that are unable to report battery runtime or load correctly while on battery. - Dim PowerDivider As Double = 0.5 - Select Case .Load - Case 76 To 100 - PowerDivider = 0.4 - Case 51 To 75 - PowerDivider = 0.3 - End Select - - If .Batt_Charge = 255 Then - Dim nBatt = Math.Floor(.Batt_Voltage / 12) - .Batt_Charge = Math.Floor((.Batt_Voltage - (11.6 * nBatt)) / (0.02 * nBatt)) + ' Handle out-of-range battery charge + If .Batt_Charge < 0 OrElse .Batt_Charge > 100 Then + If .Batt_Voltage > 0 Then + Dim nBatt = Math.Floor(.Batt_Voltage / 12) + .Batt_Charge = Math.Floor((.Batt_Voltage - (11.6 * nBatt)) / (0.02 * nBatt)) + Else + LogFile.LogTracing("Unable to calculate UPS Batt_Charge: Batt_Voltage (" & .Batt_Voltage & ") out of range.", LogLvl.LOG_WARNING, Me) + End If End If - If .Batt_Runtime >= 86400 Then - .Load = If(.Load <> 0, .Load, 0.1) - Dim BattInstantCurrent = (.Output_Voltage * .Load) / (.Batt_Voltage * 100) - .Batt_Runtime = Math.Floor(.Batt_Capacity * 0.6 * .Batt_Charge * (1 - PowerDivider) * 3600 / (BattInstantCurrent * 100)) + ' Attempt to calculate battery runtime if not given by the UPS. + If .Batt_Runtime = -1 Then + If .Output_Voltage = -1 OrElse .Batt_Voltage = -1 OrElse .Batt_Capacity = -1 OrElse .Batt_Charge = -1 Then + LogFile.LogTracing("Unable to calculate battery runtime, missing UPS variables.", LogLvl.LOG_WARNING, Me) + LogFile.LogTracing(String.Format("Output_Voltage: {0}, Batt_Voltage: {1}, Batt_Capacity: {2}, Batt_Charge: {3}", + .Output_Voltage, .Batt_Voltage, .Batt_Capacity, .Batt_Charge), LogLvl.LOG_WARNING, Me) + + Else + Dim PowerDivider As Double = 0.5 + Select Case .Load + Case 76 To 100 + PowerDivider = 0.4 + Case 51 To 75 + PowerDivider = 0.3 + End Select + + .Load = If(.Load <> 0, .Load, 0.1) + Dim BattInstantCurrent = (.Output_Voltage * .Load) / (.Batt_Voltage * 100) + .Batt_Runtime = Math.Floor(.Batt_Capacity * 0.6 * .Batt_Charge * (1 - PowerDivider) * 3600 / (BattInstantCurrent * 100)) + End If End If UPS_rt_Status = GetUPSVar("ups.status", UPS_States.None) @@ -361,9 +373,10 @@ Public Class UPS_Device End With RaiseEvent DataUpdated() End If - Catch Excep As Exception ' Something went wrong while trying to read the data... Consider the socket broken and proceed from here. - LogFile.LogTracing("Something went wrong in Retrieve_UPS_Datas: " & Excep.ToString(), LogLvl.LOG_ERROR, Me) + Catch Excep As Exception + LogFile.LogTracing("Something went wrong in Retrieve_UPS_Datas:", LogLvl.LOG_ERROR, Me) + LogFile.LogException(Excep, Me) Disconnect(False, True) Socket_Broken() End Try diff --git a/WinNUT_V2/WinNUT-Client_Common/WinNUT_Globals.vb b/WinNUT_V2/WinNUT-Client_Common/WinNUT_Globals.vb index 58d2ba1..aec9386 100644 --- a/WinNUT_V2/WinNUT-Client_Common/WinNUT_Globals.vb +++ b/WinNUT_V2/WinNUT-Client_Common/WinNUT_Globals.vb @@ -12,7 +12,6 @@ Public Module WinNUT_Globals #Region "Constants/Shareds" Public ReadOnly ProgramName = My.Application.Info.ProductName - Public ReadOnly LongProgramName = My.Application.Info.Description Public ReadOnly ProgramVersion = My.Application.Info.Version.ToString() Public ReadOnly ShortProgramVersion = ProgramVersion.Substring(0, ProgramVersion.IndexOf(".", ProgramVersion.IndexOf(".") + 1)) Public ReadOnly GitHubURL = My.Application.Info.Trademark