Switch License Module, Move SnapToDesktopBorder to Window Module

This commit is contained in:
Jonathan Jenne 2021-09-23 11:23:01 +02:00
parent 7e28e072df
commit 59d6d26dce
7 changed files with 30 additions and 121 deletions

View File

@ -0,0 +1,7 @@
# Changelog
## 2.5.0
* Replace Mail Library
* Use DigitalData.Modules.Database for DB Access
* Remove clsHotkey.vb

View File

@ -8,8 +8,6 @@ Imports DigitalData.Modules.Database
Imports DLLLicenseManager Imports DLLLicenseManager
Public Class ClassInit Public Class ClassInit
Public _lizenzManager As ClassLicenseManager
Public Sub InitLogger() Public Sub InitLogger()
ClassLogger.Init("", Environment.UserName) ClassLogger.Init("", Environment.UserName)
LOGCONFIG = New LogConfig(LogConfig.PathType.AppData, Nothing, Nothing, LOGCONFIG = New LogConfig(LogConfig.PathType.AppData, Nothing, Nothing,

View File

@ -1,15 +1,17 @@
Imports System.Globalization Imports System.Globalization
Imports DLLLicenseManager Imports DLLLicenseManager
Imports DigitalData.Modules.License
Public Class ClassLicence Public Class ClassLicence
Public Shared License_Date As Date Public Shared LicenseDate As Date
Private Shared _lizenzManager As ClassLicenseManager Public Shared LicenseManager As LicenseManagerLegacy
Public Shared Sub Refresh_Licence() Public Shared Sub Refresh_Licence()
Try Try
_lizenzManager = New ClassLicenseManager("#DigitalData35452!#", "") LicenseManager = New LicenseManagerLegacy(LOGCONFIG, "#DigitalData35452!#", "")
Dim sql As String = "SELECT LICENSEKEY FROM TBGI_CONFIGURATION WHERE GUID = 1" Dim sql As String = "SELECT LICENSEKEY FROM TBGI_CONFIGURATION WHERE GUID = 1"
Dim licEncoded As String = DATABASE_ECM.GetScalarValue(sql) Dim licEncoded As String = DATABASE_ECM.GetScalarValue(sql)
Dim licString As String = _lizenzManager.DecodeLicenseKey(licEncoded) Dim licString As String = LicenseManager.DecodeLicenseKey(licEncoded)
Dim licArray() As String = licString.ToString.Split("#") Dim licArray() As String = licString.ToString.Split("#")
If licEncoded <> "" Then If licEncoded <> "" Then
@ -20,10 +22,10 @@ Public Class ClassLicence
LOGGER.Debug("License Date is {0}", licArray(1)) LOGGER.Debug("License Date is {0}", licArray(1))
License_Date = Date.ParseExact(licArray(1), "dd.MM.yyyy", CultureInfo.InvariantCulture) LicenseDate = Date.ParseExact(licArray(1), "dd.MM.yyyy", CultureInfo.InvariantCulture)
'License_Date = CDate(split(1)) 'License_Date = CDate(split(1))
If License_Date < Now Then If LicenseDate < Now Then
If USER_LANGUAGE = "de-DE" Then If USER_LANGUAGE = "de-DE" Then
MsgBox("Ihre Lizenz ist abgelaufen!" & vbNewLine & "Letztes Gültigkeitsdatum: " & licArray(1) & vbNewLine & "Bitte setzen Sie sich mit Digital Data in Verbindung", MsgBoxStyle.Exclamation) MsgBox("Ihre Lizenz ist abgelaufen!" & vbNewLine & "Letztes Gültigkeitsdatum: " & licArray(1) & vbNewLine & "Bitte setzen Sie sich mit Digital Data in Verbindung", MsgBoxStyle.Exclamation)
Else Else
@ -51,9 +53,9 @@ Public Class ClassLicence
Public Shared Function license_is_Valid() Public Shared Function license_is_Valid()
If LICENSE_EXPIRED Then If LICENSE_EXPIRED Then
If USER_LANGUAGE = "de-DE" Then If USER_LANGUAGE = "de-DE" Then
MsgBox("Ihre Lizenz ist abgelaufen!" & vbNewLine & "Letztes Gültigkeitsdatum: " & License_Date & vbNewLine & "Bitte setzen Sie sich mit Digital Data in Verbindung", MsgBoxStyle.Exclamation) MsgBox("Ihre Lizenz ist abgelaufen!" & vbNewLine & "Letztes Gültigkeitsdatum: " & LicenseDate & vbNewLine & "Bitte setzen Sie sich mit Digital Data in Verbindung", MsgBoxStyle.Exclamation)
Else Else
MsgBox("Your license has expired!" & vbNewLine & "Last Valid Date: " & License_Date & vbNewLine & "Please contact Digital Data", MsgBoxStyle.Exclamation) MsgBox("Your license has expired!" & vbNewLine & "Last Valid Date: " & LicenseDate & vbNewLine & "Please contact Digital Data", MsgBoxStyle.Exclamation)
End If End If
Return False Return False

View File

@ -174,6 +174,9 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\DDMonorepo\Modules.Language\bin\Debug\DigitalData.Modules.Language.dll</HintPath> <HintPath>..\..\DDMonorepo\Modules.Language\bin\Debug\DigitalData.Modules.Language.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.License">
<HintPath>..\..\DDMonorepo\Modules.License\bin\Debug\DigitalData.Modules.License.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Logging, Version=2.0.0.1, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.Modules.Logging, Version=2.0.0.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath> <HintPath>..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
@ -188,10 +191,6 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\DDMonorepo\Modules.Windream\bin\Debug\DigitalData.Modules.Windream.dll</HintPath> <HintPath>..\..\DDMonorepo\Modules.Windream\bin\Debug\DigitalData.Modules.Windream.dll</HintPath>
</Reference> </Reference>
<Reference Include="DLLLicenseManager, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>P:\Visual Studio Projekte\Bibliotheken\DLLLicenseManager.dll</HintPath>
</Reference>
<Reference Include="Interop.WINDREAMLib"> <Reference Include="Interop.WINDREAMLib">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WINDREAMLib.dll</HintPath> <HintPath>P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WINDREAMLib.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes> <EmbedInteropTypes>False</EmbedInteropTypes>
@ -781,6 +780,7 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Resources\DD_Icons_ICO_GLOBIX_1.ico" /> <Content Include="Resources\DD_Icons_ICO_GLOBIX_1.ico" />
<Content Include="Changelog.txt" />
<None Include="Resources\itemtypechecked.svg" /> <None Include="Resources\itemtypechecked.svg" />
<None Include="Resources\trackingchanges_next.svg" /> <None Include="Resources\trackingchanges_next.svg" />
<None Include="Resources\GLOBIX_short.png" /> <None Include="Resources\GLOBIX_short.png" />

View File

@ -1,7 +1,6 @@
Imports System.Resources Imports System.Resources
Imports DLLLicenseManager
Public Class frmLicense Public Class frmLicense
Public _lizenzManager As ClassLicenseManager
Private LocRM As ResourceManager Private LocRM As ResourceManager
Private Sub btnPW_check_Click(sender As System.Object, e As System.EventArgs) Handles btnPW_check.Click Private Sub btnPW_check_Click(sender As System.Object, e As System.EventArgs) Handles btnPW_check.Click
If Me.txtPW.Text <> "" Then If Me.txtPW.Text <> "" Then
@ -25,7 +24,7 @@ Public Class frmLicense
Try Try
If Me.txtNewlicences.Text <> "" And txtProfile.Text <> "" Then If Me.txtNewlicences.Text <> "" And txtProfile.Text <> "" Then
'Encode the license 'Encode the license
Dim result As String = Me._lizenzManager.EncodeLicenseKey(txtNewlicences.Text & "#" & dtpGueltig_GI.Text & "#" & txtProfile.Text & "#" & txtHotKey.Text, "#DigitalData35452!#") Dim result As String = ClassLicence.LicenseManager.EncodeLicenseKey(txtNewlicences.Text & "#" & dtpGueltig_GI.Text & "#" & txtProfile.Text & "#" & txtHotKey.Text, "#DigitalData35452!#")
txtlicensekey.Text = result txtlicensekey.Text = result
Dim sql As String = "UPDATE TBGI_CONFIGURATION SET LICENSEKEY = '" & result & "' where guid = 1" Dim sql As String = "UPDATE TBGI_CONFIGURATION SET LICENSEKEY = '" & result & "' where guid = 1"
If DATABASE_ECM.ExecuteNonQuery(sql) = True Then If DATABASE_ECM.ExecuteNonQuery(sql) = True Then
@ -41,11 +40,10 @@ Public Class frmLicense
Sub Refresh_Licence(Neu As Boolean) Sub Refresh_Licence(Neu As Boolean)
Dim lizenzzahl As Integer Dim lizenzzahl As Integer
Try Try
Me._lizenzManager = New ClassLicenseManager("#DigitalData35452!#", "")
Dim sql As String = "SELECT LICENSEKEY FROM TBGI_CONFIGURATION WHERE GUID = 1" Dim sql As String = "SELECT LICENSEKEY FROM TBGI_CONFIGURATION WHERE GUID = 1"
Dim lic As String = DATABASE_ECM.GetScalarValue(sql) Dim lic As String = DATABASE_ECM.GetScalarValue(sql)
Dim licString = Me._lizenzManager.DecodeLicenseKey(lic) Dim licString = ClassLicence.LicenseManager.DecodeLicenseKey(lic)
Dim split() = licString.ToString.Split("#") Dim split() = licString.ToString.Split("#")

View File

@ -6,120 +6,25 @@ Imports System.Globalization
Imports System.Threading Imports System.Threading
Imports System.Runtime.InteropServices Imports System.Runtime.InteropServices
Imports DigitalData.Modules.Language Imports DigitalData.Modules.Language
Imports DigitalData.Modules.Windows
Imports DigitalData.Modules.License
Public Class frmStart Public Class frmStart
Public _lizenzManager As ClassLicenseManager Public _lizenzManager As LicenseManagerLegacy
Dim loaded As Boolean = False
Dim WithEvents HotKey As New clsHotkey(Me)
Private Const mSnapOffset As Integer = 35
Private Const WM_WINDOWPOSCHANGING As Integer = &H46 Private Const WM_WINDOWPOSCHANGING As Integer = &H46
Private IndexForm As frmIndex Private IndexForm As frmIndex
<StructLayout(LayoutKind.Sequential)>
Public Structure WINDOWPOS
Public hwnd As IntPtr
Public hwndInsertAfter As IntPtr
Public x As Integer
Public y As Integer
Public cx As Integer
Public cy As Integer
Public flags As Integer
End Structure
Protected Overrides Sub WndProc(ByRef m As Message) Protected Overrides Sub WndProc(ByRef m As Message)
' Listen for operating system messages ' Listen for operating system messages
Select Case m.Msg Select Case m.Msg
Case WM_WINDOWPOSCHANGING Case WM_WINDOWPOSCHANGING
SnapToDesktopBorder(Me, m.LParam, 0) Window.SnapToDesktopBorder(Me, m.LParam)
End Select End Select
MyBase.WndProc(m) MyBase.WndProc(m)
End Sub End Sub
Public Shared Sub SnapToDesktopBorder(ByVal clientForm _
As Form, ByVal LParam As IntPtr, ByVal widthAdjustment As Integer)
If clientForm Is Nothing Then
' Satisfies rule: Validate parameters
Throw New ArgumentNullException("clientForm")
End If
' Snap client to the top, left, bottom or right desktop border
' as the form is moved near that border.
Try
' Marshal the LPARAM value which is a WINDOWPOS struct
Dim NewPosition As New WINDOWPOS
NewPosition = CType(Runtime.InteropServices.Marshal.PtrToStructure(
LParam, GetType(WINDOWPOS)), WINDOWPOS)
If NewPosition.y = 0 OrElse NewPosition.x = 0 Then
Return ' Nothing to do!
End If
' Adjust the client size for borders and caption bar
Dim ClientRect As Rectangle =
clientForm.RectangleToScreen(clientForm.ClientRectangle)
ClientRect.Width +=
SystemInformation.FrameBorderSize.Width - widthAdjustment
ClientRect.Height += (SystemInformation.FrameBorderSize.Height +
SystemInformation.CaptionHeight)
' Now get the screen working area (without taskbar)
Dim WorkingRect As Rectangle =
Screen.GetWorkingArea(clientForm.ClientRectangle)
' Left border
If NewPosition.x >= WorkingRect.X - mSnapOffset AndAlso
NewPosition.x <= WorkingRect.X + mSnapOffset Then
NewPosition.x = WorkingRect.X
End If
' Get screen bounds and taskbar height
' (when taskbar is horizontal)
Dim ScreenRect As Rectangle =
Screen.GetBounds(Screen.PrimaryScreen.Bounds)
Dim TaskbarHeight As Integer =
ScreenRect.Height - WorkingRect.Height
' Top border (check if taskbar is on top
' or bottom via WorkingRect.Y)
If NewPosition.y >= -mSnapOffset AndAlso
(WorkingRect.Y > 0 AndAlso NewPosition.y <=
(TaskbarHeight + mSnapOffset)) OrElse
(WorkingRect.Y <= 0 AndAlso NewPosition.y <=
(mSnapOffset)) Then
If TaskbarHeight > 0 Then
NewPosition.y = WorkingRect.Y ' Horizontal Taskbar
Else
NewPosition.y = 0 ' Vertical Taskbar
End If
End If
' Right border
If NewPosition.x + ClientRect.Width <=
WorkingRect.Right + mSnapOffset AndAlso
NewPosition.x + ClientRect.Width >=
WorkingRect.Right - mSnapOffset Then
NewPosition.x = WorkingRect.Right - (ClientRect.Width +
SystemInformation.FrameBorderSize.Width)
End If
' Bottom border
If NewPosition.y + ClientRect.Height <=
WorkingRect.Bottom + mSnapOffset AndAlso
NewPosition.y + ClientRect.Height >=
WorkingRect.Bottom - mSnapOffset Then
NewPosition.y = WorkingRect.Bottom - (ClientRect.Height +
SystemInformation.FrameBorderSize.Height)
End If
' Marshal it back
Runtime.InteropServices.Marshal.StructureToPtr(NewPosition,
LParam, True)
Catch ex As ArgumentException
End Try
End Sub
Private Sub frmMain_DragDrop(sender As Object, e As DragEventArgs) Handles MyBase.DragDrop Private Sub frmMain_DragDrop(sender As Object, e As DragEventArgs) Handles MyBase.DragDrop
DragDropForm(e) DragDropForm(e)
@ -215,7 +120,7 @@ Public Class frmStart
CURRENT_WORKFILE_HASH = Utils.NotNull(Filerow.Item("FILE_HASH"), "") CURRENT_WORKFILE_HASH = Utils.NotNull(Filerow.Item("FILE_HASH"), "")
LOGGER.Info(">> CURRENT_WORKFILE: " & CURRENT_WORKFILE) LOGGER.Info(">> CURRENT_WORKFILE: " & CURRENT_WORKFILE)
If File.Exists(CURRENT_WORKFILE) = True And DTACTUAL_FILES.Rows.Count > 0 Then If IO.File.Exists(CURRENT_WORKFILE) = True And DTACTUAL_FILES.Rows.Count > 0 Then
Open_IndexDialog() Open_IndexDialog()
Else Else
Throw New FileNotFoundException("Dropped file does not exist anymore!") Throw New FileNotFoundException("Dropped file does not exist anymore!")
@ -560,7 +465,6 @@ Public Class frmStart
Else Else
TimerFolderWatch.Start() TimerFolderWatch.Start()
End If End If
loaded = True
Opacity = 0.7 Opacity = 0.7
ClassHelper.Refresh_RegexTable() ClassHelper.Refresh_RegexTable()

View File

@ -113,12 +113,12 @@
<File Id="Globix" Name="DigitalData.GUIs.GlobalIndexer.dll" Source="DigitalData.GUIs.GlobalIndexer.dll" KeyPath="no" /> <File Id="Globix" Name="DigitalData.GUIs.GlobalIndexer.dll" Source="DigitalData.GUIs.GlobalIndexer.dll" KeyPath="no" />
<File Id="Filesystem" Name="DigitalData.Modules.Filesystem.dll" Source="DigitalData.Modules.Filesystem.dll" KeyPath="no" /> <File Id="Filesystem" Name="DigitalData.Modules.Filesystem.dll" Source="DigitalData.Modules.Filesystem.dll" KeyPath="no" />
<File Id="Config" Name="DigitalData.Modules.Config.dll" Source="DigitalData.Modules.Config.dll" KeyPath="no" /> <File Id="Config" Name="DigitalData.Modules.Config.dll" Source="DigitalData.Modules.Config.dll" KeyPath="no" />
<File Id="DLLLicenseManager" Name="DLLLicenseManager.dll" Source="P:\Visual Studio Projekte\Bibliotheken\DLLLicenseManager.dll" KeyPath="no" />
<File Id="DocumentViewer" Name="DigitalData.Controls.DocumentViewer.dll" Source="DigitalData.Controls.DocumentViewer.dll" KeyPath="no" /> <File Id="DocumentViewer" Name="DigitalData.Controls.DocumentViewer.dll" Source="DigitalData.Controls.DocumentViewer.dll" KeyPath="no" />
<File Id="LookupGrid" Name="DigitalData.Controls.LookupGrid.dll" Source="DigitalData.Controls.LookupGrid.dll" KeyPath="no" /> <File Id="LookupGrid" Name="DigitalData.Controls.LookupGrid.dll" Source="DigitalData.Controls.LookupGrid.dll" KeyPath="no" />
<File Id="Windream" Name="DigitalData.Modules.Windream.dll" Source="DigitalData.Modules.Windream.dll" KeyPath="no" /> <File Id="Windream" Name="DigitalData.Modules.Windream.dll" Source="DigitalData.Modules.Windream.dll" KeyPath="no" />
<File Id="Windows" Name="DigitalData.Modules.Windows.dll" Source="DigitalData.Modules.Windows.dll" KeyPath="no" /> <File Id="Windows" Name="DigitalData.Modules.Windows.dll" Source="DigitalData.Modules.Windows.dll" KeyPath="no" />
<File Id="Language" Name="DigitalData.Modules.Language.dll" Source="DigitalData.Modules.Language.dll" KeyPath="no" /> <File Id="Language" Name="DigitalData.Modules.Language.dll" Source="DigitalData.Modules.Language.dll" KeyPath="no" />
<File Id="License" Name="DigitalData.Modules.License.dll" Source="DigitalData.Modules.License.dll" KeyPath="no" />
<File Id="Database" Name="DigitalData.Modules.Database.dll" Source="DigitalData.Modules.Database.dll" KeyPath="no" /> <File Id="Database" Name="DigitalData.Modules.Database.dll" Source="DigitalData.Modules.Database.dll" KeyPath="no" />
<File Id="Messaging" Name="DigitalData.Modules.Messaging.dll" Source="DigitalData.Modules.Messaging.dll" KeyPath="no" /> <File Id="Messaging" Name="DigitalData.Modules.Messaging.dll" Source="DigitalData.Modules.Messaging.dll" KeyPath="no" />