Page 1 of 1

vBasic (C# conver too) image CON extraction

Posted: Thu Mar 26, 2009 5:02 am
by Rogue_Modder
Hi, i have the offset and length of the CON image, i need to have a picture box on my form to show the image. how would i do this?

My current code is this:

Code: Select all

Imports System
Imports System.IO
Imports DevComponents.DotNetBar
Imports DevComponents.DotNetBar.Office2007RibbonForm
Imports System.Text


Public Class Form1
    Inherits DevComponents.DotNetBar.Office2007RibbonForm

#Region "Hexing info"
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ofd As New OpenFileDialog()
        If ofd.ShowDialog() = DialogResult.OK Then


            Dim fs As New FileStream(ofd.FileName, FileMode.Open)
            Dim br As New BinaryReader(fs)
            Dim length As Long = fs.Length


            br.BaseStream.Position = &H412
            Dim Name As Byte() = br.ReadBytes(57)
            TextBoxX1.Text = UnicodeEncoding.Unicode.GetString(Name)

            br.BaseStream.Position = &H1692
            Dim game As Byte() = br.ReadBytes(12)
            TextBoxX2.Text = UnicodeEncoding.Unicode.GetString(game)

            br.BaseStream.Position = &H171A
            Dim Bio As Byte() = br.ReadBytes(530)
            PictureBox1.Image = 'I want to inject the image here, is this the right place? and what is the code?

            'br.BaseStream.Position = &H"#"
            'Dim Location As Byte() = br.ReadBytes("#")
            'TextBoxX4.Text = BitConverter.ToString(Location)
        End If
    End Sub
#End Region
End Class