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

@@ -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