updater
This commit is contained in:
3
SDL.sln
3
SDL.sln
@@ -4,9 +4,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
VisualStudioVersion = 17.0.31825.309
|
VisualStudioVersion = 17.0.31825.309
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SDL", "SDL\SDL.vbproj", "{289BCD77-BC00-4BA1-95ED-A79176D99525}"
|
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SDL", "SDL\SDL.vbproj", "{289BCD77-BC00-4BA1-95ED-A79176D99525}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
|
||||||
{739BDC39-3580-4209-85DD-677A125618F4} = {739BDC39-3580-4209-85DD-677A125618F4}
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
EndProject
|
||||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SDLUPDATER", "SDLUPDATER\SDLUPDATER.vbproj", "{739BDC39-3580-4209-85DD-677A125618F4}"
|
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SDLUPDATER", "SDLUPDATER\SDLUPDATER.vbproj", "{739BDC39-3580-4209-85DD-677A125618F4}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|||||||
@@ -107,6 +107,7 @@
|
|||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="cProgrammeUpdate.vb" />
|
||||||
<Compile Include="UPDATERfrm.Designer.vb">
|
<Compile Include="UPDATERfrm.Designer.vb">
|
||||||
<DependentUpon>UPDATERfrm.vb</DependentUpon>
|
<DependentUpon>UPDATERfrm.vb</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -168,10 +169,6 @@
|
|||||||
<Project>{e4190547-b222-4ae3-a0be-a44eaee70335}</Project>
|
<Project>{e4190547-b222-4ae3-a0be-a44eaee70335}</Project>
|
||||||
<Name>Parkzeit</Name>
|
<Name>Parkzeit</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\VERAG_PROG_ALLGEMEIN\VERAG_PROG_ALLGEMEIN.vbproj">
|
|
||||||
<Project>{a3b497bd-842c-4a2b-b398-ed1976849df1}</Project>
|
|
||||||
<Name>VERAG_PROG_ALLGEMEIN</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
Imports VERAG_PROG_ALLGEMEIN
|
Public Class UPDATERfrm
|
||||||
Public Class UPDATERfrm
|
|
||||||
|
|
||||||
Dim CopyIncremental = True
|
Dim CopyIncremental = True
|
||||||
Private Sub UPDATERfrm_Load(sender As Object, e As EventArgs) Handles Me.Load
|
Private Sub UPDATERfrm_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||||
|
|||||||
215
SDLUPDATER/cProgrammeUpdate.vb
Normal file
215
SDLUPDATER/cProgrammeUpdate.vb
Normal 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
|
||||||
Reference in New Issue
Block a user