Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Connection handling & Logging, Power State handling #11

Merged
merged 9 commits into from
Aug 6, 2022
Merged
301 changes: 148 additions & 153 deletions WinNUT_V2/Setup/Setup.vdproj

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions WinNUT_V2/SharedAssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,17 @@
' This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY

Imports System.Resources
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices

' Les informations générales relatives à un assembly dépendent de
' l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
' associées à un assembly.

' Vérifiez les valeurs des attributs de l'assembly

<Assembly: AssemblyCompany("Gawindx")>
<Assembly: AssemblyCompany("NUTDotNet")>
<Assembly: AssemblyProduct("WinNUT-Client")>
<Assembly: AssemblyCopyright("Copyright Gawindx (Decaux Nicolas) © 2019-2021")>
<Assembly: AssemblyCopyright("NUTDotNet contributors © 2019-2022")>
<Assembly: AssemblyTrademark("https://github.com/nutdotnet/WinNUT-Client")>

' Les informations de version pour un assembly se composent des quatre valeurs suivantes :
Expand All @@ -34,5 +32,5 @@ Imports System.Runtime.InteropServices
' en utilisant '*', comme indiqué ci-dessous :
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("2.1.*")>
<Assembly: AssemblyVersion("2.2.*")>
<Assembly: NeutralResourcesLanguage("en-US")>
27 changes: 25 additions & 2 deletions WinNUT_V2/WinNUT-Client_Common/Common_Classes.vb
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ End Class
Public Class Nut_Exception
Inherits System.ApplicationException

Public Property ExceptionValue As Nut_Exception_Value

Public Sub New(ByVal Nut_Error_Lvl As Nut_Exception_Value)
MyBase.New(StringEnum.GetStringValue(Nut_Error_Lvl))
End Sub

Public Sub New(ByVal Nut_Error_Lvl As Nut_Exception_Value, ByVal Message As String)
MyBase.New(StringEnum.GetStringValue(Nut_Error_Lvl) & Message)
Public Sub New(ByVal Nut_Error_Lvl As Nut_Exception_Value, ByVal Message As String, Optional innerEx As Exception = Nothing)
MyBase.New(StringEnum.GetStringValue(Nut_Error_Lvl) & Message, innerEx)
ExceptionValue = Nut_Error_Lvl
End Sub
End Class

Expand All @@ -51,4 +54,24 @@ Public Class Nut_Parameter
Public Password As String = ""
Public UPSName As String = ""
Public AutoReconnect As Boolean = False

Public Sub New(Host As String, Port As Integer, Login As String, Password As String, UPSName As String,
Optional AutoReconnect As Boolean = False)
Me.Host = Host
Me.Port = Port
Me.Login = Login
Me.Password = Password
Me.UPSName = UPSName
Me.AutoReconnect = AutoReconnect
End Sub

''' <summary>
''' Generate an informative String representing this Parameter object. Note password is not printed.
''' </summary>
''' <returns></returns>
Public Overrides Function ToString() As String
Return String.Format("{0}@{1}:{2}, Name: {3}" & If(AutoReconnect, " [AutoReconnect]", Nothing),
Login, Host, Port, UPSName, AutoReconnect)
' Return MyBase.ToString())
End Function
End Class