Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.IO
- Public Class frmIDE
- Dim openedFile As String = ""
- Dim currentForm As Form
- Dim createdButton As New Button
- Public history As String
- Public works As Boolean = True
- Private Sub RunToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles RunToolStripMenuItem.Click
- End Sub
- Sub createdButton_Click()
- For u = 0 To txtCode.Items.Count - 1
- Dim userCode As String = txtCode.Items.Item(u)
- Dim input() As String = Split(userCode)
- Dim newLabel As New Label
- If input(0) = "labelOutput:" Then
- Dim x As Integer
- For Each a As String In txtInput.Text
- If txtInput.Text.Contains(" ") Then
- x += 1
- End If
- Try
- currentForm.Controls.Add(newLabel)
- newLabel.Text = newLabel.Text & " " & input(x)
- newLabel.AutoSize = False
- newLabel.Size = New Size(260, 243)
- Catch ex As Exception
- End Try
- Next
- x = 0
- End If
- Next
- End Sub
- Private Sub frmIDE_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
- If works = True Then
- My.Settings.Works = True
- Else
- My.Settings.Works = False
- End If
- My.Settings.History = txtInput.Text
- My.Settings.Code = txtInput.Text
- End Sub
- Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
- Dim ofd As New OpenFileDialog
- ofd.Title = "Select File To Run"
- ofd.Filter = "(*.phOS)|*.phOS"
- Dim fl As String
- ofd.ShowDialog()
- fl = ofd.FileName
- If fl <> Nothing Then
- Dim sr As New StreamReader(fl)
- txtInput.Text = sr.ReadToEnd
- sr.Close()
- openedFile = fl
- End If
- Timer1.Start()
- Dim newForm As New Form
- Dim newLabel As New Label
- Dim createdForm As New Form
- txtCode.Items.Clear()
- txtCode.Items.AddRange(txtInput.Lines)
- My.Settings.History = txtInput.Text
- For u = 0 To txtCode.Items.Count - 1
- Dim userCode As String = txtCode.Items.Item(u)
- Dim input() As String = Split(userCode)
- Dim newSize1 As Integer
- Dim newSize2 As Integer
- If input(0) = "m->" Then
- newForm.MaximizeBox = False
- newForm.StartPosition = FormStartPosition.CenterScreen
- newForm.Text = input(1) & "*" & input(2)
- newForm.Show()
- newForm.Controls.Add(newLabel)
- newLabel.AutoSize = False
- newLabel.Size = New Size(260, 243)
- With newLabel
- .Font = New Font("Consolas", 11)
- End With
- Convert.ToDouble(input(1))
- Convert.ToDouble(input(2))
- Dim i As Integer = input(1) * input(2)
- newLabel.Text = input(1) & " * " & input(2) & " = " & i
- works = True
- My.Settings.Works = True
- ElseIf input(0) = "newForm.button.add" Then
- currentForm.Controls.Add(createdButton)
- Dim buttonX As Integer = input(1)
- Dim buttonY As Integer = input(2)
- Dim locationX As Integer = input(3)
- Dim locationY As Integer = input(4)
- createdButton.Location = New Point(locationX, locationY)
- createdButton.Size = New Size(buttonX, buttonY)
- createdButton.Size = New Size(100, 100)
- ElseIf input(0) = "newForm.startPos.center" Then
- currentForm.StartPosition = FormStartPosition.CenterScreen
- ElseIf input(0) = "newForm.startPos.manual" Then
- currentForm.StartPosition = FormStartPosition.Manual
- ElseIf input(0) = "newForm.startPos.centerParent" Then
- currentForm.StartPosition = FormStartPosition.CenterParent
- ElseIf input(0) = "newForm.startPos.defaultBou" Then
- currentForm.StartPosition = FormStartPosition.WindowsDefaultBounds
- ElseIf input(0) = "newForm.startPos.defaultLoc" Then
- currentForm.StartPosition = FormStartPosition.WindowsDefaultLocation
- ElseIf input(0) = "output:" Then
- Dim x As Integer
- For Each a As String In txtInput.Text
- If txtInput.Text.Contains(" ") Then
- x += 1
- End If
- Try
- currentForm.Controls.Add(newLabel)
- newLabel.Text = newLabel.Text & " " & input(x)
- newLabel.AutoSize = False
- newLabel.Size = New Size(260, 243)
- Catch ex As Exception
- End Try
- Next
- x = 0
- works = True
- My.Settings.Works = True
- ElseIf input(0) = "newForm.create" Then
- currentForm = createdForm
- works = True
- My.Settings.Works = True
- ElseIf input(0) = "newForm.size" Then
- newSize1 = input(1)
- newSize2 = input(2)
- works = True
- My.Settings.Works = True
- currentForm.Size = New Size(newSize1, newSize2)
- ElseIf input(0) = "newForm.show" Then
- currentForm = createdForm
- currentForm.Show()
- newSize1 = 0
- newSize2 = 0
- works = True
- AddHandler currentForm.FormClosed, AddressOf currentForm_Closing
- Me.Hide()
- My.Settings.Works = True
- ElseIf input(0) = "newForm.button.text" Then
- Dim x As Integer
- For Each a As String In txtInput.Text
- If txtInput.Text.Contains(" ") Then
- x += 1
- End If
- Try
- createdButton.Text = input(x)
- Catch ex As Exception
- End Try
- Next
- works = True
- My.Settings.Works = True
- ElseIf input(0) = "button_clickEvent" Then
- AddHandler createdButton.Click, AddressOf createdButton_Click
- works = True
- My.Settings.Works = True
- Else
- If input(0) <> "labelOutput:" Then
- txtCode.Items.Add("!Error somewhere in yor program!")
- txtCode.Items.Add(" ")
- txtCode.Items.Add(" ")
- txtCode.Items.Add(" ")
- txtCode.Items.Remove("!Error somewhere in yor program!")
- txtCode.Items.Remove(" ")
- txtCode.Items.Remove(" ")
- txtCode.Items.Remove(" ")
- works = False
- My.Settings.Works = False
- End If
- End If
- Next
- If works = True Then
- Label2.Text = "No Errors Found"
- Label2.BackColor = Color.Lime
- Else
- Label2.Text = "!Errors Have Been Found!"
- Label2.BackColor = Color.Red
- End If
- If works = True Then
- Label2.Text = "No Errors Found"
- Label2.BackColor = Color.Lime
- Else
- Label2.Text = "!Errors Have Been Found!"
- Label2.BackColor = Color.Red
- End If
- If My.Settings.Works = True Then
- works = True
- Else
- works = False
- End If
- End Sub
- Private Sub txtInput_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles txtInput.KeyDown
- If e.KeyCode = Keys.F5 Then
- RunToolStripMenuItem.PerformClick()
- ElseIf e.KeyCode = Keys.F6 Then
- SaveToolStripMenuItem.PerformClick()
- ElseIf e.KeyCode = Keys.F7 Then
- OpenToolStripMenuItem.PerformClick()
- End If
- End Sub
- Private Sub SaveToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SaveToolStripMenuItem.Click
- Dim SFD As New SaveFileDialog
- SFD.Title = "phOS Save .txt File"
- Dim SV As String
- SFD.Filter = "(*.phOS)|*.phOS"
- If openedFile <> Nothing Then
- SFD.FileName = openedFile
- End If
- SFD.ShowDialog()
- SV = SFD.FileName
- If txtInput.Text <> Nothing And SV <> Nothing Then
- Dim sw As New StreamWriter(SV)
- sw.Write(txtInput.Text)
- sw.Close()
- openedFile = SV
- MsgBox("File saved to " & SV, MsgBoxStyle.Information, "Success")
- End If
- Application.Restart()
- End Sub
- Private Sub OpenToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenToolStripMenuItem.Click
- Dim ofd As New OpenFileDialog
- ofd.Title = "Select File To Run"
- ofd.Filter = "(*.phOS)|*.phOS"
- Dim fl As String
- ofd.ShowDialog()
- fl = ofd.FileName
- If fl <> Nothing Then
- Dim sr As New StreamReader(fl)
- txtInput.Text = sr.ReadToEnd
- sr.Close()
- openedFile = fl
- End If
- End Sub
- Private Sub txtInput_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtInput.TextChanged
- For Each s As String In txtInput.Text
- If s = "create" Then
- End If
- Next
- End Sub
- Sub currentForm_Closing()
- Application.Exit()
- End Sub
- Private Sub HistoryToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles HistoryToolStripMenuItem.Click
- frmHistory.Show()
- End Sub
- Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
- Me.Hide()
- End Sub
- Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
- Timer2.Start()
- End Sub
- Private Sub Timer2_Tick(sender As System.Object, e As System.EventArgs) Handles Timer2.Tick
- Timer1.Stop()
- Me.Hide()
- End Sub
- Private Sub Timer3_Tick(sender As System.Object, e As System.EventArgs) Handles Timer3.Tick
- Timer4.Start()
- End Sub
- Private Sub Timer4_Tick(sender As System.Object, e As System.EventArgs) Handles Timer4.Tick
- Timer3.Stop()
- currentForm.Select()
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement