Add RegexEditor, Improve Database Add Language

This commit is contained in:
Jonathan Jenne 2019-08-08 16:42:38 +02:00
parent f418074011
commit c9e0d8cec1
33 changed files with 1384 additions and 124 deletions

View File

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

View File

@ -0,0 +1,13 @@
'------------------------------------------------------------------------------
' <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

View File

@ -0,0 +1,11 @@
<?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>Form1</MainForm>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<ApplicationType>0</ApplicationType>
<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("RegexEditor")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("RegexEditor")>
<Assembly: AssemblyCopyright("Copyright © 2019")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
<Assembly: Guid("e1f1019a-5d39-4410-994b-90d8f93d4ca2")>
' 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,
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@ -0,0 +1,63 @@
'------------------------------------------------------------------------------
' <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", "15.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("DigitalData.Controls.RegexEditor.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
End Module
End Namespace

View File

@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

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
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.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 "Automatische My.Settings-Speicherfunktion"
#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(sender As Global.System.Object, 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.DigitalData.Controls.RegexEditor.My.MySettings
Get
Return Global.DigitalData.Controls.RegexEditor.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>

View File

@ -0,0 +1,27 @@
Imports System.ComponentModel
Imports System.Drawing.Design
Imports System.Windows.Forms.Design
Imports DigitalData.Modules.Language
Public Class RegexEditor
Inherits UITypeEditor
Public Overrides Function GetEditStyle(context As ITypeDescriptorContext) As UITypeEditorEditStyle
Return UITypeEditorEditStyle.Modal
End Function
Public Overrides Function EditValue(context As ITypeDescriptorContext, provider As IServiceProvider, value As Object) As Object
Dim oService As IWindowsFormsEditorService = TryCast(provider.GetService(GetType(IWindowsFormsEditorService)), IWindowsFormsEditorService)
Dim oRegexString As String = Utils.NotNull(value, String.Empty)
If oService IsNot Nothing Then
Using oform As New frmRegexEditor(oRegexString)
If oService.ShowDialog(oform) = DialogResult.OK Then
value = oform.RegexString
End If
End Using
End If
Return value
End Function
End Class

View File

@ -0,0 +1,130 @@
<?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>{BCC6942F-CD4B-4B67-8200-1C0D002E7CC2}</ProjectGuid>
<OutputType>Library</OutputType>
<StartupObject>
</StartupObject>
<RootNamespace>DigitalData.Controls.RegexEditor</RootNamespace>
<AssemblyName>DigitalData.Controls.RegexEditor</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>Windows</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</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>DigitalData.Controls.RegexEditor.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>DigitalData.Controls.RegexEditor.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>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<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="frmRegexEditor.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmRegexEditor.Designer.vb">
<DependentUpon>frmRegexEditor.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>
<Compile Include="RegexEditor.vb" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="frmRegexEditor.resx">
<DependentUpon>frmRegexEditor.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>
<ProjectReference Include="..\Modules.Language\Language.vbproj">
<Project>{d3c8cfed-d6f6-43a8-9bdf-454145d0352f}</Project>
<Name>Language</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

View File

@ -0,0 +1,149 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmRegexEditor
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.txtRegex = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label4 = New System.Windows.Forms.Label()
Me.labelResult = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.txtTest = New System.Windows.Forms.TextBox()
Me.btnTest = New System.Windows.Forms.Button()
Me.btnSave = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'txtRegex
'
Me.txtRegex.Location = New System.Drawing.Point(12, 25)
Me.txtRegex.Name = "txtRegex"
Me.txtRegex.Size = New System.Drawing.Size(419, 20)
Me.txtRegex.TabIndex = 0
'
'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(101, 13)
Me.Label1.TabIndex = 2
Me.Label1.Text = "Regular Expression:"
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(12, 48)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(419, 33)
Me.Label4.TabIndex = 8
Me.Label4.Text = "Wenn die Eingabe insgesamt validiert werden soll, muss der Regex in ^ und $ einge" &
"schlossen sein"
'
'labelResult
'
Me.labelResult.AutoSize = True
Me.labelResult.Location = New System.Drawing.Point(12, 163)
Me.labelResult.Name = "labelResult"
Me.labelResult.Size = New System.Drawing.Size(282, 13)
Me.labelResult.TabIndex = 12
Me.labelResult.Text = "Klicken Sie auf Test, um die Regular Expression zu testen."
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(12, 150)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(51, 13)
Me.Label3.TabIndex = 11
Me.Label3.Text = "Ergebnis:"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(12, 100)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(61, 13)
Me.Label2.TabIndex = 10
Me.Label2.Text = "Test String:"
'
'txtTest
'
Me.txtTest.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtTest.Location = New System.Drawing.Point(12, 116)
Me.txtTest.Name = "txtTest"
Me.txtTest.Size = New System.Drawing.Size(419, 20)
Me.txtTest.TabIndex = 9
'
'btnTest
'
Me.btnTest.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnTest.Location = New System.Drawing.Point(201, 193)
Me.btnTest.Name = "btnTest"
Me.btnTest.Size = New System.Drawing.Size(112, 31)
Me.btnTest.TabIndex = 14
Me.btnTest.Text = "Test"
Me.btnTest.UseVisualStyleBackColor = True
'
'btnSave
'
Me.btnSave.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnSave.DialogResult = System.Windows.Forms.DialogResult.OK
Me.btnSave.Location = New System.Drawing.Point(319, 193)
Me.btnSave.Name = "btnSave"
Me.btnSave.Size = New System.Drawing.Size(112, 31)
Me.btnSave.TabIndex = 13
Me.btnSave.Text = "Speichern"
Me.btnSave.UseVisualStyleBackColor = True
'
'frmRegexEditor
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(443, 236)
Me.Controls.Add(Me.btnTest)
Me.Controls.Add(Me.btnSave)
Me.Controls.Add(Me.labelResult)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.txtTest)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtRegex)
Me.Name = "frmRegexEditor"
Me.ShowIcon = False
Me.Text = "Regex Editor"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents txtRegex As TextBox
Friend WithEvents Label1 As Label
Friend WithEvents Label4 As Label
Friend WithEvents labelResult As Label
Friend WithEvents Label3 As Label
Friend WithEvents Label2 As Label
Friend WithEvents txtTest As TextBox
Friend WithEvents btnTest As Button
Friend WithEvents btnSave As Button
End Class

View File

@ -0,0 +1,120 @@
<?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>
</root>

View File

@ -0,0 +1,35 @@
Imports System.Text.RegularExpressions
Public Class frmRegexEditor
Public RegexString As String
Public Sub New(RegexString As String)
' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent()
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
Me.RegexString = RegexString
End Sub
Private Sub RegexEditor_Load(sender As Object, e As EventArgs) Handles MyBase.Load
txtRegex.Text = RegexString
End Sub
Private Sub btnTest_Click(sender As Object, e As EventArgs) Handles btnTest.Click
Try
Dim oTestString As String = txtTest.Text
If Regex.IsMatch(oTestString, txtRegex.Text) Then
labelResult.Text = "Test String ist gültig."
Else
labelResult.Text = "Test String ist nicht gültig."
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Regex Test")
End Try
End Sub
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
RegexString = txtRegex.Text
End Sub
End Class

View File

@ -76,6 +76,10 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "LookupControlGui", "LookupC
EndProject EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "MonoDiag", "LoggerDiag\MonoDiag.vbproj", "{3D437957-B90B-4D8F-9219-6D19B0C90994}" Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "MonoDiag", "LoggerDiag\MonoDiag.vbproj", "{3D437957-B90B-4D8F-9219-6D19B0C90994}"
EndProject EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Language", "Modules.Language\Language.vbproj", "{D3C8CFED-D6F6-43A8-9BDF-454145D0352F}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "RegexEditor", "Controls.RegexEditor\RegexEditor.vbproj", "{BCC6942F-CD4B-4B67-8200-1C0D002E7CC2}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -186,6 +190,14 @@ Global
{3D437957-B90B-4D8F-9219-6D19B0C90994}.Debug|Any CPU.Build.0 = Debug|Any CPU {3D437957-B90B-4D8F-9219-6D19B0C90994}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D437957-B90B-4D8F-9219-6D19B0C90994}.Release|Any CPU.ActiveCfg = Release|Any CPU {3D437957-B90B-4D8F-9219-6D19B0C90994}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D437957-B90B-4D8F-9219-6D19B0C90994}.Release|Any CPU.Build.0 = Release|Any CPU {3D437957-B90B-4D8F-9219-6D19B0C90994}.Release|Any CPU.Build.0 = Release|Any CPU
{D3C8CFED-D6F6-43A8-9BDF-454145D0352F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D3C8CFED-D6F6-43A8-9BDF-454145D0352F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D3C8CFED-D6F6-43A8-9BDF-454145D0352F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D3C8CFED-D6F6-43A8-9BDF-454145D0352F}.Release|Any CPU.Build.0 = Release|Any CPU
{BCC6942F-CD4B-4B67-8200-1C0D002E7CC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BCC6942F-CD4B-4B67-8200-1C0D002E7CC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BCC6942F-CD4B-4B67-8200-1C0D002E7CC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BCC6942F-CD4B-4B67-8200-1C0D002E7CC2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -217,6 +229,8 @@ Global
{926E6474-5613-4373-BB99-B101158B91EF} = {7AF3F9C2-C939-4A08-95C1-0453207E298A} {926E6474-5613-4373-BB99-B101158B91EF} = {7AF3F9C2-C939-4A08-95C1-0453207E298A}
{B65E24B3-D334-455D-A0BF-B33B8358B013} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A} {B65E24B3-D334-455D-A0BF-B33B8358B013} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A}
{3D437957-B90B-4D8F-9219-6D19B0C90994} = {8FFE925E-8B84-45F1-93CB-32B1C96F41EB} {3D437957-B90B-4D8F-9219-6D19B0C90994} = {8FFE925E-8B84-45F1-93CB-32B1C96F41EB}
{D3C8CFED-D6F6-43A8-9BDF-454145D0352F} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC}
{BCC6942F-CD4B-4B67-8200-1C0D002E7CC2} = {F98C0329-C004-417F-B2AB-7466E88D8220}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286} SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286}

View File

@ -1,35 +1,3 @@
Public Class ClassUtils Public Class ClassUtils
''' <summary>
''' Generates a random short (8 characters) guid
''' </summary>
''' <returns>The generated guid as a String</returns>
Public Shared Function ShortGUID() As String
Return Guid.NewGuid().ToString().GetHashCode().ToString("x")
End Function
''' <summary>
''' Converts a String value to the given Enum
''' </summary>
''' <typeparam name="T">The Enum Type</typeparam>
''' <param name="value">The string value to convert</param>
Public Shared Function ToEnum(Of T)(value As String) As T
Return [Enum].Parse(GetType(T), value)
End Function
''' <summary>
''' Checks a value for three different `null` values,
''' Nothing, Empty String, DBNull
'''
''' Returns the original value if the value is not null, or `defaultValue`
''' </summary>
''' <typeparam name="T">The type of the value</typeparam>
''' <param name="value">The value</param>
''' <param name="defaultValue">The default Value</param>
Public Function NotNull(Of T)(ByVal value As T, ByVal defaultValue As T) As T
If IsNothing(value) OrElse String.IsNullOrEmpty(value.ToString) OrElse IsDBNull(value) Then
Return defaultValue
Else
Return value
End If
End Function
End Class End Class

View File

@ -504,6 +504,10 @@
<Project>{44982f9b-6116-44e2-85d0-f39650b1ef99}</Project> <Project>{44982f9b-6116-44e2-85d0-f39650b1ef99}</Project>
<Name>Config</Name> <Name>Config</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Modules.Language\Language.vbproj">
<Project>{d3c8cfed-d6f6-43a8-9bdf-454145d0352f}</Project>
<Name>Language</Name>
</ProjectReference>
<ProjectReference Include="..\Modules.License\License.vbproj"> <ProjectReference Include="..\Modules.License\License.vbproj">
<Project>{5ebacbfa-f11a-4bbf-8d02-91461f2293ed}</Project> <Project>{5ebacbfa-f11a-4bbf-8d02-91461f2293ed}</Project>
<Name>License</Name> <Name>License</Name>

View File

@ -8,6 +8,7 @@ Imports DigitalData.Controls.LookupGrid
Imports DigitalData.GUIs.ClientSuite.Controls Imports DigitalData.GUIs.ClientSuite.Controls
Imports DigitalData.GUIs.ClientSuite.Controls.Properties Imports DigitalData.GUIs.ClientSuite.Controls.Properties
Imports DigitalData.GUIs.ClientSuite.Controls.Editors Imports DigitalData.GUIs.ClientSuite.Controls.Editors
Imports DigitalData.Modules.Language
Public Class frmFormDesigner Public Class frmFormDesigner
Private _FormId As Int64 Private _FormId As Int64
@ -47,7 +48,7 @@ Public Class frmFormDesigner
Dim oPosition As Point = LayoutControlMain.PointToClient(MousePosition) Dim oPosition As Point = LayoutControlMain.PointToClient(MousePosition)
Dim oHitInfo As BaseLayoutItemHitInfo = LayoutControlMain.CalcHitInfo(oPosition) Dim oHitInfo As BaseLayoutItemHitInfo = LayoutControlMain.CalcHitInfo(oPosition)
Dim oLayoutControl As LayoutControlItem = DirectCast(_DragItem, LayoutControlItem) Dim oLayoutControl As LayoutControlItem = DirectCast(_DragItem, LayoutControlItem)
Dim oControlName As String = oLayoutControl.Tag & ClassUtils.ShortGUID() Dim oControlName As String = oLayoutControl.Tag & Utils.ShortGUID()
Dim oControl As Control = _ControlLoader.CreateLayoutControl(oLayoutControl.Tag, oControlName, 0) Dim oControl As Control = _ControlLoader.CreateLayoutControl(oLayoutControl.Tag, oControlName, 0)
If oLayoutControl IsNot Nothing Then If oLayoutControl IsNot Nothing Then

View File

@ -0,0 +1,5 @@
Public MustInherit Class BaseClass
Public MustOverride Function GetDatatable(SqlCommand As String) As DataTable
Public MustOverride Function GetScalarValue(SqlCommand As String) As Object
Public MustOverride Function ExecuteNonQuery(SqlCommand As String) As Boolean
End Class

View File

@ -0,0 +1,5 @@
Public Class Constants
Public Const PROVIDER_MSSQL = "MS-SQL"
Public Const PROVIDER_ORACLE = "ORACLE"
Public Const PROVIDER_ODBC = "ODBC"
End Class

View File

@ -90,6 +90,8 @@
<Import Include="System.Threading.Tasks" /> <Import Include="System.Threading.Tasks" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="BaseClass.vb" />
<Compile Include="Constants.vb" />
<Compile Include="Exceptions.vb" /> <Compile Include="Exceptions.vb" />
<Compile Include="Firebird.vb" /> <Compile Include="Firebird.vb" />
<Compile Include="ODBC.vb" /> <Compile Include="ODBC.vb" />

View File

@ -46,6 +46,8 @@ Imports DigitalData.Modules.Logging
''' REMARKS: If the connection fails due to "wrong username or password", the cause might be that the server harddrive is full.. ''' REMARKS: If the connection fails due to "wrong username or password", the cause might be that the server harddrive is full..
''' </summary> ''' </summary>
Public Class Firebird Public Class Firebird
Inherits BaseClass
Private _Logger As Logger Private _Logger As Logger
Private _LogConfig As LogConfig Private _LogConfig As LogConfig
Private _connectionServer As String Private _connectionServer As String
@ -183,7 +185,7 @@ Public Class Firebird
''' <param name="Connection">The Firebird connection to use</param> ''' <param name="Connection">The Firebird connection to use</param>
''' <returns>True, if command was executed sucessfully. Otherwise false.</returns> ''' <returns>True, if command was executed sucessfully. Otherwise false.</returns>
Public Function ExecuteNonQueryWithConnection(SqlCommand As String, Connection As FbConnection, Optional TransactionMode As TransactionMode = TransactionMode.WithTransaction, Optional Transaction As FbTransaction = Nothing) As Boolean Public Function ExecuteNonQueryWithConnection(SqlCommand As String, Connection As FbConnection, Optional TransactionMode As TransactionMode = TransactionMode.WithTransaction, Optional Transaction As FbTransaction = Nothing) As Boolean
_logger.Debug("Executing Non-Query: {0}", SqlCommand) _Logger.Debug("Executing Non-Query: {0}", SqlCommand)
If Connection Is Nothing Then If Connection Is Nothing Then
_Logger.Warn("Connection is nothing!") _Logger.Warn("Connection is nothing!")
@ -219,7 +221,7 @@ Public Class Firebird
''' </summary> ''' </summary>
''' <param name="SqlCommand">The command to execute</param> ''' <param name="SqlCommand">The command to execute</param>
''' <returns>True, if command was executed sucessfully. Otherwise false.</returns> ''' <returns>True, if command was executed sucessfully. Otherwise false.</returns>
Public Function ExecuteNonQuery(SqlCommand As String) As Boolean Public Overrides Function ExecuteNonQuery(SqlCommand As String) As Boolean
Dim oConnection As FbConnection = GetConnection() Dim oConnection As FbConnection = GetConnection()
Dim oScalarValue As Object = ExecuteNonQueryWithConnection(SqlCommand, oConnection) Dim oScalarValue As Object = ExecuteNonQueryWithConnection(SqlCommand, oConnection)
oConnection.Close() oConnection.Close()
@ -234,7 +236,7 @@ Public Class Firebird
''' <param name="Connection">The Firebird connection to use</param> ''' <param name="Connection">The Firebird connection to use</param>
''' <returns>The scalar value if the command was executed successfully. Nothing otherwise.</returns> ''' <returns>The scalar value if the command was executed successfully. Nothing otherwise.</returns>
Public Function GetScalarValueWithConnection(SqlQuery As String, Connection As FbConnection, Optional TransactionMode As TransactionMode = TransactionMode.WithTransaction, Optional Transaction As FbTransaction = Nothing) As Object Public Function GetScalarValueWithConnection(SqlQuery As String, Connection As FbConnection, Optional TransactionMode As TransactionMode = TransactionMode.WithTransaction, Optional Transaction As FbTransaction = Nothing) As Object
_logger.Debug("Fetching Scalar-Value: {0}", SqlQuery) _Logger.Debug("Fetching Scalar-Value: {0}", SqlQuery)
If Connection Is Nothing Then If Connection Is Nothing Then
_Logger.Warn("Connection is nothing!") _Logger.Warn("Connection is nothing!")
@ -252,7 +254,7 @@ Public Class Firebird
} }
oResult = oCommand.ExecuteScalar() oResult = oCommand.ExecuteScalar()
Catch ex As Exception Catch ex As Exception
_logger.Error(ex, $"Error in ReturnScalar while executing command: '{SqlQuery}'") _Logger.Error(ex, $"Error in ReturnScalar while executing command: '{SqlQuery}'")
Throw ex Throw ex
Finally Finally
MaybeCommitTransaction(oTransaction, TransactionMode) MaybeCommitTransaction(oTransaction, TransactionMode)
@ -266,7 +268,7 @@ Public Class Firebird
''' </summary> ''' </summary>
''' <param name="SqlQuery">The query to execute</param> ''' <param name="SqlQuery">The query to execute</param>
''' <returns>The scalar value if the command was executed successfully. Nothing otherwise.</returns> ''' <returns>The scalar value if the command was executed successfully. Nothing otherwise.</returns>
Public Function GetScalarValue(SqlQuery As String) As Object Public Overrides Function GetScalarValue(SqlQuery As String) As Object
Dim oConnection As FbConnection = GetConnection() Dim oConnection As FbConnection = GetConnection()
Dim oScalarValue As Object = GetScalarValueWithConnection(SqlQuery, oConnection) Dim oScalarValue As Object = GetScalarValueWithConnection(SqlQuery, oConnection)
oConnection.Close() oConnection.Close()
@ -281,7 +283,7 @@ Public Class Firebird
''' <param name="Connection">The Firebird connection to use</param> ''' <param name="Connection">The Firebird connection to use</param>
''' <returns>A datatable containing the results if the command was executed successfully. Nothing otherwise.</returns> ''' <returns>A datatable containing the results if the command was executed successfully. Nothing otherwise.</returns>
Public Function GetDatatableWithConnection(SqlQuery As String, Connection As FbConnection, Optional TransactionMode As TransactionMode = TransactionMode.NoTransaction, Optional Transaction As FbTransaction = Nothing) As DataTable Public Function GetDatatableWithConnection(SqlQuery As String, Connection As FbConnection, Optional TransactionMode As TransactionMode = TransactionMode.NoTransaction, Optional Transaction As FbTransaction = Nothing) As DataTable
_logger.Debug("Fetching Datatable: {0}", SqlQuery) _Logger.Debug("Fetching Datatable: {0}", SqlQuery)
If Connection Is Nothing Then If Connection Is Nothing Then
_Logger.Warn("Connection is nothing!") _Logger.Warn("Connection is nothing!")
@ -302,7 +304,7 @@ Public Class Firebird
oAdapter.Fill(oDatatable) oAdapter.Fill(oDatatable)
Catch ex As Exception Catch ex As Exception
_logger.Error(ex, $"Error in GetDatatableWithConnection while executing command: '{SqlQuery}'") _Logger.Error(ex, $"Error in GetDatatableWithConnection while executing command: '{SqlQuery}'")
Throw ex Throw ex
Finally Finally
MaybeCommitTransaction(oTransaction, TransactionMode) MaybeCommitTransaction(oTransaction, TransactionMode)
@ -316,9 +318,9 @@ Public Class Firebird
''' </summary> ''' </summary>
''' <param name="SqlQuery">The query to execute</param> ''' <param name="SqlQuery">The query to execute</param>
''' <returns>A datatable containing the results if the command was executed successfully. Nothing otherwise.</returns> ''' <returns>A datatable containing the results if the command was executed successfully. Nothing otherwise.</returns>
Public Function GetDatatable(SqlQuery As String, Optional TransactionMode As TransactionMode = TransactionMode.NoTransaction) As DataTable Public Overrides Function GetDatatable(SqlQuery As String) As DataTable
Dim oConnection As FbConnection = GetConnection() Dim oConnection As FbConnection = GetConnection()
Dim oDatatable As DataTable = GetDatatableWithConnection(SqlQuery, oConnection, TransactionMode) Dim oDatatable As DataTable = GetDatatableWithConnection(SqlQuery, oConnection)
oConnection.Close() oConnection.Close()
Return oDatatable Return oDatatable

View File

@ -2,12 +2,17 @@
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Public Class MSSQLServer Public Class MSSQLServer
Inherits BaseClass
Public DBInitialized As Boolean = False Public DBInitialized As Boolean = False
Public CurrentSQLConnectionString As String = "" Public CurrentSQLConnectionString As String = ""
Private _Timeout As Integer
Private _Logger As Logger Private _Logger As Logger
Public Sub New(LogConfig As LogConfig, ConnectionString As String) Public Sub New(LogConfig As LogConfig, ConnectionString As String, Optional Timeout As Integer = 120)
_Logger = LogConfig.GetLogger() _Logger = LogConfig.GetLogger()
_Timeout = Timeout
CurrentSQLConnectionString = ConnectionString CurrentSQLConnectionString = ConnectionString
@ -19,6 +24,31 @@ Public Class MSSQLServer
End Try End Try
End Sub End Sub
Public Sub New(LogConfig As LogConfig, Server As String, Database As String, UserId As String, Password As String, Optional Timeout As Integer = 120)
_Logger = LogConfig.GetLogger()
_Timeout = Timeout
CurrentSQLConnectionString = GetConnectionString(Server, Database, UserId, Password)
Try
DBInitialized = TestCanConnect()
Catch ex As Exception
DBInitialized = False
_Logger.Error(ex)
End Try
End Sub
Public Shared Function GetConnectionString(Server As String, Database As String, UserId As String, Password As String) As String
Dim oConnectionStringBuilder As New SqlConnectionStringBuilder() With {
.DataSource = Server,
.InitialCatalog = Database,
.UserId = UserId,
.Password = Password
}
Return oConnectionStringBuilder.ToString
End Function
Private Function TestCanConnect() As Boolean Private Function TestCanConnect() As Boolean
Try Try
Dim oConnection As New SqlConnection(CurrentSQLConnectionString) Dim oConnection As New SqlConnection(CurrentSQLConnectionString)
@ -41,14 +71,13 @@ Public Class MSSQLServer
Return Nothing Return Nothing
End Try End Try
End Function End Function
''' <summary> ''' <summary>
''' Returns a datatable for a sql-statement ''' Returns a datatable for a sql-statement
''' </summary> ''' </summary>
''' <param name="sqlcommand">sqlcommand for datatable (select XYZ from TableORView)</param> ''' <param name="SqlCommand">sqlcommand for datatable (select XYZ from TableORView)</param>
''' <param name="Timeout">Optional Timeout</param>
''' <returns>Returns a datatable</returns> ''' <returns>Returns a datatable</returns>
''' <remarks></remarks> Public Overrides Function GetDatatable(SqlCommand As String) As DataTable
Public Function GetDatatable(sqlcommand As String, Optional Timeout As Integer = 120) As DataTable
Try Try
If TestCanConnect() = False Then If TestCanConnect() = False Then
Return Nothing Return Nothing
@ -56,8 +85,8 @@ Public Class MSSQLServer
Using oConnection = GetSQLConnection() Using oConnection = GetSQLConnection()
Using oSQLCOmmand = oConnection.CreateCommand() Using oSQLCOmmand = oConnection.CreateCommand()
oSQLCOmmand.CommandText = sqlcommand oSQLCOmmand.CommandText = SqlCommand
oSQLCOmmand.CommandTimeout = Timeout oSQLCOmmand.CommandTimeout = _Timeout
Dim dt As DataTable = New DataTable() Dim dt As DataTable = New DataTable()
Dim oAdapter As SqlDataAdapter = New SqlDataAdapter(oSQLCOmmand) Dim oAdapter As SqlDataAdapter = New SqlDataAdapter(oSQLCOmmand)
@ -67,23 +96,23 @@ Public Class MSSQLServer
End Using End Using
Catch ex As Exception Catch ex As Exception
_Logger.Error(ex) _Logger.Error(ex)
_Logger.Debug("sqlcommand: " & sqlcommand) _Logger.Debug("sqlcommand: " & SqlCommand)
Return Nothing Return Nothing
End Try End Try
End Function End Function
''' <summary> ''' <summary>
''' Executes the passed sql-statement ''' Executes the passed sql-statement
''' </summary> ''' </summary>
''' <param name="executeStatement">the sql statement</param> ''' <param name="executeStatement">the sql statement</param>
''' <param name="Timeout">Optional Timeout</param>
''' <returns>Returns true if properly executed, else false</returns> ''' <returns>Returns true if properly executed, else false</returns>
''' <remarks></remarks> ''' <remarks></remarks>
Public Function NewExecutenonQuery(executeStatement As String, Optional Timeout As Integer = 120) As Boolean Public Function NewExecutenonQuery(executeStatement As String) As Boolean
_Logger.Warn("NewExecutenonQuery is deprecated. Use ExecuteNonQuery instead.") _Logger.Warn("NewExecutenonQuery is deprecated. Use ExecuteNonQuery instead.")
Return ExecuteNonQuery(executeStatement, Timeout) Return ExecuteNonQuery(executeStatement)
End Function End Function
Public Function ExecuteNonQuery(SQLCommand As String, Optional Timeout As Integer = 120) As Boolean Public Overrides Function ExecuteNonQuery(SQLCommand As String) As Boolean
Try Try
If TestCanConnect() = False Then If TestCanConnect() = False Then
Return Nothing Return Nothing
@ -92,7 +121,7 @@ Public Class MSSQLServer
Using oConnection = GetSQLConnection() Using oConnection = GetSQLConnection()
Using oSQLCOmmand = oConnection.CreateCommand() Using oSQLCOmmand = oConnection.CreateCommand()
oSQLCOmmand.CommandText = SQLCommand oSQLCOmmand.CommandText = SQLCommand
oSQLCOmmand.CommandTimeout = Timeout oSQLCOmmand.CommandTimeout = _Timeout
oSQLCOmmand.ExecuteNonQuery() oSQLCOmmand.ExecuteNonQuery()
Return True Return True
End Using End Using
@ -108,15 +137,13 @@ Public Class MSSQLServer
''' Executes the passed sql-statement as Scalar ''' Executes the passed sql-statement as Scalar
''' </summary> ''' </summary>
''' <param name="ScalarSQL">the sql statement</param> ''' <param name="ScalarSQL">the sql statement</param>
''' <param name="Timeout">Optional Timeout</param>
''' <returns>Returns true if properly executed, else false</returns> ''' <returns>Returns true if properly executed, else false</returns>
''' <remarks></remarks> Public Function NewExecuteScalar(ScalarSQL As String) As Object
Public Function NewExecuteScalar(ScalarSQL As String, Optional Timeout As Integer = 120) As Object
_Logger.Warn("NewExecuteScalar is deprecated. Use GetScalarValue instead.") _Logger.Warn("NewExecuteScalar is deprecated. Use GetScalarValue instead.")
Return GetScalarValue(ScalarSQL, Timeout) Return GetScalarValue(ScalarSQL)
End Function End Function
Public Function GetScalarValue(SQLQuery As String, Optional Timeout As Integer = 120) As Object Public Overrides Function GetScalarValue(SQLQuery As String) As Object
Try Try
If TestCanConnect() = False Then If TestCanConnect() = False Then
Return Nothing Return Nothing
@ -125,7 +152,7 @@ Public Class MSSQLServer
Using oConnection As SqlConnection = GetSQLConnection() Using oConnection As SqlConnection = GetSQLConnection()
Using oSQLCOmmand = oConnection.CreateCommand() Using oSQLCOmmand = oConnection.CreateCommand()
oSQLCOmmand.CommandText = SQLQuery oSQLCOmmand.CommandText = SQLQuery
oSQLCOmmand.CommandTimeout = Timeout oSQLCOmmand.CommandTimeout = _Timeout
Dim oResult As Object = oSQLCOmmand.ExecuteScalar() Dim oResult As Object = oSQLCOmmand.ExecuteScalar()
Return oResult Return oResult
End Using End Using

View File

@ -2,6 +2,8 @@
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Public Class ODBC Public Class ODBC
Inherits BaseClass
Private _Logger As Logger Private _Logger As Logger
Private _LogConfig As LogConfig Private _LogConfig As LogConfig
@ -86,7 +88,7 @@ Public Class ODBC
''' </summary> ''' </summary>
''' <param name="SqlCommand">The command to execute</param> ''' <param name="SqlCommand">The command to execute</param>
''' <returns>True, if command was executed sucessfully. Otherwise false.</returns> ''' <returns>True, if command was executed sucessfully. Otherwise false.</returns>
Public Function ExecuteNonQuery(SqlCommand As String) As Boolean Public Overrides Function ExecuteNonQuery(SqlCommand As String) As Boolean
Dim oConnection As OdbcConnection = GetConnection() Dim oConnection As OdbcConnection = GetConnection()
Dim oScalarValue As Object = ExecuteNonQueryWithConnection(SqlCommand, oConnection) Dim oScalarValue As Object = ExecuteNonQueryWithConnection(SqlCommand, oConnection)
oConnection.Close() oConnection.Close()
@ -126,7 +128,7 @@ Public Class ODBC
''' </summary> ''' </summary>
''' <param name="SqlQuery">The query to execute</param> ''' <param name="SqlQuery">The query to execute</param>
''' <returns>A datatable containing the results if the command was executed successfully. Nothing otherwise.</returns> ''' <returns>A datatable containing the results if the command was executed successfully. Nothing otherwise.</returns>
Public Function GetScalarValue(SqlQuery As String) As Object Public Overrides Function GetScalarValue(SqlQuery As String) As Object
Dim oConnection As OdbcConnection = GetConnection() Dim oConnection As OdbcConnection = GetConnection()
Dim oDatatable As DataTable = GetDatatableWithConnection(SqlQuery, oConnection) Dim oDatatable As DataTable = GetDatatableWithConnection(SqlQuery, oConnection)
oConnection.Close() oConnection.Close()
@ -169,7 +171,7 @@ Public Class ODBC
''' </summary> ''' </summary>
''' <param name="SqlQuery">The query to execute</param> ''' <param name="SqlQuery">The query to execute</param>
''' <returns>A datatable containing the results if the command was executed successfully. Nothing otherwise.</returns> ''' <returns>A datatable containing the results if the command was executed successfully. Nothing otherwise.</returns>
Public Function GetDatatable(SqlQuery As String) As DataTable Public Overrides Function GetDatatable(SqlQuery As String) As DataTable
Dim oConnection As OdbcConnection = GetConnection() Dim oConnection As OdbcConnection = GetConnection()
Dim oDatatable As DataTable = GetDatatableWithConnection(SqlQuery, oConnection) Dim oDatatable As DataTable = GetDatatableWithConnection(SqlQuery, oConnection)
oConnection.Close() oConnection.Close()

View File

@ -1,35 +1,53 @@
Imports Oracle.ManagedDataAccess.Client Imports DigitalData.Modules.Logging
Imports Oracle.ManagedDataAccess.Client
Public Class Oracle Public Class Oracle
Private Shared Logger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger
Public DBInitialized As Boolean = False Public DBInitialized As Boolean = False
Public CurrentOracleConnectionString As String = "" Public CurrentOracleConnectionString As String = ""
Public Sub New(CONSTRING As String)
Init(CONSTRING) Private _Timeout As Integer
Private _Logger As Logger
Public Sub New(LogConfig As LogConfig, ConnectionString As String, Optional Timeout As Integer = 120)
_Timeout = Timeout
_Logger = LogConfig.GetLogger()
CurrentOracleConnectionString = ConnectionString
DBInitialized = TestCanConnect(CurrentOracleConnectionString)
End Sub End Sub
Public Function Init(CONSTRING As String)
Public Sub New(LogConfig As LogConfig, Server As String, Database As String, UserId As String, Password As String, Optional Timeout As Integer = 120)
_Timeout = Timeout
_Logger = LogConfig.GetLogger()
CurrentOracleConnectionString = GetConnectionString(Server, Database, UserId, Password)
DBInitialized = TestCanConnect(CurrentOracleConnectionString)
End Sub
Private Function TestCanConnect(ConnectionString As String) As Boolean
Try Try
Dim oSQLconnect As New OracleConnection Dim oSQLconnect As New OracleConnection
oSQLconnect.ConnectionString = CONSTRING oSQLconnect.ConnectionString = ConnectionString
oSQLconnect.Open() oSQLconnect.Open()
oSQLconnect.Close() oSQLconnect.Close()
CurrentOracleConnectionString = CONSTRING
DBInitialized = True
Return True Return True
Catch ex As Exception Catch ex As Exception
DBInitialized = False _Logger.Error(ex)
Logger.Error(ex)
'clsLogger.Add("Error in DatabaseInit: " & ex.Message, True)
Return False Return False
End Try End Try
End Function End Function
Public Shared Function GetConnectionString(Server As String, Database As String, UserId As String, Password As String) As String
Dim oConnectionString = $"Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={Server})(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME={Database})));User Id={UserId};Password={Password};"
Return oConnectionString
End Function
''' <summary> ''' <summary>
''' Returns a datatable for a sql-statement ''' Returns a datatable for a sql-statement
''' </summary> ''' </summary>
''' <param name="sqlcommand">sqlcommand for datatable (select XYZ from TableORView)</param> ''' <param name="sqlcommand">sqlcommand for datatable (select XYZ from TableORView)</param>
''' <param name="commandtimeout">Optional Timeout</param>
''' <returns>Returns a datatable</returns> ''' <returns>Returns a datatable</returns>
''' <remarks></remarks> Public Function GetDatatable(sqlcommand As String) As DataTable
Public Function GetDatatable(sqlcommand As String, Optional commandtimeout As Integer = 120) As DataTable
Try Try
Dim oSQLconnect As New OracleConnection Dim oSQLconnect As New OracleConnection
Dim oSQLCOmmand As OracleCommand Dim oSQLCOmmand As OracleCommand
@ -37,15 +55,15 @@ Public Class Oracle
oSQLconnect.Open() oSQLconnect.Open()
oSQLCOmmand = oSQLconnect.CreateCommand() oSQLCOmmand = oSQLconnect.CreateCommand()
oSQLCOmmand.CommandText = sqlcommand oSQLCOmmand.CommandText = sqlcommand
oSQLCOmmand.CommandTimeout = commandtimeout oSQLCOmmand.CommandTimeout = _Timeout
Dim adapter1 As OracleDataAdapter = New OracleDataAdapter(oSQLCOmmand) Dim adapter1 As OracleDataAdapter = New OracleDataAdapter(oSQLCOmmand)
Dim dt As DataTable = New DataTable() Dim dt As DataTable = New DataTable()
adapter1.Fill(dt) adapter1.Fill(dt)
oSQLconnect.Close() oSQLconnect.Close()
Return dt Return dt
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) _Logger.Error(ex)
Logger.Debug("sqlcommand: " & sqlcommand) _Logger.Debug("sqlcommand: " & sqlcommand)
Return Nothing Return Nothing
End Try End Try
End Function End Function
@ -53,10 +71,8 @@ Public Class Oracle
''' Executes the passed sql-statement ''' Executes the passed sql-statement
''' </summary> ''' </summary>
''' <param name="executeStatement">the sql statement</param> ''' <param name="executeStatement">the sql statement</param>
''' <param name="commandtimeout">Optional Timeout</param>
''' <returns>Returns true if properly executed, else false</returns> ''' <returns>Returns true if properly executed, else false</returns>
''' <remarks></remarks> Public Function NewExecutenonQuery(executeStatement As String) As Boolean
Public Function NewExecutenonQuery(executeStatement As String, Optional commandtimeout As Integer = 120) As Boolean
Try Try
Dim oSQLconnect As New OracleConnection Dim oSQLconnect As New OracleConnection
Dim oSQLCOmmand As OracleCommand Dim oSQLCOmmand As OracleCommand
@ -64,55 +80,24 @@ Public Class Oracle
oSQLconnect.Open() oSQLconnect.Open()
oSQLCOmmand = oSQLconnect.CreateCommand() oSQLCOmmand = oSQLconnect.CreateCommand()
oSQLCOmmand.CommandText = executeStatement oSQLCOmmand.CommandText = executeStatement
oSQLCOmmand.CommandTimeout = commandtimeout oSQLCOmmand.CommandTimeout = _Timeout
oSQLCOmmand.ExecuteNonQuery() oSQLCOmmand.ExecuteNonQuery()
oSQLCOmmand.Dispose() oSQLCOmmand.Dispose()
oSQLconnect.Close() oSQLconnect.Close()
Return True Return True
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) _Logger.Error(ex)
Logger.Debug("executeStatement: " & executeStatement) _Logger.Debug("executeStatement: " & executeStatement)
Return False Return False
End Try End Try
End Function End Function
''' <summary>
''' Executes the passed sql-statement in asyncmode
''' </summary>
''' <param name="executeStatement">the sql statement</param>
''' <param name="commandtimeout">Optional Timeout</param>
''' <remarks></remarks>
Public Sub NewExecuteNonQueryAsync(executeStatement As String, Optional commandtimeout As Integer = 120)
Dim oSQLconnect As New OracleConnection
Dim oSQLCOmmand As OracleCommand
Dim callback As New AsyncCallback(AddressOf Execute_non_Query_Async_Callback)
Try
oSQLconnect.ConnectionString = CurrentOracleConnectionString
oSQLconnect.Open()
oSQLCOmmand = oSQLconnect.CreateCommand()
oSQLCOmmand.CommandText = executeStatement
oSQLCOmmand.CommandTimeout = commandtimeout
oSQLCOmmand.ExecuteNonQuery()
oSQLCOmmand.Dispose()
oSQLconnect.Close()
Catch ex As Exception
Logger.Error(ex)
Logger.Debug("executeStatement: " & executeStatement)
End Try
End Sub
Private Sub Execute_non_Query_Async_Callback(ByVal result As IAsyncResult)
Dim command As OracleCommand = CType(result.AsyncState, OracleCommand)
Dim res = command.ExecuteNonQuery
Logger.Info(String.Format("Finished executing Async database operation: {0}", command.CommandText))
End Sub
''' <summary> ''' <summary>
''' Executes the passed sql-statement as Scalar ''' Executes the passed sql-statement as Scalar
''' </summary> ''' </summary>
''' <param name="executeStatement">the sql statement</param> ''' <param name="executeStatement">the sql statement</param>
''' <param name="commandtimeout">Optional Timeout</param> ''' <returns>Returns the scalarvalue</returns>
''' <returns>Returns true if properly executed, else false</returns> Public Function NewExecuteScalar(executeStatement As String)
''' <remarks></remarks>
Public Function NewExecuteScalar(executeStatement As String, Optional commandtimeout As Integer = 120)
Dim result Dim result
Try Try
Dim oSQLconnect As New OracleConnection Dim oSQLconnect As New OracleConnection
@ -121,15 +106,15 @@ Public Class Oracle
oSQLconnect.Open() oSQLconnect.Open()
oSQLCOmmand = oSQLconnect.CreateCommand() oSQLCOmmand = oSQLconnect.CreateCommand()
oSQLCOmmand.CommandText = executeStatement oSQLCOmmand.CommandText = executeStatement
oSQLCOmmand.CommandTimeout = commandtimeout oSQLCOmmand.CommandTimeout = _Timeout
result = oSQLCOmmand.ExecuteScalar() result = oSQLCOmmand.ExecuteScalar()
oSQLCOmmand.Dispose() oSQLCOmmand.Dispose()
oSQLconnect.Close() oSQLconnect.Close()
Return result Return result
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) _Logger.Error(ex)
Logger.Debug("executeStatement: " & executeStatement) _Logger.Debug("executeStatement: " & executeStatement)
Return Nothing Throw ex
End Try End Try
End Function End Function
End Class End Class

View File

@ -0,0 +1,103 @@
<?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>{D3C8CFED-D6F6-43A8-9BDF-454145D0352F}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>DigitalData.Modules.Language</RootNamespace>
<AssemblyName>DigitalData.Modules.Language</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>Windows</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>DigitalData.Modules.Language.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>DigitalData.Modules.Language.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>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<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.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="Utils.vb" />
<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="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>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

View File

@ -0,0 +1,13 @@
'------------------------------------------------------------------------------
' <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

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>false</MySubMain>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<ApplicationType>1</ApplicationType>
<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("Language")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("Language")>
<Assembly: AssemblyCopyright("Copyright © 2019")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
<Assembly: Guid("d1eb6e0e-d2e1-4de1-a5ea-6a5a7406969b")>
' 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,
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@ -0,0 +1,63 @@
'------------------------------------------------------------------------------
' <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", "15.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("DigitalData.Modules.Language.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
End Module
End Namespace

View File

@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

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
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.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 "Automatische My.Settings-Speicherfunktion"
#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(sender As Global.System.Object, 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.DigitalData.Modules.Language.My.MySettings
Get
Return Global.DigitalData.Modules.Language.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>

38
Modules.Language/Utils.vb Normal file
View File

@ -0,0 +1,38 @@
''' <summary>
''' Provides common utility functions that do not require a specific context.
''' </summary>
Public Class Utils
''' <summary>
''' Generates a random short (8 characters) guid
''' </summary>
''' <returns>The generated guid as a String</returns>
Public Shared Function ShortGUID() As String
Return Guid.NewGuid().ToString().GetHashCode().ToString("x")
End Function
''' <summary>
''' Converts a String value to the given Enum
''' </summary>
''' <typeparam name="T">The Enum Type</typeparam>
''' <param name="value">The string value to convert</param>
Public Shared Function ToEnum(Of T)(value As String) As T
Return [Enum].Parse(GetType(T), value)
End Function
''' <summary>
''' Checks a value for three different `null` values,
''' Nothing, Empty String, DBNull
'''
''' Returns the original value if the value is not null, or `defaultValue`
''' </summary>
''' <typeparam name="T">The type of the value</typeparam>
''' <param name="value">The value</param>
''' <param name="defaultValue">The default Value</param>
Public Shared Function NotNull(Of T)(ByVal value As T, ByVal defaultValue As T) As T
If IsNothing(value) OrElse String.IsNullOrEmpty(value.ToString) OrElse IsDBNull(value) Then
Return defaultValue
Else
Return value
End If
End Function
End Class