You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
4.3 KiB

Public Class Form1
Dim cdb As New DB_Connection
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
If OpenFileDialog1.FileName <> "" Then Me.TextBox1.Text = Me.OpenFileDialog1.FileName
End Sub
Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.CheckedChanged
If Me.RadioButton1.Checked Then
Me.TextBox1.Text = ""
Me.TextBox1.Enabled = False
Me.Button1.Enabled = False
Else
Me.TextBox1.Enabled = True
Me.Button1.Enabled = True
End If
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
FileOpen(1, Globals.Paramdatei, OpenMode.Input)
Input(1, Globals.Applicationdata)
FileClose(1)
Dim words() As String
Dim s As String
ListBox1.Items.Clear()
ListBox2.Items.Clear()
FileOpen(1, Globals.Applicationdata + "\Params.txt", OpenMode.Input)
While Not EOF(1)
Input(1, s)
words = s.Split(":")
Select Case words(0)
Case "EXE-Datei"
Me.TextBox1.Text = words(1)
If Me.TextBox1.Text <> "" Then
Me.RadioButton2.Checked = True
Me.RadioButton1.Checked = False
End If
Case "Partnernr"
Me.TextBox2.Text = words(1)
Case "Berater"
Me.TextBox3.Text = words(1)
End Select
End While
FileClose(1)
OpenFileDialog1.Filter = "Exe-Dateien (*.exe)|*.exe|Alle Dateien (*.*)|*.*"
FileOpen(1, Globals.Applicationdata + "\edkdateien.txt", OpenMode.Input)
While Not EOF(1)
Input(1, s)
words = s.Split(";")
ListBox1.Items.Add(words(0))
ListBox2.Items.Add(words(1))
End While
FileClose(1)
End Sub
Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
Me.ListBox2.SelectedIndex = Me.ListBox1.SelectedIndex
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Replace_Text()
'FileCopy(ListBox2.SelectedItem, Application.StartupPath + "\tmpedk.edk")
Dim p As New Process
If Me.RadioButton1.Checked Then
p.StartInfo.FileName = Globals.Applicationdata + "\tmpedk.edk"
Else
p.StartInfo.FileName = Me.TextBox1.Text
p.StartInfo.Arguments = Globals.Applicationdata + "\tmpedk.edk"
End If
p.Start()
End Sub
Private Sub ListBox1_DoubleClick(sender As Object, e As EventArgs) Handles ListBox1.DoubleClick
Me.ListBox2.SelectedIndex = Me.ListBox1.SelectedIndex
Button2_Click(sender, e)
End Sub
Sub Replace_Text()
Dim myStreamReaderL1 As System.IO.StreamReader
Dim myStream As System.IO.StreamWriter
Dim myStr As String
If Trim(Me.txtedkdatei.Text) <> "" Then
myStreamReaderL1 = System.IO.File.OpenText(Me.txtedkdatei.Text)
Else
myStreamReaderL1 = System.IO.File.OpenText(ListBox2.SelectedItem)
End If
myStr = myStreamReaderL1.ReadToEnd()
myStreamReaderL1.Close()
If Me.TextBox2.Text <> "" Then
myStr = myStr.Replace("<PartnerNr>????????</PartnerNr>", "<PartnerNr>" + Trim(Me.TextBox2.Text) + "</PartnerNr>")
End If
If Me.TextBox2.Text <> "" Then
myStr = myStr.Replace("<creatorTg>??????</creatorTg>", "<creatorTg>" + Trim(Me.TextBox3.Text) + "</creatorTg>")
End If
myStream = System.IO.File.CreateText(Globals.Applicationdata + "\tmpedk.edk")
myStream.WriteLine(myStr)
myStream.Close()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
OpenFileDialog1.FileName = ""
OpenFileDialog1.Filter = "EDK-Dateien|*.edk|Alle Dateien (*.*)|*.*"
OpenFileDialog1.FilterIndex = 1
OpenFileDialog1.ShowDialog()
If OpenFileDialog1.FileName <> "" Then Me.txtedkdatei.Text = Me.OpenFileDialog1.FileName
End Sub
End Class