Advertisement
agentsix1

Code Update

Apr 29th, 2015 (edited)
2,445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 14.48 KB | None | 0 0
  1. Module runAPIWizard
  2.     Public intro As Boolean = False, keynname As Boolean = False, finished As Boolean = False, input As Boolean = False
  3.     Public curLine As Integer = 0, totalLength As Integer = 0, curPlugin As String, fullPlugin() As String, pluginName As String, pluginAsText As String
  4.     Public Sub Introduction(line)
  5.  
  6.     End Sub
  7.  
  8.     Public Sub getLength()
  9.  
  10.     End Sub
  11.  
  12.     Public Sub nextLine()
  13.  
  14.     End Sub
  15.  
  16.     Public Sub findPlugin()
  17.         setPlugin()
  18.         If testPlugin() Then
  19.             If completeIntroduction() Then
  20.                 If completeKeys() Then
  21.                     If completeInput() Then
  22.                         If completeFinish() Then
  23.                             If detectWrongCodeIntrouduction() Then
  24.                                 If detectWrongCodeKeys() Then
  25.                                     If detectWrongCodeInput() Then
  26.                                         If detectWrongCodeFinish() Then
  27.                                             If startToIntroduction() Then
  28.                                                 If IntroductionToKeys() Then
  29.  
  30.                                                 Else : MsgBox("Plugin failed to load.") : Exit Sub
  31.                                                 End If
  32.                                             Else : MsgBox("Plugin failed to load.") : Exit Sub
  33.                                             End If
  34.                                         Else : MsgBox("Plugin failed to load.") : Exit Sub
  35.                                         End If
  36.                                     Else : MsgBox("Plugin failed to load.") : Exit Sub
  37.                                     End If
  38.                                 Else : MsgBox("Plugin failed to load.") : Exit Sub
  39.                                 End If
  40.                             Else : MsgBox("Plugin failed to load.") : Exit Sub
  41.                             End If
  42.                         Else : MsgBox("Plugin failed to load.") : Exit Sub
  43.                         End If
  44.                     Else : MsgBox("Plugin failed to load.") : Exit Sub
  45.                     End If
  46.                 Else : MsgBox("Plugin failed to load.") : Exit Sub
  47.                 End If
  48.             Else : MsgBox("Plugin failed to load.") : Exit Sub
  49.             End If
  50.         Else : MsgBox("Plugin failed to load.") : Exit Sub
  51.         End If
  52.  
  53.     End Sub
  54.  
  55.     Public Sub setPlugin()
  56.         fullPlugin = System.IO.File.ReadAllLines(curPlugin)
  57.         pluginAsText = System.IO.File.ReadAllText(curPlugin)
  58.     End Sub
  59.  
  60.     Public Function testPlugin()
  61.         If Array.Find(fullPlugin, Function(x) (x.Contains("Introduction() {"))) = "Introduction() {" Then
  62.             If Array.Find(fullPlugin, Function(x) (x.Contains("Keys() {"))) = "Keys() {" Then
  63.                 If Array.Find(fullPlugin, Function(x) (x.Contains("Input() {"))) = "Input() {" Then
  64.                     If Array.Find(fullPlugin, Function(x) (x.Contains("Finish() {"))) = "Finish() {" Then
  65.                         Return True
  66.                     Else : consoleColor(getTime() + "API INCOMPLETE: Plugin could not find finish. PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red") : triggerColor() : Return False
  67.                     End If
  68.                 Else : consoleColor(getTime() + "API INCOMPLETE: Plugin could not find input. PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red") : triggerColor() : Return False
  69.                 End If
  70.             Else : consoleColor(getTime() + "API INCOMPLETE: Plugin could not find keys. PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red") : triggerColor() : Return False
  71.             End If
  72.         Else : consoleColor(getTime() + "API INCOMPLETE: Plugin could not find introduction. PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red") : triggerColor() : Return False
  73.         End If
  74.     End Function
  75.  
  76. #Region "Detect Extra Input"
  77.     Public Function completeIntroduction()
  78.         Dim a() = Split(pluginAsText, "Introduction() {")
  79.         Dim b() = Split(a(1), "}")
  80.         Dim c() = Split(b(0), vbCrLf)
  81.         For Each ln In c
  82.             If c.Contains("Introduction() {") Or c.Contains("Keys() {") Or c.Contains("Input() {") Or c.Contains("Finish() {") Then
  83.                 consoleColor(getTime() + "API ERROR: Plugin Contains excess of/is missing 1 or more ""}"". Probelem related to ""Introduction() {"". PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red")
  84.                 triggerColor()
  85.                 Return False
  86.             End If
  87.         Next
  88.         Return True
  89.     End Function
  90.  
  91.     Public Function completeKeys()
  92.         Dim a() = Split(pluginAsText, "Keys() {")
  93.         Dim b() = Split(a(1), "}")
  94.         Dim c() = Split(b(0), vbCrLf)
  95.         For Each ln In c
  96.             If c.Contains("Introduction() {") Or c.Contains("Keys() {") Or c.Contains("Input() {") Or c.Contains("Finish() {") Then
  97.                 consoleColor(getTime() + "API ERROR: Plugin Contains excess of/is missing 1 or more ""}"". Probelem related to ""Keys() {"". PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red")
  98.                 triggerColor()
  99.                 Return False
  100.             End If
  101.         Next
  102.         Return True
  103.     End Function
  104.  
  105.     Public Function completeInput()
  106.         Dim a() = Split(pluginAsText, "Input() {")
  107.         Dim b() = Split(a(1), "}")
  108.         Dim c() = Split(b(0), vbCrLf)
  109.         For Each ln In c
  110.             If c.Contains("Introduction() {") Or c.Contains("Keys() {") Or c.Contains("Input() {") Or c.Contains("Finish() {") Then
  111.                 consoleColor(getTime() + "API ERROR: Plugin Contains excess of/is missing 1 or more ""}"". Probelem related to ""Input() {"". PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red")
  112.                 triggerColor()
  113.                 Return False
  114.             End If
  115.         Next
  116.         Return True
  117.     End Function
  118.  
  119.     Public Function completeFinish()
  120.         Dim a() = Split(pluginAsText, "Finish() {")
  121.         Dim b() = Split(a(1), "}")
  122.         Dim c() = Split(b(0), vbCrLf)
  123.         For Each ln In c
  124.             If c.Contains("Introduction() {") Or c.Contains("Keys() {") Or c.Contains("Input() {") Or c.Contains("Finish() {") Then
  125.                 consoleColor(getTime() + "API ERROR: Plugin Contains excess of/is missing 1 or more ""}"". Probelem related to ""Finish() {"". PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red")
  126.                 triggerColor()
  127.                 Return False
  128.             End If
  129.         Next
  130.         Return True
  131.     End Function
  132. #End Region
  133.  
  134. #Region "Detect Wrong Code"
  135.     Public Function detectWrongCodeIntrouduction()
  136.         'Possible codes
  137.         'use(
  138.         'description(
  139.         'name(
  140.         'furtherInfo(
  141.         'type(
  142.         'listLength(
  143.         Dim d() As String, i As Integer = 0, e As String = ""
  144.         Dim a() As String = Split(pluginAsText, "Introduction() {")
  145.         Dim b() As String = Split(a(1), "}")
  146.         Dim c() As String = Split(b(0), vbCrLf)
  147.         For Each ln In c
  148.             If i = 0 Then
  149.                 i += 1
  150.             Else
  151.                 i += 1
  152.                 Try
  153.                     d = Split(ln, " use(")
  154.                     e = d(1)
  155.                 Catch ex As Exception
  156.                     Try
  157.                         d = Split(ln, " description(")
  158.                         e = d(1)
  159.                     Catch ex1 As Exception
  160.                         Try
  161.                             d = Split(ln, " name(")
  162.                             e = d(1)
  163.                         Catch ex2 As Exception
  164.                             Try
  165.                                 d = Split(ln, " furtherInfo(")
  166.                                 e = d(1)
  167.                             Catch ex3 As Exception
  168.                                 Try
  169.                                     d = Split(ln, " type(")
  170.                                     e = d(1)
  171.                                 Catch ex4 As Exception
  172.                                     Try
  173.                                         d = Split(ln, " listLength(")
  174.                                         e = d(1)
  175.                                     Catch ex5 As Exception
  176.                                         If Not ln = "" Then
  177.                                             consoleColor(getTime() + "API UNEXPECT CODE: Plugin found ambiguous code under Introudction. PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red") : triggerColor()
  178.                                             Return False
  179.                                         End If
  180.                                     End Try
  181.                                 End Try
  182.                             End Try
  183.                         End Try
  184.                     End Try
  185.                 End Try
  186.             End If
  187.         Next
  188.         Return True
  189.     End Function
  190.  
  191.     Public Function detectWrongCodeKeys()
  192.         'Possible codes
  193.         'getKey(
  194.         'setKey(
  195.         'getName(
  196.         'setName(
  197.         Dim d() As String, i As Integer = 0, e As String = ""
  198.         Dim a() As String = Split(pluginAsText, "Keys() {")
  199.         Dim b() As String = Split(a(1), "}")
  200.         Dim c() As String = Split(b(0), vbCrLf)
  201.         For Each ln In c
  202.             If i = 0 Then
  203.                 i += 1
  204.             Else
  205.                 i += 1
  206.                 Try
  207.                     d = Split(ln, "getKey(")
  208.                     e = d(1)
  209.                 Catch ex As Exception
  210.                     Try
  211.                         d = Split(ln, "setKey(")
  212.                         e = d(1)
  213.                     Catch ex1 As Exception
  214.                         Try
  215.                             d = Split(ln, "getName(")
  216.                             e = d(1)
  217.                         Catch ex2 As Exception
  218.                             Try
  219.                                 d = Split(ln, "setName(")
  220.                                 e = d(1)
  221.                             Catch ex3 As Exception
  222.                                 If Not ln = "" Then
  223.                                     consoleColor(getTime() + "API UNEXPECT CODE: Plugin found ambiguous code under Keys. PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red") : triggerColor()
  224.                                     Return False
  225.                                 End If
  226.                             End Try
  227.                         End Try
  228.                     End Try
  229.                 End Try
  230.             End If
  231.         Next
  232.         Return True
  233.     End Function
  234.  
  235.     Public Function detectWrongCodeInput()
  236.         'Possible codes
  237.         'startRepeat(
  238.         'endRepeat(
  239.         'getInput(
  240.         'setInput(
  241.         Dim d() As String, i As Integer = 0, e As String = ""
  242.         Dim a() As String = Split(pluginAsText, "Input() {")
  243.         Dim b() As String = Split(a(1), "}")
  244.         Dim c() As String = Split(b(0), vbCrLf)
  245.         For Each ln In c
  246.             If i = 0 Then
  247.                 i += 1
  248.             Else
  249.                 i += 1
  250.                 Try
  251.                     d = Split(ln, "startRepeat(")
  252.                     e = d(1)
  253.                 Catch ex As Exception
  254.                     Try
  255.                         d = Split(ln, "endRepeat(")
  256.                         e = d(1)
  257.                     Catch ex1 As Exception
  258.                         Try
  259.                             d = Split(ln, "getInput(")
  260.                             e = d(1)
  261.                         Catch ex2 As Exception
  262.                             Try
  263.                                 d = Split(ln, "setInput(")
  264.                                 e = d(1)
  265.                             Catch ex3 As Exception
  266.                                 If Not ln = "" Then
  267.                                     consoleColor(getTime() + "API UNEXPECT CODE: Plugin found ambiguous code under Input. PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red") : triggerColor()
  268.                                     Return False
  269.                                 End If
  270.                             End Try
  271.                         End Try
  272.                     End Try
  273.                 End Try
  274.             End If
  275.         Next
  276.         Return True
  277.     End Function
  278.  
  279.     Public Function detectWrongCodeFinish()
  280.         'Possible codes
  281.         'setOutput(
  282.         Dim d() As String, i As Integer = 0, e As String = ""
  283.         Dim a() As String = Split(pluginAsText, "Finish() {")
  284.         Dim b() As String = Split(a(1), "}")
  285.         Dim c() As String = Split(b(0), vbCrLf)
  286.         For Each ln In c
  287.             If i = 0 Then
  288.                 i += 1
  289.             Else
  290.                 i += 1
  291.                 Try
  292.                     d = Split(ln, "setOutput(")
  293.                     e = d(1)
  294.                 Catch ex As Exception
  295.                     If Not ln = "" Then
  296.                         consoleColor(getTime() + "API UNEXPECT CODE: Plugin found ambiguous code under Finish. PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red") : triggerColor()
  297.                         Return False
  298.                     End If
  299.                 End Try
  300.             End If
  301.         Next
  302.         Return True
  303.     End Function
  304. #End Region
  305.  
  306.     Public Function startToIntroduction()
  307.         Dim a As String() = Split(pluginAsText, "Introduction() {")
  308.         Dim b As String() = Split(a(0), vbCrLf)
  309.         For Each ln In b
  310.             If Not ln = "" Then
  311.                 consoleColor(getTime() + "API BAD CODE: Plugin found code in a wrong place before ""Introduction"". PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red")
  312.                 triggerColor()
  313.                 Return False
  314.             End If
  315.         Next
  316.         Return True
  317.     End Function
  318.  
  319.     Public Function IntroductionToKeys()
  320.         Dim a As String() = Split(pluginAsText, "Introduction() {")
  321.         Dim b As String() = Split(a(1), "Keys() {")
  322.         Dim c As String() = Split(b(0), "}")
  323.         Dim d As String() = Split(c(1), vbCrLf)
  324.         If c.Length > 2 Then
  325.             consoleColor(getTime() + "API BAD CODE: Found multiple ""}"" between ""Introduction"" and ""Keys"". PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red")
  326.             triggerColor()
  327.             Return False
  328.         End If
  329.         For Each ln In d
  330.             If Not ln = "" Then
  331.                 consoleColor(getTime() + "API BAD CODE: Plugin found code in a wrong place after ""Introduction"" but before ""Keys"". PLUGIN: " + pluginName + " LOCATION: " + curPlugin, "Red")
  332.                 triggerColor()
  333.                 Return False
  334.             End If
  335.         Next
  336.         Return True
  337.     End Function
  338.  
  339.     Public Sub KeysToInput()
  340.  
  341.     End Sub
  342.  
  343.     Public Sub InputToFinish()
  344.  
  345.     End Sub
  346.  
  347. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement