This commit is contained in:
2019-10-28 09:30:39 +01:00
parent d29dc72b22
commit 6ae299259e
38 changed files with 2570 additions and 1168 deletions

View File

@@ -11,7 +11,7 @@
<AssemblyName>AVISOUPDATER</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup>
@@ -75,7 +75,8 @@
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="Update.vb" />
<Compile Include="cProgrammeUpdate.vb" />
<Compile Include="OLDUpdate.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>

View File

@@ -1 +1,9 @@
F:\Programme\AVISO\
F:\Programme\AVISO\
192.168.0.**|\\share01.verag.ost.dmn\Programme\AVISO
172.16.0.**|\\172.16.0.99\Daten\PROGRAMME\AVISO
192.168.1.**|\\192.168.1.20\daten\VERAG Programme\AVISO
192.168.133.**|\\192.168.133.98\f\Programme\AVISO
172.16.1.**|\\172.16.1.100\f\PROGRAMME\AVISO
192.168.32.**|\\192.168.32.253\Files\Programme\AVISO
192.168.100.**|\\192.168.100.11\Daten\Programme\AVISO
10.4.3.**|\\10.4.3.17\VERAG gemeinsam\AVISO

View File

@@ -1 +1 @@
4.0
6.0

View File

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

View File

@@ -14,8 +14,8 @@ Option Explicit On
Namespace My
'HINWEIS: Diese Datei wird automatisch generiert. Ändern Sie sie nicht direkt. Zum Ändern
' oder bei in dieser Datei auftretenden Buildfehlern wechseln Sie zum Projekt-Designer.
'HINWEIS: Diese Datei wird automatisch generiert und darf nicht direkt bearbeitet werden. Wenn Sie Änderungen vornehmen möchten
' oder in dieser Datei Buildfehler auftreten, wechseln Sie zum Projekt-Designer.
' (Wechseln Sie dazu zu den Projekteigenschaften, oder doppelklicken Sie auf den Knoten "Mein Projekt" im
' Projektmappen-Explorer). Nehmen Sie auf der Registerkarte "Anwendung" entsprechende Änderungen vor.
'

View File

@@ -22,7 +22,7 @@ Namespace My.Resources
'''<summary>
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
<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()> _

View File

@@ -15,21 +15,21 @@ Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0"), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.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 "Funktion zum automatischen Speichern von My.Settings"
#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(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If

View File

@@ -6,6 +6,7 @@
Sub Main()
'Falls Settings existiert, wird der Pfad daraus verwendet.
F = System.IO.File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory & "AVISOUPDATER_Settings.txt")
If Not System.IO.Directory.Exists(F) Then
MsgBox("ERROR_UPDATE_05: Es konnte keine Verbindung mit dem F:\ Laufwerk hergestellt werden." & vbNewLine & "Wenn Sie eine Remote-Sitzung verwenden, melden Sie sich mit dieser erneut an.", MsgBoxStyle.Critical, "ERROR")
Environment.Exit(0)
@@ -13,6 +14,7 @@
System.Console.WriteLine("3 Sekunden warten, um sicherzustellen, dass das Programm beendet wurde...")
Threading.Thread.Sleep(3000) 'Falls Programm gerade am Beenden
System.Console.WriteLine("Starte Update...")
System.Console.WriteLine("UPDATEPFAD: " & F)
' If Not My.Computer.FileSystem.DirectoryExists(F) Then
'MsgBox("ERROR_UPDATE_02: Update-Daten existieren nicht.", MsgBoxStyle.Critical, "ERROR")
' Else
@@ -47,6 +49,8 @@
'End If
Environment.Exit(0)
End Sub
Private Sub FileCopier()
For Each file As String In IO.Directory.GetFiles(F) ' Ermittelt alle Dateien des Ordners
IO.File.Copy(file, AppDomain.CurrentDomain.BaseDirectory & cut_file(file), True) ' Kopiert die Dateien Next

View File

@@ -3,7 +3,7 @@ Imports System.Security.Cryptography
Public Class UPDATERfrm
Dim CopyIdentical = False ' selbe Dateien nicht kopieren
Dim CopyIncremental = True ' selbe Dateien nicht kopieren
Private Sub UPDATERfrm_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -23,6 +23,19 @@ Public Class UPDATERfrm
Dim F_ATILLA As String = "\\172.16.0.99\Daten\Programme\AVISO\" ' ATILLA
Public Sub Main()
'STARTPARAMETER - DP
Dim PARAM = ""
Dim parameter() As String = Environment.GetCommandLineArgs().ToArray
If (parameter.Count - 1) >= 1 Then 'Höher als 1 weil der index 0 der Pfad zum programm ist
PARAM = parameter(1)
End If
If PARAM = "full" Then
CopyIncremental = False
End If
Dim FIRMA = "VERAG"
Dim pfadDatei As String = System.AppDomain.CurrentDomain.BaseDirectory & "\Standort.txt"
FIRMA = "VERAG"
@@ -39,22 +52,31 @@ Public Class UPDATERfrm
'Falls Settings existiert, wird der Pfad daraus verwendet.
F = System.IO.File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory & "AVISOUPDATER_Settings.txt")
' F = System.IO.File.ReadAllLines(AppDomain.CurrentDomain.BaseDirectory & "AVISOUPDATER_Settings.txt")(0)
' F = System.IO.File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory & "AVISOUPDATER_Settings.txt")
If Not System.IO.Directory.Exists(F) Then
F = getFByIP()
If FIRMA = "ATILLA" Then
F = F_ATILLA 'Sichere Verbindung
Else
F = F_PROD
End If
writeLine(RichTextBox, "F-Pfad nicht gefunden, verbinde mit '" & F & "' ...")
writeLine(RichTextBox, "Verbinde mit '" & F & "' ...")
If Not System.IO.Directory.Exists(F) Then
MsgBox("ERROR_UPDATE_05: Es konnte keine Verbindung mit dem F:\ Laufwerk hergestellt werden." & vbNewLine & "Wenn Sie eine Remote-Sitzung verwenden, melden Sie sich mit dieser erneut an.", MsgBoxStyle.Critical, "ERROR")
Environment.Exit(0)
If FIRMA = "ATILLA" Then
F = F_ATILLA 'Sichere Verbindung
Else
F = F_PROD
End If
writeLine(RichTextBox, "Standard-Freigabelaufwerk nicht gefunden. Verbinde mit '" & F & "' ...")
If Not System.IO.Directory.Exists(F) Then
MsgBox("ERROR_UPDATE_05: Es konnte keine Verbindung mit dem Freigabe-Laufwerk hergestellt werden." & vbNewLine & "Wenn Sie eine Remote-Sitzung verwenden, melden Sie sich mit dieser erneut an.", MsgBoxStyle.Critical, "ERROR")
Environment.Exit(0)
End If
End If
writeLine(RichTextBox, "Verbindung erfolgreich...")
'Else
' System.Console.WriteLine("UPDATEPFAD: " & F)
End If
writeLine(RichTextBox, "3 Sekunden warten, um sicherzustellen, dass das Programm beendet wurde...")
@@ -73,14 +95,22 @@ Public Class UPDATERfrm
End If
'---------------------------
delFiles()
FileCopier()
'---------------------------
'Alternative:
'---------------------------
'-------
'copyAndDelFilesAndDir()
'---------------------------
' If Not cut_file(File).Contains("AVISOUPDATER") And Not cut_file(File).Contains("NOT_DEL_") Then
If CopyIncremental Then
cProgrammeUpdate.copyProgramLIST(F, AppDomain.CurrentDomain.BaseDirectory, {"AVISOUPDATER", "NOT_DEL_"})
Else
delFiles()
FileCopier()
End If
If Not System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory & "AVISO.exe") Then
@@ -105,6 +135,57 @@ Public Class UPDATERfrm
Environment.Exit(0)
End Sub
Function getFByIP() As String
Dim default_F = ""
getFByIP = ""
Try
Dim IPADDR As System.Net.IPAddress
IPADDR = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName()).AddressList(0)
'MsgBox(IPADDR.ToString())
For Each l In System.IO.File.ReadAllLines(AppDomain.CurrentDomain.BaseDirectory & "AVISOUPDATER_Settings.txt")
If l.Contains("|") Then
Dim sp = l.Split("|")
If IPADDR.ToString.Contains(sp(0).Replace("**", "")) Then
getFByIP = sp(1)
End If
Else
default_F = l
End If
Next
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
End Try
If getFByIP = "" Then
If default_F <> "" Then
getFByIP = default_F
Else
getFByIP = F
End If
End If
If F.Contains("10.4.3.17") Then buildConnectionUNISPED()
End Function
Sub buildConnectionUNISPED()
Try
writeLine(RichTextBox, "UNISPED Netzwerkzugriff einrichten...")
Dim netuse As New System.Diagnostics.ProcessStartInfo()
netuse.FileName = "C:\Windows\system32\net"
netuse.Arguments = "use \\10.4.3.17 /User:VERAG 1VerSub9#"
netuse.CreateNoWindow = True
netuse.WindowStyle = ProcessWindowStyle.Hidden
System.Diagnostics.Process.Start(netuse)
Catch ex As Exception
writeLine(RichTextBox, "ERR: UNISPED Netzwerkzugriff fehlgeschlagen...")
End Try
End Sub
Delegate Sub writeLineCallback(rtb As System.Windows.Forms.RichTextBox, text As String)
Private Sub writeLine(rtb As System.Windows.Forms.RichTextBox, text As String)
If Me.InvokeRequired Then

View File

@@ -0,0 +1,215 @@

Imports System.Data.SqlClient
Imports System.Reflection
Public Class cProgrammeUpdate
Property pud_progId As Object = Nothing
Property pud_codename As String
Property pud_version As String
Property pud_fileName As String
Property pud_filePathFolder As Object = Nothing
Property pud_datum As Date = Now
Property pud_file_Verion As String
Property pud_file_Date As Date
Property pud_file_Size As Integer
Shared Function getParameterList(UD As cProgrammeUpdate) As List(Of SQLVariable)
Dim list As New List(Of SQLVariable)
list.Add(New SQLVariable("pud_progId", UD.pud_progId))
list.Add(New SQLVariable("pud_codename", UD.pud_codename))
list.Add(New SQLVariable("pud_version", UD.pud_version))
list.Add(New SQLVariable("pud_fileName", UD.pud_fileName))
list.Add(New SQLVariable("pud_filePathFolder", UD.pud_filePathFolder))
list.Add(New SQLVariable("pud_datum", UD.pud_datum))
list.Add(New SQLVariable("pud_file_Verion", UD.pud_file_Verion))
list.Add(New SQLVariable("pud_file_Date", UD.pud_file_Date))
list.Add(New SQLVariable("pud_file_Size", UD.pud_file_Size))
Return list
End Function
Public Shared Function isNewFile(ByRef file As cProgrammeUpdate, LIST_DEST As List(Of cProgrammeUpdate)) As Boolean
For Each l In LIST_DEST
If l.pud_filePathFolder = file.pud_filePathFolder And l.pud_fileName = file.pud_fileName And l.pud_file_Size = file.pud_file_Size And l.pud_file_Date = file.pud_file_Date Then
Return False
End If
Next
Return True
End Function
Public Shared Function isOldFile(ByRef file As cProgrammeUpdate, LIST_SOURCE As List(Of cProgrammeUpdate)) As Boolean
For Each l In LIST_SOURCE
If l.pud_filePathFolder = file.pud_filePathFolder And l.pud_fileName = file.pud_fileName And l.pud_file_Size = file.pud_file_Size And l.pud_file_Date = file.pud_file_Date Then
Return False
End If
Next
Return True
End Function
Public Shared Function copyProgramLIST(ByRef sourcePfad As String, ByVal destPfad As String, ignoreFilesBeginWith As String()) As Boolean
Try
If destPfad.Trim = "" Then Return False
If sourcePfad.Trim = "" Then Return False
If Not My.Computer.FileSystem.DirectoryExists(sourcePfad) Then
MsgBox("ERROR_COPY_01: Quell-Ordner existiert nicht.", MsgBoxStyle.Critical, "ERROR") : Return False
End If
If Not My.Computer.FileSystem.DirectoryExists(destPfad) Then
MsgBox("ERROR_COPY_02: Ziel-Ordner existiert nicht.", MsgBoxStyle.Critical, "ERROR") : Return False
End If
Dim LIST_SOURCE As New List(Of cProgrammeUpdate)
Dim dirNameReplace_SOURCE = ""
Dim DI_SOURCE As New IO.DirectoryInfo(sourcePfad)
RekursivGetFiles(DI_SOURCE, dirNameReplace_SOURCE, LIST_SOURCE, {})
Dim LIST_DEST As New List(Of cProgrammeUpdate)
Dim dirNameReplace_DEST = ""
Dim DI_DEST As New IO.DirectoryInfo(destPfad)
RekursivGetFiles(DI_DEST, dirNameReplace_DEST, LIST_DEST, ignoreFilesBeginWith)
If LIST_SOURCE.Count = 0 Then
MsgBox("ERROR_COPY_01: Quell-Daten existiert nicht.", MsgBoxStyle.Critical, "ERROR") : Return False
End If
If LIST_DEST.Count = 0 Then
MsgBox("ERROR_COPY_02: Ziel-Daten existiert nicht.", MsgBoxStyle.Critical, "ERROR") : Return False
End If
'ORDNER erstellen:
For Each f In LIST_SOURCE
If If(f.pud_filePathFolder, "") <> "" Then
If Not IO.Directory.Exists(dirNameReplace_DEST & "\" & f.pud_filePathFolder.Replace("\\", "\")) Then
IO.Directory.CreateDirectory(dirNameReplace_DEST & "\" & f.pud_filePathFolder.Replace("\\", "\"))
End If
End If
Next
'Löschen der unbenötigten Files:
For Each f In LIST_DEST
If isOldFile(f, LIST_SOURCE) Then
IO.File.Delete(dirNameReplace_DEST & "\" & If(f.pud_filePathFolder, "") & "\" & f.pud_fileName.Replace("\\", "\"))
End If
Next
'Kopieren/Überschreiben der neuen Files:
For Each f In LIST_SOURCE
If isNewFile(f, LIST_DEST) Then
Dim s_path = dirNameReplace_SOURCE & "\" & If(f.pud_filePathFolder, "") & "\" & f.pud_fileName.Replace("\\", "\")
Dim d_path = dirNameReplace_DEST & "\" & If(f.pud_filePathFolder, "") & "\" & f.pud_fileName.Replace("\\", "\")
IO.File.Copy(s_path, d_path)
End If
Next
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
Return False
End Try
' If isNewFile(destPfad) Then Return FileCopier(sourcePfad, destPfad)
Return True
End Function
Public Shared Function fileStartsWith(fileName As String, ignoreFilesBeginWith As String())
For Each s In ignoreFilesBeginWith
If fileName.StartsWith(s) Then Return True
Next
Return False
End Function
Public Shared Sub RekursivGetFiles(ByVal oDir As IO.DirectoryInfo, ByRef dirNameReplace As String, ByRef LIST As List(Of cProgrammeUpdate), ignoreFilesBeginWith As String())
Dim oSubDir As IO.DirectoryInfo
Dim FI As IO.FileInfo
' zunächst alle Dateien des Ordners aufspüren
For Each FI In oDir.GetFiles()
If Not fileStartsWith(FI.Name, ignoreFilesBeginWith) Then 'DATEIEN beginnen mit betimmten Namen, z.B. UPDATER
' Dim FI As New IO.FileInfo(oFile)
If dirNameReplace = "" Then
dirNameReplace = FI.DirectoryName
End If
Dim UD As New cProgrammeUpdate
UD.pud_fileName = FI.Name
UD.pud_filePathFolder = FI.DirectoryName.Replace(dirNameReplace, "")
If UD.pud_filePathFolder = "" Then UD.pud_filePathFolder = Nothing
UD.pud_file_Size = FI.Length
UD.pud_file_Date = FI.LastWriteTime
UD.pud_file_Verion = "" 'FI.
LIST.Add(UD)
End If
'With oFile
' ListBox1.Items.Add(.DirectoryName & "\" & .Name & vbTab &
' .Length & vbTab & .LastWriteTime)
'End With
Next
' Jetzt alle Unterverzeichnis durchlaufen
' und die Prozedur rekursiv selbst aufrufen
For Each oSubDir In oDir.GetDirectories()
RekursivGetFiles(oSubDir, dirNameReplace, LIST, {})
Next
End Sub
End Class
Public Class SQLVariable
Private TextSQLName As String
Private ValueSQLVALUE As Object
Private Scalarvariablename As String
Private primaryParam As Boolean
Private onlyForLoad As Boolean
Public Sub New(ByVal Text As String, ByVal Value As Object, Optional Scalarvariablename As String = "", Optional primaryParam As Boolean = False, Optional onlyForLoad As Boolean = False)
Me.TextSQLName = Text
Me.ValueSQLVALUE = Value
Me.primaryParam = primaryParam
Me.onlyForLoad = onlyForLoad
If Scalarvariablename <> "" Then Me.Scalarvariablename = Scalarvariablename Else Me.Scalarvariablename = Text
End Sub
Public ReadOnly Property Text() As String
Get
Return TextSQLName
End Get
End Property
Public ReadOnly Property Value() As Object
Get
Return ValueSQLVALUE
End Get
End Property
Public ReadOnly Property Scalarvariable() As Object
Get
Return Scalarvariablename
End Get
End Property
Public ReadOnly Property isPrimaryParam() As Boolean
Get
Return primaryParam
End Get
End Property
Public ReadOnly Property isonlyForLoad() As Boolean
Get
Return onlyForLoad
End Get
End Property
' Public Overrides Function ToString() As Object
' Return mText
' End Function
End Class