Public Class BMP
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
Dim oRead As System.IO.StreamReader
Dim formated As String
Dim Test As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SelFile.FileOk
ImageName.Text = "Image: " + SelFile.FileName
Dim Bitmap As New System.Drawing.Bitmap(SelFile.FileName)
Me.bricknum.Text = (Bitmap.Size.Width * Bitmap.Size.Height).ToString()
Picture.PictureBox1.ImageLocation = SelFile.FileName
Picture.Show()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SelFile.ShowDialog()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Picture.Close()
If SelFile.FileName = "" Then
MsgBox("Error, no Image Selected", MsgBoxStyle.Critical, "Error:5224")
Else
oWrite = System.IO.File.CreateText("C:\Roblox_Image.txt")
Dim Bitmap As New System.Drawing.Bitmap(SelFile.FileName)
Dim cont As Integer = 0
oWrite.WriteLine(Me.BrickMake.Text)
Dim form As String = "2"
If Me.Sizey.Text / 1 = Int(Me.Sizey.Text / 1) Then
form = "0"
Else
form = "2"
End If
oWrite.WriteLine("Brick.Size = Vector3.new(" + Me.Sizex.Text + "," + Me.Sizey.Text + "," + Me.Sizez.Text + ")")
oWrite.WriteLine("Brick.formFactor = " + form)
oWrite.WriteLine("Tab = {")
For x = 0 To Bitmap.Size.Width - 1 'Syntax errors? I haven't done VB in a while
For y = 0 To Bitmap.Size.Height - 1
Dim Color As System.Drawing.Color = Bitmap.GetPixel(x, y)
Dim col = Color.ToString()
If cont = 0 Then
formated = col
cont = cont + 1
Else
cont = cont + 1
formated = formated + col
If cont = 5 Then
cont = 0
formated = Replace(formated, "Color [A=255,", "Color3.new(")
formated = Replace(formated, "R=", "")
formated = Replace(formated, "G=", "")
formated = Replace(formated, "B=", "")
formated = Replace(formated, "]", "),")
formated = formated.ToString()
oWrite.WriteLine(formated.ToCharArray(), ",")
End If
End If
Next
Next
oWrite.WriteLine("}")
oWrite.WriteLine("x=" + (Bitmap.Width).ToString())
oWrite.WriteLine("z=" + (Bitmap.Height).ToString())
oWrite.WriteLine(Me.TheScript.Text)
Dim pixelcount As Long = Bitmap.Height * Bitmap.Width
If Me.CB1.Checked = True Then
oWrite.WriteLine(Me.DeLag.Text)
pixelcount = pixelcount * 2
End If
oWrite.Close()
Dim msg As String
If pixelcount > 100000 Then
msg = "Please I beg, dont do this"
ElseIf pixelcount > 50000 Then
msg = "This might crash your computer, or just take forever"
ElseIf pixelcount > 30000 Then
msg = "You will be waiting for a few minutes"
ElseIf pixelcount > 20000 Then
msg = "This is going to lag ALOT"
ElseIf pixelcount > 10000 Then
msg = "There will be QUITE a bit of lag when you run the script"
ElseIf pixelcount > 1000 Then
msg = "There will be a slight lag"
ElseIf pixelcount > 100 Then
msg = "There will be almost no lag"
End If
MsgBox(msg, MsgBoxStyle.Critical, "!!!WARNING!!!")
End If
End Sub
Private Sub BrickMake_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrickMake.TextChanged
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Form2.Show()
End Sub
Private Sub DeLag_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeLag.TextChanged
End Sub
Private Sub TheScript_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TheScript.TextChanged
End Sub
End Class