diff --git a/app/DD_Clipboard_Searcher/App.config b/app/DD_Clipboard_Searcher/App.config index fdceb01..89659fa 100644 --- a/app/DD_Clipboard_Searcher/App.config +++ b/app/DD_Clipboard_Searcher/App.config @@ -1,17 +1,15 @@ - + - -
+ +
- + - + @@ -20,4 +18,4 @@ - \ No newline at end of file + diff --git a/app/DD_Clipboard_Searcher/Class1.vb b/app/DD_Clipboard_Searcher/Class1.vb index e81de26..c51f8fa 100644 --- a/app/DD_Clipboard_Searcher/Class1.vb +++ b/app/DD_Clipboard_Searcher/Class1.vb @@ -27,7 +27,7 @@ Public Class ClipboardWatcher : Inherits NativeWindow : Implements IDisposable 'Dim CapTxt As String = clsWINDOWSApi.GetCaption() If IsNothing(PROC_Name) Then Exit Sub If PROC_Name.StartsWith("DD_Clipboard_Watcher") Then Exit Sub - If LogErrorsOnly = False Then clsLogger.Add(String.Format(" >>{0} - Clipboard ChangedEvent for process '{1}' fired!", Now.ToString, PROC_Name), False) + 'Logger.Debug(String.Format(" >>{0} - Clipboard ChangedEvent for process '{1}' fired!", Now.ToString, PROC_Name), False) ' If CapTxt.ToUpper.StartsWith("DD") Then Exit Sub RaiseEvent Changed(Me, EventArgs.Empty) End Select diff --git a/app/DD_Clipboard_Searcher/ClassConfig.vb b/app/DD_Clipboard_Searcher/ClassConfig.vb new file mode 100644 index 0000000..04baed4 --- /dev/null +++ b/app/DD_Clipboard_Searcher/ClassConfig.vb @@ -0,0 +1,9 @@ +Imports DigitalData.Modules.Config.ConfigAttributes + +Public Class ClassConfig + + Public Property ConnectionString As String = "" + Public Property LogErrorsOnly As Boolean = True + Public Property HotkeyFunctionKey As String = "strg" + Public Property HotkeySearchKey As String = "f" +End Class diff --git a/app/DD_Clipboard_Searcher/ClassInit.vb b/app/DD_Clipboard_Searcher/ClassInit.vb index e823faa..546e0e0 100644 --- a/app/DD_Clipboard_Searcher/ClassInit.vb +++ b/app/DD_Clipboard_Searcher/ClassInit.vb @@ -1,24 +1,13 @@ Imports System.ComponentModel Imports DD_LIB_Standards -Imports System.IO +Imports DigitalData.Modules.Logging +Imports DigitalData.Modules.Config Public Class ClassInit Public _lizenzManager As clsLicenseManager Public Sub InitLogger() - Try - ' legt den Speicherort fest - Dim f As New IO.DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Digital Data\Clipboard Watcher\Log")) - If IO.Directory.Exists(f.ToString) = False Then - IO.Directory.CreateDirectory(f.ToString) - End If - - Dim logfilename As String = f.ToString & "\" & System.DateTime.Now.ToString("yyyy_MM_dd") & ".txt" - LOGGER_FILEPATH = logfilename - clsLogger.LOGFILE_PATH = LOGGER_FILEPATH - Catch ex As Exception - MsgBox("Unexpected Error while initializing Logger: " & ex.Message, MsgBoxStyle.Critical) - End Try - + LogConfig = New LogConfig(LogConfig.PathType.AppData) + Logger = LogConfig.GetLogger() End Sub Public Function InitDatabase() Dim dbResult As Boolean @@ -41,14 +30,47 @@ Public Class ClassInit End If End Function Public Function InitBasics() - Dim configResult As Boolean - configResult = LoadMyConfig() - If configResult = False Then - Throw New Exception("Unexpected error inm Initialisieren der Basis-Einstellungen. Weitere Informationen finden Sie in der Logdatei.") + ConfigManager = New ConfigManager(Of ClassConfig)(LogConfig, Application.UserAppDataPath, Application.CommonAppDataPath) + + With ConfigManager.Config + MyConnectionString = DecryptConnectionString(.ConnectionString) + LogErrorsOnly = .LogErrorsOnly + HotkeyFunctionKey = .HotkeyFunctionKey + HotkeySearchKey = .HotkeySearchKey + + LogConfig.Debug = Not .LogErrorsOnly + End With + 'Dim configResult As Boolean + 'configResult = LoadMyConfig() + 'If configResult = False Then + ' Throw New Exception("Unexpected error inm Initialisieren der Basis-Einstellungen. Weitere Informationen finden Sie in der Logdatei.") + 'Else + ' Return False + 'End If + End Function + + Private Function DecryptConnectionString(EncryptedConnectionString As String) As String + Dim oBuilder As New SqlClient.SqlConnectionStringBuilder With { + .ConnectionString = EncryptedConnectionString + } + + If oBuilder.ConnectionString.Contains("Password=") Then + Dim oPlaintextPassword As String + Dim oDecryptor As New clsEncryption("!35452didalog=") + + Try + oPlaintextPassword = oDecryptor.DecryptData(oBuilder.Password) + Catch ex As Exception + Logger.Error(ex) + Logger.Debug("Password {0} could not be decrypted. Assuming plaintext password.") + oPlaintextPassword = oBuilder.Password + End Try + Return EncryptedConnectionString.Replace(oBuilder.Password, oPlaintextPassword) Else - Return False + Return EncryptedConnectionString End If End Function + Public Shared Function InitUserLogin(Optional _User As String = "") Try If _User = "" Then @@ -63,13 +85,13 @@ Public Class ClassInit ElseIf DT_CLIENT_USER.Rows.Count = 1 Then CLIENT_SELECTED = DT_CLIENT_USER.Rows(0).Item("CLIENT_ID") Else - clsLogger.Add("User '" & USER_USERNAME & "' not related to a client", True) + Logger.Info("User '" & USER_USERNAME & "' not related to a client", True) ERROR_INIT = "NO CLIENT" 'ERROR_STATE = "NO CLIENT" Return False End If Catch ex As Exception - clsLogger.Add("Unexpected error in checking CLIENT: " & ex.Message) + Logger.Info("Unexpected error in checking CLIENT: " & ex.Message) CLIENT_SELECTED = 1 End Try @@ -77,14 +99,14 @@ Public Class ClassInit Dim sql = String.Format("SELECT * FROM [dbo].[FNDD_CHECK_USER_MODULE] ('{0}','CW',{1})", USER_USERNAME, CLIENT_SELECTED) Dim DT_CHECKUSER_MODULE As DataTable = clsDatabase.Return_Datatable(sql) If DT_CHECKUSER_MODULE.Rows.Count = 0 Then - clsLogger.Add("DT_CHECKUSER_MODULE.Rows.Count = 0", True) + Logger.Info("DT_CHECKUSER_MODULE.Rows.Count = 0", True) 'ERROR_STATE = "NO USER" MsgBox("Sorry - Something went wrong in getting Your rights." & vbNewLine & "Please contact the system administrator!", MsgBoxStyle.Exclamation) Return False End If If DT_CHECKUSER_MODULE.Rows.Count = 1 Then - clsLogger.Add(">> Login Username: " & USER_USERNAME, False) - clsLogger.Add(">> Login time: " & Now.ToString, False) + Logger.Info(">> Login Username: " & USER_USERNAME, False) + Logger.Info(">> Login time: " & Now.ToString, False) USER_ID = DT_CHECKUSER_MODULE.Rows(0).Item("USER_ID") USER_SURNAME = IIf(IsDBNull(DT_CHECKUSER_MODULE.Rows(0).Item("USER_SURNAME")), "", DT_CHECKUSER_MODULE.Rows(0).Item("USER_SURNAME")) USER_PRENAME = IIf(IsDBNull(DT_CHECKUSER_MODULE.Rows(0).Item("USER_PRENAME")), "", DT_CHECKUSER_MODULE.Rows(0).Item("USER_PRENAME")) @@ -100,7 +122,7 @@ Public Class ClassInit Else - clsLogger.Add(" - User '" & USER_USERNAME & "' not listed in Useradministration!", False) + Logger.Info(" - User '" & USER_USERNAME & "' not listed in Useradministration!", False) 'MsgBox("Achtung: Sie sind nicht in der Userverwaltung hinterlegt." & vbNewLine & "Bitte setzen Sie sich mit dem Systembetreuer in Verbindung!", MsgBoxStyle.Critical, "Achtung:") 'Me.Close() Dim msg = String.Format("You are not listed in the Useradministration." & vbNewLine & "Please contact the admin.") @@ -110,7 +132,7 @@ Public Class ClassInit If USER_IN_MODULE = False Then If USER_IS_ADMIN = False Then - clsLogger.Add(" - User: " & USER_USERNAME & " not related to module!", False) + Logger.Info(" - User: " & USER_USERNAME & " not related to module!", False) Dim msg = String.Format("Sie sind nicht für die Nutzung dieses Moduls freigeschaltet." & vbNewLine & "Bitte setzen Sie sich mit dem Systemadministrator in Verbindung!") If USER_LANGUAGE <> "de-DE" Then @@ -146,7 +168,7 @@ Public Class ClassInit WD_UNICODE = clsDatabase.Execute_Scalar("SELECT WD_UNICODE FROM TBCW_CONFIGURATION WHERE GUID = 1") - If LogErrorsOnly = False Then clsLogger.Add(" >> Count Users logged in: " & USERCOUNT_LOGGED_IN.ToString, False) + Logger.Debug(" >> Count Users logged in: " & USERCOUNT_LOGGED_IN.ToString, False) If LICENSE_COUNT < USERCOUNT_LOGGED_IN And LICENSE_EXPIRED = False Then Dim msg = String.Format("Die Anzahl der aktuell angemeldeten User (" & USERCOUNT_LOGGED_IN.ToString & ") überschreitet die Anzahl der aktuellen Lizenzen!" & vbNewLine & "Anzahl der Lizenzen: " & LICENSE_COUNT.ToString & vbNewLine & "Bitte setzen Sie sich mit dem Systembetreuer in Verbindung!") @@ -155,12 +177,12 @@ Public Class ClassInit "Number of licenses: " & LICENSE_COUNT.ToString & vbNewLine & "Please contact Your admin!") End If MsgBox(msg, MsgBoxStyle.Exclamation) - clsLogger.Add(" >> The number of logged Users (" & USERCOUNT_LOGGED_IN.ToString & ") exceeds the number of licenses (" & LICENSE_COUNT & ") ", False) + Logger.Info(" >> The number of logged Users (" & USERCOUNT_LOGGED_IN.ToString & ") exceeds the number of licenses (" & LICENSE_COUNT & ") ", False) If USER_IS_ADMIN = False Then 'Anmeldung wieder herausnehmen sql = "DELETE FROM TBDD_USER_MODULE_LOG_IN WHERE USER_ID = " & USER_ID & " AND MODULE= 'Clipboard-Watcher'" clsDatabase.Execute_non_Query(sql, True) - clsLogger.Add(" - logged out the user", False) + Logger.Info(" - logged out the user", False) Return False End If End If @@ -168,7 +190,7 @@ Public Class ClassInit Catch ex As Exception - clsLogger.Add("Unexpected Error in InitUserLogin: " & ex.Message, True) + Logger.Info("Unexpected Error in InitUserLogin: " & ex.Message, True) MsgBox("Unexpected Error in InitUserLogin: " & ex.Message, MsgBoxStyle.Critical) Return False End Try diff --git a/app/DD_Clipboard_Searcher/ClassLayout.vb b/app/DD_Clipboard_Searcher/ClassLayout.vb index 88a845a..cc1aba1 100644 --- a/app/DD_Clipboard_Searcher/ClassLayout.vb +++ b/app/DD_Clipboard_Searcher/ClassLayout.vb @@ -47,7 +47,7 @@ Public Class ClassWindowLocation Next Catch notFoundEx As System.IO.FileNotFoundException - clsLogger.Add("Window Position & Size added for Form " & form.Name) + Logger.Info("Window Position & Size added for Form " & form.Name) Catch ex As Exception MsgBox("Error while loading Window Position!" & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try @@ -82,7 +82,7 @@ Public Class ClassWindowLocation layout.Save(settings) Catch notFoundEx As System.IO.FileNotFoundException - clsLogger.Add("Window Position & Size added for Form " & form.Name) + Logger.Info("Window Position & Size added for Form " & form.Name) Catch ex As Exception MsgBox("Error while saving Window Position!" & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try diff --git a/app/DD_Clipboard_Searcher/DD_Clipboard_Watcher.vbproj b/app/DD_Clipboard_Searcher/DD_Clipboard_Watcher.vbproj index 67b3c3a..9282b96 100644 --- a/app/DD_Clipboard_Searcher/DD_Clipboard_Watcher.vbproj +++ b/app/DD_Clipboard_Searcher/DD_Clipboard_Watcher.vbproj @@ -11,8 +11,9 @@ DD_Clipboard_Watcher 512 WindowsForms - v4.5.1 + v4.6.1 true + AnyCPU @@ -53,44 +54,59 @@ ..\..\..\DDLibStandards\DD_LIB_Standards\bin\Debug\DD_LIB_Standards.dll - + False - D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.Data.v15.2.dll + - + False - D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.Printing.v15.2.Core.dll + - + False - D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.Sparkline.v15.2.Core.dll + - + False - D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.Utils.v15.2.dll + - + False - D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.XtraEditors.v15.2.dll + - + False - D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.XtraGrid.v15.2.dll + - + False - D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.XtraLayout.v15.2.dll + - + False - D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.XtraPrinting.v15.2.dll + + + + ..\..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Config.dll + + + ..\..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Logging.dll + + + + ..\packages\NLog.4.5.11\lib\net45\NLog.dll + + + + + @@ -113,6 +129,7 @@ + @@ -235,6 +252,7 @@ MyDataset.xsd + diff --git a/app/DD_Clipboard_Searcher/DD_Clipboard_Watcher.vbproj.bak b/app/DD_Clipboard_Searcher/DD_Clipboard_Watcher.vbproj.bak new file mode 100644 index 0000000..5e1e4b8 --- /dev/null +++ b/app/DD_Clipboard_Searcher/DD_Clipboard_Watcher.vbproj.bak @@ -0,0 +1,290 @@ + + + + + Debug + AnyCPU + {09BC9934-1A38-4752-8873-639B42779CDB} + WinExe + DD_Clipboard_Watcher.My.MyApplication + DD_Clipboard_Watcher + DD_Clipboard_Watcher + 512 + WindowsForms + v4.6.1 + true + + + + AnyCPU + true + full + true + true + bin\Debug\ + DD_Clipboard_Watcher.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + AnyCPU + pdbonly + false + true + true + bin\Release\ + DD_Clipboard_Watcher.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + DD_Icons_ICO_CBWATCHER_48px.ico + + + + ..\..\..\DDLibStandards\DD_LIB_Standards\bin\Debug\DD_LIB_Standards.dll + + + False + D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.Data.v15.2.dll + + + False + D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.Printing.v15.2.Core.dll + + + False + D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.Sparkline.v15.2.Core.dll + + + False + D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.Utils.v15.2.dll + + + False + D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.XtraEditors.v15.2.dll + + + False + D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.XtraGrid.v15.2.dll + + + False + D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.XtraLayout.v15.2.dll + + + False + D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.XtraPrinting.v15.2.dll + + + ..\..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Config.dll + + + ..\..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Logging.dll + + + + ..\packages\NLog.4.5.11\lib\net45\NLog.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + frmAdministration.vb + + + Form + + + frmClientLogin.vb + + + Form + + + frmLicense.vb + + + Form + + + Form + + + frmMain.vb + Form + + + frmConfig_Basic.vb + + + Form + + + frmSplash.vb + + + Form + + + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + True + True + MyDataset.xsd + + + + + frmAdministration.vb + Designer + + + frmClientLogin.vb + + + frmClientLogin.vb + + + frmLicense.vb + + + frmMain.vb + + + frmConfig_Basic.vb + + + frmSplash.vb + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + + MyDataset.xsd + + + Designer + MSDataSetGenerator + MyDataset.Designer.vb + + + MyDataset.xsd + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/DD_Clipboard_Searcher/My Project/Settings.Designer.vb b/app/DD_Clipboard_Searcher/My Project/Settings.Designer.vb index f1c5cdc..ceedb44 100644 --- a/app/DD_Clipboard_Searcher/My Project/Settings.Designer.vb +++ b/app/DD_Clipboard_Searcher/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/app/DD_Clipboard_Searcher/My Project/licenses.licx b/app/DD_Clipboard_Searcher/My Project/licenses.licx index 16b05ba..e69de29 100644 --- a/app/DD_Clipboard_Searcher/My Project/licenses.licx +++ b/app/DD_Clipboard_Searcher/My Project/licenses.licx @@ -1 +0,0 @@ -DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/app/DD_Clipboard_Searcher/My Project/licenses.licx.bak b/app/DD_Clipboard_Searcher/My Project/licenses.licx.bak new file mode 100644 index 0000000..16b05ba --- /dev/null +++ b/app/DD_Clipboard_Searcher/My Project/licenses.licx.bak @@ -0,0 +1 @@ +DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/app/DD_Clipboard_Searcher/clsSearch.vb b/app/DD_Clipboard_Searcher/clsSearch.vb index 853cf0e..abdb028 100644 --- a/app/DD_Clipboard_Searcher/clsSearch.vb +++ b/app/DD_Clipboard_Searcher/clsSearch.vb @@ -27,7 +27,7 @@ Public Class clsSearch Dim extension = Path.GetExtension(BaseSearch) Dim windream_temp_search As String = "" If IO.File.Exists(BaseSearch) = False Then - clsLogger.Add("Die Windream-Suche existiert nicht oder ist nicht zugreifbar!", True) + Logger.Info("Die Windream-Suche existiert nicht oder ist nicht zugreifbar!", True) MsgBox("Die Windream-Suche existiert nicht oder ist nicht zugreifbar!", MsgBoxStyle.Critical) Return Nothing End If @@ -47,15 +47,15 @@ Public Class clsSearch If WD_UNICODE = True Then EncodingFormat = Encoding.GetEncoding(1252) '1252 - If LogErrorsOnly = False Then clsLogger.Add(" ...Unicode is used (Encoding.GetEncoding(1252))", False) + Logger.Debug(" ...Unicode is used (Encoding.GetEncoding(1252))", False) Else - If LogErrorsOnly = False Then clsLogger.Add(" ...UTF8 (Encoding.GetEncoding(65001))", False) + Logger.Debug(" ...UTF8 (Encoding.GetEncoding(65001))", False) EncodingFormat = Encoding.GetEncoding(65001) End If - If LogErrorsOnly = False Then clsLogger.Add(" ...ReadAlltext: " & BaseSearch, False) + Logger.Debug(" ...ReadAlltext: " & BaseSearch, False) fileContents = My.Computer.FileSystem.ReadAllText(BaseSearch, EncodingFormat) ', System.Text.Encoding.Unicode - If LogErrorsOnly = False Then clsLogger.Add(" ...fileContents geladen", False) + Logger.Debug(" ...fileContents geladen", False) fileContents = fileContents.Replace("Í", "Ö") fileContents = fileContents.Replace("@Clipboard", CURR_MATCH_RESULT) fileContents = fileContents.Replace("@CLIPBOARD", CURR_MATCH_RESULT) @@ -68,7 +68,7 @@ Public Class clsSearch Try 'Die File schreiben My.Computer.FileSystem.WriteAllText(windream_temp_search, fileContents, False, EncodingFormat) - If LogErrorsOnly = False Then clsLogger.Add(" ...wrote Text to windream_temp_search: " & windream_temp_search, False) + Logger.Debug(" ...wrote Text to windream_temp_search: " & windream_temp_search, False) ' XML-Datei öffnen und laden Dim Stream As New IO.StreamReader(CStr(windream_temp_search), EncodingFormat) Dim Reader As New System.Xml.XmlTextReader(Stream) @@ -79,9 +79,9 @@ Public Class clsSearch xml.Load(Reader) Reader.Close() xml.Save(windream_temp_search) - If LogErrorsOnly = False Then clsLogger.Add(" ...Xml Generiert: " & windream_temp_search, False) + Logger.Debug(" ...Xml Generiert: " & windream_temp_search, False) Catch ex As Exception - clsLogger.Add("TempFile could not be created: " & ex.Message, True) + Logger.Info("TempFile could not be created: " & ex.Message, True) MsgBox(ex.Message, MsgBoxStyle.Critical, "Unerwarteter Fehler in Write XmlSearch:") End Try @@ -103,14 +103,14 @@ Public Class clsSearch Dim rctMain As RECT GetWindowRect(p.MainWindowHandle, rctMain) If LogErrorsOnly = False Then - clsLogger.Add(" ...Top-Position: " & rctMain.Top.ToString, False) - clsLogger.Add(" ...Left-Position: " & rctMain.Left.ToString, False) - clsLogger.Add(" ...Right-Position: " & rctMain.Right.ToString, False) - clsLogger.Add(" ...Bottom-Position: " & rctMain.Bottom.ToString, False) + Logger.Debug(" ...Top-Position: " & rctMain.Top.ToString, False) + Logger.Debug(" ...Left-Position: " & rctMain.Left.ToString, False) + Logger.Debug(" ...Right-Position: " & rctMain.Right.ToString, False) + Logger.Debug(" ...Bottom-Position: " & rctMain.Bottom.ToString, False) End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Ausführen der windream-Suche:") - clsLogger.Add("Unexpected error while executing search: " & ex.Message, True) + Logger.Info("Unexpected error while executing search: " & ex.Message, True) Return "Unexpected error while executing search" End Try Dim psList() As Process @@ -134,19 +134,19 @@ Public Class clsSearch Next p Catch ex As Exception - clsLogger.Add("Unexpected error while Setting foreground: " & ex.Message) + Logger.Info("Unexpected error while Setting foreground: " & ex.Message) End Try CURR_MATCH_WM_SEARCH = Nothing CURR_MATCH_RESULT = Nothing Return "" Catch ex As Exception - clsLogger.Add("Unexpected error in Create Search: " & ex.Message) + Logger.Info("Unexpected error in Create Search: " & ex.Message) MsgBox("Error in Create Search:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) Return "Unexpected error in Create Search" End Try Catch ex As Exception - clsLogger.Add("Unexpected error in RUN_WD_SEARCH: " & ex.Message) + Logger.Info("Unexpected error in RUN_WD_SEARCH: " & ex.Message) MsgBox("Error in RUN_WD_SEARCH:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) Return "Unerwarteter Unexpected error in RUN_WD_SEARCH" End Try diff --git a/app/DD_Clipboard_Searcher/clsWINDOWSApi.vb b/app/DD_Clipboard_Searcher/clsWINDOWSApi.vb index c8ce1fe..09bb196 100644 --- a/app/DD_Clipboard_Searcher/clsWINDOWSApi.vb +++ b/app/DD_Clipboard_Searcher/clsWINDOWSApi.vb @@ -25,7 +25,7 @@ Public Class clsWINDOWSApi Dim enumerator1 As New clsWindowApi 'Jedes Formularwindow durchlaufen For Each top As clsWindowApi.ApiWindow In enumerator1.GetTopLevelWindows() - If LogErrorsOnly = False Then clsLogger.Add(" ... top-window Name: " & top.MainWindowTitle, False) + Logger.Debug(" ... top-window Name: " & top.MainWindowTitle, False) If top.MainWindowTitle.Contains(windowname) Or top.MainWindowTitle.ToLower = windowname.ToLower Then Console.WriteLine(top.MainWindowTitle) Return False @@ -33,7 +33,7 @@ Public Class clsWINDOWSApi Next top Catch ex As Exception MsgBox("Error in IsRelevantWindowt:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) - clsLogger.Add(">> Error in IsRelevantWindow:" & ex.Message, False) + Logger.Info(">> Error in IsRelevantWindow:" & ex.Message, False) Return False End Try End Function diff --git a/app/DD_Clipboard_Searcher/frmConfig_Basic.vb b/app/DD_Clipboard_Searcher/frmConfig_Basic.vb index 088bbf4..1bb0abd 100644 --- a/app/DD_Clipboard_Searcher/frmConfig_Basic.vb +++ b/app/DD_Clipboard_Searcher/frmConfig_Basic.vb @@ -38,7 +38,11 @@ Public Class frmConfig_Basic Dim pw As String = cipherText con = "Server=" & Me.txtServer.Text & ";Database=" & Me.cmbDatenbank.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & pw & ";" End If - SaveConfigValue("MyConnectionString", con) + + 'SaveConfigValue("MyConnectionString", con) + ConfigManager.Config.ConnectionString = con + ConfigManager.Save() + Dim csb As New SqlClient.SqlConnectionStringBuilder csb.ConnectionString = MyConnectionString Dim constr = connection.ConnectionString @@ -136,15 +140,11 @@ Public Class frmConfig_Basic End If End Sub - Private Sub chkbxloadWDDocs_CheckedChanged(sender As Object, e As EventArgs) - - End Sub - Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked ' Specify that the link was visited. - Me.LinkLabel1.LinkVisited = True + LinkLabel1.LinkVisited = True ' Navigate to a URL. - System.Diagnostics.Process.Start("http://www.didalog.de/Support") + Process.Start("http://www.didalog.de/Support") End Sub Private Sub btnApplicationFolder_Click(sender As Object, e As EventArgs) Handles btnApplicationFolder.Click @@ -152,12 +152,16 @@ Public Class frmConfig_Basic End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click - Process.Start(System.IO.Path.GetDirectoryName(LOGGER_FILEPATH)) + Process.Start(LogConfig.LogDirectory) End Sub Private Sub chkLogErrorsOnly_CheckedChanged(sender As Object, e As EventArgs) Handles chkLogErrorsOnly.CheckedChanged LogErrorsOnly = chkLogErrorsOnly.Checked - SaveConfigValue("LogErrorsOnly", LogErrorsOnly) + LogConfig.Debug = Not LogErrorsOnly + + 'SaveConfigValue("LogErrorsOnly", LogErrorsOnly) + ConfigManager.Config.LogErrorsOnly = LogErrorsOnly + ConfigManager.Save() End Sub @@ -174,9 +178,6 @@ Public Class frmConfig_Basic Catch ex As Exception End Try - - - End Select End Sub @@ -209,8 +210,13 @@ Public Class frmConfig_Basic Try If cmbfunctionHit.SelectedIndex <> -1 Then Hotkey.RemoveHotKey(354523017) - SaveConfigValue("HotkeyFunctionKey", cmbfunctionHit.Text) - SaveConfigValue("HotkeySearchKey", txtHotkeySearchKey.Text) + + 'SaveConfigValue("HotkeyFunctionKey", cmbfunctionHit.Text) + 'SaveConfigValue("HotkeySearchKey", txtHotkeySearchKey.Text) + ConfigManager.Config.HotkeyFunctionKey = cmbfunctionHit.Text + ConfigManager.Config.HotkeySearchKey = txtHotkeySearchKey.Text + ConfigManager.Save() + Dim keyCode As Keys Dim kc As New KeysConverter Dim obj As Object = kc.ConvertFromString(txtHotkeySearchKey.Text.ToUpper) diff --git a/app/DD_Clipboard_Searcher/frmMain.vb b/app/DD_Clipboard_Searcher/frmMain.vb index 4bef0e4..e958eb4 100644 --- a/app/DD_Clipboard_Searcher/frmMain.vb +++ b/app/DD_Clipboard_Searcher/frmMain.vb @@ -37,7 +37,7 @@ Public Class frmMain 'End With Dim found As Boolean = False CLIPBOARD_TEXT = Clipboard.GetText - If LogErrorsOnly = False Then clsLogger.Add(String.Format(" >>{0} - Clipboard-Watcher fired for process '{1}'", Now.ToString, PROC_Name), False) + Logger.Debug(String.Format(" >>{0} - Clipboard-Watcher fired for process '{1}'", Now.ToString, PROC_Name), False) For Each row As DataRow In DT_USER_PROFILES.Rows If found = True Then Exit For @@ -56,16 +56,16 @@ Public Class frmMain End If 'Else ' NotifyIconMain.ShowBalloonTip(20000, "Clipboard Watcher", String.Format("Clipboard Watcher fired but Clipboardcontent is equal: '{0}'", CURR_MATCH_RESULT), ToolTipIcon.Info) - ' If LogErrorsOnly = False Then clsLogger.Add(String.Format(" >> {0} - Equal Clipboard-result '{1}'", Now.ToString, CURR_MATCH_RESULT), False) + ' Logger.Debug(String.Format(" >> {0} - Equal Clipboard-result '{1}'", Now.ToString, CURR_MATCH_RESULT), False) ' Exit For 'End If Else - If LogErrorsOnly = False Then clsLogger.Add(String.Format(" >> {0} - No regex-match for cliboardtext '{1}'", Now.ToString, match.Groups(0).Value), False) + Logger.Debug(String.Format(" >> {0} - No regex-match for cliboardtext '{1}'", Now.ToString, match.Groups(0).Value), False) End If End If Next If found = False Then - If LogErrorsOnly = False Then clsLogger.Add(String.Format(" >> {0} - Process '{1}' not configured!", Now.ToString, PROC_Name), False) + Logger.Debug(String.Format(" >> {0} - Process '{1}' not configured!", Now.ToString, PROC_Name), False) End If End Sub @@ -94,7 +94,7 @@ Public Class frmMain End Sub Private Sub frmMain_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing - clsLogger.Add(">> Logout time: " & Now.ToString, False) + Logger.Info(">> Logout time: " & Now.ToString, False) If ERROR_INIT = "INVALID USER" Or ERROR_INIT = "NO CLIENT" Then Exit Sub End If @@ -129,7 +129,7 @@ Public Class frmMain End Try If clsLogger.LOGG_MSG <> String.Empty Then - clsLogger.Add(clsLogger.LOGG_MSG, False) + Logger.Info(clsLogger.LOGG_MSG, False) End If End Sub diff --git a/app/DD_Clipboard_Searcher/modCurrent.vb b/app/DD_Clipboard_Searcher/modCurrent.vb index 7b9b404..3ff6ace 100644 --- a/app/DD_Clipboard_Searcher/modCurrent.vb +++ b/app/DD_Clipboard_Searcher/modCurrent.vb @@ -1,4 +1,11 @@ -Module modCurrent +Imports DigitalData.Modules.Config +Imports DigitalData.Modules.Logging + +Module modCurrent + Public LogConfig As LogConfig + Public Logger As Logger + + Public ConfigManager As ConfigManager(Of ClassConfig) Public MyConnectionString As String = "" Public HotkeyFunctionKey As String = "strg" @@ -47,7 +54,6 @@ Public PROC_PID As String Public PROC_Name As String Public PROC_WindowTitle As String - Public LOGGER_FILEPATH As String Public CLIENT_SELECTED As Integer = 0 End Module diff --git a/app/DD_Clipboard_Searcher/modMySettings.vb b/app/DD_Clipboard_Searcher/modMySettings.vb index 94258f9..bb0855c 100644 --- a/app/DD_Clipboard_Searcher/modMySettings.vb +++ b/app/DD_Clipboard_Searcher/modMySettings.vb @@ -30,7 +30,7 @@ Module modMySettings Try PWplainText = wrapper.DecryptData(csb.Password) Catch ex As Exception - clsLogger.Add("- the Password '" & csb.Password & "' could not be decrypted", False) + Logger.Info("- the Password '" & csb.Password & "' could not be decrypted", False) PWplainText = csb.Password End Try connstring = Row.Item("Value").ToString.Replace(csb.Password, PWplainText) diff --git a/app/DD_Clipboard_Searcher/packages.config b/app/DD_Clipboard_Searcher/packages.config new file mode 100644 index 0000000..a515109 --- /dev/null +++ b/app/DD_Clipboard_Searcher/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file