Projektdateien hinzufügen.
This commit is contained in:
parent
e54ca7130b
commit
fcf688d4f2
41
sltSync.Test/AuthTest.vb
Normal file
41
sltSync.Test/AuthTest.vb
Normal file
@ -0,0 +1,41 @@
|
||||
Imports Microsoft.VisualStudio.TestTools.UnitTesting
|
||||
Imports Newtonsoft.Json
|
||||
Imports sltSync
|
||||
|
||||
Namespace sltSync.Test
|
||||
<TestClass>
|
||||
Public Class AuthTest
|
||||
ReadOnly oAvailableSystemsResponse As String = "{""Message"":null,""State"":true,""Type"":40,""Value"":[{""Deactivated"":false,""Description"":"""",""Priority"":1,""SystemID"":""764f0168-0005-43ca-bfe7-267b5fe254f4"",""SystemName"":""Prod: e.wa riss Netze GmbH""}]}"
|
||||
ReadOnly oLoginResponse As String = "{""Message"":null,""State"":true,""Type"":40,""Value"":""18487109-f789-4094-9f18-4f0ce85461ca""}"
|
||||
ReadOnly oLogoutResponse As String = "{""Message"": null,""State"":true,""Type"":40}"
|
||||
|
||||
<TestMethod>
|
||||
Sub AvailableSystemsTest()
|
||||
Dim oResp As sltAvailableSystemResponse = JsonConvert.DeserializeObject(Of sltAvailableSystemResponse)(oAvailableSystemsResponse)
|
||||
|
||||
Assert.AreEqual(True, oResp.State)
|
||||
Assert.AreEqual(40, oResp.Type)
|
||||
Assert.AreEqual(1, oResp.Value.Count)
|
||||
End Sub
|
||||
|
||||
<TestMethod>
|
||||
Sub LoginTest()
|
||||
Dim oResp As sltLoginResponse = JsonConvert.DeserializeObject(Of sltLoginResponse)(oLoginResponse)
|
||||
|
||||
Assert.AreEqual(Nothing, oResp.Message)
|
||||
Assert.AreEqual(True, oResp.State)
|
||||
Assert.AreEqual(40, oResp.Type)
|
||||
Assert.AreEqual("18487109-f789-4094-9f18-4f0ce85461ca", oResp.Value)
|
||||
End Sub
|
||||
|
||||
<TestMethod>
|
||||
Sub Logout()
|
||||
Dim oResp As sltLogoutResponse = JsonConvert.DeserializeObject(Of sltLogoutResponse)(oLogoutResponse)
|
||||
|
||||
Assert.AreEqual(Nothing, oResp.Message)
|
||||
Assert.AreEqual(True, oResp.State)
|
||||
Assert.AreEqual(40, oResp.Type)
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
22
sltSync.Test/sltSync.Test.vbproj
Normal file
22
sltSync.Test/sltSync.Test.vbproj
Normal file
@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>sltSync.Test</RootNamespace>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\sltSync\sltSync.vbproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
31
sltSync.sln
Normal file
31
sltSync.sln
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.33516.290
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "sltSync", "sltSync\sltSync.vbproj", "{A439775B-FF9C-4C46-9395-79356A8FC601}"
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "sltSync.Test", "sltSync.Test\sltSync.Test.vbproj", "{71398AA2-8017-4CE2-8E29-187D38324FE7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A439775B-FF9C-4C46-9395-79356A8FC601}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A439775B-FF9C-4C46-9395-79356A8FC601}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A439775B-FF9C-4C46-9395-79356A8FC601}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A439775B-FF9C-4C46-9395-79356A8FC601}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{71398AA2-8017-4CE2-8E29-187D38324FE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{71398AA2-8017-4CE2-8E29-187D38324FE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{71398AA2-8017-4CE2-8E29-187D38324FE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{71398AA2-8017-4CE2-8E29-187D38324FE7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {3693DCD7-5A26-4718-B8A4-81F662966E3E}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
26
sltSync/Config.vb
Normal file
26
sltSync/Config.vb
Normal file
@ -0,0 +1,26 @@
|
||||
Public Class Config
|
||||
Public Property Hostname As String = ""
|
||||
Public Property Port As String = ""
|
||||
Public Property Username As String = ""
|
||||
Public Property Password As String = ""
|
||||
|
||||
Public Property ConnectionString As String = ""
|
||||
''' <summary>
|
||||
''' This query must contain two placeholders:
|
||||
'''
|
||||
''' - {0} for ExtDocId
|
||||
''' - {1} for Filename
|
||||
''' </summary>
|
||||
Public Property SQLQueryExport As String = ""
|
||||
''' <summary>
|
||||
''' This query needs to return a table with exactly one column, which represents the ExtDocId
|
||||
''' </summary>
|
||||
Public Property SQLQueryFetch As String = ""
|
||||
|
||||
Public Property OutputDirectory As String = ""
|
||||
Public Property TimerIntervalMin As Integer = 10
|
||||
|
||||
Public Property SystemId As String = ""
|
||||
|
||||
Public Property Debug As Boolean = False
|
||||
End Class
|
||||
10
sltSync/Entities/sltAvailableSystem.vb
Normal file
10
sltSync/Entities/sltAvailableSystem.vb
Normal file
@ -0,0 +1,10 @@
|
||||
Namespace Entities
|
||||
Public Class sltAvailableSystem
|
||||
Public SystemId As String
|
||||
Public SystemName As String
|
||||
Public Description As String
|
||||
Public Deactivated As Boolean
|
||||
Public Priority As Integer
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
15
sltSync/Entities/sltDocument.vb
Normal file
15
sltSync/Entities/sltDocument.vb
Normal file
@ -0,0 +1,15 @@
|
||||
Namespace Entities
|
||||
Public Class sltDocument
|
||||
Public Property ExtDocId As String
|
||||
Public Property Name As String
|
||||
Public Property Description As String
|
||||
Public Property DocMimeType As String
|
||||
Public Property DocModifyTimestamp As String
|
||||
Public Property DocOrigin As String
|
||||
Public Property DocOriginalFilename As String
|
||||
Public Property DocSize As Long
|
||||
Public Property StorPlaceId As String
|
||||
Public Property ExternalId As String
|
||||
Public Property Data As Byte()
|
||||
End Class
|
||||
End Namespace
|
||||
38
sltSync/My Project/Application.Designer.vb
generated
Normal file
38
sltSync/My Project/Application.Designer.vb
generated
Normal file
@ -0,0 +1,38 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <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
|
||||
|
||||
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
|
||||
' or if you encounter build errors in this file, go to the Project Designer
|
||||
' (go to Project Properties or double-click the My Project node in
|
||||
' Solution Explorer), and make changes on the Application tab.
|
||||
'
|
||||
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.sltSync.frmMain
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
11
sltSync/My Project/Application.myapp
Normal file
11
sltSync/My Project/Application.myapp
Normal 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>
|
||||
36
sltSync/My Project/AssemblyInfo.vb
Normal file
36
sltSync/My Project/AssemblyInfo.vb
Normal file
@ -0,0 +1,36 @@
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.CompilerServices
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
' General Information about an assembly is controlled through the following
|
||||
' set of attributes. Change these attribute values to modify the information
|
||||
' associated with an assembly.
|
||||
<Assembly: AssemblyTitle("sltSync")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyConfiguration("")>
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("sltSync")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2023")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
<Assembly: AssemblyCulture("")>
|
||||
|
||||
' Setting ComVisible to false makes the types in this assembly not visible
|
||||
' to COM components. If you need to access a type in this assembly from
|
||||
' COM, set the ComVisible attribute to true on that type.
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
' The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
<Assembly: Guid("9006f149-aa49-4b8e-ba69-386d945fa738")>
|
||||
|
||||
' Version information for an assembly consists of the following four values:
|
||||
'
|
||||
' Major Version
|
||||
' Minor Version
|
||||
' Build Number
|
||||
' Revision
|
||||
'
|
||||
' You can specify all the values or you can default the Build and Revision Numbers
|
||||
' by using the '*' as shown below:
|
||||
' [assembly: AssemblyVersion("1.0.*")]
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
61
sltSync/My Project/Resources.Designer.vb
generated
Normal file
61
sltSync/My Project/Resources.Designer.vb
generated
Normal file
@ -0,0 +1,61 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.18034
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' A strongly-typed resource class, for looking up localized strings, etc.
|
||||
''' </summary>
|
||||
' This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
' class via a tool like ResGen or Visual Studio.
|
||||
' To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
' with the /str option, or rebuild your VS project.
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.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
|
||||
|
||||
' internal Resources()
|
||||
' {
|
||||
' }
|
||||
|
||||
''' <summary>
|
||||
''' Returns the cached ResourceManager instance used by this class.
|
||||
''' </summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)>
|
||||
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||
Get
|
||||
If (resourceMan Is Nothing) Then
|
||||
Dim temp As New Global.System.Resources.ResourceManager("Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Overrides the current thread's CurrentUICulture property for all
|
||||
''' resource lookups using this strongly typed resource class.
|
||||
''' </summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)>
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set(ByVal value As System.Globalization.CultureInfo)
|
||||
resourceCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
117
sltSync/My Project/Resources.resx
Normal file
117
sltSync/My Project/Resources.resx
Normal 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:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string"></xsd:attribute>
|
||||
<xsd:attribute name="type" type="xsd:string"></xsd:attribute>
|
||||
<xsd:attribute name="mimetype" type="xsd:string"></xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string"></xsd:attribute>
|
||||
<xsd:attribute name="name" type="xsd:string"></xsd:attribute>
|
||||
</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>
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2"></xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1"></xsd:attribute>
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3"></xsd:attribute>
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4"></xsd:attribute>
|
||||
</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:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required"></xsd:attribute>
|
||||
</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>
|
||||
26
sltSync/My Project/Settings.Designer.vb
generated
Normal file
26
sltSync/My Project/Settings.Designer.vb
generated
Normal file
@ -0,0 +1,26 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.18034
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Namespace My
|
||||
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")>
|
||||
Friend NotInheritable Partial Class Settings
|
||||
Inherits System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As Settings = (CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New Settings()), Settings))
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As Settings
|
||||
Get
|
||||
Return defaultInstance
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
7
sltSync/My Project/Settings.settings
Normal file
7
sltSync/My Project/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
1
sltSync/My Project/licenses.licx
Normal file
1
sltSync/My Project/licenses.licx
Normal file
@ -0,0 +1 @@
|
||||
DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
5
sltSync/Responses/sltDocumentResponse.vb
Normal file
5
sltSync/Responses/sltDocumentResponse.vb
Normal file
@ -0,0 +1,5 @@
|
||||
Public Class sltDocumentResponse
|
||||
Inherits sltResponse
|
||||
|
||||
Public Property Value As Entities.sltDocument
|
||||
End Class
|
||||
5
sltSync/Responses/sltLoginResponse.vb
Normal file
5
sltSync/Responses/sltLoginResponse.vb
Normal file
@ -0,0 +1,5 @@
|
||||
Public Class sltLoginResponse
|
||||
Inherits sltResponse
|
||||
|
||||
Public Property Value As String
|
||||
End Class
|
||||
3
sltSync/Responses/sltLogoutResponse.vb
Normal file
3
sltSync/Responses/sltLogoutResponse.vb
Normal file
@ -0,0 +1,3 @@
|
||||
Public Class sltLogoutResponse
|
||||
Inherits sltResponse
|
||||
End Class
|
||||
5
sltSync/Responses/sltMandatorResponse.vb
Normal file
5
sltSync/Responses/sltMandatorResponse.vb
Normal file
@ -0,0 +1,5 @@
|
||||
Public Class sltAvailableSystemResponse
|
||||
Inherits sltResponse
|
||||
|
||||
Public Property Value As List(Of Entities.sltAvailableSystem)
|
||||
End Class
|
||||
5
sltSync/Responses/sltResponse.vb
Normal file
5
sltSync/Responses/sltResponse.vb
Normal file
@ -0,0 +1,5 @@
|
||||
Public MustInherit Class sltResponse
|
||||
Public Property Message As String
|
||||
Public Property State As Boolean
|
||||
Public Property Type As Integer
|
||||
End Class
|
||||
41
sltSync/app.config
Normal file
41
sltSync/app.config
Normal file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System">
|
||||
<section name="DevExpress.LookAndFeel.Design.AppSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<applicationSettings>
|
||||
<DevExpress.LookAndFeel.Design.AppSettings>
|
||||
<setting name="DPIAwarenessMode" serializeAs="String">
|
||||
<value>System</value>
|
||||
</setting>
|
||||
<setting name="RegisterBonusSkins" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</DevExpress.LookAndFeel.Design.AppSettings>
|
||||
</applicationSettings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
|
||||
</startup>
|
||||
<system.diagnostics>
|
||||
<sources>
|
||||
<!-- This section defines the logging configuration for My.Application.Log -->
|
||||
<source name="DefaultSource" switchName="DefaultSwitch">
|
||||
<listeners>
|
||||
<add name="FileLog" />
|
||||
<!-- Uncomment the below section to write to the Application Event Log -->
|
||||
<!--<add name="EventLog"/>-->
|
||||
</listeners>
|
||||
</source>
|
||||
</sources>
|
||||
<switches>
|
||||
<add name="DefaultSwitch" value="Information" />
|
||||
</switches>
|
||||
<sharedListeners>
|
||||
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" />
|
||||
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
|
||||
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
|
||||
</sharedListeners>
|
||||
</system.diagnostics>
|
||||
</configuration>
|
||||
138
sltSync/frmMain.Designer.vb
generated
Normal file
138
sltSync/frmMain.Designer.vb
generated
Normal file
@ -0,0 +1,138 @@
|
||||
Partial Public Class frmMain
|
||||
Inherits DevExpress.XtraBars.Ribbon.RibbonForm
|
||||
|
||||
''' <summary>
|
||||
''' Required designer variable.
|
||||
''' </summary>
|
||||
Private components As System.ComponentModel.IContainer = Nothing
|
||||
|
||||
''' <summary>
|
||||
''' Clean up any resources being used.
|
||||
''' </summary>
|
||||
''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||
If disposing AndAlso (components IsNot Nothing) Then
|
||||
components.Dispose()
|
||||
End If
|
||||
MyBase.Dispose(disposing)
|
||||
End Sub
|
||||
|
||||
#Region "Windows Form Designer generated code"
|
||||
|
||||
''' <summary>
|
||||
''' Required method for Designer support - do not modify
|
||||
''' the contents of this method with the code editor.
|
||||
''' </summary>
|
||||
Private Sub InitializeComponent()
|
||||
Me.components = New System.ComponentModel.Container()
|
||||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMain))
|
||||
Me.ListBoxControl1 = New DevExpress.XtraEditors.ListBoxControl()
|
||||
Me.RibbonControl1 = New DevExpress.XtraBars.Ribbon.RibbonControl()
|
||||
Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage()
|
||||
Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
|
||||
Me.btnSyncStart = New DevExpress.XtraBars.BarButtonItem()
|
||||
Me.btnStopSync = New DevExpress.XtraBars.BarButtonItem()
|
||||
Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
|
||||
Me.BarButtonItem1 = New DevExpress.XtraBars.BarButtonItem()
|
||||
Me.SyncTimer = New System.Windows.Forms.Timer(Me.components)
|
||||
CType(Me.ListBoxControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'ListBoxControl1
|
||||
'
|
||||
Me.ListBoxControl1.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.ListBoxControl1.Location = New System.Drawing.Point(0, 63)
|
||||
Me.ListBoxControl1.Name = "ListBoxControl1"
|
||||
Me.ListBoxControl1.Size = New System.Drawing.Size(632, 215)
|
||||
Me.ListBoxControl1.TabIndex = 0
|
||||
'
|
||||
'RibbonControl1
|
||||
'
|
||||
Me.RibbonControl1.CommandLayout = DevExpress.XtraBars.Ribbon.CommandLayout.Simplified
|
||||
Me.RibbonControl1.ExpandCollapseItem.Id = 0
|
||||
Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.btnSyncStart, Me.btnStopSync, Me.BarButtonItem1})
|
||||
Me.RibbonControl1.Location = New System.Drawing.Point(0, 0)
|
||||
Me.RibbonControl1.MaxItemId = 4
|
||||
Me.RibbonControl1.Name = "RibbonControl1"
|
||||
Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1})
|
||||
Me.RibbonControl1.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.[False]
|
||||
Me.RibbonControl1.ShowDisplayOptionsMenuButton = DevExpress.Utils.DefaultBoolean.[False]
|
||||
Me.RibbonControl1.ShowPageHeadersMode = DevExpress.XtraBars.Ribbon.ShowPageHeadersMode.Hide
|
||||
Me.RibbonControl1.ShowToolbarCustomizeItem = False
|
||||
Me.RibbonControl1.Size = New System.Drawing.Size(632, 63)
|
||||
Me.RibbonControl1.Toolbar.ShowCustomizeItem = False
|
||||
'
|
||||
'RibbonPage1
|
||||
'
|
||||
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup2})
|
||||
Me.RibbonPage1.Name = "RibbonPage1"
|
||||
Me.RibbonPage1.Text = "RibbonPage1"
|
||||
'
|
||||
'RibbonPageGroup1
|
||||
'
|
||||
Me.RibbonPageGroup1.ItemLinks.Add(Me.btnSyncStart)
|
||||
Me.RibbonPageGroup1.ItemLinks.Add(Me.btnStopSync)
|
||||
Me.RibbonPageGroup1.Name = "RibbonPageGroup1"
|
||||
Me.RibbonPageGroup1.Text = "RibbonPageGroup1"
|
||||
'
|
||||
'btnSyncStart
|
||||
'
|
||||
Me.btnSyncStart.Caption = "Sync starten"
|
||||
Me.btnSyncStart.Id = 1
|
||||
Me.btnSyncStart.ImageOptions.SvgImage = CType(resources.GetObject("btnSyncStart.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
|
||||
Me.btnSyncStart.Name = "btnSyncStart"
|
||||
'
|
||||
'btnStopSync
|
||||
'
|
||||
Me.btnStopSync.Caption = "Sync stoppen"
|
||||
Me.btnStopSync.Enabled = False
|
||||
Me.btnStopSync.Id = 2
|
||||
Me.btnStopSync.ImageOptions.SvgImage = CType(resources.GetObject("btnStopSync.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
|
||||
Me.btnStopSync.Name = "btnStopSync"
|
||||
'
|
||||
'RibbonPageGroup2
|
||||
'
|
||||
Me.RibbonPageGroup2.Alignment = DevExpress.XtraBars.Ribbon.RibbonPageGroupAlignment.Far
|
||||
Me.RibbonPageGroup2.ItemLinks.Add(Me.BarButtonItem1)
|
||||
Me.RibbonPageGroup2.Name = "RibbonPageGroup2"
|
||||
Me.RibbonPageGroup2.Text = "RibbonPageGroup2"
|
||||
'
|
||||
'BarButtonItem1
|
||||
'
|
||||
Me.BarButtonItem1.Caption = "Log öffnen"
|
||||
Me.BarButtonItem1.Id = 3
|
||||
Me.BarButtonItem1.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem1.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
|
||||
Me.BarButtonItem1.Name = "BarButtonItem1"
|
||||
'
|
||||
'frmMain
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(632, 278)
|
||||
Me.Controls.Add(Me.ListBoxControl1)
|
||||
Me.Controls.Add(Me.RibbonControl1)
|
||||
Me.IconOptions.SvgImage = CType(resources.GetObject("frmMain.IconOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
|
||||
Me.Name = "frmMain"
|
||||
Me.Ribbon = Me.RibbonControl1
|
||||
Me.Text = "sltSync"
|
||||
CType(Me.ListBoxControl1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.ResumeLayout(False)
|
||||
Me.PerformLayout()
|
||||
|
||||
End Sub
|
||||
|
||||
Friend WithEvents ListBoxControl1 As DevExpress.XtraEditors.ListBoxControl
|
||||
Friend WithEvents RibbonControl1 As DevExpress.XtraBars.Ribbon.RibbonControl
|
||||
Friend WithEvents RibbonPage1 As DevExpress.XtraBars.Ribbon.RibbonPage
|
||||
Friend WithEvents btnSyncStart As DevExpress.XtraBars.BarButtonItem
|
||||
Friend WithEvents btnStopSync As DevExpress.XtraBars.BarButtonItem
|
||||
Friend WithEvents RibbonPageGroup1 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
|
||||
Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem
|
||||
Friend WithEvents RibbonPageGroup2 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
|
||||
Friend WithEvents SyncTimer As Timer
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
205
sltSync/frmMain.resx
Normal file
205
sltSync/frmMain.resx
Normal file
@ -0,0 +1,205 @@
|
||||
<?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="DevExpress.Data.v21.2" name="DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<data name="btnSyncStart.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIxLjIsIFZlcnNpb249MjEuMi40
|
||||
LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl
|
||||
dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAANoCAAAC77u/
|
||||
PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi
|
||||
IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv
|
||||
MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh
|
||||
Y2U9InByZXNlcnZlIiBpZD0iTGF5ZXJfMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAg
|
||||
MzIgMzIiPg0KICA8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLlllbGxvd3tmaWxsOiNGRkIxMTU7fQoJ
|
||||
LlJlZHtmaWxsOiNEMTFDMUM7fQoJLkJsdWV7ZmlsbDojMTE3N0Q3O30KCS5HcmVlbntmaWxsOiMwMzlD
|
||||
MjM7fQoJLkJsYWNre2ZpbGw6IzcyNzI3Mjt9CgkuV2hpdGV7ZmlsbDojRkZGRkZGO30KCS5zdDB7b3Bh
|
||||
Y2l0eTowLjU7fQoJLnN0MXtkaXNwbGF5Om5vbmU7fQoJLnN0MntkaXNwbGF5OmlubGluZTtmaWxsOiMw
|
||||
MzlDMjM7fQoJLnN0M3tkaXNwbGF5OmlubGluZTtmaWxsOiNEMTFDMUM7fQoJLnN0NHtkaXNwbGF5Omlu
|
||||
bGluZTtmaWxsOiM3MjcyNzI7fQo8L3N0eWxlPg0KICA8ZyBpZD0iR2V0dGluZ1N0YXJ0ZWQiPg0KICAg
|
||||
IDxwYXRoIGQ9Ik0xNiwyQzguMywyLDIsOC4zLDIsMTZzNi4zLDE0LDE0LDE0czE0LTYuMywxNC0xNFMy
|
||||
My43LDIsMTYsMnogTTEyLDIyVjEwbDEwLDZMMTIsMjJ6IiBjbGFzcz0iR3JlZW4iIC8+DQogIDwvZz4N
|
||||
Cjwvc3ZnPgs=
|
||||
</value>
|
||||
</data>
|
||||
<data name="btnStopSync.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIxLjIsIFZlcnNpb249MjEuMi40
|
||||
LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl
|
||||
dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAAFECAAAC77u/
|
||||
PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi
|
||||
IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv
|
||||
MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh
|
||||
Y2U9InByZXNlcnZlIiBpZD0iTGF5ZXJfMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAg
|
||||
MzIgMzIiPg0KICA8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLkJsdWV7ZmlsbDojMTE3N0Q3O30KCS5Z
|
||||
ZWxsb3d7ZmlsbDojRkZCMTE1O30KCS5CbGFja3tmaWxsOiM3MjcyNzI7fQoJLkdyZWVue2ZpbGw6IzAz
|
||||
OUMyMzt9CgkuUmVke2ZpbGw6I0QxMUMxQzt9Cgkuc3Qwe29wYWNpdHk6MC43NTt9Cgkuc3Qxe29wYWNp
|
||||
dHk6MC41O30KPC9zdHlsZT4NCiAgPGcgaWQ9IlJlbW92ZUNpcmNsZWQiPg0KICAgIDxwYXRoIGQ9Ik0x
|
||||
Niw0QzkuNCw0LDQsOS40LDQsMTZzNS40LDEyLDEyLDEyczEyLTUuNCwxMi0xMlMyMi42LDQsMTYsNHog
|
||||
TTI0LDE4SDh2LTRoMTZWMTh6IiBjbGFzcz0iUmVkIiAvPg0KICA8L2c+DQo8L3N2Zz4L
|
||||
</value>
|
||||
</data>
|
||||
<data name="BarButtonItem1.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIxLjIsIFZlcnNpb249MjEuMi40
|
||||
LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl
|
||||
dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAAJQCAAAC77u/
|
||||
PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi
|
||||
IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv
|
||||
MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh
|
||||
Y2U9InByZXNlcnZlIiBpZD0iT3BlbiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMzIg
|
||||
MzIiPg0KICA8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLlllbGxvd3tmaWxsOiNGRkIxMTU7fQoJLnN0
|
||||
MHtvcGFjaXR5OjAuNzU7fQo8L3N0eWxlPg0KICA8ZyBjbGFzcz0ic3QwIj4NCiAgICA8cGF0aCBkPSJN
|
||||
Mi4yLDI1LjJsNS41LTEyYzAuMy0wLjcsMS0xLjIsMS44LTEuMkgyNlY5YzAtMC42LTAuNC0xLTEtMUgx
|
||||
MlY1YzAtMC42LTAuNC0xLTEtMUgzQzIuNCw0LDIsNC40LDIsNXYyMCAgIGMwLDAuMiwwLDAuMywwLjEs
|
||||
MC40QzIuMSwyNS4zLDIuMiwyNS4zLDIuMiwyNS4yeiIgY2xhc3M9IlllbGxvdyIgLz4NCiAgPC9nPg0K
|
||||
ICA8cGF0aCBkPSJNMzEuMywxNEg5LjZMNCwyNmgyMS44YzAuNSwwLDEuMS0wLjMsMS4zLTAuN0wzMiwx
|
||||
NC43QzMyLjEsMTQuMywzMS44LDE0LDMxLjMsMTR6IiBjbGFzcz0iWWVsbG93IiAvPg0KPC9zdmc+Cw==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="SyncTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<data name="frmMain.IconOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIxLjIsIFZlcnNpb249MjEuMi40
|
||||
LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl
|
||||
dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAAFAEAAAC77u/
|
||||
PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi
|
||||
IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv
|
||||
MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh
|
||||
Y2U9InByZXNlcnZlIiBpZD0iTGF5ZXJfMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAg
|
||||
MzIgMzIiPg0KICA8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLkJsdWV7ZmlsbDojMTE3N0Q3O30KCS5Z
|
||||
ZWxsb3d7ZmlsbDojRkZCMTE1O30KCS5SZWR7ZmlsbDojRDExQzFDO30KCS5HcmVlbntmaWxsOiMwMzlD
|
||||
MjM7fQoJLkJsYWNre2ZpbGw6IzcyNzI3Mjt9CgkuV2hpdGV7ZmlsbDojRkZGRkZGO30KCS5zdDB7b3Bh
|
||||
Y2l0eTowLjU7fQoJLnN0MXtvcGFjaXR5OjAuNzU7fQoJLnN0MntkaXNwbGF5Om5vbmU7fQoJLnN0M3tk
|
||||
aXNwbGF5OmlubGluZTtmaWxsOiNGRkIxMTU7fQoJLnN0NHtkaXNwbGF5OmlubGluZTt9Cgkuc3Q1e2Rp
|
||||
c3BsYXk6aW5saW5lO29wYWNpdHk6MC43NTt9Cgkuc3Q2e2Rpc3BsYXk6aW5saW5lO29wYWNpdHk6MC41
|
||||
O30KCS5zdDd7ZGlzcGxheTppbmxpbmU7ZmlsbDojMDM5QzIzO30KCS5zdDh7ZGlzcGxheTppbmxpbmU7
|
||||
ZmlsbDojRDExQzFDO30KCS5zdDl7ZGlzcGxheTppbmxpbmU7ZmlsbDojMTE3N0Q3O30KCS5zdDEwe2Rp
|
||||
c3BsYXk6aW5saW5lO2ZpbGw6I0ZGRkZGRjt9Cjwvc3R5bGU+DQogIDxnIGlkPSJBdWRpdF94NUZfQ2hh
|
||||
bmdlSGlzdG9yeSI+DQogICAgPHBvbHlnb24gcG9pbnRzPSIxNiwxNiAxNiwxMCAxNCwxMCAxNCwxOCAy
|
||||
MiwxOCAyMiwxNiAgIiBjbGFzcz0iQmxhY2siIC8+DQogICAgPHBhdGggZD0iTTE2LDJDMTEuNiwyLDcu
|
||||
Nyw0LDUuMiw3LjJMMiw0djEwaDAuMmg0SDEybC00LTRjMS44LTIuNCw0LjctNCw4LTRjNS41LDAsMTAs
|
||||
NC41LDEwLDEwYzAsNS41LTQuNSwxMC0xMCwxMCAgIGMtNC44LDAtOC45LTMuNC05LjgtOGgtNGMxLDYu
|
||||
OCw2LjgsMTIsMTMuOCwxMmM3LjcsMCwxNC02LjMsMTQtMTRTMjMuNywyLDE2LDJ6IiBjbGFzcz0iQmx1
|
||||
ZSIgLz4NCiAgPC9nPg0KPC9zdmc+Cw==
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
247
sltSync/frmMain.vb
Normal file
247
sltSync/frmMain.vb
Normal file
@ -0,0 +1,247 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.Configuration
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.IO
|
||||
Imports System.Text
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Base.IDB
|
||||
Imports DigitalData.Modules.Config
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports Microsoft.Win32
|
||||
|
||||
Partial Public Class frmMain
|
||||
Private LogConfig As LogConfig
|
||||
Private Logger As Logger
|
||||
Private ConfigManager As ConfigManager(Of Config)
|
||||
Private Database As MSSQLServer
|
||||
Private Sync As sltSync
|
||||
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
End Sub
|
||||
|
||||
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Try
|
||||
LogConfig = New LogConfig(LogConfig.PathType.CustomPath, Application.LocalUserAppDataPath, CompanyName:="Digital Data", ProductName:="sltSync")
|
||||
Logger = LogConfig.GetLogger()
|
||||
ConfigManager = New ConfigManager(Of Config)(LogConfig, Application.UserAppDataPath)
|
||||
LogConfig.Debug = ConfigManager.Config.Debug
|
||||
|
||||
SyncTimer.Interval = ConfigManager.Config.TimerIntervalMin * 60 * 1_000
|
||||
|
||||
AddInfoEntry("Application started.")
|
||||
AddInfoEntry("Version: {0}", Application.ProductVersion)
|
||||
AddInfoEntry("Timer Interval: {0} min", ConfigManager.Config.TimerIntervalMin.ToString)
|
||||
AddDivider()
|
||||
|
||||
Database = New MSSQLServer(LogConfig, ConfigManager.Config.ConnectionString)
|
||||
Sync = New sltSync(LogConfig, ConfigManager.Config)
|
||||
|
||||
If Database.DBInitialized = False Then
|
||||
AddWarnEntry("Database could not be initialized. Please check connection string.")
|
||||
Else
|
||||
StartTimer()
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
AddWarnEntry($"Error while loading the application: {ex.Message}")
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Async Function frmMain_Closing(sender As Object, e As CancelEventArgs) As Threading.Tasks.Task Handles Me.Closing
|
||||
Try
|
||||
If Sync IsNot Nothing AndAlso Sync.IsLoggedIn Then
|
||||
AddInfoEntry("Logging out..")
|
||||
Await Sync.Logout()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
AddWarnEntry($"Error while closing the application: {ex.Message}")
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Sub StartTimer()
|
||||
If TestConfigurationIsComplete() = False Then
|
||||
AddInfoEntry("Configuration is incomplete. Stopping.")
|
||||
AddDivider()
|
||||
Else
|
||||
AddInfoEntry("Starting timer..")
|
||||
btnStopSync.Enabled = True
|
||||
btnSyncStart.Enabled = False
|
||||
SyncTimer.Enabled = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub StopTimer()
|
||||
AddInfoEntry("Stopping timer..")
|
||||
btnStopSync.Enabled = False
|
||||
btnSyncStart.Enabled = True
|
||||
SyncTimer.Enabled = False
|
||||
End Sub
|
||||
|
||||
Private Async Function Timer_Elapsed(sender As Object, e As System.EventArgs) As Threading.Tasks.Task Handles SyncTimer.Tick
|
||||
Try
|
||||
AddInfoEntry("Starting Sync.")
|
||||
AddDivider()
|
||||
|
||||
Dim oOutputDirectory As String = ConfigManager.Config.OutputDirectory
|
||||
|
||||
If Directory.Exists(oOutputDirectory) = False Then
|
||||
Throw New DirectoryNotFoundException($"Directory '{oOutputDirectory}' does not exist.")
|
||||
End If
|
||||
|
||||
Dim oTable As DataTable = Await Database.GetDatatableAsync(ConfigManager.Config.SQLQueryFetch)
|
||||
Dim oExtDocIds = oTable.Rows.Cast(Of DataRow).Select(Function(r) r.Item(0).ToString()).ToList()
|
||||
|
||||
AddInfoEntry("Found [{0}] files.", oExtDocIds.Count.ToString)
|
||||
|
||||
AddInfoEntry("Logging in..")
|
||||
Await Sync.GetAvailableSystems()
|
||||
Await Sync.Login(ConfigManager.Config.SystemId)
|
||||
|
||||
For Each oDocId As String In oExtDocIds
|
||||
Try
|
||||
Logger.Debug("Fetching document from API..")
|
||||
Dim oDocument = Await Sync.GetDocumentContent(oDocId)
|
||||
Logger.Debug("Document fetched!")
|
||||
|
||||
AddInfoEntry("Document: [{0}]", oDocument.Name)
|
||||
Logger.Info("ExtDocId: [{0}]", oDocument.ExtDocId)
|
||||
|
||||
'Dim oCleanFilename = StringEx.ConvertTextToSlug(oDocument.Name)
|
||||
Dim oFileName = GetFilenameWithExtension(oDocument.Name, oDocument.DocMimeType)
|
||||
Dim oFilePath = Path.Combine(oOutputDirectory, oFileName)
|
||||
|
||||
Using oStream As New MemoryStream(oDocument.Data)
|
||||
Using oWriter As New FileStream(oFilePath, FileMode.Create)
|
||||
oStream.CopyTo(oWriter)
|
||||
End Using
|
||||
End Using
|
||||
|
||||
Dim oSQL = String.Format(ConfigManager.Config.SQLQueryExport, oDocument.ExtDocId, oDocument.Name)
|
||||
Await Database.ExecuteNonQueryAsync(oSQL)
|
||||
|
||||
Catch ex As IOException
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
|
||||
Catch ex As SqlException
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
AddWarnEntry("Error while running Sync: " & ex.Message)
|
||||
End Try
|
||||
Next
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
AddWarnEntry("Error while running Sync: " & ex.Message)
|
||||
|
||||
End Try
|
||||
|
||||
AddInfoEntry("Finished Sync.")
|
||||
AddInfoEntry("Logging Out..")
|
||||
AddDivider()
|
||||
Await Sync.Logout()
|
||||
End Function
|
||||
|
||||
Private Function GetFilenameWithExtension(pFilename As String, pMimetype As String) As String
|
||||
Try
|
||||
Dim oExtension = MimeTypes.MimeTypeMap.GetExtension(pMimetype)
|
||||
If pFilename.EndsWith(oExtension) Then
|
||||
Return pFilename
|
||||
End If
|
||||
|
||||
Return pFilename & oExtension
|
||||
|
||||
Catch ex As Exception
|
||||
AddWarnEntry("File [{0}] does not have a valid mimetype [{1}]. Returning original filename.", pFilename, pMimetype)
|
||||
|
||||
Return pFilename
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
Private Sub AddInfoEntry(pMessage As String, ParamArray pArgs As Object())
|
||||
Logger.Info(pMessage, pArgs)
|
||||
ListBoxControl1.Items.Add(Now & " " & String.Format(pMessage, pArgs))
|
||||
End Sub
|
||||
|
||||
Private Sub AddWarnEntry(pMessage As String, ParamArray pArgs As Object())
|
||||
Logger.Info(pMessage, pArgs)
|
||||
ListBoxControl1.Items.Add(String.Format(pMessage, pArgs))
|
||||
End Sub
|
||||
|
||||
Private Sub AddDivider()
|
||||
ListBoxControl1.Items.Add("=====================================")
|
||||
End Sub
|
||||
|
||||
Private Function TestConfigurationIsComplete() As Boolean
|
||||
Dim oComplete = True
|
||||
|
||||
If ConfigManager.Config.Hostname = String.Empty Then
|
||||
AddWarnEntry("Configuration for 'Hostname' is empty.")
|
||||
oComplete = False
|
||||
End If
|
||||
|
||||
If ConfigManager.Config.Port = String.Empty Then
|
||||
AddWarnEntry("Configuration for 'Port' is empty.")
|
||||
oComplete = False
|
||||
End If
|
||||
|
||||
If ConfigManager.Config.Username = String.Empty Then
|
||||
AddWarnEntry("Configuration for 'Username' is empty.")
|
||||
oComplete = False
|
||||
End If
|
||||
|
||||
If ConfigManager.Config.Password = String.Empty Then
|
||||
AddWarnEntry("Configuration for 'Password' is empty.")
|
||||
oComplete = False
|
||||
End If
|
||||
|
||||
If ConfigManager.Config.ConnectionString = String.Empty Then
|
||||
AddWarnEntry("Configuration for 'ConnectionString' is empty.")
|
||||
oComplete = False
|
||||
End If
|
||||
|
||||
If ConfigManager.Config.SQLQueryFetch = String.Empty Then
|
||||
AddWarnEntry("Configuration for 'SQLQueryFetch' is empty.")
|
||||
oComplete = False
|
||||
End If
|
||||
|
||||
If ConfigManager.Config.SQLQueryExport = String.Empty Then
|
||||
AddWarnEntry("Configuration for 'SQLQueryExport' is empty.")
|
||||
oComplete = False
|
||||
End If
|
||||
|
||||
If ConfigManager.Config.OutputDirectory = String.Empty Then
|
||||
AddWarnEntry("Configuration for 'OutputDirectory' is empty.")
|
||||
oComplete = False
|
||||
End If
|
||||
|
||||
Return oComplete
|
||||
End Function
|
||||
|
||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
||||
Try
|
||||
Dim oPath = LogConfig.LogDirectory
|
||||
Process.Start("explorer.exe", oPath)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub btnSyncStart_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnSyncStart.ItemClick
|
||||
StartTimer()
|
||||
End Sub
|
||||
|
||||
Private Sub btnStopSync_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnStopSync.ItemClick
|
||||
StopTimer()
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
6
sltSync/packages.config
Normal file
6
sltSync/packages.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MediaTypeMap" version="2.1.0.0" targetFramework="net462" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net462" />
|
||||
<package id="NLog" version="5.0.5" targetFramework="net462" />
|
||||
</packages>
|
||||
10
sltSync/sltException.vb
Normal file
10
sltSync/sltException.vb
Normal file
@ -0,0 +1,10 @@
|
||||
Public Class sltException
|
||||
Inherits ApplicationException
|
||||
|
||||
Public ReadOnly ErrorType As sltSync.ErrorType
|
||||
|
||||
Public Sub New(pErrorType As sltSync.ErrorType, pMessage As String)
|
||||
MyBase.New(pMessage)
|
||||
ErrorType = pErrorType
|
||||
End Sub
|
||||
End Class
|
||||
184
sltSync/sltSync.vb
Normal file
184
sltSync/sltSync.vb
Normal file
@ -0,0 +1,184 @@
|
||||
Imports System.Net.Http
|
||||
Imports DevExpress.XtraPrinting.Export.Pdf.PdfImageCache
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Base.ModuleExtensions
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports Newtonsoft.Json
|
||||
Imports sltSync.Entities
|
||||
|
||||
Partial Public Class sltSync
|
||||
Inherits BaseClass
|
||||
|
||||
Private ReadOnly Config As Config
|
||||
|
||||
Public IsLoggedIn As Boolean = False
|
||||
Public SessionId As String = Nothing
|
||||
Public AvailableSystems As New List(Of sltAvailableSystem)
|
||||
|
||||
Public Enum ErrorType
|
||||
LoginError
|
||||
LogoutError
|
||||
AvailableSystemError
|
||||
NotLoggedInError
|
||||
GetDocumentError
|
||||
End Enum
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pConfig As Config)
|
||||
MyBase.New(pLogConfig)
|
||||
|
||||
Config = pConfig
|
||||
End Sub
|
||||
|
||||
Public Async Function GetAvailableSystems() As Threading.Tasks.Task
|
||||
Try
|
||||
Logger.Debug("Fetching available systems..")
|
||||
|
||||
Dim oUrl = "/slt/External/System/Authentication/Json/AvailableSystems"
|
||||
Dim oJson As String = Await SendRequest(oUrl)
|
||||
Dim oResponse = JsonConvert.DeserializeObject(Of sltAvailableSystemResponse)(oJson)
|
||||
|
||||
TestRequestSuccessful(oUrl, oResponse, ErrorType.AvailableSystemError)
|
||||
|
||||
AvailableSystems = oResponse.Value
|
||||
|
||||
Logger.Debug("Fetched [{0}] available systems!", oResponse.Value.Count)
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Throw New sltException(ErrorType.AvailableSystemError, ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Async Function Login(pSystemId As String) As Threading.Tasks.Task
|
||||
Try
|
||||
Logger.Debug("Logging in..")
|
||||
|
||||
If AvailableSystems.Any(Function(s) s.SystemId = pSystemId) = False Then
|
||||
Dim oMessage = String.Format("SystemId [{0}] does not match any System returned from API.", pSystemId)
|
||||
Logger.Warn(oMessage)
|
||||
Throw New sltException(ErrorType.LoginError, oMessage)
|
||||
End If
|
||||
|
||||
Dim oUrl = "/slt/External/System/Authentication/Json/Login"
|
||||
Dim oParams = New Dictionary(Of String, String) From {
|
||||
{"systemid", pSystemId},
|
||||
{"user", Config.Username},
|
||||
{"password", Config.Password}
|
||||
}
|
||||
|
||||
Logger.Debug("Username: [{0}]", Config.Username)
|
||||
Logger.Debug("SystemId: [{0}]", pSystemId)
|
||||
|
||||
Dim oJson As String = Await SendRequest(oUrl, oParams)
|
||||
Dim oResponse = JsonConvert.DeserializeObject(Of sltLoginResponse)(oJson)
|
||||
|
||||
TestRequestSuccessful(oUrl, oResponse, ErrorType.LoginError)
|
||||
|
||||
SessionId = oResponse.Value
|
||||
IsLoggedIn = True
|
||||
|
||||
Logger.Debug("Login successful!")
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Throw New sltException(ErrorType.LoginError, ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Async Function Logout() As Threading.Tasks.Task
|
||||
If Not IsLoggedIn Then
|
||||
Throw New sltException(ErrorType.NotLoggedInError, "No session found")
|
||||
End If
|
||||
|
||||
Logger.Debug("Logging out..")
|
||||
|
||||
Try
|
||||
Dim oUrl = "/slt/External/System/Authentication/Json/Logout"
|
||||
Dim oParams = New Dictionary(Of String, String) From {
|
||||
{"SessionId", SessionId}
|
||||
}
|
||||
Dim oJson As String = Await SendRequest(oUrl, oParams)
|
||||
Dim oResponse = JsonConvert.DeserializeObject(Of sltLogoutResponse)(oJson)
|
||||
|
||||
TestRequestSuccessful(oUrl, oResponse, ErrorType.LogoutError)
|
||||
|
||||
SessionId = Nothing
|
||||
IsLoggedIn = False
|
||||
|
||||
Logger.Debug("Login successful!")
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Throw New sltException(ErrorType.LogoutError, ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Async Function GetDocumentContent(pExternalDocumentId As String) As Threading.Tasks.Task(Of sltDocument)
|
||||
If Not IsLoggedIn Then
|
||||
Throw New sltException(ErrorType.NotLoggedInError, "No session found")
|
||||
End If
|
||||
|
||||
Try
|
||||
Logger.Debug("Fetching document with ExtDocId [{0}]", pExternalDocumentId)
|
||||
|
||||
Dim oUrl = "/slt/External/Services/Allgemein/ExtDocs/JSon/GetDocument"
|
||||
Dim oParams As New Dictionary(Of String, String) From {
|
||||
{"extdocid", pExternalDocumentId},
|
||||
{"sessionid", SessionId}
|
||||
}
|
||||
|
||||
Dim oJson = Await SendRequest(oUrl, oParams)
|
||||
Dim oResponse = JsonConvert.DeserializeObject(Of sltDocumentResponse)(oJson)
|
||||
|
||||
Logger.Debug("Document Fetched!")
|
||||
|
||||
Return oResponse.Value
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Throw New sltException(ErrorType.GetDocumentError, ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Async Function SendRequest(pUrl As String) As Threading.Tasks.Task(Of String)
|
||||
Return Await SendRequest(pUrl, New Dictionary(Of String, String))
|
||||
End Function
|
||||
|
||||
Private Async Function SendRequest(pUrl As String, pQueryParams As Dictionary(Of String, String)) As Threading.Tasks.Task(Of String)
|
||||
Try
|
||||
Dim oUrl = GetUrl(pUrl, pQueryParams)
|
||||
Logger.Debug("Preparing request to: [{0}]", oUrl)
|
||||
|
||||
Using oClient As New HttpClient()
|
||||
oClient.DefaultRequestHeaders.Accept.Clear()
|
||||
oClient.DefaultRequestHeaders.Accept.Add(New Headers.MediaTypeWithQualityHeaderValue("application/json"))
|
||||
oClient.DefaultRequestHeaders.Add("User-Agent", "Digital Data sltSync")
|
||||
|
||||
Logger.Debug("Sending request.")
|
||||
Return Await oClient.GetStringAsync(oUrl)
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function GetUrl(pPath As String, pQueryParams As Dictionary(Of String, String)) As String
|
||||
Dim oUrl As String = $"http://{Config.Hostname}:{Config.Port}"
|
||||
If Not pPath.StartsWith("/") Then pPath &= "/"
|
||||
|
||||
Dim queryString = pQueryParams.ToURLQueryString()
|
||||
|
||||
Return $"{oUrl}{pPath}?{queryString}"
|
||||
End Function
|
||||
|
||||
Private Sub TestRequestSuccessful(pUrl As String, pResponse As sltResponse, pErrorType As ErrorType)
|
||||
If pResponse.State = False Then
|
||||
Logger.Warn("Request to Url [{0}] returned error.", pUrl)
|
||||
Logger.Error(pResponse.Message)
|
||||
Throw New sltException(pErrorType, pResponse.Message)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
161
sltSync/sltSync.vbproj
Normal file
161
sltSync/sltSync.vbproj
Normal file
@ -0,0 +1,161 @@
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{A439775B-FF9C-4C46-9395-79356A8FC601}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>sltSync</RootNamespace>
|
||||
<AssemblyName>sltSync</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<MyType>WindowsForms</MyType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>sltSync.My.MyApplication</StartupObject>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DevExpress.BonusSkins.v21.2" />
|
||||
<Reference Include="DevExpress.Data.v21.2" />
|
||||
<Reference Include="DevExpress.Data.Desktop.v21.2" />
|
||||
<Reference Include="DevExpress.Utils.v21.2" />
|
||||
<Reference Include="DevExpress.Sparkline.v21.2.Core" />
|
||||
<Reference Include="DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
||||
<Reference Include="DevExpress.XtraEditors.v21.2" />
|
||||
<Reference Include="DevExpress.Printing.v21.2.Core" />
|
||||
<Reference Include="DigitalData.Modules.Base">
|
||||
<HintPath>..\..\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Config">
|
||||
<HintPath>..\..\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Database">
|
||||
<HintPath>..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging">
|
||||
<HintPath>..\..\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MimeTypeMap, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MediaTypeMap.2.1.0.0\lib\net40\MimeTypeMap.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Drawing" />
|
||||
<Import Include="System.Windows.Forms" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
<Import Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Config.vb" />
|
||||
<Compile Include="Entities\sltDocument.vb" />
|
||||
<Compile Include="frmMain.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="frmMain.Designer.vb">
|
||||
<DependentUpon>frmMain.vb</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Entities\sltAvailableSystem.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="Responses\sltDocumentResponse.vb" />
|
||||
<Compile Include="sltException.vb" />
|
||||
<Compile Include="Responses\sltLoginResponse.vb" />
|
||||
<Compile Include="Responses\sltLogoutResponse.vb" />
|
||||
<Compile Include="Responses\sltMandatorResponse.vb" />
|
||||
<Compile Include="Responses\sltResponse.vb" />
|
||||
<Compile Include="sltSync.vb" />
|
||||
<EmbeddedResource Include="frmMain.resx">
|
||||
<DependentUpon>frmMain.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="My Project\licenses.licx" />
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="app.config" />
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Loading…
x
Reference in New Issue
Block a user