This commit is contained in:
ms
2019-10-24 16:47:06 +02:00
parent d3f95ae877
commit 18e00e475d
18 changed files with 3423 additions and 0 deletions

6
App.config Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

131
Main.Designer.vb generated Normal file
View File

@@ -0,0 +1,131 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class TSUserReporter
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Wird vom Windows Form-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(TSUserReporter))
Me.cmdGetLocalUser = New System.Windows.Forms.Button()
Me.NotifyIcon1 = New System.Windows.Forms.NotifyIcon(Me.components)
Me.ContextMenuStripIcon = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.ReportToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.BeendenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.ReporterAnzeigenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator()
Me.Label1 = New System.Windows.Forms.Label()
Me.cmdMini = New System.Windows.Forms.Button()
Me.ContextMenuStripIcon.SuspendLayout()
Me.SuspendLayout()
'
'cmdGetLocalUser
'
Me.cmdGetLocalUser.Location = New System.Drawing.Point(12, 123)
Me.cmdGetLocalUser.Name = "cmdGetLocalUser"
Me.cmdGetLocalUser.Size = New System.Drawing.Size(199, 23)
Me.cmdGetLocalUser.TabIndex = 0
Me.cmdGetLocalUser.Text = "Lokalen User abfragen"
Me.cmdGetLocalUser.UseVisualStyleBackColor = True
'
'NotifyIcon1
'
Me.NotifyIcon1.ContextMenuStrip = Me.ContextMenuStripIcon
Me.NotifyIcon1.Icon = CType(resources.GetObject("NotifyIcon1.Icon"), System.Drawing.Icon)
Me.NotifyIcon1.Text = "TSUserReporter"
Me.NotifyIcon1.Visible = True
'
'ContextMenuStripIcon
'
Me.ContextMenuStripIcon.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ReportToolStripMenuItem, Me.ReporterAnzeigenToolStripMenuItem, Me.ToolStripSeparator1, Me.BeendenToolStripMenuItem})
Me.ContextMenuStripIcon.Name = "ContextMenuStripIcon"
Me.ContextMenuStripIcon.Size = New System.Drawing.Size(170, 76)
'
'ReportToolStripMenuItem
'
Me.ReportToolStripMenuItem.Name = "ReportToolStripMenuItem"
Me.ReportToolStripMenuItem.Size = New System.Drawing.Size(169, 22)
Me.ReportToolStripMenuItem.Text = "Report"
'
'BeendenToolStripMenuItem
'
Me.BeendenToolStripMenuItem.Name = "BeendenToolStripMenuItem"
Me.BeendenToolStripMenuItem.Size = New System.Drawing.Size(169, 22)
Me.BeendenToolStripMenuItem.Text = "Beenden"
'
'ReporterAnzeigenToolStripMenuItem
'
Me.ReporterAnzeigenToolStripMenuItem.Name = "ReporterAnzeigenToolStripMenuItem"
Me.ReporterAnzeigenToolStripMenuItem.Size = New System.Drawing.Size(169, 22)
Me.ReporterAnzeigenToolStripMenuItem.Text = "Reporter anzeigen"
'
'ToolStripSeparator1
'
Me.ToolStripSeparator1.Name = "ToolStripSeparator1"
Me.ToolStripSeparator1.Size = New System.Drawing.Size(166, 6)
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(12, 9)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(39, 13)
Me.Label1.TabIndex = 2
Me.Label1.Text = "Label1"
'
'cmdMini
'
Me.cmdMini.Image = Global.TSUserReporter.My.Resources.Resources.del
Me.cmdMini.Location = New System.Drawing.Point(168, 9)
Me.cmdMini.Name = "cmdMini"
Me.cmdMini.Size = New System.Drawing.Size(43, 23)
Me.cmdMini.TabIndex = 3
Me.cmdMini.UseVisualStyleBackColor = True
'
'TSUserReporter
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(219, 157)
Me.ControlBox = False
Me.Controls.Add(Me.cmdMini)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.cmdGetLocalUser)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "TSUserReporter"
Me.ShowInTaskbar = False
Me.Text = "TSUserReporter"
Me.WindowState = System.Windows.Forms.FormWindowState.Minimized
Me.ContextMenuStripIcon.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents cmdGetLocalUser As Button
Friend WithEvents NotifyIcon1 As NotifyIcon
Friend WithEvents ContextMenuStripIcon As ContextMenuStrip
Friend WithEvents ReportToolStripMenuItem As ToolStripMenuItem
Friend WithEvents ReporterAnzeigenToolStripMenuItem As ToolStripMenuItem
Friend WithEvents ToolStripSeparator1 As ToolStripSeparator
Friend WithEvents BeendenToolStripMenuItem As ToolStripMenuItem
Friend WithEvents Label1 As Label
Friend WithEvents cmdMini As Button
End Class

2391
Main.resx Normal file

File diff suppressed because it is too large Load Diff

85
Main.vb Normal file
View File

@@ -0,0 +1,85 @@
Public Class TSUserReporter
Dim lastupdate As DateTime
Private Sub TSUserReporter_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Routine()
FillLabel()
End Sub
Private Sub cmdGetLocalUser_Click(sender As Object, e As EventArgs) Handles cmdGetLocalUser.Click
Routine()
End Sub
Sub Routine()
cRes.LocalUser.FillWithLoggedOnUser()
cRes.LocalTeamviewerID = getregkey()
Report()
FillLabel()
End Sub
Function getregkey()
Dim Reg As String = Nothing
If My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\TeamViewer", "ClientIDOfTSUser", Nothing) Is Nothing Then
Reg = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\TeamViewer", "ClientID", Nothing)
Else
Reg = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\TeamViewer", "ClientIDOfTSUser", Nothing)
End If
Return Reg
End Function
Function Report()
lastupdate = Date.Now
Dim ds As New DataSet
cSQL.SQL2DS("select * from TbL_TSSitzungen where Benutzeranmeldename = '" & cRes.LocalUser.BenutzeranmeldeName & " ' ", ds)
If Not ds.Tables(0).Rows.Count = 0 Then
RemoveSitzung()
End If
cSQL.InsertSQL("TbL_TSSitzungen", "(Benutzeranmeldename, Name, TeamviewerID, LastReport, TSServer) VALUES (
'" & cRes.LocalUser.BenutzeranmeldeName & "',
'" & cRes.LocalUser.Name & "',
'" & cRes.LocalTeamviewerID & "',
'" & Date.Now & "',
'" & cRes.LocalUser.Hostname & "')")
End Function
Function FillLabel()
Label1.Text = ""
Label1.Text &= cRes.LocalUser.BenutzeranmeldeName & vbCrLf
Label1.Text &= cRes.LocalUser.Name & vbCrLf
Label1.Text &= cRes.LocalUser.Hostname & vbCrLf
Label1.Text &= "TeamviewerID: " & cRes.LocalTeamviewerID & vbCrLf
Label1.Text &= vbCrLf
Label1.Text &= "Letzte Aktualisierung:" & vbCrLf
Label1.Text &= lastupdate
End Function
Sub RemoveSitzung()
cSQL.DeleteSQL("TbL_TSSitzungen", "Benutzeranmeldename = '" & cRes.LocalUser.BenutzeranmeldeName & " ' ")
End Sub
Private Sub TSUserReporter_Closed(sender As Object, e As EventArgs) Handles Me.Closed
RemoveSitzung()
End Sub
Private Sub ReportToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ReportToolStripMenuItem.Click
Routine()
End Sub
Private Sub BeendenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles BeendenToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub ReporterAnzeigenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ReporterAnzeigenToolStripMenuItem.Click
Me.Show()
Me.WindowState = WindowState.Normal
Me.Show()
End Sub
Private Sub cmdMini_Click(sender As Object, e As EventArgs) Handles cmdMini.Click
Me.WindowState = WindowState.Minimized
Me.Hide()
End Sub
End Class

38
My Project/Application.Designer.vb generated Normal file
View File

@@ -0,0 +1,38 @@
'------------------------------------------------------------------------------
' <auto-generated>
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.42000
'
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
'HINWEIS: Diese Datei wird automatisch generiert und darf nicht direkt bearbeitet werden. Wenn Sie Änderungen vornehmen möchten
' oder in dieser Datei Buildfehler auftreten, wechseln Sie zum Projekt-Designer.
' (Wechseln Sie dazu zu den Projekteigenschaften, oder doppelklicken Sie auf den Knoten "Mein Projekt" im
' Projektmappen-Explorer). Nehmen Sie auf der Registerkarte "Anwendung" entsprechende Änderungen vor.
'
Partial Friend Class MyApplication
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Sub New()
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
Me.IsSingleInstance = false
Me.EnableVisualStyles = true
Me.SaveMySettingsOnExit = true
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
End Sub
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.TSUserReporter.TSUserReporter
End Sub
End Class
End Namespace

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>true</MySubMain>
<MainForm>TSUserReporter</MainForm>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>

View File

@@ -0,0 +1,35 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' Allgemeine Informationen über eine Assembly werden über die folgenden
' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
' die einer Assembly zugeordnet sind.
' Werte der Assemblyattribute überprüfen
<Assembly: AssemblyTitle("TSUserReporter")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("TSUserReporter")>
<Assembly: AssemblyCopyright("Copyright © 2019")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'Die folgende GUID wird für die typelib-ID verwendet, wenn dieses Projekt für COM verfügbar gemacht wird.
<Assembly: Guid("326fd539-62fc-46b5-bb18-bbeedb6fda85")>
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
'
' Hauptversion
' Nebenversion
' Buildnummer
' Revision
'
' Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
' indem Sie "*" wie unten gezeigt eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

73
My Project/Resources.Designer.vb generated Normal file
View File

@@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <auto-generated>
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.42000
'
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Namespace My.Resources
'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
'-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
'''<summary>
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("TSUserReporter.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
'''<summary>
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
'''</summary>
Friend ReadOnly Property del() As System.Drawing.Bitmap
Get
Dim obj As Object = ResourceManager.GetObject("del", resourceCulture)
Return CType(obj,System.Drawing.Bitmap)
End Get
End Property
End Module
End Namespace

124
My Project/Resources.resx Normal file
View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="del" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\del.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

73
My Project/Settings.Designer.vb generated Normal file
View File

@@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.TSUserReporter.My.MySettings
Get
Return Global.TSUserReporter.My.MySettings.Default
End Get
End Property
End Module
End Namespace

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

BIN
Resources/del.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

25
TSUserReporter.sln Normal file
View File

@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29411.108
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TSUserReporter", "TSUserReporter.vbproj", "{86DD3C4F-CD19-4809-98DD-5E6CBE68124A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{86DD3C4F-CD19-4809-98DD-5E6CBE68124A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{86DD3C4F-CD19-4809-98DD-5E6CBE68124A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{86DD3C4F-CD19-4809-98DD-5E6CBE68124A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{86DD3C4F-CD19-4809-98DD-5E6CBE68124A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1B4E59B3-990B-4994-8D6A-F192E04187F0}
EndGlobalSection
EndGlobal

168
TSUserReporter.vbproj Normal file
View File

@@ -0,0 +1,168 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{86DD3C4F-CD19-4809-98DD-5E6CBE68124A}</ProjectGuid>
<OutputType>WinExe</OutputType>
<StartupObject>TSUserReporter.My.MyApplication</StartupObject>
<RootNamespace>TSUserReporter</RootNamespace>
<AssemblyName>TSUserReporter</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>TSUserReporter.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>TSUserReporter.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>info.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>443CA3745EE904EED98572A89099259301BA06D1</ManifestCertificateThumbprint>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.DirectoryServices.AccountManagement" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Drawing" />
<Import Include="System.Diagnostics" />
<Import Include="System.Windows.Forms" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="cBenutzer.vb" />
<Compile Include="cRes.vb" />
<Compile Include="cSQL.vb" />
<Compile Include="Main.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Main.Designer.vb">
<DependentUpon>Main.vb</DependentUpon>
<SubType>Form</SubType>
</Compile>
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Main.resx">
<DependentUpon>Main.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="info.ico" />
<None Include="Resources\del.png" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 und x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

173
cBenutzer.vb Normal file
View File

@@ -0,0 +1,173 @@
Imports System.Reflection
Public Class cBenutzer
Property Name As String = ""
Property userPrincipalName As String = ""
Property Domäne As String = ""
Property BenutzeranmeldeName As String = ""
Property Nachname As String = ""
Property Vorname As String = ""
Property Mail As String = ""
Property distinguishedName As String = ""
Property cn As String = ""
Property msDSPrincipalName As String = ""
Property localdistinguishedName As String = ""
Property suchname As String = ""
Property Hostname As String = ""
Function FillWithLoggedOnUser(Optional ByVal dcabfrage As Boolean = False, Optional ByVal LDAPa As String = "") '"LDAP://DC=VERAG,DC=OST,DC=DMN")
Try
userPrincipalName = System.DirectoryServices.AccountManagement.UserPrincipal.Current.UserPrincipalName
Name = System.DirectoryServices.AccountManagement.UserPrincipal.Current.Name
Hostname = Environment.MachineName
Catch
End Try
Domäne = System.DirectoryServices.ActiveDirectory.Domain.GetCurrentDomain.ToString
BenutzeranmeldeName = Environment.UserDomainName & "\" & Environment.UserName
If dcabfrage = True Then
'cRes.DebugText = userPrincipalName & LDAPa
FillFromDC(userPrincipalName, "userPrincipalName", LDAPa)
End If
End Function
Function FillFromDC(ByVal searchname As String, Optional ByVal searchfilter As String = "distinguishedName", Optional ByVal LDAP As String = "LDAP://DC=VERAG,DC=OST,DC=DMN")
Try
localdistinguishedName = searchname
suchname = searchname
If searchname.Contains("ForeignSecurityPrincipals") Then
'MsgBox("!")
Dim FSlocDirectoryEntry As New DirectoryServices.DirectoryEntry(LDAP)
Dim FSsearcher As New DirectoryServices.DirectorySearcher
With FSsearcher
.SearchRoot = FSlocDirectoryEntry
.Filter = searchfilter & "=" & searchname
.PropertiesToLoad.Add("msDS-PrincipalName")
End With
Dim FSResult As DirectoryServices.SearchResult = FSsearcher.FindOne
' MsgBox(FSResult.Properties("msDS-PrincipalName").Count)
searchname = FSResult.Properties("msDS-PrincipalName").Item(0)
Dim DomainName As String = searchname.Substring(0, searchname.IndexOf("\"))
' MsgBox(DomainName)
Select Case DomainName
Case "IMEX"
Me.Domäne = "imex.local"
LDAP = "LDAP://DC=IMEX,DC=LOCAL"
'MsgBox("Me.Domäne = imex.local")
Case "VERAGNEUHAUS"
Me.Domäne = "VERAGNEUHAUS.local"
LDAP = "LDAP://DC=VERAGNEUHAUS,DC=LOCAL"
Case "VERAGOST"
Me.Domäne = "verag.ost.dmn"
End Select
' MsgBox(searchname)
searchname = searchname.Substring((searchname.IndexOf("\") + 1), searchname.Length - searchname.IndexOf("\") - 1)
searchfilter = "sAMAccountName"
Else
'Me.Domäne = "verag.ost.dmn"
End If
If LDAP = "LDAP://DC=VERAG,DC=OST,DC=DMN" Then Me.Domäne = "verag.ost.dmn"
' MsgBox(searchname & vbCrLf & searchfilter & vbCrLf & Me.Domäne & vbCrLf & LDAP)
Dim locDirectoryEntry As New DirectoryServices.DirectoryEntry(LDAP)
' Dim Searcher1 As New DirectoryServices.DirectorySearcher(locDirectoryEntry, searchfilter & "=" & searchname)
Dim searcher As New DirectoryServices.DirectorySearcher
With searcher
.SearchRoot = locDirectoryEntry
.Filter = searchfilter & "=" & searchname
' .ExtendedDN = True
.PropertiesToLoad.Add("sn")
.PropertiesToLoad.Add("givenName")
.PropertiesToLoad.Add("mail")
.PropertiesToLoad.Add("distinguishedName")
.PropertiesToLoad.Add("cn")
.PropertiesToLoad.Add("distinguishedName")
.PropertiesToLoad.Add("msDS-PrincipalName")
.PropertiesToLoad.Add("userPrincipalName")
End With
Dim Result As DirectoryServices.SearchResult = searcher.FindOne
Me.Nachname = blablabla(Result, "sn")
Me.Vorname = blablabla(Result, "givenName")
Me.Mail = blablabla(Result, "mail")
Me.distinguishedName = blablabla(Result, "distinguishedName")
Me.cn = blablabla(Result, "cn")
Me.Name = blablabla(Result, "cn")
Me.BenutzeranmeldeName = blablabla(Result, "msDS-PrincipalName")
Me.msDSPrincipalName = blablabla(Result, "msDS-PrincipalName")
Me.userPrincipalName = blablabla(Result, "userPrincipalName")
Catch ex As Exception
MsgBox("FillFromDC: " & ex.Message)
End Try
End Function
Function isDokuAdmin() As Boolean
Dim ds As New DataSet
cSQL.SQL2DS("select * from TbL_Berechtigungen where Benutzeranmeldename = '" & Me.BenutzeranmeldeName & "' AND Standort = 'DokuAdmin'", ds)
If ds.Tables(0).Rows.Count > 0 Then
Return True
Else
Return False
End If
End Function
Function blablabla(result As DirectoryServices.SearchResult, Prop As String) As String
If result.Properties(Prop).Count = 0 Then
Return ""
Else
Return result.Properties(Prop)(0)
End If
End Function
Function emptyreturn(ByVal ding As String)
If ding Is Nothing Then
Return ""
Else
Return ding
End If
End Function
End Class
Public Class cBenutzergruppe
Public Shared Function GetUsersInGroup(ByVal groupname As String, Optional ByVal LDAP As String = "LDAP://DC=VERAG,DC=OST,DC=DMN") As List(Of String)
Dim Userlist As New List(Of String)
Dim locDirectoryEntry As New DirectoryServices.DirectoryEntry(LDAP)
Dim Searcher As New DirectoryServices.DirectorySearcher(locDirectoryEntry, "sAMAccountName=" & groupname)
Dim Result As DirectoryServices.SearchResult = Searcher.FindOne
If Result IsNot Nothing Then
For Each User In Result.Properties("Member")
Userlist.Add(User)
Next
End If
Return Userlist
End Function
End Class
Public Class cSharedClasses
' Public Shared LoggedOnUser As New cBenutzer
End Class

8
cRes.vb Normal file
View File

@@ -0,0 +1,8 @@
Public Class cRes
Public Shared DBConString As String = "Server=buchhaltung.verag.ost.dmn\SQLEXPRESS;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;"
Public Shared DBConstringDev As String = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;"
Public Shared LocalUser As New cBenutzer
Public Shared LocalTeamviewerID As String
End Class

76
cSQL.vb Normal file
View File

@@ -0,0 +1,76 @@
Imports System.Data.SqlClient
Public Class cSQL
Public Shared Sub SQL2DS(ByRef selector As String, ByRef ds As DataSet)
Dim con As New SqlConnection
Dim cmd As New SqlCommand
con.ConnectionString = cRes.DBConString
cmd.Connection = con
Dim dataadapter As New SqlDataAdapter(selector, con)
con.Open()
dataadapter.Fill(ds)
con.Close()
End Sub
Public Shared Sub UpdateSQL(ByRef table As String, ByRef values As String, ByRef where As String)
Dim con As New SqlConnection
Dim cmd As New SqlCommand
con.ConnectionString = cRes.DBConString
cmd.Connection = con
con.Open()
cmd.CommandText = "UPDATE " & table & " SET " & values & " WHERE " & where & ""
cmd.ExecuteNonQuery()
con.Close()
End Sub
Public Shared Sub InsertSQL(ByRef table As String, ByRef insert As String)
Dim con As New SqlConnection
Dim cmd As New SqlCommand
con.ConnectionString = cRes.DBConString
cmd.Connection = con
con.Open()
cmd.CommandText = "INSERT INTO " & table & " " & insert & ""
cmd.ExecuteNonQuery()
con.Close()
End Sub
Public Shared Sub DeleteSQL(ByRef table As String, ByRef where As String)
Dim con As New SqlConnection
Dim cmd As New SqlCommand
con.ConnectionString = cRes.DBConString
cmd.Connection = con
con.Open()
cmd.CommandText = "DELETE FROM " & table & " WHERE " & where & ""
cmd.ExecuteNonQuery()
con.Close()
End Sub
End Class
Public Class SQLVariable
Private Text, Value As String
Private prim As Boolean
Public Sub New(ByVal btext As String, ByVal bvalue As String, Optional bprim As Boolean = False)
Me.Value = bvalue
Me.Text = btext
End Sub
Public ReadOnly Property SQLText() As String
Get
Return Text
End Get
End Property
Public ReadOnly Property SQLValue() As Object
Get
Return Value
End Get
End Property
End Class

BIN
info.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB