GSC Compiler v1.0 Source

Posts 1–3 of 3 · Page 1 of 1
GSC Compiler v1.0 Source
This only includes the main form source not any other one, so don't ask for the full code like intelligence and other shits, piss off and enjoy this one

[php]Imports [property]
Imports INIControl.INIControl
Public Class Form1

Public Sub CreateRAW()
Try
Eprv.Text = "Creating RAW Backup......."
Dim path As String = Application.StartupPath & "\data\source\Raw Backup.txt"

Using sWrite As New IO.StreamWriter(path)
sWrite.Write(Intellisense.Text)
End Using
If Eprv.Text = "RAW Backup Created!" Then
Eprv.Text = "Compiled as *.gsc Script:: 0 Errors, 0 Up-to-dated, 1 Compiled. ENJOY! :=)"
Else
Eprv.Text = "RAW Backup Created!"
End If
Catch ex As Exception
Eprv.Text = "Can't create a RAW backup. :=("
End Try
End Sub

Public Sub ErrorCheck()

Dim i As Integer = 1

Dim openStasheCount As Integer = 0
Dim closeStasheCount As Integer = 0
Dim openbacket As Integer = 0
Dim closebacket As Integer = 0
Dim orgIF As Integer = 0
Dim nonIF As Integer = 0

Dim startLineSearchBracket As Integer = -1
Dim currentSearchBracket As Integer = -1

Dim totalLines As String() = Intellisense.Text.Split(vbCrLf)
Dim functions(450) As String
Dim includes(25) As String

Dim functionCount As Integer = 0
Dim includeCount As Integer = 0

For Each line As String In totalLines
Dim commentChar As Integer = line.Length
If (line.LastIndexOf("//") <> -1) Then
commentChar = line.IndexOf("//")
End If
Dim beforeComment As String = line.Substring(0, commentChar)

openStasheCount += CharCount(beforeComment, "{")
closeStasheCount += CharCount(beforeComment, "}")
openbacket += CharCount(beforeComment, "(")
closebacket += CharCount(beforeComment, ")")
orgIF += CharCount("if(" & String.Empty, "==")

If (openStasheCount = closeStasheCount And line.IndexOf("}") And line.IndexOf("#include") = -1) Then ' if the line isn't in a function....
If (line.IndexOf("(") = -1) Then
Else
functions(functionCount) = line.Substring(0, line.IndexOf("("))
functionCount += 1
End If


End If
If (line.IndexOf("#include") <> -1) Then
includes(includeCount) = line.Substring(line.IndexOf("#include") + 8)
includeCount += 1
End If
i += 1
Next

Dim allFunctions As String = ""
Dim allIncludes As String = ""
For k As Integer = 0 To functions.Length - 1
allFunctions += functions(k) + ","
Next
ReDim functions(1)
For k As Integer = 0 To includes.Length - 1
allIncludes += includes(k) + ","
Next
ReDim functions(1)
i = 1
For Each line As String In totalLines
If (line.IndexOf("self thread ") <> -1) Then
Dim endOffset As Integer = line.IndexOfAny(New Char() {"(", " "}, line.IndexOf(" thread ") + 8) - line.IndexOf(" thread ") - 8
Dim called As String = line.Substring(line.IndexOf(" thread ") + 8, endOffset)

If (allFunctions.IndexOf(called + ",") = -1) Then
If (called.IndexOf("\") = -1) Then
Eprv.Text = "Script compile error: Unknown function """ + called + """" + "on line: " + i.ToString()
End If

End If
End If
i += 1
Next

If (openStasheCount < closeStasheCount) Then
Eprv.Text = "Script Compile Error: Too many closed '}'."
End If
If (openStasheCount > closeStasheCount) Then
Eprv.Text = "Script Compile Error: Too many open '{'."
End If
If (openbacket < closebacket) Then
Eprv.Text = "Script Compile Error: Too many closed ')'."
End If
If (openbacket > closebacket) Then
Eprv.Text = "Script Compile Error: Too many open '('."
End If
If (orgIF = "=") Then
Eprv.Text = "Skipped one '=' while looking for errors. Did you forgot to add one '='?"
End If
End Sub

Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EX.Click
Close()
End Sub

Private Sub GSCToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cgsc.Click
Crypter.Show()
End Sub

Private Sub RAWToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Craw.Click
Try
Dim dlg As New SaveFileDialog
dlg.Title = "Save RAW As..."
dlg.Filter = "RAW File *.*|*.*"
dlg.ShowDialog()
Dim i As New System.IO.StreamWriter(dlg.FileName.ToString())
i.Write(Intellisense.Text)
i.Close()
Catch ex As Exception
MsgBox("The operation was canceled!")
End Try
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ini_tool As New IniReader
Eprv.Text = "Loading engine......"
Tools1.Start()
intel.Start()
Eprv.Text = "Engine loaded!"
Form2.Timer1.Start()
Intellisense.CreateGraphics()
Intellisense.SetHighlighting("C#")
lol()
End Sub

Private Sub ManualErrorCheckToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MEC.Click
Dim i As Integer = 1

Dim openStasheCount As Integer = 0
Dim closeStasheCount As Integer = 0
Dim openbacket As Integer = 0
Dim closebacket As Integer = 0
Dim orgIF As Integer = 0
Dim nonIF As Integer = 0

Dim startLineSearchBracket As Integer = -1
Dim currentSearchBracket As Integer = -1

Dim totalLines As String() = Intellisense.Text.Split(vbCrLf)
Dim functions(450) As String
Dim includes(25) As String

Dim functionCount As Integer = 0
Dim includeCount As Integer = 0

For Each line As String In totalLines
Dim commentChar As Integer = line.Length
If (line.LastIndexOf("//") <> -1) Then
commentChar = line.IndexOf("//")
End If
Dim beforeComment As String = line.Substring(0, commentChar)

openStasheCount += CharCount(beforeComment, "{")
closeStasheCount += CharCount(beforeComment, "}")
openbacket += CharCount(beforeComment, "(")
closebacket += CharCount(beforeComment, ")")
orgIF += CharCount("if(" + beforeComment, "==")
nonIF += CharCount("if(" + beforeComment, "=")

If (openStasheCount = closeStasheCount And line.IndexOf("}") And line.IndexOf("#include") = -1) Then
If (line.IndexOf("(") = -1) Then
Else
functions(functionCount) = line.Substring(0, line.IndexOf("("))
functionCount += 1
End If


End If
If (line.IndexOf("#include") <> -1) Then
includes(includeCount) = line.Substring(line.IndexOf("#include") + 8)
includeCount += 1
End If
i += 1
Next
Dim allFunctions As String = ""
Dim allIncludes As String = ""
For k As Integer = 0 To functions.Length - 1
allFunctions += functions(k) + ","
Next
ReDim functions(1)
For k As Integer = 0 To includes.Length - 1
allIncludes += includes(k) + ","
Next
ReDim functions(1)
i = 1
For Each line As String In totalLines
If (line.IndexOf("self thread ") <> -1) Then
Dim endOffset As Integer = line.IndexOfAny(New Char() {"(", " "}, line.IndexOf(" thread ") + 8) - line.IndexOf(" thread ") - 8
Dim called As String = line.Substring(line.IndexOf(" thread ") + 8, endOffset)

If (allFunctions.IndexOf(called + ",") = -1) Then
If (called.IndexOf("\") = -1) Then
Eprv.Text = "Script compile error: Unknown function """ + called + """" + "on line: " + i.ToString()
End If

End If
End If
i += 1
Next

If (openStasheCount < closeStasheCount) Then
MsgBox("Syntax error: Too many close braces '}' at line: " + i.ToString)
End If
If (openStasheCount > closeStasheCount) Then
MsgBox("Syntax error: Too many open braces '{' at line: " + i.ToString)
End If
If (openbacket < closebacket) Then
MsgBox("Syntax error: Too many closed barces ')' at line: " + i.ToString)
End If
If (openbacket > closebacket) Then
MsgBox("Syntax error: Too many open barces '(' at line:" + i.ToString)
End If
If (orgIF = nonIF) Then
MsgBox("Syntax error: You must add one more '=' at line: " + i.ToString)
End If
MessageBox.Show("Script Check ended!")
End Sub

Private Sub Tools_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tools1.Tick
Try
If Intellisense.Text = "" Then

'Do Nothing()

Else

CreateRAW()

End If

ErrorCheck()

Catch ex As Exception

End Try

End Sub

Private Sub Tools2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tools2.Tick
ErrorCheck()
End Sub

Private Sub SettingsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles STT.Click
Form2.Show()
End Sub

Private Sub RankToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RankToolStripMenuItem.Click
Dim path As String = Application.StartupPath.ToString() + "\data\codes\_rank.txt"
Using sRead As New System.IO.StreamReader(path)
Intellisense.Text = sRead.ReadToEnd()
End Using
End Sub

Private Sub MissionsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MissionsToolStripMenuItem.Click
Dim path As String = Application.StartupPath.ToString() + "\data\codes\musics_and_dialogs.txt"
Using sRead As New System.IO.StreamReader(path)
Intellisense.Text = sRead.ReadToEnd()
End Using
End Sub

Private Sub CalssToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalssToolStripMenuItem.Click
Dim path As String = Application.StartupPath.ToString() + "\data\codes\_class.txt"
Using sRead As New System.IO.StreamReader(path)
Intellisense.Text = sRead.ReadToEnd()
End Using
End Sub

Private Sub MissionsToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MissionsToolStripMenuItem1.Click
Dim path As String = Application.StartupPath.ToString() + "\data\codes\_missions.txt"
Using sRead As New System.IO.StreamReader(path)
Intellisense.Text = sRead.ReadToEnd()
End Using
End Sub

Private Sub EventsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EventsToolStripMenuItem.Click
Dim path As String = Application.StartupPath.ToString() + "\data\codes\_events.txt"
Using sRead As New System.IO.StreamReader(path)
Intellisense.Text = sRead.ReadToEnd()
End Using
End Sub

Private Sub AnimatedmodelsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AnimatedmodelsToolStripMenuItem.Click
Dim path As String = Application.StartupPath.ToString() + "\data\codes\_animatedmodels.txt"
Using sRead As New System.IO.StreamReader(path)
Intellisense.Text = sRead.ReadToEnd()
End Using
End Sub

Private Sub Destructibledlc2ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Destructibledlc2ToolStripMenuItem.Click
Dim path As String = Application.StartupPath.ToString() + "\data\codes\common_scripts\_destructible_dlc2.txt "
Using sRead As New System.IO.StreamReader(path)
Intellisense.Text = sRead.ReadToEnd()
End Using
End Sub

Private Sub Destructibletypesdlc2ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Destructibletypesdlc2ToolStripMenuItem.Click
Dim path As String = Application.StartupPath.ToString() + "\data\codes\common_scripts\_destructible_types_dl c2.txt"
Using sRead As New System.IO.StreamReader(path)
Intellisense.Text = sRead.ReadToEnd()
End Using
End Sub

Private Sub MpafghanToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MpafghanToolStripMenuItem.Click
Dim path As String = Application.StartupPath.ToString() + "\data\codes\mp\mp_afghan.txt"
Using sRead As New System.IO.StreamReader(path)
Intellisense.Text = sRead.ReadToEnd()
End Using
End Sub

Private Sub MprustToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MprustToolStripMenuItem.Click
Dim path As String = Application.StartupPath.ToString() + "\data\codes\mp\mp_rust.txt"
Using sRead As New System.IO.StreamReader(path)
Intellisense.Text = sRead.ReadToEnd()
End Using
End Sub

Private Sub MpderailToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MpderailToolStripMenuItem.Click
Dim path As String = Application.StartupPath.ToString() + "\data\codes\mp\mp_derail.txt"
Using sRead As New System.IO.StreamReader(path)
Intellisense.Text = sRead.ReadToEnd()
End Using
End Sub

Private Sub Ac130ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Ac130ToolStripMenuItem.Click
Dim path As String = Application.StartupPath.ToString() + "\data\codes\killstreaks\_ac130.txt"
Using sRead As New System.IO.StreamReader(path)
Intellisense.Text = sRead.ReadToEnd()
End Using
End Sub

Private Sub PackageToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PackageToolStripMenuItem.Click
Dim path As String = Application.StartupPath.ToString() + "\data\codes\killstreaks\_airdrop.txt"
Using sRead As New System.IO.StreamReader(path)
Intellisense.Text = sRead.ReadToEnd()
End Using
End Sub

Private Sub HelicopterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelicopterToolStripMenuItem.Click
Dim path As String = Application.StartupPath.ToString() + "\data\codes\killstreaks\_helicopter.txt"
Using sRead As New System.IO.StreamReader(path)
Intellisense.Text = sRead.ReadToEnd()
End Using
End Sub

Private Sub AirstrikeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AirstrikeToolStripMenuItem.Click
Dim path As String = Application.StartupPath.ToString() + "\data\codes\killstreaks\_airstrike.txt"
Using sRead As New System.IO.StreamReader(path)
Intellisense.Text = sRead.ReadToEnd()
End Using
End Sub

Private Sub KillstreaksToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KillstreaksToolStripMenuItem1.Click
Dim path As String = Application.StartupPath.ToString() + "\data\codes\killstreaks\_killstreaks.txt"
Using sRead As New System.IO.StreamReader(path)
Intellisense.Text = sRead.ReadToEnd()
End Using
End Sub

Private Sub OpenScriptToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenScriptToolStripMenuItem.Click
Try
Dim opg As New OpenFileDialog
opg.Title = "Open Script...."
opg.Filter = "Script *.gsc|*.gsc"
opg.ShowDialog()
Using sRead As New System.IO.StreamReader(opg.FileName)
Intellisense.Text = sRead.ReadToEnd()
End Using
Catch ex As Exception

End Try
End Sub

Private Sub AuthorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorToolStripMenuItem.Click
Form3.Show()
End Sub

Private Sub SwitchToEasybuilerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SwitchToEasybuilerToolStripMenuItem.Click
Easy_Builder.Show()
End Sub

Private Sub ApplicationScanerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ApplicationScanerToolStripMenuItem.Click
GSC_Compiler_Scaner_Beta.Show()
End Sub

Private Sub GoToLineToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoToLineToolStripMenuItem.Click
Find.Show()
End Sub

Private Sub SelectAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectAllToolStripMenuItem.Click
Intellisense.Undo()
End Sub

Private Sub RedoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedoToolStripMenuItem.Click
Intellisense.Redo()
End Sub

Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click
String.Copy(Intellisense.Text)
Clipboard.SetText(Intellisense.Text)
End Sub

Private Sub lol()
Dim lp As New DataConnector
If Not lp.a("<url>") = My.Settings.Bytes.ToString() Then
MsgBox("The program bytes has been changed! The program will now close! To fix this error you have to update the program!", MsgBoxStyle.Exclamation, "Bytes has been changed")
End
End If
End Sub
End Class[/php]

Like it?
Well, I hope this will help for future releases,

Cheers, Ace.
no problem dude, hope this helps!
Posts 1–3 of 3 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us