Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module runAPIWizard
- Public intro As Boolean = False, keynname As Boolean = False, finished As Boolean = False, input As Boolean = False
- Public curLine As Integer = 0, totalLength As Integer = 0, curPlugin As String, fullPlugin() As String, pluginName As String, pluginAsText As String
- Public Sub Introduction(line)
- End Sub
- Public Sub getLength()
- End Sub
- Public Sub nextLine()
- End Sub
- Public Sub findPlugin()
- setPlugin()
- If testPlugin() Then
- If completeIntroduction() Then
- If completeKeys() Then
- If completeInput() Then
- If completeFinish() Then
- If detectWrongCodeIntrouduction() Then
- If detectWrongCodeKeys() Then
- If detectWrongCodeInput() Then
- If detectWrongCodeFinish() Then
- If startToIntroduction() Then
- If IntroductionToKeys() Then
- Else : MsgBox("Plugin failed to load.") : Exit Sub
- End If
- Else : MsgBox("Plugin failed to load.") : Exit Sub
- End If
- Else : MsgBox("Plugin failed to load.") : Exit Sub
- End If
- Else : MsgBox("Plugin failed to load.") : Exit Sub
- End If
- Else : MsgBox("Plugin failed to load.") : Exit Sub
- End If
- Else : MsgBox("Plugin failed to load.") : Exit Sub
- End If
- Else : MsgBox("Plugin failed to load.") : Exit Sub
- End If
- Else : MsgBox("Plugin failed to load.") : Exit Sub
- End If
- Else : MsgBox("Plugin failed to load.") : Exit Sub
- End If
- Else : MsgBox("Plugin failed to load.") : Exit Sub
- End If
- Else : MsgBox("Plugin failed to load.") : Exit Sub
- End If
- End Sub
- Public Sub setPlugin()
- fullPlugin = System.IO.File.ReadAllLines(curPlugin)
- pluginAsText = System.IO.File.ReadAllText(curPlugin)
- End Sub
- Public Function testPlugin()
- If Array.Find(fullPlugin, Function(x) (x.Contains("Introduction() {"))) = "Introduction() {" Then
- If Array.Find(fullPlugin, Function(x) (x.Contains("Keys() {"))) = "Keys() {" Then
- If Array.Find(fullPlugin, Function(x) (x.Contains("Input() {"))) = "Input() {" Then
- If Array.Find(fullPlugin, Function(x) (x.Contains("Finish() {"))) = "Finish() {" Then
- Return True
- Else : consoleColor(getTime() + "API INCOMPLETE: Plugin could not find finish. PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red") : triggerColor() : Return False
- End If
- Else : consoleColor(getTime() + "API INCOMPLETE: Plugin could not find input. PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red") : triggerColor() : Return False
- End If
- Else : consoleColor(getTime() + "API INCOMPLETE: Plugin could not find keys. PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red") : triggerColor() : Return False
- End If
- Else : consoleColor(getTime() + "API INCOMPLETE: Plugin could not find introduction. PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red") : triggerColor() : Return False
- End If
- End Function
- #Region "Detect Extra Input"
- Public Function completeIntroduction()
- Dim a() = Split(pluginAsText, "Introduction() {")
- Dim b() = Split(a(1), "}")
- Dim c() = Split(b(0), vbCrLf)
- For Each ln In c
- If c.Contains("Introduction() {") Or c.Contains("Keys() {") Or c.Contains("Input() {") Or c.Contains("Finish() {") Then
- consoleColor(getTime() + "API ERROR: Plugin Contains excess of/is missing 1 or more ""}"". Probelem related to ""Introduction() {"". PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red")
- triggerColor()
- Return False
- End If
- Next
- Return True
- End Function
- Public Function completeKeys()
- Dim a() = Split(pluginAsText, "Keys() {")
- Dim b() = Split(a(1), "}")
- Dim c() = Split(b(0), vbCrLf)
- For Each ln In c
- If c.Contains("Introduction() {") Or c.Contains("Keys() {") Or c.Contains("Input() {") Or c.Contains("Finish() {") Then
- consoleColor(getTime() + "API ERROR: Plugin Contains excess of/is missing 1 or more ""}"". Probelem related to ""Keys() {"". PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red")
- triggerColor()
- Return False
- End If
- Next
- Return True
- End Function
- Public Function completeInput()
- Dim a() = Split(pluginAsText, "Input() {")
- Dim b() = Split(a(1), "}")
- Dim c() = Split(b(0), vbCrLf)
- For Each ln In c
- If c.Contains("Introduction() {") Or c.Contains("Keys() {") Or c.Contains("Input() {") Or c.Contains("Finish() {") Then
- consoleColor(getTime() + "API ERROR: Plugin Contains excess of/is missing 1 or more ""}"". Probelem related to ""Input() {"". PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red")
- triggerColor()
- Return False
- End If
- Next
- Return True
- End Function
- Public Function completeFinish()
- Dim a() = Split(pluginAsText, "Finish() {")
- Dim b() = Split(a(1), "}")
- Dim c() = Split(b(0), vbCrLf)
- For Each ln In c
- If c.Contains("Introduction() {") Or c.Contains("Keys() {") Or c.Contains("Input() {") Or c.Contains("Finish() {") Then
- consoleColor(getTime() + "API ERROR: Plugin Contains excess of/is missing 1 or more ""}"". Probelem related to ""Finish() {"". PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red")
- triggerColor()
- Return False
- End If
- Next
- Return True
- End Function
- #End Region
- #Region "Detect Wrong Code"
- Public Function detectWrongCodeIntrouduction()
- 'Possible codes
- 'use(
- 'description(
- 'name(
- 'furtherInfo(
- 'type(
- 'listLength(
- Dim d() As String, i As Integer = 0, e As String = ""
- Dim a() As String = Split(pluginAsText, "Introduction() {")
- Dim b() As String = Split(a(1), "}")
- Dim c() As String = Split(b(0), vbCrLf)
- For Each ln In c
- If i = 0 Then
- i += 1
- Else
- i += 1
- Try
- d = Split(ln, " use(")
- e = d(1)
- Catch ex As Exception
- Try
- d = Split(ln, " description(")
- e = d(1)
- Catch ex1 As Exception
- Try
- d = Split(ln, " name(")
- e = d(1)
- Catch ex2 As Exception
- Try
- d = Split(ln, " furtherInfo(")
- e = d(1)
- Catch ex3 As Exception
- Try
- d = Split(ln, " type(")
- e = d(1)
- Catch ex4 As Exception
- Try
- d = Split(ln, " listLength(")
- e = d(1)
- Catch ex5 As Exception
- If Not ln = "" Then
- consoleColor(getTime() + "API UNEXPECT CODE: Plugin found ambiguous code under Introudction. PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red") : triggerColor()
- Return False
- End If
- End Try
- End Try
- End Try
- End Try
- End Try
- End Try
- End If
- Next
- Return True
- End Function
- Public Function detectWrongCodeKeys()
- 'Possible codes
- 'getKey(
- 'setKey(
- 'getName(
- 'setName(
- Dim d() As String, i As Integer = 0, e As String = ""
- Dim a() As String = Split(pluginAsText, "Keys() {")
- Dim b() As String = Split(a(1), "}")
- Dim c() As String = Split(b(0), vbCrLf)
- For Each ln In c
- If i = 0 Then
- i += 1
- Else
- i += 1
- Try
- d = Split(ln, "getKey(")
- e = d(1)
- Catch ex As Exception
- Try
- d = Split(ln, "setKey(")
- e = d(1)
- Catch ex1 As Exception
- Try
- d = Split(ln, "getName(")
- e = d(1)
- Catch ex2 As Exception
- Try
- d = Split(ln, "setName(")
- e = d(1)
- Catch ex3 As Exception
- If Not ln = "" Then
- consoleColor(getTime() + "API UNEXPECT CODE: Plugin found ambiguous code under Keys. PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red") : triggerColor()
- Return False
- End If
- End Try
- End Try
- End Try
- End Try
- End If
- Next
- Return True
- End Function
- Public Function detectWrongCodeInput()
- 'Possible codes
- 'startRepeat(
- 'endRepeat(
- 'getInput(
- 'setInput(
- Dim d() As String, i As Integer = 0, e As String = ""
- Dim a() As String = Split(pluginAsText, "Input() {")
- Dim b() As String = Split(a(1), "}")
- Dim c() As String = Split(b(0), vbCrLf)
- For Each ln In c
- If i = 0 Then
- i += 1
- Else
- i += 1
- Try
- d = Split(ln, "startRepeat(")
- e = d(1)
- Catch ex As Exception
- Try
- d = Split(ln, "endRepeat(")
- e = d(1)
- Catch ex1 As Exception
- Try
- d = Split(ln, "getInput(")
- e = d(1)
- Catch ex2 As Exception
- Try
- d = Split(ln, "setInput(")
- e = d(1)
- Catch ex3 As Exception
- If Not ln = "" Then
- consoleColor(getTime() + "API UNEXPECT CODE: Plugin found ambiguous code under Input. PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red") : triggerColor()
- Return False
- End If
- End Try
- End Try
- End Try
- End Try
- End If
- Next
- Return True
- End Function
- Public Function detectWrongCodeFinish()
- 'Possible codes
- 'setOutput(
- Dim d() As String, i As Integer = 0, e As String = ""
- Dim a() As String = Split(pluginAsText, "Finish() {")
- Dim b() As String = Split(a(1), "}")
- Dim c() As String = Split(b(0), vbCrLf)
- For Each ln In c
- If i = 0 Then
- i += 1
- Else
- i += 1
- Try
- d = Split(ln, "setOutput(")
- e = d(1)
- Catch ex As Exception
- If Not ln = "" Then
- consoleColor(getTime() + "API UNEXPECT CODE: Plugin found ambiguous code under Finish. PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red") : triggerColor()
- Return False
- End If
- End Try
- End If
- Next
- Return True
- End Function
- #End Region
- Public Function startToIntroduction()
- Dim a As String() = Split(pluginAsText, "Introduction() {")
- Dim b As String() = Split(a(0), vbCrLf)
- For Each ln In b
- If Not ln = "" Then
- consoleColor(getTime() + "API BAD CODE: Plugin found code in a wrong place before ""Introduction"". PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red")
- triggerColor()
- Return False
- End If
- Next
- Return True
- End Function
- Public Function IntroductionToKeys()
- Dim a As String() = Split(pluginAsText, "Introduction() {")
- Dim b As String() = Split(a(1), "Keys() {")
- Dim c As String() = Split(b(0), "}")
- Dim d As String() = Split(c(1), vbCrLf)
- If c.Length > 2 Then
- consoleColor(getTime() + "API BAD CODE: Found multiple ""}"" between ""Introduction"" and ""Keys"". PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red")
- triggerColor()
- Return False
- End If
- For Each ln In d
- If Not ln = "" Then
- consoleColor(getTime() + "API BAD CODE: Plugin found code in a wrong place after ""Introduction"" but before ""Keys"". PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red")
- triggerColor()
- Return False
- End If
- Next
- Return True
- End Function
- Public Sub KeysToInput()
- End Sub
- Public Sub InputToFinish()
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement