Option Strict Off
Option Explicit On

Imports System.IO

Friend Class MainWindow
    Inherits System.Windows.Forms.Form
    Public openfname As String


    'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Public Sub CheckAll_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CheckAll.Click
        Dim cw As New CheckingWindow

        cw.Show()

        Dim i As Short
        Dim gw%, gh%
        For i = 0 To graphics.numitems - 1
            If mapfile.gettype_Renamed(i) = "IMG1" Then
                gw = graphics.getgbitmapwidth(i)
                gh = graphics.getgbitmapheight(i)
                'gw = graphics.itemint(i, 1)
                'gh = graphics.itemint(i, 3)
                If (gw Mod 16) > 0 Then
                    cw.CheckList.Items.Add("Error: Item #" + Trim(Str(i - 1)) + " (0x" + Trim(Hex(i - 1)) + ")'s width (" + Trim(Str(gw)) + ")is not divisible by 16.")
                Else
                    If gw > 320 Then
                        cw.CheckList.Items.Add("Warning: Item #" + Trim(Str(i - 1)) + " (0x" + Trim(Hex(i - 1)) + ") width (" + Trim(Str(gw)) + ") is > 320.")
                    End If
                    If gh > 240 Then
                        cw.CheckList.Items.Add("Warning: Item #" + Trim(Str(i - 1)) + " (0x" + Trim(Hex(i - 1)) + ") width (" + Trim(Str(gw)) + ") is > 320.")
                    End If
                End If
            End If
        Next

        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        If graphics.getgitemsize(558) <> 4720 Then
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            cw.CheckList.Items.Add("Error: Item #" & Trim(Str(558)) & " (0x" & Trim(Hex(558)) & ")'s size (" & Trim(Str(graphics.getgitemsize(558))) & ")is not 4720.", -1)
        End If
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        If graphics.getgitemsize(559) <> 3086 Then
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            cw.CheckList.Items.Add("Error: Item #" & Trim(Str(559)) & " (0x" & Trim(Hex(559)) & ")'s size (" & Trim(Str(graphics.getgitemsize(559))) & ")is not 3086.", -1)
        End If
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        If graphics.getgitemsize(560) <> 1256 Then
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            cw.CheckList.Items.Add("Error: Item #" & Trim(Str(560)) & " (0x" & Trim(Hex(560)) & ")'s size (" & Trim(Str(graphics.getgitemsize(560))) & ")is not 1256.", -1)
        End If
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        If graphics.getgitemsize(561) <> 2052 Then
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            cw.CheckList.Items.Add("Error: Item #" & Trim(Str(561)) & " (0x" & Trim(Hex(561)) & ")'s size (" & Trim(Str(graphics.getgitemsize(561))) & ")is not 2052.", -1)
        End If
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        If graphics.getgitemsize(562) <> 1826 Then
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            cw.CheckList.Items.Add("Error: Item #" & Trim(Str(562)) & " (0x" & Trim(Hex(562)) & ")'s size (" & Trim(Str(graphics.getgitemsize(562))) & ")is not 1826.", -1)
        End If

        If cw.CheckList.Items.Count = 0 Then
            cw.CheckList.Items.Add("No problems found.", -1)
        End If
    End Sub

    'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Public Sub CheckGraphicSizes_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CheckGraphicSizes.Click
        Dim cw As New CheckingWindow

        cw.Show()

        Dim i As Short
        Dim gw%, gh%
        For i = 1 To graphics.numitems
            If mapfile.gettype_Renamed(i) = "IMG1" Then

                gw = graphics.getgbitmapwidth(i)
                gh = graphics.getgbitmapheight(i)
                'gw = graphics.itemint(i, 1)
                'gh = graphics.itemint(i, 3)
                If (gw Mod 16) > 0 Then
                    cw.CheckList.Items.Add("Error: Item #" + Trim(Str(i - 1)) + " (0x" + Trim(Hex(i - 1)) + ")'s width (" + Trim(Str(gw)) + ")is not divisible by 16.")
                Else
                    If gw > 320 Then
                        cw.CheckList.Items.Add("Warning: Item #" + Trim(Str(i - 1)) + " (0x" + Trim(Hex(i - 1)) + ") width (" + Trim(Str(gw)) + ") is > 320.")
                    End If
                    If gh > 240 Then
                        cw.CheckList.Items.Add("Warning: Item #" + Trim(Str(i - 1)) + " (0x" + Trim(Hex(i - 1)) + ") width (" + Trim(Str(gw)) + ") is > 320.")
                    End If
                End If
            End If
        Next

        If cw.CheckList.Items.Count = 0 Then
            cw.CheckList.Items.Add("No problems found.", -1)
        End If
    End Sub

    'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Public Sub CheckItemSizes_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CheckItemSizes.Click
        Dim cw As New CheckingWindow

        cw.Show()

        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        If graphics.getgitemsize(558) <> 4720 Then
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            cw.CheckList.Items.Add("Error: Item #" & Trim(Str(558)) & " (0x" & Trim(Hex(558)) & ")'s size (" & Trim(Str(graphics.getgitemsize(558))) & ")is not 4720.", -1)
        End If
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        If graphics.getgitemsize(559) <> 3086 Then
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            cw.CheckList.Items.Add("Error: Item #" & Trim(Str(559)) & " (0x" & Trim(Hex(559)) & ")'s size (" & Trim(Str(graphics.getgitemsize(559))) & ")is not 3086.", -1)
        End If
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        If graphics.getgitemsize(560) <> 1256 Then
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            cw.CheckList.Items.Add("Error: Item #" & Trim(Str(560)) & " (0x" & Trim(Hex(560)) & ")'s size (" & Trim(Str(graphics.getgitemsize(560))) & ")is not 1256.", -1)
        End If
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        If graphics.getgitemsize(561) <> 2052 Then
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            cw.CheckList.Items.Add("Error: Item #" & Trim(Str(561)) & " (0x" & Trim(Hex(561)) & ")'s size (" & Trim(Str(graphics.getgitemsize(561))) & ")is not 2052.", -1)
        End If
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        If graphics.getgitemsize(562) <> 1826 Then
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            cw.CheckList.Items.Add("Error: Item #" & Trim(Str(562)) & " (0x" & Trim(Hex(562)) & ")'s size (" & Trim(Str(graphics.getgitemsize(562))) & ")is not 1826.", -1)
        End If

        If cw.CheckList.Items.Count = 0 Then
            cw.CheckList.Items.Add("No problems found.", -1)
        End If
    End Sub

    'UPGRADE_NOTE: mapfile was upgraded to mapfile_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Private Sub ItemList_ClickEvent(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles ItemList.Click
        StatusBar.Items.Item(0).Text = "Item #" & zerostr(ItemList.FocusedItem.Index, 4) & " 0x" & zerohex((ItemList.FocusedItem.Index), 4)
        StatusBar.Items.Item(1).Text = mapfile.getname(ItemList.FocusedItem.Index)
        If mapfile.gettype_Renamed(ItemList.FocusedItem.Index) = "IMG1" Then
            StatusBar.Items.Item(2).Text = Trim(Str(graphics.getgbitmapwidth(ItemList.FocusedItem.Index))) & "x" & Trim(Str(graphics.getgbitmapheight(ItemList.FocusedItem.Index)))
        Else
            StatusBar.Items.Item(2).Text = ""
        End If
    End Sub

    'UPGRADE_NOTE: mapfile was upgraded to mapfile_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Private Sub ItemList_MouseDownEvent(ByVal eventSender As System.Object, ByVal eventArgs As MouseEventArgs)
        'Dim cursorx As Integer = eventArgs.X
        'Dim cursory As Integer = eventArgs.Y
        'Dim newindex As Short
        '
        'If graphics.bytes = 0 Then
        'Exit Sub
        'End If
        '
        'If cursory < 0 Or cursory > ItemList.Height Or cursorx < 0 Or cursorx > ItemList.Width Then
        'Exit Sub
        'End If
        'Dim inum As Integer
        'Dim itype As String
        'If eventArgs.Button = 2 Then
        ''Y = Y * 1.35
        ''UPGRADE_WARNING: Couldn't resolve default property of object ItemList.TopIndex. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        'newindex = ItemList.TopItem.Index()
        'While (cursory > 9.75)
        '7cursory = cursory - 9.75
        'newindex = newindex + 1
        'End While
        'If newindex > ItemList.Items.Count Then
        'newindex = ItemList.Items.Count
        'ElseIf newindex < 0 Then
        'newindex = 0
        'End If
        '
        'ItemList.Items(newindex).Focused = True
        '
        ''UPGRADE_WARNING: Couldn't resolve default property of object ItemList.ListIndex. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        'inum = ItemList.FocusedItem.Index
        ''UPGRADE_WARNING: Couldn't resolve default property of object mapfile.gettype. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        'itype = mapfile.gettype_Renamed(inum)
        '
        'If itype = "IMG1" Then
        'ExportIMG1.Enabled = True
        'Else
        'ExportIMG1.Enabled = False
        'End If
        '
        ''UPGRADE_ISSUE: Constant vbPopupMenuLeftAlign was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="55B59875-9A95-4B71-9D6A-7C294BF7139D"'
        ''UPGRADE_ISSUE: Form method MainWindow.PopupMenu was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
        'Dim M As ContextMenuStrip = New ContextMenuStrip
        'M.Items.Add(RightClickMenu)
        'M.Show()
        'End If
    End Sub

    'UPGRADE_NOTE: mapfile was upgraded to mapfile_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Private Sub ExportIMG_Click(ByVal sender As Object, ByVal eventArgs As EventArgs) Handles ExportIMG1.Click
        Dim itemnum As Integer

        'UPGRADE_WARNING: Couldn't resolve default property of object ItemList.ListIndex. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        itemnum = ItemList.FocusedItem.Index
        Dim sfile As String

        Dim dlg As New SaveFileDialog
        'UPGRADE_WARNING: CommonDialog variable was not upgraded Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="671167DC-EA81-475D-B690-7A40C7BF4A23"'
        With dlg
            On Error GoTo canceled
            .Title = "Export IMG"
            'UPGRADE_WARNING: The CommonDialog CancelError property is not supported in Visual Basic .NET. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="8B377936-3DF7-4745-AA26-DD00FA5B9BE1"'
            '.CancelError = True
            'UPGRADE_WARNING: MSComDlg.CommonDialog property dlg.Flags was upgraded to dlgSave.OverwritePrompt which has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="DFCDE711-9694-47D7-9C50-45A99CD8E91E"'
            .OverwritePrompt = True
            'ToDo: set the flags and attributes of the common dialog control
            'UPGRADE_WARNING: Filter has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
            .Filter = "*.bmp|*.bmp|All Files (*.*)|*.*||"
            'UPGRADE_WARNING: Couldn't resolve default property of object mapfile.getname. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            .FileName = CStr((zerostr(itemnum, 4) & " ") + mapfile.getname(itemnum) + (".bmp"))
            If .ShowDialog() <> Windows.Forms.DialogResult.OK Then Error 1
            On Error GoTo 0
            'UPGRADE_WARNING: CommonDialog property dlg.FileTitle was upgraded to dlg.FileName which has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="DFCDE711-9694-47D7-9C50-45A99CD8E91E"'
            If Len((New System.IO.DirectoryInfo(.FileName)).Name) = 0 Then
                Exit Sub
            End If
            sfile = .FileName
            'curlevel = 0
        End With
        App.graphics.kkspec_gexport_img1_type2(itemnum, sfile, 0)
        'App.graphics.export_img1 graphics.itemstr(itemnum), sfile, False
canceled:
    End Sub
    'UPGRADE_NOTE: mapfile was upgraded to mapfile_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Public Sub ExportRAW_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles ExportRAW.Click
        Dim itemnum As Integer

        'UPGRADE_WARNING: Couldn't resolve default property of object ItemList.ListIndex. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        itemnum = ItemList.FocusedItem.Index
        Dim sfile As String

        Dim dlg As New SaveFileDialog
        'UPGRADE_WARNING: CommonDialog variable was not upgraded Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="671167DC-EA81-475D-B690-7A40C7BF4A23"'
        With dlg
            On Error GoTo canceled
            .Title = "Export RAW"
            'UPGRADE_WARNING: The CommonDialog CancelError property is not supported in Visual Basic .NET. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="8B377936-3DF7-4745-AA26-DD00FA5B9BE1"'
            '.CancelError = True
            'UPGRADE_WARNING: MSComDlg.CommonDialog property dlg.Flags was upgraded to dlgSave.OverwritePrompt which has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="DFCDE711-9694-47D7-9C50-45A99CD8E91E"'
            .OverwritePrompt = True
            'ToDo: set the flags and attributes of the common dialog control
            'UPGRADE_WARNING: Filter has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
            .Filter = "*.dat|*.dat|All Files (*.*)|*.*"
            'UPGRADE_WARNING: Couldn't resolve default property of object mapfile.getname. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            .FileName = CStr((zerostr(itemnum, 4) & " ") + mapfile.getname(itemnum) + (".dat"))
            If .ShowDialog() <> Windows.Forms.DialogResult.OK Then Error 1
            On Error GoTo 0
            If Len(.FileName) = 0 Then
                Exit Sub
            End If
            sfile = .FileName
            'curlevel = 0

            'itemnum = itemnum - 1
            'shouldnt need this...
            'If itemnum = 556 Then
            '    f556.update
            'ElseIf itemnum = 558 Then
            '    f558.update
            'ElseIf itemnum = 559 Then
            '    f559.update
            'ElseIf itemnum = 560 Then
            '    f560.update
            'End If

            App.graphics.gexport_raw(itemnum, sfile)
            'App.graphics.export_raw graphics.itemstr(itemnum + 1), sfile
canceled:

        End With

    End Sub
    'UPGRADE_NOTE: mapfile was upgraded to mapfile_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Public Sub ImportRAW_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles ImportRAW.Click
        Dim itemnum As Integer

        'UPGRADE_WARNING: Couldn't resolve default property of object ItemList.ListIndex. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        itemnum = ItemList.FocusedItem.Index
        Dim sfile As String

        Dim dlg As New OpenFileDialog
        'UPGRADE_WARNING: CommonDialog variable was not upgraded Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="671167DC-EA81-475D-B690-7A40C7BF4A23"'
        With dlg
            On Error GoTo canceled
            .Title = "Import RAW"
            'UPGRADE_WARNING: The CommonDialog CancelError property is not supported in Visual Basic .NET. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="8B377936-3DF7-4745-AA26-DD00FA5B9BE1"'
            '.CancelError = True
            'ToDo: set the flags and attributes of the common dialog control
            'UPGRADE_WARNING: Filter has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
            .Filter = "*.dat|*.dat|All Files (*.*)|*.*||"
            'UPGRADE_WARNING: Couldn't resolve default property of object mapfile.getname. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            .FileName = CStr((zerostr(itemnum, 4) & " ") + mapfile.getname(itemnum) + (".dat"))
            If .ShowDialog() <> Windows.Forms.DialogResult.OK Then Error 1
            On Error GoTo 0
            If Len(.FileName) = 0 Then
                Exit Sub
            End If
            sfile = .FileName
            'curlevel = 0
        End With

        Dim newstr As New MemoryStream
        Dim newlen As Integer
        Dim newtype As String

        newlen = App.graphics.import_raw(newstr, sfile)
        'UPGRADE_WARNING: Couldn't resolve default property of object mapfile.gettype. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        newtype = mapfile.gettype_Renamed(itemnum)
        'graphics.setitemstr itemnum, newstr
        'graphics.setitemsize itemnum, newlen
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.setgitemdata. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        graphics.setgitemdata(itemnum, newstr)
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.setgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        graphics.setgitemsize(itemnum, newlen)
        If newtype = "IMG1" Then
            'graphics.reloadgraphic itemnum, 0
            'instead, build a new bmp for it
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.buildbmp. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.buildbmp(itemnum)
        End If

        itemnum = itemnum

        If itemnum = 556 Then
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f556. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f556.itemdata = newstr
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f556. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f556.itemlen = newlen
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f556. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f556.read()
        ElseIf itemnum = 558 Then
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f558.itemdata = newstr
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f558.itemloc = 0
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f558.read()
        ElseIf itemnum = 559 Then
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f559. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f559.itemdata = newstr
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f559. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f559.itemloc = 0
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f559. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f559.read()
        ElseIf itemnum = 560 Then
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f560. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f560.itemdata = newstr
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f560. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f560.itemloc = 0
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f560. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f560.read()
        ElseIf itemnum = 561 Then
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f561. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f561.itemdata = newstr
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f561. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f561.itemloc = 0
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f561. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f561.read()
            'ElseIf itemnum = 562 Then
            '    graphics.f562.itemdata = itemstrs(563)
            '    graphics.f562.itemlen = itemsizes(563)
            '    graphics.f562.read
        ElseIf itemnum = 562 Then
            graphics.f562.itemdata = newstr
            graphics.f562.read()
        End If

canceled:
    End Sub

    Private Sub Options_Click()
        Dim dlg_options As New Options
        dlg_options.Show()

    End Sub

    Public Sub Save_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Save.Click
        savefile(openfname)
    End Sub

    Public Sub Attacks_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Attacks.Click
        App.dlg_attackeditor.Show()
        App.dlg_attackeditor.init()
    End Sub

    Public Sub Combos_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Combos.Click
        App.dlg_comboeditor.init()
        App.dlg_comboeditor.Show()

    End Sub

    Public Sub Doors_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Doors.Click
        App.dlg_dooreditor.init()
        App.dlg_dooreditor.Show()
    End Sub
    Public Sub ImportManager_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles ImportManager.Click
        App.dlg_importmanager.init()
        App.dlg_importmanager.Show()
    End Sub
    Public Sub GraphicsStructure_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles GraphicsStructure.Click
        App.dlg_graphicsstructure.init()
        App.dlg_graphicsstructure.ptrmainwindow = Me
        App.dlg_graphicsstructure.Show()
    End Sub
    Public Sub GIMonsters_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles GIMonsters.Click
        App.dlg_monstergraphicinfoeditor.init()
        App.dlg_monstergraphicinfoeditor.Show()
    End Sub
    Public Sub GIItems_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles GIItems.Click
        App.dlg_itemgraphicinfoeditor.init()
        App.dlg_itemgraphicinfoeditor.Show()
    End Sub
    Public Sub GIdoordecorations_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles GIdoordecorations.Click
        App.dlg_doordecorationgraphicinfoeditor.init()
        App.dlg_doordecorationgraphicinfoeditor.Show()
    End Sub
    Public Sub GIfloordecorations_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles GIfloordecorations.Click
        App.dlg_floordecorationgraphicinfoeditor.Show()
        App.dlg_floordecorationgraphicinfoeditor.init()
    End Sub
    Public Sub GIwalldecorations_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles GIwalldecorations.Click
        App.dlg_walldecorationgraphicinfoeditor.init()
        App.dlg_walldecorationgraphicinfoeditor.Show()
    End Sub
    Public Sub GIbuttons_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles GIbuttons.Click
        App.dlg_buttongraphicinfoeditor.init()
        App.dlg_buttongraphicinfoeditor.Show()
    End Sub
    Public Sub giclickablebuttons_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles giclickablebuttons.Click
        App.dlg_buttoneditor.init()
        App.dlg_buttoneditor.Show()
    End Sub
    Public Sub GIMissiles_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles GIMissiles.Click
        App.dlg_missilegraphicinfoeditor.init()
        App.dlg_missilegraphicinfoeditor.Show()
    End Sub
    Public Sub GICreatures_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles GICreatures.Click
        App.dlg_creaturegraphicinfoeditor.Show()
        App.dlg_creaturegraphicinfoeditor.init()
    End Sub
    Public Sub GIFloorItems_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles GIFloorItems.Click
        App.dlg_flooritemgraphicinfoeditor.Show()
        App.dlg_flooritemgraphicinfoeditor.init()
    End Sub
    Public Sub GITeleporterInfo_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles GITeleporterInfo.Click
        App.dlg_teleporterinfoeditor.init()
        App.dlg_teleporterinfoeditor.Show()
    End Sub
    Public Sub GIGraphicRectInfo_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles GIGraphicRectInfo.Click
        App.dlg_graphicrectinfoeditor.init()
        App.dlg_graphicrectinfoeditor.Show()
    End Sub
    'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Public Sub ExportCSBWinObjNames_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles ExportCSBWinObjNames.Click
        Dim i As Short
        Dim stra As String
        Dim strb As String
        Dim dlg As New SaveFileDialog
        'UPGRADE_WARNING: CommonDialog variable was not upgraded Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="671167DC-EA81-475D-B690-7A40C7BF4A23"'
        With dlg
            On Error GoTo canceled
            .Title = "Save as..."
            'UPGRADE_WARNING: The CommonDialog CancelError property is not supported in Visual Basic .NET. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="8B377936-3DF7-4745-AA26-DD00FA5B9BE1"'
            '.CancelError = True
            'UPGRADE_WARNING: MSComDlg.CommonDialog property dlg.Flags was upgraded to dlgSave.OverwritePrompt which has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="DFCDE711-9694-47D7-9C50-45A99CD8E91E"'
            .OverwritePrompt = True
            'ToDo: set the flags and attributes of the common dialog control
            'UPGRADE_WARNING: Filter has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
            .Filter = "*.txt|*.txt|All Files (*.*)|*.*||"
            .FileName = "objnames.txt"
            If .ShowDialog() <> Windows.Forms.DialogResult.OK Then Error 1
            On Error GoTo 0
            If Len(.FileName) = 0 Then
                Exit Sub
            End If
            'savefile (.FileName)
            'curlevel = 0

            FileOpen(4, .FileName, OpenMode.Output)

            PrintLine(4, "## objnames.txt file for CSBWin")
            PrintLine(4, "## Exported by ADGE")
            PrintLine(4, "## Note: Some items may have similar names")
            PrintLine(4, "##")


            For i = 1 To 180
                'MsgBox "i=" + Str(i) + "(" + graphics.f556.objstring(graphics.f559.obj(i).ItemType + 1) + "," + App.CSBWinObjName(i)
                'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f559. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f556. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                'UPGRADE_WARNING: Couldn't resolve default property of object stra. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                stra = graphics.f556.objstring(graphics.f559.obj(i).ItemType + 1)
                strb = App.CSBWinObjName(i)
                If i = 133 Then
                    'put PARTY after bones, no matter what the name to distinguish.
                    stra = stra + "(PARTY)"
                End If
                If stra <> strb Then
                    PrintLine(4, strb & ", " + stra)
                End If
            Next
            FileClose(4)
        End With
canceled:

    End Sub
    Public Sub Exit_Renamed_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Exit_Renamed.Click
        Me.Close()
    End Sub

    'UPGRADE_WARNING: Event MainWindow.Resize may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
    Private Sub MainWindow_Resize(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Resize
        'Dim newwidth As Integer
        'Dim newheight As Integer
        'ItemList.Width = Me.ClientRectangle.Width - 16
        ''ItemList.height = Me.ScaleHeight - 20 - 16
        'newheight = Me.ClientRectangle.Height - 20 - 16
        'newheight = newheight - (newheight Mod 13)
        'newheight = newheight + 5
        'ItemList.Height = newheight
        '
        'newwidth = ItemList.Width - 264
        'If newwidth < 16 Then
        '    newwidth = 16
        'End If
        'newwidth = newwidth * 3 / 4
        ''ItemList.ColumnWidths = "30 pt;38 pt;" & Str(newwidth) & " pt;34 pt;40 pt;48 pt"
        ''UPGRADE_WARNING: Lower bound of collection StatusBar.Panels has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
        'newwidth = Me.ClientRectangle.Width - StatusBar.Items.Item(3).Width - StatusBar.Items.Item(1).Width - 20
        'If newwidth < 16 Then
        '    newwidth = 16
        'End If
        ''UPGRADE_WARNING: Lower bound of collection StatusBar.Panels has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
        'StatusBar.Items.Item(2).Width = newwidth
    End Sub

    'UPGRADE_NOTE: mapfile was upgraded to mapfile_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Private Sub MainWindow_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
        openfname = ""
        'openfile ("graphics.dat")
        'UPGRADE_WARNING: Couldn't resolve default property of object mapfile.File. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        mapfile.File = App.apppath & "\dm.map"
        'UPGRADE_WARNING: Couldn't resolve default property of object mapfile.read. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        mapfile.read()
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.mainwin. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        graphics.mainwin = Me
        'StatusBar.Items.Clear()
        ''UPGRADE_WARNING: MSComctlLib.Panels method StatusBar.Panels.add has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6BA9B8D2-2A32-4B6E-8D36-44949974A5B4"'
        'StatusBar.Items.Add(New System.Windows.Forms.ToolStripStatusLabel())
        ''UPGRADE_WARNING: MSComctlLib.Panels method StatusBar.Panels.add has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6BA9B8D2-2A32-4B6E-8D36-44949974A5B4"'
        'StatusBar.Items.Add(New System.Windows.Forms.ToolStripStatusLabel())
        ''UPGRADE_WARNING: MSComctlLib.Panels method StatusBar.Panels.add has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6BA9B8D2-2A32-4B6E-8D36-44949974A5B4"'
        'StatusBar.Items.Add(New System.Windows.Forms.ToolStripStatusLabel())
        ''UPGRADE_WARNING: Lower bound of collection StatusBar.Panels has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
        'StatusBar.Items.Item(1).Width = VB6.TwipsToPixelsX(120)
        ''UPGRADE_WARNING: Lower bound of collection StatusBar.Panels has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
        'StatusBar.Items.Item(2).Width = VB6.TwipsToPixelsX(Me.ClientRectangle.Width - VB6.PixelsToTwipsX(StatusBar.Items.Item(3).Width) - VB6.PixelsToTwipsX(StatusBar.Items.Item(1).Width) - 20)
        ''UPGRADE_WARNING: Lower bound of collection StatusBar.Panels has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
        'StatusBar.Items.Item(3).Width = VB6.TwipsToPixelsX(50)
    End Sub

    'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Private Sub MainWindow_FormClosed(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        App.dlg_progresswindow.Close()
        App.dlg_objectlist.Close()
        App.dlg_itemtypeeditor.Close()
        App.dlg_comboeditor.Close()
        App.dlg_attackeditor.Close()
        App.dlg_dooreditor.Close()
        App.dlg_monsterdropeditor.Close()
        App.dlg_spelleditor.Close()
        App.dlg_runeeditor.Close()
        App.dlg_monstereditor.Close()
        App.dlg_importmanager.Close()
        App.dlg_graphicsstructure.Close()

        App.dlg_floordecorationgraphicinfoeditor.Close()
        App.dlg_walldecorationgraphicinfoeditor.Close()
        App.dlg_doordecorationgraphicinfoeditor.Close()
        App.dlg_buttongraphicinfoeditor.Close()
        App.dlg_buttoneditor.Close()
        App.dlg_itemgraphicinfoeditor.Close()
        App.dlg_monstergraphicinfoeditor.Close()
        App.dlg_missilegraphicinfoeditor.Close()
        App.dlg_flooritemgraphicinfoeditor.Close()
        App.dlg_creaturegraphicinfoeditor.Close()
        App.dlg_teleporterinfoeditor.Close()
        App.dlg_graphicrectinfoeditor.Close()

        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.unload. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        graphics.unload()

        App.debug_deinit()
    End Sub

    'UPGRADE_NOTE: mapfile was upgraded to mapfile_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Private Sub ItemList_DblClick(ByVal eventSender As System.Object, ByVal eventArgs As EventArgs) Handles ItemList.DoubleClick
        Dim itemnum As Short
        Dim ItemType As String

        Dim dlg_texteditor As TextEditor
        Dim dlg_hexeditor As HexEditor
        Dim dlg_graphiceditor As GraphicEditor

        'UPGRADE_WARNING: Couldn't resolve default property of object ItemList.ListIndex. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        itemnum = ItemList.FocusedItem.Index
        'UPGRADE_WARNING: Couldn't resolve default property of object mapfile.gettype. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        ItemType = mapfile.gettype_Renamed(itemnum)

        If ItemType = "TXT1" Then
            dlg_texteditor = New TextEditor
            dlg_texteditor.itemnum = itemnum
            dlg_texteditor.init()
            dlg_texteditor.Show()
        ElseIf ItemType = "IMG1" Then

            dlg_graphiceditor = New GraphicEditor
            dlg_graphiceditor.itemnum = itemnum
            dlg_graphiceditor.Show()
            dlg_graphiceditor.init()
            dlg_graphiceditor.Cancel.Focus() 'stops crashes somehow.

        Else
            dlg_hexeditor = New HexEditor
            dlg_hexeditor.itemnum = itemnum
            dlg_hexeditor.init()
            dlg_hexeditor.Show()
        End If

    End Sub

    Public Sub ItemTypes_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles ItemTypes.Click
        App.dlg_itemtypeeditor.init()
        App.dlg_itemtypeeditor.Show()
    End Sub

    Public Sub MonsterDrops_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MonsterDrops.Click
        App.dlg_monsterdropeditor.init()
        App.dlg_monsterdropeditor.Show()

    End Sub

    Public Sub monsters_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles monsters.Click
        App.dlg_monstereditor.init()
        App.dlg_monstereditor.Show()

    End Sub

    Public Sub Runes_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Runes.Click
        App.dlg_runeeditor.init()
        App.dlg_runeeditor.Show()
    End Sub

    Public Sub SaveAs_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles SaveAs.Click

        Dim dlg As New SaveFileDialog
        'UPGRADE_WARNING: CommonDialog variable was not upgraded Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="671167DC-EA81-475D-B690-7A40C7BF4A23"'
        With dlg
            On Error GoTo canceled
            .Title = "Save as..."
            .FileName = "graphics.dat"
            'UPGRADE_WARNING: The CommonDialog CancelError property is not supported in Visual Basic .NET. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="8B377936-3DF7-4745-AA26-DD00FA5B9BE1"'
            '.CancelError = True
            'UPGRADE_WARNING: MSComDlg.CommonDialog property dlg.Flags was upgraded to dlgSave.OverwritePrompt which has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="DFCDE711-9694-47D7-9C50-45A99CD8E91E"'
            .OverwritePrompt = True
            'ToDo: set the flags and attributes of the common dialog control
            'UPGRADE_WARNING: Filter has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
            .Filter = "*.dat|*.dat|All Files (*.*)|*.*||"
            If .ShowDialog() <> Windows.Forms.DialogResult.OK Then Error 1
            On Error GoTo 0
            If Len(.FileName) = 0 Then
                Exit Sub
            End If
            savefile(.FileName)
            openfname = .FileName
            'curlevel = 0
        End With
canceled:

    End Sub

    Public Sub spells_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles spells.Click
        App.dlg_spelleditor.init()
        App.dlg_spelleditor.Show()

    End Sub

    Public Sub Objects_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Objects.Click
        App.dlg_objectlist.Show()
        App.dlg_objectlist.init()
    End Sub

    Public Sub Open_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Open.Click
        Dim dlg As New OpenFileDialog
        'UPGRADE_WARNING: CommonDialog variable was not upgraded Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="671167DC-EA81-475D-B690-7A40C7BF4A23"'
        With dlg
            On Error GoTo canceled
            .Title = "Open"
            'UPGRADE_WARNING: The CommonDialog CancelError property is not supported in Visual Basic .NET. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="8B377936-3DF7-4745-AA26-DD00FA5B9BE1"'
            '.CancelError = True
            .FileName = ""
            'ToDo: set the flags and attributes of the common dialog control
            'UPGRADE_WARNING: Filter has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
            .Filter = "*.dat|*.dat|All Files (*.*)|*.*"
            If .ShowDialog() <> Windows.Forms.DialogResult.OK Then Error 1
            On Error GoTo 0
            If Len(.FileName) = 0 Then
                Exit Sub
            End If
            On Error GoTo 0
            openfile(.FileName)
            'curlevel = 0
        End With

canceled:

    End Sub

    'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Public Sub openfile(ByVal fname As String)
        Dim Ok As Boolean
        graphics.bytes = CInt(New IO.FileInfo(fname).Length)
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.File. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        graphics.File = fname
        dlg_progresswindow.Text = "Loading graphics.dat..."
        dlg_progresswindow.updateinterval = 8
        dlg_progresswindow.Show()
        'Ok = graphics.read


        'If Ok = False Then
        '    dlg_progresswindow.Hide
        '    MsgBox "Could not open file, not a valid atari graphics.dat format."
        '    Exit Function
        'End If

        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.gread. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        Ok = graphics.gread
        If Ok = False Then
            dlg_progresswindow.Hide()
            MsgBox("Could not open file, not a valid atari graphics.dat format.")
            Exit Sub
        End If



        openfname = fname

        inititemlist()

        Me.Save.Enabled = True
        Me.SaveAs.Enabled = True
        Me.ExportCSBWinObjNames.Enabled = True

        Me.ItemTypes.Enabled = True
        Me.Attacks.Enabled = True
        Me.Combos.Enabled = True
        Me.Objects.Enabled = True
        Me.MonsterDrops.Enabled = True
        Me.Monsters.Enabled = True
        Me.Doors.Enabled = True
        Me.Spells.Enabled = True
        Me.Runes.Enabled = True
        Me.ImportManager.Enabled = True
        'Me.GraphicsStructure.Enabled = True
        ' TODO: New editor enables on loading here
        Me.PaletteModifierToDisplayItemsInActionAreaToolStripMenuItem.Enabled = True
        Me.IngamePalettesEditorToolStripMenuItem.Enabled = True
        Me.IngamePalettesEditorSubToolStripMenuItem.Enabled = True

        Me.GIMonsters.Enabled = True
        Me.GIItems.Enabled = True
        Me.GIButtons.Enabled = True
        Me.GIClickableButtons.Enabled = True
        Me.GIDoorDecorations.Enabled = True
        Me.GIFloorDecorations.Enabled = True
        Me.GIWallDecorations.Enabled = True
        Me.GIMissiles.Enabled = True
        Me.GICreatures.Enabled = True
        Me.GIFloorItems.Enabled = True
        Me.GITeleporterInfo.Enabled = True
        Me.GIGraphicRectInfo.Enabled = True

        Me.CheckAll.Enabled = True
        Me.CheckGraphicSizes.Enabled = True
        Me.CheckItemSizes.Enabled = True
    End Sub

    'UPGRADE_NOTE: mapfile was upgraded to mapfile_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Public Sub inititemlist()
        dlg_progresswindow.Title.Text = "Adding items to list..."
        dlg_progresswindow.setcurrent((0))
        dlg_progresswindow.setmax(graphics.numitems)
        dlg_progresswindow.updateinterval = 10
        ItemList.Items.Clear()
        Dim i As Short

        For i = 0 To graphics.numitems - 1
            Dim lvi As ListViewItem = ItemList.Items.Add(zerostr(i, 4))
            dlg_progresswindow.setcurrent((i))
            lvi.SubItems.Add("0x" & zerohex(i, 4))
            'UPGRADE_WARNING: Couldn't resolve default property of object mapfile.getname. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            'UPGRADE_WARNING: Couldn't resolve default property of object ItemList.List(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            lvi.SubItems.Add(mapfile.getname(i))
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgitemsize. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            'UPGRADE_WARNING: Couldn't resolve default property of object ItemList.List(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            lvi.SubItems.Add(Str(graphics.getgitemsize(i)))
            'UPGRADE_WARNING: Couldn't resolve default property of object mapfile.gettype. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            'UPGRADE_WARNING: Couldn't resolve default property of object ItemList.List(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            lvi.SubItems.Add(mapfile.gettype_Renamed(i))
            'UPGRADE_WARNING: Couldn't resolve default property of object mapfile.gettype. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            If mapfile.gettype_Renamed(i) = "IMG1" Then
                '            ItemList.List(i, 5) = Trim(Str(graphics.itemint(i, 1))) + "x" + Trim(Str(graphics.itemint(i, 3)))
                'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgbitmapheight. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getgbitmapwidth. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                'UPGRADE_WARNING: Couldn't resolve default property of object ItemList.List(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                lvi.SubItems.Add(Trim(Str(graphics.getgbitmapwidth(i))) & "x" & Trim(Str(graphics.getgbitmapheight(i))))
            End If
        Next

        dlg_progresswindow.Hide()
    End Sub
    'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Public Sub savefile(ByVal fname As String)
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.File. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        graphics.File = fname
        'graphics.Save
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.gsave. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        graphics.gsave()


    End Sub


    Public Sub ViewasRAW_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles ViewasRAW.Click

        Dim itemnum As Short

        Dim dlg_hexeditor As HexEditor

        'UPGRADE_WARNING: Couldn't resolve default property of object ItemList.ListIndex. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        itemnum = ItemList.FocusedItem.Index
        dlg_hexeditor = New HexEditor
        dlg_hexeditor.itemnum = itemnum
        dlg_hexeditor.init()
        dlg_hexeditor.Show()

    End Sub

    Private Sub ContextMenuStrip1_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStrip1.Opening
        ExportIMG1.Enabled = Not (graphics.bytes = 0)
        ExportRAW.Enabled = Not (graphics.bytes = 0)
        ImportRAW.Enabled = Not (graphics.bytes = 0)
        ViewasRAW.Enabled = Not (graphics.bytes = 0)

        If graphics.bytes = 0 Then
            Exit Sub
        End If

        Dim inum As Integer
        Dim itype As String

        inum = ItemList.FocusedItem.Index
        itype = mapfile.gettype_Renamed(inum)

        ExportIMG1.Enabled = ExportIMG1.Enabled AndAlso (itype = "IMG1")
    End Sub

    Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
        Using Form As New AboutBox_ADGE
            Form.ShowDialog(Me)
        End Using
    End Sub

    Private Sub ItemList_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ItemList.SelectedIndexChanged
        If ItemList.FocusedItem Is Nothing Then Exit Sub

        ItemList_ClickEvent(sender, e)
    End Sub

    Private Sub ItemList_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ItemList.KeyPress
        Select e.KeyChar
            Case vbCr
                ItemList_DblClick(sender, e)
            Case Chr(32)
                ItemList.ContextMenuStrip.Show(ItemList, 0, 0)
        End Select
    End Sub

    Private Sub HexEditToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HexEditToolStripMenuItem.Click

    End Sub

    Private Sub PaletteModifierToDisplayItemsInActionAreaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PaletteModifierToDisplayItemsInActionAreaToolStripMenuItem.Click
        App.dlg_bytes20194editor.init()
        App.dlg_bytes20194editor.Show()
    End Sub

    Private Sub IngamePalettesEditorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IngamePalettesEditorToolStripMenuItem.Click
        App.dlg_ingamepaletteeditor.init()
        App.dlg_ingamepaletteeditor.Show()
    End Sub

    Private Sub IngamePalettesEditorSubToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IngamePalettesEditorSubToolStripMenuItem.Click
        App.dlg_ingamepaletteeditorsub.init()
        App.dlg_ingamepaletteeditorsub.Show()
    End Sub
End Class