From 7b64f9ea6b534ec7a1b6d89773ecb32f066d71b5 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Tue, 30 Aug 2016 09:01:45 +0200
Subject: [PATCH] removed some unused code in Vecto (2.2/GUI)

---
 VECTO/GUI/F_ENG.vb             |  12 --
 VECTO/GUI/F_JIRA.vb            |   5 -
 VECTO/GUI/F_MAINForm.vb        |  25 -----
 VECTO/GUI/F_VECTO.vb           |   4 -
 VECTO/GUI/F_VEH.vb             |   5 -
 VECTO/GUI/GearboxGearDialog.vb |   6 -
 VECTO/Input Files/cVEH.vb      |   1 -
 VECTO/cJSONparser.vb           | 200 ---------------------------------
 VECTO/cRegression.vb           |  12 +-
 9 files changed, 5 insertions(+), 265 deletions(-)

diff --git a/VECTO/GUI/F_ENG.vb b/VECTO/GUI/F_ENG.vb
index 46e6fab3f7..963279e7ab 100644
--- a/VECTO/GUI/F_ENG.vb
+++ b/VECTO/GUI/F_ENG.vb
@@ -278,10 +278,6 @@ Public Class F_ENG
 		Change()
 	End Sub
 
-	Private Sub TbPnenn_TextChanged(sender As System.Object, e As System.EventArgs)
-		Change()
-	End Sub
-
 	Private Sub TbDispl_TextChanged(sender As System.Object, e As System.EventArgs) Handles TbDispl.TextChanged
 		Change()
 		DeclInit()
@@ -296,10 +292,6 @@ Public Class F_ENG
 		Change()
 	End Sub
 
-	Private Sub TbNnenn_TextChanged(sender As System.Object, e As System.EventArgs)
-		Change()
-	End Sub
-
 	Private Sub TbMAP_TextChanged(sender As System.Object, e As System.EventArgs) _
 		Handles TbMAP.TextChanged, TbFLD.TextChanged
 		UpdatePic()
@@ -318,10 +310,6 @@ Public Class F_ENG
 		Change()
 	End Sub
 
-	Private Sub LvFLDs_SelectedIndexChanged(sender As System.Object, e As System.EventArgs)
-		UpdatePic()
-	End Sub
-
 
 #End Region
 
diff --git a/VECTO/GUI/F_JIRA.vb b/VECTO/GUI/F_JIRA.vb
index 3bc92cb622..5094fe39c3 100644
--- a/VECTO/GUI/F_JIRA.vb
+++ b/VECTO/GUI/F_JIRA.vb
@@ -5,11 +5,6 @@ Public Class F_JIRA
     Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
         Me.DialogResult = System.Windows.Forms.DialogResult.OK
         Me.Close()
-    End Sub
-
-	Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
-		Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
-		Me.Close()
 	End Sub
 
 	Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
diff --git a/VECTO/GUI/F_MAINForm.vb b/VECTO/GUI/F_MAINForm.vb
index e2ff97de1e..56b571efb5 100644
--- a/VECTO/GUI/F_MAINForm.vb
+++ b/VECTO/GUI/F_MAINForm.vb
@@ -61,9 +61,6 @@ Public Class F_MAINForm
 	Private ConMenTarget As ListView
 	Private ConMenTarJob As Boolean
 
-	Private MODpath As String
-	Private MODVehList As Int32()
-
 	Private CycleTabPage As TabPage
 	Private CycleTabPageVisible As Boolean
 
@@ -128,7 +125,6 @@ Public Class F_MAINForm
 		fbVEH = New cFileBrowser("vveh")
 		fbMAP = New cFileBrowser("vmap")
 		fbDRI = New cFileBrowser("vdri")
-		fbFLD = New cFileBrowser("vfld")
 		fbENG = New cFileBrowser("veng")
 		fbGBX = New cFileBrowser("vgbx")
 		fbACC = New cFileBrowser("vacc")
@@ -1496,27 +1492,6 @@ lbFound:
 #End Region
 
 	'VECTO Start button - Calls VECTO_Launcher or aborts calculation
-	Private Sub Button1_Click(sender As Object, e As EventArgs)
-
-		'VECTO Start/Stop
-		If VECTOworker.IsBusy Then
-
-			'If VECTO already running: STOP
-			ComLineShutDown = False
-			JobAbort()
-
-		Else
-
-			'...Otherwise: START
-
-			'Save Lists if Crash
-			SaveFileLists()
-
-			'Start
-			VECTO_Launcher()
-
-		End If
-	End Sub
 
 	Private Sub btStartV3_Click(sender As Object, e As EventArgs) Handles btStartV3.Click
 		If Not VECTOworkerV3.IsBusy Then
diff --git a/VECTO/GUI/F_VECTO.vb b/VECTO/GUI/F_VECTO.vb
index a12f91b237..773946ca64 100644
--- a/VECTO/GUI/F_VECTO.vb
+++ b/VECTO/GUI/F_VECTO.vb
@@ -698,10 +698,6 @@ Public Class F_VECTO
 		Change()
 	End Sub
 
-	Private Sub TbAlookahead_TextChanged(sender As Object, e As EventArgs)
-		Change()
-	End Sub
-
 	Private Sub LvCycles_AfterLabelEdit(sender As Object, e As LabelEditEventArgs) _
 		Handles LvCycles.AfterLabelEdit
 		Change()
diff --git a/VECTO/GUI/F_VEH.vb b/VECTO/GUI/F_VEH.vb
index 54eee8866b..341a85eab0 100644
--- a/VECTO/GUI/F_VEH.vb
+++ b/VECTO/GUI/F_VEH.vb
@@ -543,11 +543,6 @@ Public Class F_VEH
 		Change()
 	End Sub
 
-	Private Sub CbRim_SelectedIndexChanged(sender As Object, e As EventArgs)
-		Change()
-		DeclInit()
-	End Sub
-
 	Private Sub TBcw_TextChanged(sender As Object, e As EventArgs) _
 		Handles TbLoad.TextChanged, TBrdyn.TextChanged, TBcdA.TextChanged, TbCdFile.TextChanged, TbRtRatio.TextChanged,
 				cbAngularGearType.SelectedIndexChanged, TbRtPath.TextChanged, tbAngularGearLossMapPath.TextChanged,
diff --git a/VECTO/GUI/GearboxGearDialog.vb b/VECTO/GUI/GearboxGearDialog.vb
index 3fc3a37ce5..df1841fa57 100644
--- a/VECTO/GUI/GearboxGearDialog.vb
+++ b/VECTO/GUI/GearboxGearDialog.vb
@@ -88,12 +88,6 @@ Public Class GearboxGearDialog
 		End If
 	End Sub
 
-	Private Sub BtBrowseFld_Click(sender As Object, e As EventArgs)
-		If fbFLD.OpenDialog(fFileRepl(TbMaxTorque.Text, GbxPath)) Then
-			TbMaxTorque.Text = fFileWoDir(fbFLD.Files(0), GbxPath)
-		End If
-	End Sub
-
 	Private Sub Button1_Click(sender As Object, e As EventArgs) Handles BtPrevious.Click
 		If Not IsNumeric(TbRatio.Text) Then
 			MsgBox("Gear ratio is invalid!")
diff --git a/VECTO/Input Files/cVEH.vb b/VECTO/Input Files/cVEH.vb
index 4c5f57f8f2..8308bdbdf4 100644
--- a/VECTO/Input Files/cVEH.vb	
+++ b/VECTO/Input Files/cVEH.vb	
@@ -42,7 +42,6 @@ Public Class cVEH
 	Public RtType As tRtType '0=None, 1=Primary, 2=Secondary
 	Public RtRatio As Single = 0
 	Public RtFile As cSubPath
-	Private RtDim As Integer
 	Private RtnU As List(Of Single)
 	Private RtM As List(Of Single)
 
diff --git a/VECTO/cJSONparser.vb b/VECTO/cJSONparser.vb
index e9c5fa55eb..6d4b57a11a 100644
--- a/VECTO/cJSONparser.vb
+++ b/VECTO/cJSONparser.vb
@@ -102,89 +102,6 @@ Public Class JSON
 
 	Private fullfile As String
 
-	Private Function ReadFileXXX(path As String) As Boolean
-		Dim file As TextFieldParser
-
-		Content.Clear()
-
-		'check if file exists
-		If Not IO.File.Exists(path) Then Return False
-
-		'open file
-		Try
-			file = New TextFieldParser(path)
-		Catch ex As Exception
-			Return False
-		End Try
-
-		'Check if file is empty
-		If file.EndOfData Then
-			file.Close()
-			Return False
-		End If
-
-		'read file
-		fullfile = file.ReadToEnd
-
-		'close file
-		file.Close()
-
-		'trim spaces
-		fullfile = fullfile.Trim
-
-		'remove line breaks
-		fullfile = fullfile.Replace(vbCrLf, "")
-
-		If Left(fullfile, 1) <> "{" Or Right(fullfile, 1) <> "}" Then Return False
-
-		'parse JSON to Dictionary
-		Try
-			Content = GetObject()
-		Catch ex As Exception
-			Return False
-		End Try
-
-
-		Return True
-	End Function
-
-
-	Private Function WriteFileXXX(path As String) As Boolean
-		Dim file As StreamWriter
-		Dim kv As KeyValuePair(Of String, Object)
-		Dim str As New StringBuilder
-		Dim First As Boolean = True
-
-		If Content.Count = 0 Then Return False
-
-		Try
-			str.AppendLine("{")
-			For Each kv In Content
-				If First Then
-					First = False
-				Else
-					str.AppendLine(",")
-				End If
-				str.Append(GetKeyValString(1, kv))
-			Next
-			str.AppendLine()
-			str.AppendLine("}")
-		Catch ex As Exception
-			Return False
-		End Try
-
-		Try
-			file = My.Computer.FileSystem.OpenTextFileWriter(path, False)
-		Catch ex As Exception
-			Return False
-		End Try
-
-		file.Write(str.ToString)
-
-		file.Close()
-
-		Return True
-	End Function
 
 	Private Function GetKeyValString(TabLvl As Integer, ByRef kv As KeyValuePair(Of String, Object)) As String
 		Dim str As New StringBuilder
@@ -301,123 +218,6 @@ Public Class JSON
 		Return str
 	End Function
 
-	Private Function GetObject() As Dictionary(Of String, Object)
-		Dim MyDic As Dictionary(Of String, Object)
-		Dim key As String
-		Dim obj As Object
-		Dim i As Integer
-		Dim i2 As Integer
-		Dim Valstr As String
-		Dim ValList As List(Of Object) = Nothing
-		Dim ArrayMode As Boolean = False
-
-		'remove {
-		fullfile = (Right(fullfile, Len(fullfile) - 1)).Trim
-
-		'new list of key/value pairs
-		MyDic = New Dictionary(Of String, Object)
-
-
-		'loop through key/value pairs
-lb10:
-		If Left(fullfile, 1) <> ChrW(34) Then
-			Throw New Exception
-			Return Nothing
-		End If
-
-		'get key
-		i = fullfile.IndexOf(ChrW(34), 1)
-		key = Mid(fullfile, 2, i - 1)
-		fullfile = (Right(fullfile, Len(fullfile) - i - 1)).Trim
-		fullfile = (Right(fullfile, Len(fullfile) - 1)).Trim
-
-		If key = "" Then
-			Throw New Exception
-			Return Nothing
-		End If
-
-		'get value (object, number, boolean, array)
-		If Left(fullfile, 1) = "[" Then
-			ArrayMode = True
-			fullfile = (Right(fullfile, Len(fullfile) - 1)).Trim
-			ValList = New List(Of Object)
-		End If
-
-lb20:
-		If Left(fullfile, 1) = "{" Then
-			obj = GetObject()
-		Else
-			If Left(fullfile, 1) = ChrW(34) Then
-				'string
-				i = fullfile.IndexOf(ChrW(34), 1)
-				obj = Mid(fullfile, 2, i - 1)
-				fullfile = (Right(fullfile, Len(fullfile) - i - 1)).Trim
-			Else
-				'number/boolean
-				i = fullfile.IndexOf(",", 1)
-				i2 = fullfile.IndexOf("}", 1)
-
-				If i = -1 Then
-					If i2 = -1 Then
-						Valstr = Right(fullfile, Len(fullfile) - 1)
-						fullfile = ""
-					Else
-						Valstr = Mid(fullfile, 1, i2)
-						fullfile = (Right(fullfile, Len(fullfile) - i2)).Trim
-					End If
-				Else
-					If i2 = -1 Or i < i2 Then
-						Valstr = Mid(fullfile, 1, i)
-						fullfile = (Right(fullfile, Len(fullfile) - i)).Trim
-					Else
-						Valstr = Mid(fullfile, 1, i2)
-						fullfile = (Right(fullfile, Len(fullfile) - i2)).Trim
-					End If
-				End If
-
-				If IsNumeric(Valstr) Then
-					obj = CDbl(Valstr)
-				ElseIf (UCase(Valstr)).Trim = "FALSE" Then
-					obj = False
-				ElseIf (UCase(Valstr)).Trim = "TRUE" Then
-					obj = True
-				ElseIf (UCase(Valstr)).Trim = "NULL" Then
-					obj = Nothing
-				Else
-					Throw New Exception
-					Return Nothing
-				End If
-
-			End If
-		End If
-
-		If ArrayMode Then
-			ValList.Add(obj)
-			If Left(fullfile, 1) = "]" Then
-				ArrayMode = False
-				fullfile = (Right(fullfile, Len(fullfile) - 1)).Trim
-				MyDic.Add(key, ValList)
-			End If
-		Else
-			MyDic.Add(key, obj)
-		End If
-
-		If Left(fullfile, 1) = "," Then
-			fullfile = (Right(fullfile, Len(fullfile) - 1)).Trim
-			If ArrayMode Then
-				GoTo lb20
-			Else
-				GoTo lb10
-			End If
-		End If
-
-		If Left(fullfile, 1) = "}" Then
-			fullfile = (Right(fullfile, Len(fullfile) - 1)).Trim
-		End If
-
-		Return MyDic
-	End Function
-
 
 #End Region
 End Class
diff --git a/VECTO/cRegression.vb b/VECTO/cRegression.vb
index 61241b661f..b48141723f 100644
--- a/VECTO/cRegression.vb
+++ b/VECTO/cRegression.vb
@@ -40,17 +40,15 @@ Public Class cRegression
 
         Public PearsonsR As Double
 
-        Public t As Double
+		Public t As Double
 
-        Dim Residuals As ArrayList = New ArrayList
+		Public Overrides Function ToString() As String
 
-        Public Overrides Function ToString() As String
+			Dim ret As String = "SampleSize=" & Me.SampleSize & vbCrLf & "StandardError=" & Me.StandardError & vbCrLf & "y=" & Me.a & " + " & Me.b & "x"
 
-            Dim ret As String = "SampleSize=" & Me.SampleSize & vbCrLf & "StandardError=" & Me.StandardError & vbCrLf & "y=" & Me.a & " + " & Me.b & "x"
+			Return ret
 
-            Return ret
-
-        End Function
+		End Function
 
     End Class
 
-- 
GitLab