damn Ive broken it! I cant see what im doing wrong... can you? her is the code... I might as well make it open source...
Imports System.Diagnostics
Imports System.Deployment
Imports System.Collections.ObjectModel
Imports Microsoft.Win32
Namespace ConsoleSample
Module Module1
Dim dir As String
Dim file As String
Dim drive_letter As String
Sub Main()
Console.WriteLine()
' Title
Console.Title = "Gsupport client"
' Color
Dim newBackgroundColor As String = "white"
Console.BackgroundColor = CType(System.Enum.Parse(GetType(ConsoleColor), newBackgroundColor, True), ConsoleColor)
Dim newForegroundColor As String = "black"
Console.ForegroundColor = CType(System.Enum.Parse(GetType(ConsoleColor), newForegroundColor, True), ConsoleColor)
Console.Clear()
Console.Beep(400, 200)
Console.WriteLine("welcome to gsupport!")
Console.WriteLine()
Console.WriteLine("what directory did you install gsupport? if you dont know type '?'.")
drive_letter = Console.ReadLine()
If drive_letter = "?" Then
'* a mad attempt to find all the drives on the system...
Try
drive_letter = "a:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "b:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "c:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "d:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "e:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "f:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "g:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "h:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "i:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "j:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "k:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "l:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "m:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "n:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "o:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "p:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "q:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "r:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "s:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "t:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "u:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "v:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "w:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "x:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "y:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
Try
drive_letter = "z:\"
Console.WriteLine("the Drive " & drive_letter & "=" & My.Computer.FileSystem.DirectoryExists(drive_letter))
Catch
End Try
'ask which drive the user installed gsupport into.
Console.WriteLine("which drive did you put gsupport in? (type it like this 'C:\')")
drive_letter = Console.ReadLine()
End If
'**end of mad amount of text in one space**
Console.WriteLine("checking for local directories...")
Dim dir_uploads As String
Dim dir_downloads As String
Dim news As String
dir_downloads = My.Computer.FileSystem.DirectoryExists(drive_letter & "gsupport\downloads")
dir_uploads = My.Computer.FileSystem.DirectoryExists(drive_letter & "gsupport\uploads")
If dir_downloads = False Then
My.Computer.FileSystem.CreateDirectory(drive_letter & "gsupport\downloads")
Console.WriteLine("creating " & drive_letter & "gsupport\downloads This will be your download folder")
End If
If dir_uploads = False Then
My.Computer.FileSystem.CreateDirectory(drive_letter & "gsupport\uploads")
Console.WriteLine("creating " & drive_letter & " gsupport\uploads This will be your upload folder")
End If
Console.WriteLine("local directories OK")
Console.WriteLine()
Console.WriteLine("getting latest news...")
news = My.Computer.FileSystem.FileExists(drive_letter & "gsupport\news.rtf")
If news = True Then
Console.WriteLine("deleting old news first...")
My.Computer.FileSystem.DeleteFile(drive_letter & "gsupport\news.rtf")
Console.WriteLine("done")
Console.WriteLine()
End If
'download news.rtf
Console.WriteLine()
Console.WriteLine("downloading... please hold. please let the program pass through your firewall.")
'attempt to download
My.Computer.Network.DownloadFile("http://www.s0l1d.galekus.com/gsupport_news.rtf", drive_letter & "gsupport\news.rtf")
Console.Beep(400, 200)
Console.WriteLine("done")
Console.Clear()
Console.WriteLine("do you want to read the latest news? (yes or no)")
If Console.ReadLine = "yes" Then
Console.WriteLine("loading news_reader...")
Dim p As New Process
Try
'opening news reader
p.StartInfo.FileName = drive_letter & "gsupport\newsreader\gsupport newsreader.exe"
p.Start()
Catch
'can't find it...
Console.WriteLine("seems like newsreader aint there. skipping...")
Console.WriteLine()
End Try
Console.Beep(400, 200)
Console.WriteLine("All done. Press any key to continue.")
Console.ReadLine()
Console.Clear()
Else
Console.WriteLine("press any key to continue...")
Console.ReadLine()
Console.Clear()
End If
Console.WriteLine("are you ready to connect to gsupport? press any key to connect.")
Console.WriteLine("attempting to download directory files")
'checking for old dir files
Try
Console.WriteLine("deleting old dir list first")
My.Computer.FileSystem.DeleteFile(drive_letter & "gsupport\dir.rtf")
Console.WriteLine("done")
Console.WriteLine()
Console.WriteLine("now connecting")
Catch
Console.WriteLine("no files to delete... all clear")
End Try
'finding status
Try
My.Computer.Network.DownloadFile("http://www.s0l1d.galekus.com/gsupport_status.rtf", drive_letter & "gsupport\status.rtf")
Catch
My.Computer.FileSystem.DeleteFile(drive_letter & "gsupport\status.rtf")
My.Computer.Network.DownloadFile("http://www.s0l1d.galekus.com/gsupport_status.rtf", drive_letter & "gsupport\status.rtf")
End Try
My.Computer.FileSystem.OpenTextFileReader(drive_letter & "gsupport\status.rtf")
'if the server is up...
If My.Computer.FileSystem.ReadAllText(drive_letter & "gsupport\status.rtf") = "#up" Then
Console.Clear()
Console.WriteLine("The server is currently up!")
Console.WriteLine("We are proud to announce that, gsupport is fully functional!")
Else
'if the server is down...
Console.Clear()
Console.WriteLine("Sorry, but the server is down! This is most likely a result of our server being updated, or that this program is out-dated. Please try again later. If you still get this message, please check if there is a new version.")
Console.WriteLine("press any key to end this program")
Console.ReadLine()
End
End If
'checking that dir.rtf is non-existant
If My.Computer.FileSystem.FileExists(drive_letter & "gsupport\dir.rtf") = True Then
My.Computer.FileSystem.DeleteFile(drive_letter & "gsupport\dir.rtf")
End If
'downloading dir list
My.Computer.Network.DownloadFile("http://www.s0l1d.galekus.com/gsupport_dir.rtf", drive_letter & "gsupport\dir.rtf")
My.Computer.FileSystem.OpenTextFileReader(drive_letter & "gsupport\dir.rtf")
Console.WriteLine("These are the directories:")
Console.WriteLine(My.Computer.FileSystem.ReadAllText(drive_letter & "gsupport\dir.rtf"))
Console.WriteLine("type in the directory you want to visit like this:")
Console.WriteLine()
Console.WriteLine("'models'")
dir = Console.ReadLine()
If My.Computer.FileSystem.FileExists(drive_letter & "gsupport\files.rtf") = True Then
My.Computer.FileSystem.DeleteFile(drive_letter & "gsupport\files.rtf")
End If
Try
My.Computer.Network.DownloadFile("http://s0l1d.galekus.com/gsupport/" & dir & "/files.rtf", drive_letter & "gsupport\files.rtf")
Console.WriteLine()
Console.WriteLine("downloading...")
Console.WriteLine("done!")
Console.WriteLine("press any key to continue...")
Console.ReadLine()
dir_status()
Catch
Console.WriteLine("this directory doesn't exist... please try another")
get_dir()
End Try
End Sub
Sub get_dir()
Try
dir = Console.ReadLine()
My.Computer.Network.DownloadFile("http://s0l1d.galekus.com/gsupport/" & dir & "/files.rtf", drive_letter & "gsupport\files.rtf")
Console.WriteLine()
Console.WriteLine("downloading...")
Console.WriteLine("done!")
dir_status()
Catch
Console.WriteLine("this directory doesn't exist... please try another")
dir = Console.ReadLine()
get_dir()
End Try
End Sub
Sub dir_status()
'show files in dir chosen
If My.Computer.FileSystem.ReadAllText(drive_letter & "gsupport\files.rtf") = "#none" Then
Console.WriteLine("no files in this directory")
End If
Console.WriteLine("These are the files in this directory:")
Console.WriteLine(My.Computer.FileSystem.ReadAllText(drive_letter & "gsupport\files.rtf"))
Console.WriteLine()
Console.WriteLine("type the name of the file you want to download. Please include the file extension.")
Do
file = Console.ReadLine()
Loop Until file <> ""
Console.WriteLine("Attempting to download... please wait patiently - this may take some time.")
'Try
Debug.Print(drive_letter & "gsupport\downloads\" & file)
My.Computer.Network.DownloadFile("http://s0l1d.galekus.com/gsupport/" & dir & "/" & file, drive_letter & "gsupport\downloads\" & file)
' Catch ex As Exception
Console.WriteLine("maybe, the file was deleted. Gsupport will now end. This might solve the problem. Press any key to continue.")
Console.ReadLine()
End
' End Try
Console.WriteLine("downloaded. You can find this file in '" & drive_letter & "gsupport\downloads\'.")
Console.WriteLine("press any key to continue...")
Console.ReadLine()
Console.Clear()
Console.WriteLine(" \\\\\ \\\\\\\ \\ \\ \\\\\\ \\\\\\ \\\\\\ \\\\\\ \\\\\\\")
Console.WriteLine(" \\\\ \\ \\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\")
Console.WriteLine(" \\ \\\\\\\\ \\ \\ \\\\\\ \\\\\\ \\ \\ \\\\\\ \\")
Console.WriteLine(" \\ \\\\ \\\ \\ \\ \\ \\ \\ \\ \\ \\ \\")
Console.WriteLine(" \\ \\ \\\ \\ \\ \\ \\ \\ \\ \\ \\ \\")
Console.WriteLine(" \\\\\\\ \\\\\\\\ \\\\\\\ \\ \\ \\\\\\ \\ \\ \\")
Console.WriteLine()
Console.WriteLine("gsupport v" & My.Application.Info.Version.ToString)
Console.WriteLine("copyright s0l1dsnak3123")
Console.WriteLine("This application is freeware. Please do not use this application for anything that would be considered malicious. I am not responsible for anything you (the user) do with this program.")
Console.WriteLine()
Console.WriteLine("press any key to exit.")
Console.ReadLine()
End Sub
End Module
End Namespace
Its probably full of crap, but here it is anyway...