-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodBasicFunction.vb
145 lines (132 loc) · 5.21 KB
/
modBasicFunction.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
Imports System.Text
Imports System.Security.Cryptography
Imports System.IO
Imports System.Net
Module modBasicFunction
Private iAnzahlMandantenSettings As Integer = 10
Public bAbbruch As Boolean = False
Public txtShopURL As String = "" 'My.Settings.shop_abmelden_url(My.Settings.mandant_position)
Public gbl_tor_pid As Integer = 0
Public gbl_privoxy_pid As Integer = 0
Public strHTTPDataStore As String = ""
Public col As Integer = 0
'###################################################################
'# >> Fenstertitel anzeigen
'###################################################################
Public Function setMainWindowTitle(ByVal strFormularName As String, ByVal frmForm As Form) As Boolean
Try
If strFormularName.Length > 0 Then
frmForm.Text = "JTL2Shopste - " & strFormularName & " - Mandant: " & My.Settings.mandant_letzter_name & " v." & strVersionsNummer
Else
frmForm.Text = "JTL2Shopste - Mandant: " & My.Settings.mandant_letzter_name & " v." & strVersionsNummer
End If
Return True
Catch ex As Exception
MessageBox.Show("Fehler: " & ex.Message, "setMainWindowTitle", MessageBoxButtons.OK)
Return False
End Try
End Function
Function TorStarup() As Boolean
Dim p = New Process()
Dim bStarted As Boolean = False
p.StartInfo.FileName = Application.StartupPath & "\Tor\tor.exe"
p.StartInfo.Arguments = " -f .\torrc-defaults -controlport 9051 -hashedcontrolpassword 16:6C5A0892C58419E160285695991BEDD067449F845E14735A6FBAB0829B"
p.StartInfo.WorkingDirectory = Application.StartupPath & "\Tor\"
bStarted = p.Start()
Try
gbl_tor_pid = p.Id
bStarted = True
Catch ex As Exception
bStarted = False
End Try
Return bStarted
End Function
Function PrivoxyStarup() As Boolean
Dim p = New Process()
Dim bStarted As Boolean = False
p.StartInfo.FileName = Application.StartupPath & "\Privoxy\privoxyStart.bat"
p.StartInfo.WorkingDirectory = Application.StartupPath & "\Privoxy\"
' p.StartInfo.Arguments = " config.txt"
bStarted = p.Start()
Try
gbl_privoxy_pid = p.Id
bStarted = True
Catch ex As Exception
bStarted = False
End Try
Return bStarted
End Function
Function setKillbyPID(pid As Integer) As Boolean
Try
Dim aProcess As System.Diagnostics.Process
aProcess = System.Diagnostics.Process.GetProcessById(pid)
aProcess.Kill()
Return True
Catch ex As Exception
MessageBox.Show(ex.Message)
Return False
End Try
End Function
'#######################################################
'# Prozess suchen
'#######################################################
Function getProzessIDbySearch(strProzessName As String) As Integer
Dim arrProcList() As Process
Dim STATUS As Integer
STATUS = 0
arrProcList = Process.GetProcesses
Dim PID As Integer = 0
For i As Integer = 0 To arrProcList.Length - 1
If STATUS = 0 Then
If arrProcList(i).ProcessName = strProzessName Then
STATUS = 1
PID = arrProcList(i).Id
End If
Else
'lblRunning.Text = "Running!"
'lblRunning.ForeColor = Color.Red
End If
Next
If STATUS = 1 Then
Return PID
Else
If STATUS = 0 Then
Return -1
End If
End If
End Function
Public Function setGUIModus() As Boolean
If My.Settings.chkTranslate_funktionsattribute_only = True Then
'frmMain.btnArtikelTranslate.Visible = False
If My.Settings.chkTranslate_funktionsattribute_alleSprachen = True Then
frmMain.btnÜbertrage.Text = "Alle Funktionsattribute übersetzen"
Else
frmMain.btnÜbertrage.Text = "Funktionsattribute übersetzen"
End If
Dim sSize As New Size
sSize.Width = 300
sSize.Height = 25
frmMain.btnÜbertrage.Size = sSize
Else
If My.Settings.chkTranslate_normal_alleSprachen = True Then
'frmMain.btnArtikelTranslate.Text = "In alle Sprachen übersetzen"
Dim sSize2 As New Size
sSize2.Width = 300
sSize2.Height = 25
'frmMain.btnArtikelTranslate.Size = sSize2
Else
'frmMain.btnArtikelTranslate.Text = "Artikel übersetzen"
Dim sSize2 As New Size
sSize2.Width = 193
sSize2.Height = 25
' frmMain.btnArtikelTranslate.Size = sSize2
End If
' frmMain.btnArtikelTranslate.Visible = True
'frmMain.btnÜbertrage.Text = "Fehlende Übersetzungen"
Dim sSize As New Size
sSize.Width = 193
sSize.Height = 25
frmMain.btnÜbertrage.Size = sSize
End If
End Function
End Module