├── .gitattributes
├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── .gitignore
├── CODE_OF_CONDUCT.md
├── DiskImageTool.sln
├── DiskImageTool
├── App.config
├── Assets
│ ├── License.txt
│ ├── bootsector.xml
│ ├── bootstrap.xml
│ └── floppyDisk.ico
├── Bitstream
│ ├── BitStreamImageBase.vb
│ ├── Bitstream.vb
│ ├── BitstreamDebug.vb
│ ├── BitstreamRegion.vb
│ ├── BitstreamRegionSector.vb
│ ├── BitstreamSector.vb
│ ├── Functions.vb
│ ├── IBM_MFM
│ │ ├── IBM_MFM_Bitstream.vb
│ │ ├── IBM_MFM_Sector.vb
│ │ ├── IBM_MFM_Tools.vb
│ │ └── IBM_MFM_Track.vb
│ └── Interfaces
│ │ ├── IBitstreamImage.vb
│ │ └── IBitstreamTrack.vb
├── BootstrapDB.vb
├── Controls
│ ├── HexTextBox.vb
│ ├── SelectablePanel.vb
│ ├── ToolStripCheckBox.vb
│ ├── ToolStripNumericUpDown.vb
│ └── ToolStripSpringTextBox.vb
├── CopyProtection.vb
├── CurrentImage.vb
├── DirectoryScanResponse.vb
├── DiskImage
│ ├── AddFileOptions.vb
│ ├── BasicSectorImage.vb
│ ├── BiosParameterBlock.vb
│ ├── BootSector.vb
│ ├── DataChange.vb
│ ├── DirectoryBase.vb
│ ├── DirectoryData.vb
│ ├── DirectoryEntry.vb
│ ├── DirectoryEntryBase.vb
│ ├── Disk.vb
│ ├── EpandedDate.vb
│ ├── FAT12.vb
│ ├── FATAllocation.vb
│ ├── FATChain.vb
│ ├── FATTables.vb
│ ├── ImageHistory.vb
│ ├── Interfaces
│ │ ├── IDirectory.vb
│ │ └── IFloppyImage.vb
│ ├── MappedFloppyImage.vb
│ ├── Modules
│ │ ├── CodePage437.vb
│ │ ├── EnumDescriptions.vb
│ │ ├── FloppyDiskFunctions.vb
│ │ ├── SharedFunctions.vb
│ │ ├── Structures.vb
│ │ └── UpdateFunctions.vb
│ ├── RootDirectory.vb
│ ├── SectorBlock.vb
│ ├── SectorData.vb
│ └── SubDirectory.vb
├── DiskImageTool.vbproj
├── Extensions
│ ├── ByteArrayExtensions.vb
│ ├── DataGridViewExtensions.vb
│ ├── ListViewExtensions.vb
│ ├── StringExtensions.vb
│ └── XMLExtensions.vb
├── FileData.vb
├── Filters
│ ├── ComboFilter.vb
│ ├── Enums.vb
│ ├── FilterCounts.vb
│ ├── FilterTag.vb
│ └── ImageFilters.vb
├── FloppyDB.vb
├── FloppyDB.xml
├── FloppyDiskIO.vb
├── FormControls.vb
├── Forms
│ ├── AboutBox.Designer.vb
│ ├── AboutBox.resx
│ ├── AboutBox.vb
│ ├── BootSectorForm.Designer.vb
│ ├── BootSectorForm.resx
│ ├── BootSectorForm.vb
│ ├── DeleteFileform.Designer.vb
│ ├── DeleteFileform.resx
│ ├── DeleteFileform.vb
│ ├── Derived
│ │ ├── FilePropertiesFormMultiple.resx
│ │ ├── FilePropertiesFormMultiple.vb
│ │ ├── FilePropertiesFormSingle.vb
│ │ └── NewDirectoryForm.vb
│ ├── FATEditForm.Designer.vb
│ ├── FATEditForm.resx
│ ├── FATEditForm.vb
│ ├── FileDropForm.Designer.vb
│ ├── FileDropForm.resx
│ ├── FileDropForm.vb
│ ├── FilePropertiesForm.Designer.vb
│ ├── FilePropertiesForm.resx
│ ├── FilePropertiesForm.vb
│ ├── FloppyAccessForm.Designer.vb
│ ├── FloppyAccessForm.resx
│ ├── FloppyAccessForm.vb
│ ├── FloppyReadOptionsForm.Designer.vb
│ ├── FloppyReadOptionsForm.resx
│ ├── FloppyReadOptionsForm.vb
│ ├── FloppyWriteOptionsForm.Designer.vb
│ ├── FloppyWriteOptionsForm.resx
│ ├── FloppyWriteOptionsForm.vb
│ ├── HexSearchForm.Designer.vb
│ ├── HexSearchForm.resx
│ ├── HexSearchForm.vb
│ ├── HexViewForm.Designer.vb
│ ├── HexViewForm.resx
│ ├── HexViewForm.vb
│ ├── HexViewRawForm.Designer.vb
│ ├── HexViewRawForm.resx
│ ├── HexViewRawForm.vb
│ ├── ImageCreationForm.Designer.vb
│ ├── ImageCreationForm.resx
│ ├── ImageCreationForm.vb
│ ├── ImageLoadForm.Designer.vb
│ ├── ImageLoadForm.resx
│ ├── ImageLoadForm.vb
│ ├── ImportFileForm.Designer.vb
│ ├── ImportFileForm.resx
│ ├── ImportFileForm.vb
│ ├── ItemScanForm.Designer.vb
│ ├── ItemScanForm.resx
│ ├── ItemScanForm.vb
│ ├── ReplaceFileForm.Designer.vb
│ ├── ReplaceFileForm.resx
│ ├── ReplaceFileForm.vb
│ ├── SaveAllForm.Designer.vb
│ ├── SaveAllForm.resx
│ ├── SaveAllForm.vb
│ ├── TextViewForm.Designer.vb
│ ├── TextViewForm.resx
│ ├── TextViewForm.vb
│ ├── UndeleteForm.Designer.vb
│ ├── UndeleteForm.resx
│ ├── UndeleteForm.vb
│ ├── VolumeSerialNumberForm.Designer.vb
│ ├── VolumeSerialNumberForm.resx
│ └── VolumeSerialNumberForm.vb
├── Github.vb
├── HexBox2
│ ├── BuiltInContextMenu.vb
│ ├── ByteCharConverters.vb
│ ├── ByteCollection.vb
│ ├── BytePositionInfo.vb
│ ├── DataBlock.vb
│ ├── DataMap.vb
│ ├── DynamicByteProvider.vb
│ ├── DynamicFileByteProvider.vb
│ ├── FileByteProvider.vb
│ ├── FileDataBlock.vb
│ ├── FindOptions.vb
│ ├── HexBox.vb
│ ├── HexCasing.vb
│ ├── IByteCharConverter.vb
│ ├── IByteProvider.vb
│ ├── MemoryDataBlock.vb
│ ├── NativeMethods.vb
│ └── Util.vb
├── HexView
│ ├── HexViewData.vb
│ ├── HexViewDataGridInspector.vb
│ ├── HexViewFunctions.vb
│ ├── HexViewHighlightRegion.vb
│ ├── HexViewRegionDescription.vb
│ ├── HexViewSectorData.vb
│ ├── HexViews.vb
│ ├── HighlightedRegions.vb
│ └── MyByteProvider.vb
├── ImageData.vb
├── ImageFormats
│ ├── 86F
│ │ ├── 86FFloppyImage.vb
│ │ ├── 86FImage.vb
│ │ ├── 86FLoader.vb
│ │ ├── 86FTrack.vb
│ │ ├── Enums.vb
│ │ └── Functions.vb
│ ├── HFE
│ │ ├── Enums.vb
│ │ ├── HFEFloppyImage.vb
│ │ ├── HFEImage.vb
│ │ ├── HFELoader.vb
│ │ └── HFETrack.vb
│ ├── IMD
│ │ ├── Enums.vb
│ │ ├── IMDFloppyImage.vb
│ │ ├── IMDImage.vb
│ │ ├── IMDLoader.vb
│ │ ├── IMDSector.vb
│ │ └── IMDTrack.vb
│ ├── ImageConversion.vb
│ ├── MFM
│ │ ├── MFMFloppyImage.vb
│ │ ├── MFMImage.vb
│ │ ├── MFMLoader.vb
│ │ └── MFMTrack.vb
│ ├── PRI
│ │ ├── Enums.vb
│ │ ├── PRIAltBitClock.vb
│ │ ├── PRIChunk.vb
│ │ ├── PRIFileHeader.vb
│ │ ├── PRIFloppyImage.vb
│ │ ├── PRIImage.vb
│ │ ├── PRILoader.vb
│ │ └── PRITrack.vb
│ ├── PSI
│ │ ├── Enums.vb
│ │ ├── GCRSectorHeader.vb
│ │ ├── IBMSectorHeader.vb
│ │ ├── PSIChunk.vb
│ │ ├── PSIFileHeader.vb
│ │ ├── PSIFloppyImage.vb
│ │ ├── PSILoader.vb
│ │ ├── PSISector.vb
│ │ ├── PSISectorImage.vb
│ │ └── PSITrackInfo.vb
│ └── TC
│ │ ├── Enums.vb
│ │ ├── TCLoader.vb
│ │ ├── TransCopyImage.vb
│ │ ├── TransCopyTrack.vb
│ │ └── TranscopyFloppyImage.vb
├── ImageIO.vb
├── Lib
│ ├── CRC32.vb
│ ├── CRC32Hash.vb
│ ├── FloppyInterface.vb
│ ├── HashFunctions.vb
│ ├── ListViewColumnSorter.vb
│ ├── ListViewHeader.vb
│ ├── MyBitConverter.vb
│ └── WindowsAPI.vb
├── LoadedFiles.vb
├── MainForm.Designer.vb
├── MainForm.resx
├── MainForm.vb
├── My Project
│ ├── Application.Designer.vb
│ ├── Application.myapp
│ ├── AssemblyInfo.vb
│ ├── Resources.Designer.vb
│ ├── Resources.resx
│ ├── Settings.Designer.vb
│ ├── Settings.settings
│ └── app.manifest
├── SummaryPanel.vb
├── Testing
│ ├── DebugScript.vb
│ └── ImageCompare.vb
├── Utility.vb
└── packages.config
├── LICENSE
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/DiskImageTool.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.10.35122.118
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DiskImageTool", "DiskImageTool\DiskImageTool.vbproj", "{953D9DDF-F8AA-4A81-9DDC-DC43B972FFE7}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {953D9DDF-F8AA-4A81-9DDC-DC43B972FFE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {953D9DDF-F8AA-4A81-9DDC-DC43B972FFE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {953D9DDF-F8AA-4A81-9DDC-DC43B972FFE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {953D9DDF-F8AA-4A81-9DDC-DC43B972FFE7}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {9659CFDA-931A-4DBC-9F12-B10A153F18B4}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/DiskImageTool/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | 0
15 |
16 |
17 | 0
18 |
19 |
20 | True
21 |
22 |
23 | False
24 |
25 |
26 | True
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | True
36 |
37 |
38 | True
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/DiskImageTool/Assets/floppyDisk.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Digitoxin1/DiskImageTool/baeae0e19ddc52c22c607930cb3c95ab4c5cad37/DiskImageTool/Assets/floppyDisk.ico
--------------------------------------------------------------------------------
/DiskImageTool/Bitstream/BitStreamImageBase.vb:
--------------------------------------------------------------------------------
1 | Namespace Bitstream
2 | Public MustInherit Class BitStreamImageBase
3 | Implements IBitstreamImage
4 |
5 | Public ReadOnly Property BitRate As UShort Implements IBitstreamImage.BitRate
6 | Get
7 | Return 0
8 | End Get
9 | End Property
10 |
11 | Public ReadOnly Property HasSurfaceData As Boolean Implements IBitstreamImage.HasSurfaceData
12 | Get
13 | Return False
14 | End Get
15 | End Property
16 |
17 | Public ReadOnly Property RPM As UShort Implements IBitstreamImage.RPM
18 | Get
19 | Return 0
20 | End Get
21 | End Property
22 |
23 | Public ReadOnly Property SideCount As Byte Implements IBitstreamImage.SideCount
24 | Get
25 | Return 0
26 | End Get
27 | End Property
28 |
29 | Public ReadOnly Property TrackCount As UShort Implements IBitstreamImage.TrackCount
30 | Get
31 | Return 0
32 | End Get
33 | End Property
34 |
35 | Public ReadOnly Property TrackStep As Byte Implements IBitstreamImage.TrackStep
36 | Get
37 | Return 1
38 | End Get
39 | End Property
40 |
41 | Public ReadOnly Property VariableBitRate As Boolean Implements IBitstreamImage.VariableBitRate
42 | Get
43 | Return False
44 | End Get
45 | End Property
46 |
47 | Public ReadOnly Property VariableRPM As Boolean Implements IBitstreamImage.VariableRPM
48 | Get
49 | Return False
50 | End Get
51 | End Property
52 |
53 | Public MustOverride Function Export(FilePath As String) As Boolean Implements IBitstreamImage.Export
54 |
55 | Public MustOverride Function Load(FilePath As String) As Boolean Implements IBitstreamImage.Load
56 |
57 | Public MustOverride Function Load(Buffer() As Byte) As Boolean Implements IBitstreamImage.Load
58 |
59 | Private Function IBitstreamTrack_GetTrack(Track As UShort, Side As Byte) As IBitstreamTrack Implements IBitstreamImage.GetTrack
60 | Return Nothing
61 | End Function
62 | End Class
63 | End Namespace
64 |
--------------------------------------------------------------------------------
/DiskImageTool/Bitstream/BitstreamRegion.vb:
--------------------------------------------------------------------------------
1 | Namespace Bitstream
2 | Namespace IBM_MFM
3 | Public Class BitstreamRegion
4 | Public Sub New(RegionType As MFMRegionType, StartIndex As UInteger, Length As UInteger, Sector As BitstreamRegionSector, BitOffset As UInteger)
5 | _RegionType = RegionType
6 | _StartIndex = StartIndex
7 | _Length = Length
8 | _Sector = Sector
9 | _BitOffset = BitOffset
10 | End Sub
11 |
12 | Public Property BitOffset As UInteger
13 | Public Property Length As UInteger
14 | Public Property RegionType As MFMRegionType
15 | Public Property Sector As BitstreamRegionSector
16 | Public Property StartIndex As UInteger
17 | End Class
18 | End Namespace
19 | End Namespace
20 |
--------------------------------------------------------------------------------
/DiskImageTool/Bitstream/BitstreamRegionSector.vb:
--------------------------------------------------------------------------------
1 | Namespace Bitstream
2 | Namespace IBM_MFM
3 | Public Class BitstreamRegionSector
4 | Public Property DAM As Byte
5 | Public Property DataChecksumValid As Boolean
6 | Public Property DataLength As UInteger
7 | Public Property DataStartIndex As UInteger
8 | Public Property Gap3 As UShort
9 | Public Property HasData As Boolean
10 | Public Property HasWeakBits As Boolean
11 | Public Property IDAMChecksumValid As Boolean
12 | Public Property Length As UInteger
13 | Public Property Overlaps As Boolean
14 | Public Property SectorId As Byte
15 | Public Property SectorIndex As UShort
16 | Public Property Side As Byte
17 | Public Property StartIndex As UInteger
18 | Public Property Track As Byte
19 | Public Property WriteSplice As Boolean
20 | End Class
21 | End Namespace
22 | End Namespace
23 |
--------------------------------------------------------------------------------
/DiskImageTool/Bitstream/BitstreamSector.vb:
--------------------------------------------------------------------------------
1 | Namespace Bitstream
2 | Public Class BitstreamSector
3 | Public Sub New(MFMSector As IBM_MFM.IBM_MFM_Sector, IsStandard As Boolean)
4 | _MFMSector = MFMSector
5 | _Data = MFMSector.Data
6 | _Size = MFMSector.GetSizeBytes
7 | _IsStandard = IsStandard
8 | End Sub
9 |
10 | Public Sub New(Data() As Byte, Size As UInteger, IsStandard As Boolean)
11 | _MFMSector = Nothing
12 | _Data = Data
13 | _Size = Size
14 | _IsStandard = IsStandard
15 | End Sub
16 |
17 | Public ReadOnly Property Data As Byte()
18 | Public Property IsStandard As Boolean
19 | Public ReadOnly Property MFMSector As IBM_MFM.IBM_MFM_Sector
20 | Public ReadOnly Property Size As UInteger
21 | End Class
22 | End Namespace
23 |
--------------------------------------------------------------------------------
/DiskImageTool/Bitstream/Interfaces/IBitstreamImage.vb:
--------------------------------------------------------------------------------
1 | Namespace Bitstream
2 | Public Interface IBitstreamImage
3 | ReadOnly Property BitRate As UShort
4 | ReadOnly Property HasSurfaceData As Boolean
5 | ReadOnly Property RPM As UShort
6 | ReadOnly Property SideCount As Byte
7 | ReadOnly Property TrackCount As UShort
8 | ReadOnly Property TrackStep As Byte
9 | ReadOnly Property VariableBitRate As Boolean
10 | ReadOnly Property VariableRPM As Boolean
11 | Function Export(FilePath As String) As Boolean
12 | Function GetTrack(Track As UShort, Side As Byte) As IBitstreamTrack
13 | Function Load(FilePath As String) As Boolean
14 | Function Load(Buffer() As Byte) As Boolean
15 | End Interface
16 | End Namespace
17 |
--------------------------------------------------------------------------------
/DiskImageTool/Bitstream/Interfaces/IBitstreamTrack.vb:
--------------------------------------------------------------------------------
1 | Namespace Bitstream
2 | Public Enum BitstreamTrackType
3 | MFM = 1
4 | FM = 2
5 | Other = 3
6 | End Enum
7 |
8 | Public Interface IBitstreamTrack
9 | ReadOnly Property BitRate As UInt16
10 | Property Bitstream As BitArray
11 | ReadOnly Property Decoded As Boolean
12 | Property MFMData As IBM_MFM.IBM_MFM_Track
13 | ReadOnly Property RPM As UInt16
14 | ReadOnly Property Side As Byte
15 | ReadOnly Property SurfaceData As BitArray
16 | ReadOnly Property Track As UShort
17 | ReadOnly Property TrackType As BitstreamTrackType
18 | End Interface
19 | End Namespace
20 |
--------------------------------------------------------------------------------
/DiskImageTool/Controls/SelectablePanel.vb:
--------------------------------------------------------------------------------
1 | Class SelectablePanel
2 | Inherits Panel
3 |
4 | Public Sub New()
5 | Me.SetStyle(ControlStyles.Selectable, True)
6 | Me.TabStop = True
7 | End Sub
8 |
9 | Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
10 | Me.Focus()
11 | MyBase.OnMouseDown(e)
12 | End Sub
13 |
14 | Protected Overrides Function IsInputKey(ByVal keyData As Keys) As Boolean
15 | If keyData = Keys.Up OrElse keyData = Keys.Down Then Return True
16 | If keyData = Keys.Left OrElse keyData = Keys.Right Then Return True
17 | Return MyBase.IsInputKey(keyData)
18 | End Function
19 |
20 | Protected Overrides Sub OnEnter(ByVal e As EventArgs)
21 | Me.Invalidate()
22 | MyBase.OnEnter(e)
23 | End Sub
24 |
25 | Protected Overrides Sub OnLeave(ByVal e As EventArgs)
26 | Me.Invalidate()
27 | MyBase.OnLeave(e)
28 | End Sub
29 |
30 | 'Protected Overrides Sub OnPaint(ByVal pe As PaintEventArgs)
31 | ' MyBase.OnPaint(pe)
32 |
33 | ' If Me.Focused Then
34 | ' Dim rc = Me.ClientRectangle
35 | ' rc.Inflate(-2, -2)
36 | ' ControlPaint.DrawFocusRectangle(pe.Graphics, rc)
37 | ' End If
38 | 'End Sub
39 | End Class
--------------------------------------------------------------------------------
/DiskImageTool/Controls/ToolStripCheckBox.vb:
--------------------------------------------------------------------------------
1 | Imports System.ComponentModel
2 | Imports System.Windows.Forms.Design
3 |
4 |
5 | Public Class ToolStripCheckBox
6 | Inherits MyToolStripControlHost
7 |
8 | Public Event CheckedChanged As EventHandler
9 |
10 | Public Sub New()
11 | MyBase.New(New System.Windows.Forms.CheckBox())
12 | CheckBox.BackColor = Color.Transparent
13 | End Sub
14 |
15 |
16 | Public ReadOnly Property CheckBox() As CheckBox
17 | Get
18 | Return CType(Control, CheckBox)
19 | End Get
20 | End Property
21 |
22 |
23 | Public Property Checked() As Boolean
24 | Get
25 | Return CheckBox.Checked
26 | End Get
27 | Set(ByVal value As Boolean)
28 | CheckBox.Checked = value
29 | End Set
30 | End Property
31 |
32 |
33 | Public Overrides Property Enabled() As Boolean
34 | Get
35 | Return CheckBox.Enabled
36 | End Get
37 | Set(ByVal value As Boolean)
38 | CheckBox.Enabled = value
39 | End Set
40 | End Property
41 |
42 | Public Overrides Property Text As String
43 | Get
44 | Return CheckBox.Text
45 | End Get
46 | Set(value As String)
47 | CheckBox.Text = value
48 | End Set
49 | End Property
50 |
51 | Protected Overrides Sub OnSubscribeControlEvents(ByVal c As Control)
52 | MyBase.OnSubscribeControlEvents(c)
53 |
54 | Dim CheckBoxControl As CheckBox = CType(c, CheckBox)
55 |
56 | AddHandler CheckBoxControl.CheckedChanged, AddressOf HandleCheckedChanged
57 | End Sub
58 |
59 | Protected Overrides Sub OnUnsubscribeControlEvents(ByVal c As Control)
60 | MyBase.OnUnsubscribeControlEvents(c)
61 |
62 | Dim CheckBoxControl As CheckBox = CType(c, CheckBox)
63 |
64 | RemoveHandler CheckBoxControl.CheckedChanged, AddressOf HandleCheckedChanged
65 | End Sub
66 |
67 | Private Sub HandleCheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
68 | RaiseEvent CheckedChanged(Me, e)
69 | End Sub
70 | End Class
--------------------------------------------------------------------------------
/DiskImageTool/Controls/ToolStripSpringTextBox.vb:
--------------------------------------------------------------------------------
1 | Imports System.ComponentModel
2 | Imports System.Windows.Forms.Design
3 |
4 |
5 | Public Class ToolStripSpringTextBox
6 | Inherits ToolStripTextBox
7 |
8 | Private _MaxWidth As Single
9 |
10 |
11 | Public Property MaxWidth As Single
12 | Get
13 | Return _MaxWidth
14 | End Get
15 | Set(value As Single)
16 | _MaxWidth = value
17 | End Set
18 | End Property
19 |
20 | Public Overrides Function GetPreferredSize(constrainingSize As Size) As Size
21 | ' Use the default size if the text box is on the overflow menu
22 | ' or is on a vertical ToolStrip.
23 | If IsOnOverflow Or Owner.Orientation = Orientation.Vertical Then
24 | Return DefaultSize
25 | End If
26 |
27 | ' Declare a variable to store the total available width as
28 | ' it is calculated, starting with the display width of the
29 | ' owning ToolStrip.
30 | Dim width As Int32 = Owner.DisplayRectangle.Width
31 |
32 | ' Subtract the width of the overflow button if it is displayed.
33 | If Owner.OverflowButton.Visible Then
34 | width = width - Owner.OverflowButton.Width -
35 | Owner.OverflowButton.Margin.Horizontal()
36 | End If
37 |
38 | ' Declare a variable to maintain a count of ToolStripSpringTextBox
39 | ' items currently displayed in the owning ToolStrip.
40 | Dim springBoxCount As Int32 = 0
41 |
42 | For Each item As ToolStripItem In Owner.Items
43 |
44 | ' Ignore items on the overflow menu.
45 | If item.IsOnOverflow Or Not item.Visible Then Continue For
46 |
47 | If TypeOf item Is ToolStripSpringTextBox Then
48 | ' For ToolStripSpringTextBox items, increment the count and
49 | ' subtract the margin width from the total available width.
50 | springBoxCount += 1
51 | width -= item.Margin.Horizontal
52 | Else
53 | ' For all other items, subtract the full width from the total
54 | ' available width.
55 | width = width - item.Width - item.Margin.Horizontal
56 | End If
57 | Next
58 |
59 | ' If there are multiple ToolStripSpringTextBox items in the owning
60 | ' ToolStrip, divide the total available width between them.
61 | If springBoxCount > 1 Then width = CInt(width / springBoxCount)
62 |
63 | ' If the available width is less than the default width, use the
64 | ' default width, forcing one or more items onto the overflow menu.
65 | If width < DefaultSize.Width Then width = DefaultSize.Width
66 |
67 | ' Retrieve the preferred size from the base class, but change the
68 | ' width to the calculated width.
69 | Dim preferredSize As Size = MyBase.GetPreferredSize(constrainingSize)
70 | If _MaxWidth > 0 And width > MaxWidth Then
71 | width = MaxWidth
72 | End If
73 | preferredSize.Width = width
74 |
75 | Return preferredSize
76 | End Function
77 | End Class
--------------------------------------------------------------------------------
/DiskImageTool/CurrentImage.vb:
--------------------------------------------------------------------------------
1 | Public Class CurrentImage
2 | Public Sub New(Disk As DiskImage.Disk, ImageData As ImageData)
3 | _Disk = Disk
4 | _ImageData = ImageData
5 | End Sub
6 |
7 | Public ReadOnly Property Disk As DiskImage.Disk
8 | Public ReadOnly Property ImageData As ImageData
9 | End Class
--------------------------------------------------------------------------------
/DiskImageTool/DiskImage/AddFileOptions.vb:
--------------------------------------------------------------------------------
1 | Namespace DiskImage
2 | Public Class AddFileOptions
3 | Public Property UseLFN As Boolean
4 | Public Property UseNTExtensions As Boolean
5 | Public Property UseCreatedDate As Boolean
6 | Public Property UseLastAccessedDate As Boolean
7 | End Class
8 | End Namespace
--------------------------------------------------------------------------------
/DiskImageTool/DiskImage/DataChange.vb:
--------------------------------------------------------------------------------
1 | Namespace DiskImage
2 | Public Enum DataChangeType
3 | Data
4 | Size
5 | End Enum
6 |
7 | Public Class DataChange
8 | Public Sub New(Type As DataChangeType, Offset As UInteger, OriginalValue As Object, NewValue As Object)
9 | Me.Type = Type
10 | Me.Offset = Offset
11 | Me.OriginalValue = OriginalValue
12 | Me.NewValue = NewValue
13 | End Sub
14 |
15 | Public Property NewValue As Object
16 | Public Property Offset As UInteger
17 | Public Property OriginalValue As Object
18 | Public Property Type As DataChangeType
19 | End Class
20 | End Namespace
21 |
--------------------------------------------------------------------------------
/DiskImageTool/DiskImage/DirectoryData.vb:
--------------------------------------------------------------------------------
1 | Namespace DiskImage
2 | Public Class DirectoryData
3 | Public Sub New(Level As UInteger)
4 | _Level = Level
5 | Clear()
6 | End Sub
7 |
8 | Public Property AvailableEntryCount As UInteger
9 | Public Property BootSectorOffset As UInteger
10 | Public Property DeletedFileCount As UInteger
11 | Public Property EndOfDirectory As Boolean
12 | Public Property EntryCount As UInteger
13 | Public Property FileCount As UInteger
14 | Public Property HasAdditionalData As Boolean
15 | Public Property HasBootSector As Boolean
16 | Public ReadOnly Property Level As UInteger
17 |
18 | Public Sub Clear()
19 | _AvailableEntryCount = 0
20 | _BootSectorOffset = 0
21 | _DeletedFileCount = 0
22 | _EntryCount = 0
23 | _FileCount = 0
24 | _HasAdditionalData = False
25 | _HasBootSector = False
26 | _EndOfDirectory = False
27 | End Sub
28 | End Class
29 | End Namespace
30 |
--------------------------------------------------------------------------------
/DiskImageTool/DiskImage/FATChain.vb:
--------------------------------------------------------------------------------
1 | Namespace DiskImage
2 | Public Class FATChain
3 | Public Sub New(DirectoryEntry As DirectoryEntry)
4 | _DirectoryEntry = DirectoryEntry
5 | End Sub
6 | Public Property Clusters As New List(Of UShort)
7 | Public Property CrossLinks As New List(Of DirectoryEntry)
8 | Public Property HasCircularChain As Boolean = False
9 | Public ReadOnly Property DirectoryEntry As DirectoryEntry
10 | Public Property OpenChain As Boolean = True
11 | End Class
12 | End Namespace
13 |
--------------------------------------------------------------------------------
/DiskImageTool/DiskImage/Interfaces/IDirectory.vb:
--------------------------------------------------------------------------------
1 | Namespace DiskImage
2 | Public Interface IDirectory
3 | ReadOnly Property ClusterChain As List(Of UShort)
4 | ReadOnly Property Data As DirectoryData
5 | ReadOnly Property DirectoryEntries As List(Of DirectoryEntry)
6 | ReadOnly Property Disk As Disk
7 | ReadOnly Property IsRootDirectory As Boolean
8 | ReadOnly Property ParentEntry As DirectoryEntry
9 | ReadOnly Property SectorChain As List(Of UInteger)
10 | Function AddDirectory(EntryData() As Byte, Options As AddFileOptions, Filename As String, Optional Index As Integer = -1) As AddFileData
11 | Function AddFile(FilePath As String, Options As AddFileOptions, Optional Index As Integer = -1) As Integer
12 | Function AddFile(FileInfo As IO.FileInfo, Options As AddFileOptions, Optional Index As Integer = -1) As Integer
13 | Function FindFileName(Filename As String, IncludeDirectories As Boolean, Optional SkipIndex As Integer = -1) As Integer
14 | Function FindShortFileName(FileBytes() As Byte, IncludeDirectories As Boolean, Optional SkipIndex As Integer = -1) As Integer
15 | Function FindShortFileName(Filename As String, IncludeDirectories As Boolean, Optional SkipIndex As Integer = -1) As Integer
16 | Function GetAvailableEntry() As DirectoryEntry
17 | Function GetAvailableFileName(FileName As String, Optional CurrentIndex As Integer = -1) As String
18 | Function GetAvailableShortFileName(FileName As String, UseNTExtensions As Boolean, Optional CurrentIndex As Integer = -1) As String
19 | Function GetContent() As Byte()
20 | Function GetFile(Index As UInteger) As DirectoryEntry
21 | Function GetIndex(DirectoryEntry As DirectoryEntry) As Integer
22 | Function RemoveEntry(Index As UInteger) As Boolean
23 | Function RemoveLFN(Index As UInteger) As Boolean
24 | Sub UpdateEntryCounts()
25 | Function UpdateLFN(FileName As String, Index As Integer, UseNTExtensions As Boolean) As Boolean
26 | End Interface
27 | End Namespace
28 |
--------------------------------------------------------------------------------
/DiskImageTool/DiskImage/Interfaces/IFloppyImage.vb:
--------------------------------------------------------------------------------
1 | Imports DiskImageTool.Bitstream
2 |
3 | Namespace DiskImage
4 | Public Enum FloppyImageType
5 | BasicSectorImage
6 | TranscopyImage
7 | PRIImage
8 | PSIImage
9 | MFMImage
10 | D86FImage
11 | HFEImage
12 | IMDImage
13 | End Enum
14 |
15 | Public Interface IFloppyImage
16 | ReadOnly Property AdditionalTracks As HashSet(Of UShort)
17 | ReadOnly Property BitstreamImage As IBitstreamImage
18 | ReadOnly Property BytesPerSector As UInteger
19 | ReadOnly Property CanResize As Boolean
20 | ReadOnly Property HasWeakBitsSupport As Boolean
21 | ReadOnly Property HasWeakBits As Boolean
22 | ReadOnly Property History As ImageHistory
23 | ReadOnly Property ImageType As FloppyImageType
24 | ReadOnly Property IsBitstreamImage As Boolean
25 | ReadOnly Property Length As Integer
26 | ReadOnly Property NonStandardTracks As HashSet(Of UShort)
27 | ReadOnly Property ProtectedSectors As HashSet(Of UInteger)
28 | ReadOnly Property SideCount As Byte
29 | ReadOnly Property TrackCount As UShort
30 | Sub Append(Data() As Byte)
31 | Sub CopyTo(SourceIndex As Integer, ByRef DestinationArray() As Byte, DestinationIndex As Integer, Length As Integer)
32 | Sub CopyTo(DestinationArray() As Byte, Index As Integer)
33 | Function GetByte(Offset As UInteger) As Byte
34 | Function GetBytes() As Byte()
35 | Function GetBytes(Offset As UInteger, Size As UInteger) As Byte()
36 | Function GetBytesInteger(Offset As UInteger) As UInteger
37 | Function GetBytesShort(Offset As UInteger) As UShort
38 | Function GetCRC32() As String
39 | Function GetMD5Hash() As String
40 | Function GetSHA1Hash() As String
41 | Function Resize(Length As Integer) As Boolean
42 | Function SaveToFile(FilePath As String) As Boolean
43 | Function SetBytes(Value As Object, Offset As UInteger) As Boolean
44 | Function SetBytes(Value As UShort, Offset As UInteger) As Boolean
45 | Function SetBytes(Value As UInteger, Offset As UInteger) As Boolean
46 | Function SetBytes(Value As Byte, Offset As UInteger) As Boolean
47 | Function SetBytes(Value() As Byte, Offset As UInteger) As Boolean
48 | Function SetBytes(Value() As Byte, Offset As UInteger, Size As UInteger, Padding As Byte) As Boolean
49 | Function ToUInt16(StartIndex As Integer) As UShort
50 | End Interface
51 | End Namespace
52 |
--------------------------------------------------------------------------------
/DiskImageTool/DiskImage/Modules/CodePage437.vb:
--------------------------------------------------------------------------------
1 | Imports System.Text
2 |
3 | Namespace DiskImage
4 | Module CodePage437
5 | Private ReadOnly CodePage437LookupTable As UShort() = New UShort(255) {
6 | 65533, 9786, 9787, 9829, 9830, 9827, 9824, 8226, 9688, 9675, 9689, 9794, 9792, 9834, 9835, 9788,
7 | 9658, 9668, 8597, 8252, 182, 167, 9644, 8616, 8593, 8595, 8594, 8592, 8735, 8596, 9650, 9660,
8 | 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
9 | 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
10 | 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
11 | 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
12 | 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
13 | 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 8962,
14 | 199, 252, 233, 226, 228, 224, 229, 231, 234, 235, 232, 239, 238, 236, 196, 197,
15 | 201, 230, 198, 244, 246, 242, 251, 249, 255, 214, 220, 162, 163, 165, 8359, 402,
16 | 225, 237, 243, 250, 241, 209, 170, 186, 191, 8976, 172, 189, 188, 161, 171, 187,
17 | 9617, 9618, 9619, 9474, 9508, 9569, 9570, 9558, 9557, 9571, 9553, 9559, 9565, 9564, 9563, 9488,
18 | 9492, 9524, 9516, 9500, 9472, 9532, 9566, 9567, 9562, 9556, 9577, 9574, 9568, 9552, 9580, 9575,
19 | 9576, 9572, 9573, 9561, 9560, 9554, 9555, 9579, 9578, 9496, 9484, 9608, 9604, 9612, 9616, 9600,
20 | 945, 223, 915, 960, 931, 963, 181, 964, 934, 920, 937, 948, 8734, 966, 949, 8745,
21 | 8801, 177, 8805, 8804, 8992, 8993, 247, 8776, 176, 8729, 183, 8730, 8319, 178, 9632, 160
22 | }
23 |
24 | Private CodePage437ReverseLookupTable As Dictionary(Of UShort, Byte)
25 |
26 | Public Function CodePage437ToUnicode(b() As Byte) As String
27 | Dim b2(b.Length - 1) As UShort
28 | For counter = 0 To b.Length - 1
29 | b2(counter) = CodePage437LookupTable(b(counter))
30 | Next
31 | ReDim b(b2.Length * 2 - 1)
32 | Buffer.BlockCopy(b2, 0, b, 0, b.Length)
33 |
34 | Return Encoding.Unicode.GetString(b)
35 | End Function
36 |
37 | Public Function UnicodeToCodePage437(Value As String) As Byte()
38 | If CodePage437ReverseLookupTable Is Nothing Then
39 | CodePage437ReverseLookupTable = New Dictionary(Of UShort, Byte)
40 | For Counter = 0 To CodePage437LookupTable.Length - 1
41 | CodePage437ReverseLookupTable.Add(CodePage437LookupTable(Counter), Counter)
42 | Next
43 | End If
44 |
45 | Dim b = Encoding.Unicode.GetBytes(Value)
46 | Dim b2(b.Length / 2 - 1) As Byte
47 | For Counter = 0 To b.Length - 1 Step 2
48 | Dim c = BitConverter.ToUInt16(b, Counter)
49 | If CodePage437ReverseLookupTable.ContainsKey(c) Then
50 | c = CodePage437ReverseLookupTable.Item(c)
51 | Else
52 | c = 32
53 | End If
54 | b2(Counter / 2) = c
55 | Next
56 |
57 | Return b2
58 | End Function
59 | End Module
60 | End Namespace
61 |
--------------------------------------------------------------------------------
/DiskImageTool/DiskImage/Modules/Structures.vb:
--------------------------------------------------------------------------------
1 | Namespace DiskImage
2 | Public Class AddFileData
3 | Public Sub New()
4 | _ClusterList = Nothing
5 | _Entry = Nothing
6 | _FileInfo = Nothing
7 | End Sub
8 |
9 | Public Property ClusterList As SortedSet(Of UShort)
10 | Public Property EntriesNeeded As Integer
11 | Public Property Entry As DirectoryEntry
12 | Public Property FileInfo As IO.FileInfo
13 | Public Property HasNTLowerCaseExtension As Boolean
14 | Public Property HasNTLowerCaseFileName As Boolean
15 | Public Property Index As Integer
16 | Public Property LFNEntries As List(Of Byte())
17 | Public Property Options As AddFileOptions
18 | Public Property RequiresExpansion As Boolean
19 | Public Property ShortFileName As String
20 | End Class
21 |
22 | Public Structure DirectoryCacheEntry
23 | Dim Checksum As UInteger
24 | Dim Data() As Byte
25 | End Structure
26 | End Namespace
27 |
--------------------------------------------------------------------------------
/DiskImageTool/DiskImage/SectorBlock.vb:
--------------------------------------------------------------------------------
1 | Namespace DiskImage
2 | Public Class SectorBlock
3 | Sub New(Index As Integer, SectorStart As UInteger, SectorCount As UInteger, Offset As UInteger, Size As UInteger, Description As String)
4 | _Index = Index
5 | _Description = Description
6 | _SectorStart = SectorStart
7 | _SectorCount = SectorCount
8 | _Offset = Offset
9 | _Size = Size
10 | End Sub
11 |
12 | Public ReadOnly Property Description As String
13 | Public ReadOnly Property Index As Integer
14 | Public ReadOnly Property Offset As UInteger
15 | Public ReadOnly Property SectorCount As UInteger
16 | Public ReadOnly Property SectorStart As UInteger
17 | Public ReadOnly Property Size As UInteger
18 | End Class
19 | End Namespace
20 |
--------------------------------------------------------------------------------
/DiskImageTool/Extensions/ByteArrayExtensions.vb:
--------------------------------------------------------------------------------
1 | Imports System.Runtime.CompilerServices
2 |
3 | Module ByteArrayExtensions
4 |
5 | Public Function CompareTo(b1() As Byte, b2() As Byte, Optional IgnoreLength As Boolean = False) As Boolean
6 | If Not IgnoreLength AndAlso b1.Length <> b2.Length Then
7 | Return False
8 | End If
9 |
10 | Dim Length = Math.Min(b1.Length, b2.Length)
11 |
12 | For Counter = Length - 1 To 0 Step -1
13 | If b1(Counter) <> b2(Counter) Then
14 | Return False
15 | End If
16 | Next
17 |
18 | Return True
19 | End Function
20 | End Module
21 |
--------------------------------------------------------------------------------
/DiskImageTool/Extensions/DataGridViewExtensions.vb:
--------------------------------------------------------------------------------
1 | Imports System.Runtime.CompilerServices
2 |
3 | Module DataGridViewExtensions
4 |
5 | Public Sub DoubleBuffer(DataGridViewControl As DataGridView)
6 | DataGridViewControl.GetType() _
7 | .GetProperty("DoubleBuffered", System.Reflection.BindingFlags.Instance Or System.Reflection.BindingFlags.NonPublic) _
8 | .SetValue(DataGridViewControl, True, Nothing)
9 | End Sub
10 | End Module
11 |
--------------------------------------------------------------------------------
/DiskImageTool/Extensions/StringExtensions.vb:
--------------------------------------------------------------------------------
1 | Imports System.Runtime.CompilerServices
2 |
3 | Module StringExtensions
4 |
5 | Public Function Pluralize(Value As String, Count As Integer) As String
6 | Return Value & IIf(Count <> 1, "s", "")
7 | End Function
8 |
9 |
10 | Public Function WordWrap(Text As String, Width As Integer, Font As Font) As List(Of String)
11 | Dim StringList = New List(Of String)
12 | Dim Size = TextRenderer.MeasureText(Text, Font)
13 |
14 | If String.IsNullOrEmpty(Text) OrElse Width = 0 OrElse Width >= Size.Width Then
15 | StringList.Add(Text)
16 | Return StringList
17 | End If
18 |
19 | Dim Words = Text.Split(" ")
20 | Dim Line As String = ""
21 | For Each Word In Words
22 | Dim NewLine = Line
23 | If NewLine <> "" Then
24 | NewLine &= " "
25 | End If
26 | NewLine &= Word
27 | Size = TextRenderer.MeasureText(NewLine, Font)
28 |
29 | If Size.Width <= Width Then
30 | Line = NewLine
31 | Else
32 | StringList.Add(Line)
33 | Line = Word
34 | End If
35 | Next
36 | If Line <> "" Then
37 | StringList.Add(Line)
38 | End If
39 |
40 | Return StringList
41 | End Function
42 | End Module
43 |
--------------------------------------------------------------------------------
/DiskImageTool/Extensions/XMLExtensions.vb:
--------------------------------------------------------------------------------
1 | Imports System.Runtime.CompilerServices
2 | Imports System.Xml
3 |
4 | Module XMLExtensions
5 |
6 | Public Function AppendAttribute(Node As XmlNode, Name As String, Value As String) As XmlAttribute
7 | Dim Attribute = Node.OwnerDocument.CreateAttribute(Name)
8 | Attribute.Value = Value
9 | Node.Attributes.Append(Attribute)
10 |
11 | Return Attribute
12 | End Function
13 | End Module
14 |
--------------------------------------------------------------------------------
/DiskImageTool/FileData.vb:
--------------------------------------------------------------------------------
1 | Public Class FileData
2 | Public Property DirectoryEntry As DiskImage.DirectoryEntry
3 | Public Property DuplicateFileName As Boolean
4 | Public Property FilePath As String
5 | Public Property Index As Integer
6 | Public Property InvalidVolumeName As Boolean
7 | Public Property IsLastEntry As Boolean
8 | Public Property LFNFileName As String
9 | End Class
--------------------------------------------------------------------------------
/DiskImageTool/Filters/Enums.vb:
--------------------------------------------------------------------------------
1 | Namespace Filters
2 | Public Enum FilterTypes
3 | ModifiedFiles
4 | Disk_UnknownFormat
5 | Disk_CustomFormat
6 | Disk_NOBPB
7 | Disk_NoBootLoader
8 | DIsk_CustomBootLoader
9 | Disk_MismatchedImageSize
10 | Disk_MismatchedMediaDescriptor
11 | Disk_FreeClustersWithData
12 | Bootstrap_Unknown
13 | OEMName_Unknown
14 | OEMName_Mismatched
15 | OEMName_Windows9x
16 | OEMName_Verified
17 | OEMName_Unverified
18 | FileSystem_HasCreationDate
19 | FileSystem_HasLastAccessDate
20 | FileSystem_HasReservedBytesSet
21 | FileSystem_HasLongFileNames
22 | FileSystem_InvalidDirectoryEntries
23 | FileSystem_DirectoryHasAdditionalData
24 | FileSystem_DirectoryHasBootSector
25 | FAT_BadSectors
26 | FAT_LostClusters
27 | FAT_MismatchedFATs
28 | FAT_ChainingErrors
29 | Image_InDatabase
30 | Image_NotInDatabase
31 | Image_Verified
32 | Image_Unverified
33 | Database_MismatchedStatus
34 | End Enum
35 |
36 | Public Module Enums
37 | Public Function FilterGetCount() As Integer
38 | Return [Enum].GetNames(GetType(FilterTypes)).Length
39 | End Function
40 | End Module
41 | End Namespace
42 |
--------------------------------------------------------------------------------
/DiskImageTool/Filters/FilterCounts.vb:
--------------------------------------------------------------------------------
1 | Namespace Filters
2 | Public Class FilterCounts
3 | Public Sub New()
4 | _Total = 0
5 | _Available = 0
6 | End Sub
7 | Public Property Total As Integer
8 | Public Property Available As Integer
9 | End Class
10 | End Namespace
11 |
--------------------------------------------------------------------------------
/DiskImageTool/Filters/FilterTag.vb:
--------------------------------------------------------------------------------
1 | Namespace Filters
2 | Public Class FilterTag
3 | Public Sub New(Value As Integer)
4 | _Value = Value
5 | _Visible = False
6 | End Sub
7 | Public ReadOnly Property Value As Integer
8 | Public Property Visible As Boolean
9 | End Class
10 | End Namespace
11 |
--------------------------------------------------------------------------------
/DiskImageTool/FormControls.vb:
--------------------------------------------------------------------------------
1 | Module FormControls
2 |
3 | Public Sub ControlRevertValue(Control As Control)
4 | Control.Text = CType(Control.Tag, FormControlData).LastValue
5 | ControlUpdateColor(Control)
6 | End Sub
7 |
8 | Public Sub ControlSetLastValue(Control As Control, Value As String)
9 | CType(Control.Tag, FormControlData).LastValue = Value
10 | End Sub
11 |
12 | Public Sub ControlSetValue(Control As Control, Value As String, CheckDiskType As Boolean)
13 | Control.Text = Value
14 | Dim Data = ControlSetTagValue(Control, Value)
15 | Data.CheckDiskType = CheckDiskType
16 | ControlUpdateColor(Control)
17 | End Sub
18 |
19 | Public Sub ControlSetValue(Control As Control, Value As String, AllowedValues() As String, CheckDiskType As Boolean)
20 | Control.Text = Value
21 | Dim Data = ControlSetTagValue(Control, Value)
22 | Data.AllowedValues = AllowedValues
23 | Data.CheckDiskType = CheckDiskType
24 | ControlUpdateColor(Control)
25 | End Sub
26 |
27 | Public Sub ControlSetValue(Control As HexTextBox, Value As String, CheckDiskType As Boolean)
28 | Control.SetHex(Value)
29 | Dim Data = ControlSetTagValue(Control, Value)
30 | Data.CheckDiskType = CheckDiskType
31 | ControlUpdateColor(Control)
32 | End Sub
33 |
34 | Public Sub ControlSetValue(Control As HexTextBox, Value() As Byte, CheckDiskType As Boolean)
35 | Control.SetHex(Value)
36 | Dim Data = ControlSetTagValue(Control, BitConverter.ToString(Value).Replace("-", ""))
37 | Data.CheckDiskType = CheckDiskType
38 | ControlUpdateColor(Control)
39 | End Sub
40 |
41 | Public Sub ControlUpdateBackColor(Control As Control)
42 | ControlUpdateBackColor(Control, False, True)
43 | End Sub
44 |
45 | Public Sub ControlUpdateBackColor(Control As Control, KnownDiskType As Boolean, DefaultValid As Boolean)
46 | Dim IsValid As Boolean
47 |
48 | Dim Data = CType(Control.Tag, FormControlData)
49 |
50 | If Data.CheckDiskType And KnownDiskType Then
51 | IsValid = True
52 | ElseIf Data.AllowedValues IsNot Nothing Then
53 | IsValid = Data.AllowedValues.Contains(Control.Text)
54 | Else
55 | IsValid = DefaultValid
56 | End If
57 |
58 | If IsValid Then
59 | Control.BackColor = SystemColors.Window
60 | Else
61 | Control.BackColor = Color.LightPink
62 | End If
63 | End Sub
64 |
65 | Public Sub ControlUpdateColor(Control As Control)
66 | Dim Data = CType(Control.Tag, FormControlData)
67 |
68 | If Control.Text <> Data.OriginalValue Then
69 | Control.ForeColor = Color.Blue
70 | Else
71 | Control.ForeColor = SystemColors.WindowText
72 | End If
73 | End Sub
74 |
75 | Private Function ControlSetTagValue(Control As Control, Value As String) As FormControlData
76 | If Control.Tag Is Nothing Then
77 | Control.Tag = New FormControlData(Value)
78 | Else
79 | ControlSetLastValue(Control, Value)
80 | End If
81 |
82 | Return Control.Tag
83 | End Function
84 |
85 | Public Class FormControlData
86 |
87 | Public Sub New(Value As String)
88 | _OriginalValue = Value
89 | _LastValue = Value
90 | _AllowedValues = Nothing
91 | _CheckDiskType = False
92 | End Sub
93 |
94 | Public Property AllowedValues As String()
95 | Public Property CheckDiskType As Boolean
96 | Public Property LastValue As String
97 | Public Property OriginalValue As String
98 | End Class
99 |
100 | Public Class MediaDescriptorType
101 |
102 | Public Sub New(MediaDescriptor As String, Description As String)
103 | _MediaDescriptor = MediaDescriptor
104 | _Description = Description
105 | End Sub
106 |
107 | Public Property Description As String
108 | Public Property MediaDescriptor As String
109 |
110 | Public Overrides Function ToString() As String
111 | Return MediaDescriptor
112 | End Function
113 |
114 | End Class
115 |
116 | End Module
--------------------------------------------------------------------------------
/DiskImageTool/Forms/AboutBox.vb:
--------------------------------------------------------------------------------
1 | Public NotInheritable Class AboutBox
2 | Private ReadOnly _NameSpace As String = New StubClass().GetType.Namespace
3 |
4 | Private Sub AboutBox1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
5 | ' Set the title of the form.
6 | Dim ApplicationTitle As String
7 | If My.Application.Info.Title <> "" Then
8 | ApplicationTitle = My.Application.Info.Title
9 | Else
10 | ApplicationTitle = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName)
11 | End If
12 | Me.Text = String.Format("About {0}", ApplicationTitle)
13 | ' Initialize all of the text displayed on the About Box.
14 | ' TODO: Customize the application's assembly information in the "Application" pane of the project
15 | ' properties dialog (under the "Project" menu).
16 | Me.LabelProductName.Text = My.Application.Info.ProductName
17 | Me.LabelVersion.Text = String.Format("Version {0}", GetVersionString)
18 | Me.LabelURL.Text = MainForm.SITE_URL
19 | Me.TextBoxDescription.Text = GetResource("License.txt")
20 | End Sub
21 |
22 | Private Function GetResource(Name As String) As String
23 | Dim Value As String
24 |
25 | Dim Assembly As Reflection.[Assembly] = Reflection.[Assembly].GetExecutingAssembly()
26 | Dim Stream = Assembly.GetManifestResourceStream(_NameSpace & "." & Name)
27 | If Stream Is Nothing Then
28 | Throw New Exception("Unable to load resource " & Name)
29 | Else
30 | Dim TextStreamReader = New IO.StreamReader(Stream)
31 | Value = TextStreamReader.ReadToEnd()
32 | TextStreamReader.Close()
33 | End If
34 |
35 | Return Value
36 | End Function
37 |
38 | Private Sub LabelURL_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LabelURL.LinkClicked
39 | Process.Start(MainForm.SITE_URL)
40 | End Sub
41 |
42 | Private Sub OKButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OKButton.Click
43 | Me.Close()
44 | End Sub
45 | End Class
46 |
--------------------------------------------------------------------------------
/DiskImageTool/Forms/DeleteFileform.vb:
--------------------------------------------------------------------------------
1 | Public Class DeleteFileForm
2 | Public Structure DeleteFileFormResult
3 | Dim FillChar As Byte
4 | Dim Cancelled As Boolean
5 | Dim Clear As Boolean
6 | End Structure
7 |
8 | Private _Result As DeleteFileFormResult
9 |
10 | Public Sub New(Caption As String, Title As String, CanFill As Boolean)
11 |
12 | ' This call is required by the designer.
13 | InitializeComponent()
14 |
15 | ' Add any initialization after the InitializeComponent() call.
16 | LblCaption.Text = Caption
17 | Me.Text = Title
18 | _Result.Cancelled = True
19 | _Result.FillChar = &H0
20 | _Result.Clear = False
21 | RadioFillF6.Enabled = CanFill
22 | RadioFill00.Enabled = CanFill
23 | End Sub
24 |
25 | Public ReadOnly Property Result As DeleteFileFormResult
26 | Get
27 | Return _Result
28 | End Get
29 | End Property
30 |
31 | Private Sub SetResult(Cancelled As Boolean)
32 | If RadioFillKeep.Checked Then
33 | _Result.Clear = False
34 | ElseIf RadioFillF6.Checked Then
35 | _Result.FillChar = &HF6
36 | _Result.Clear = True
37 | Else
38 | _Result.FillChar = &H0
39 | _Result.Clear = True
40 | End If
41 | _Result.Cancelled = Cancelled
42 | End Sub
43 |
44 | Private Sub BtnOK_Click(sender As Object, e As EventArgs) Handles BtnOK.Click
45 | SetResult(False)
46 | End Sub
47 |
48 | Private Sub BtnCancel_Click(sender As Object, e As EventArgs) Handles BtnCancel.Click
49 | SetResult(True)
50 | End Sub
51 |
52 | Private Sub ClearSectorsForm_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
53 | e.Graphics.DrawImage(SystemIcons.Question.ToBitmap, 22, 24)
54 | End Sub
55 | End Class
--------------------------------------------------------------------------------
/DiskImageTool/Forms/Derived/FilePropertiesFormMultiple.vb:
--------------------------------------------------------------------------------
1 | Imports DiskImageTool.DiskImage
2 | Public Class FilePropertiesFormMultiple
3 | Inherits FilePropertiesForm
4 |
5 | Private ReadOnly _Disk As Disk
6 | Private ReadOnly _DirectoryEntries As List(Of DirectoryEntry)
7 | Private _Updated As Boolean = False
8 |
9 | Public Sub New(Disk As DiskImage.Disk, DirectoryEntries As List(Of DirectoryEntry))
10 | MyBase.New()
11 |
12 | _Disk = Disk
13 | _DirectoryEntries = DirectoryEntries
14 |
15 | MyBase.Text = "File Properties"
16 | BtnUpdate.Text = "Update"
17 | End Sub
18 |
19 | Public ReadOnly Property Updated As Boolean
20 | Get
21 | Return _Updated
22 | End Get
23 | End Property
24 |
25 | Private Sub ApplyUpdate()
26 | _Updated = False
27 |
28 | Dim UseTransaction = _Disk.BeginTransaction
29 |
30 | For Each DirectoryEntry In _DirectoryEntries
31 | Dim NewDirectoryEntry = DirectoryEntry.Clone
32 |
33 | ApplyFileDatesUpdate(NewDirectoryEntry)
34 | ApplyAttributesUpdate(NewDirectoryEntry)
35 |
36 | If Not DirectoryEntry.Data.CompareTo(NewDirectoryEntry.Data) Then
37 | DirectoryEntry.Data = NewDirectoryEntry.Data
38 | _Updated = True
39 | End If
40 |
41 | If DirectoryEntry.IsDirectory And Not DirectoryEntry.IsDeleted And Not DirectoryEntry.IsVolumeName Then
42 | DirectoryEntry.SubDirectory.UpdateLinkDates()
43 | End If
44 | Next
45 |
46 | If UseTransaction Then
47 | _Disk.EndTransaction()
48 | End If
49 | End Sub
50 |
51 | Private Sub PopulateForm()
52 | Dim DT As DiskImage.ExpandedDate
53 | Dim LastWritten = New Date(1980, 1, 1, 0, 0, 0)
54 | Dim Created As Date? = Nothing
55 | Dim LastAccessed As Date? = Nothing
56 | Dim SetArchived As Boolean = True
57 | Dim SetReadOnly As Boolean = True
58 | Dim SetSystem As Boolean = True
59 | Dim SetHidden As Boolean = True
60 |
61 | IsVolumeLabel = False
62 | Deleted = False
63 |
64 | GroupFileName.Text = "Multiple Files"
65 | LblMultipleFiles.Text = "(" & _DirectoryEntries.Count & " Files Selected)"
66 |
67 | For Each DirectoryEntry In _DirectoryEntries
68 | DT = DirectoryEntry.GetLastWriteDate
69 | If DT.DateObject > LastWritten Then
70 | LastWritten = DT.DateObject
71 | End If
72 | DT = DirectoryEntry.GetCreationDate
73 | If Created Is Nothing Or DT.DateObject > Created Then
74 | Created = DT.DateObject
75 | End If
76 | DT = DirectoryEntry.GetLastAccessDate
77 | If LastAccessed Is Nothing Or DT.DateObject > LastAccessed Then
78 | LastAccessed = DT.DateObject
79 | End If
80 |
81 | If Not DirectoryEntry.IsArchive Then
82 | SetArchived = False
83 | End If
84 | If Not DirectoryEntry.IsReadOnly Then
85 | SetReadOnly = False
86 | End If
87 | If Not DirectoryEntry.IsHidden Then
88 | SetHidden = False
89 | End If
90 | If Not DirectoryEntry.IsSystem Then
91 | SetSystem = False
92 | End If
93 | Next
94 |
95 | DTLastWritten.Value = LastWritten.Date
96 | DTLastWrittenTime.Value = LastWritten
97 | SetCreatedDateValue(Created)
98 | SetLastAccessedDateValue(LastAccessed)
99 |
100 | ChkArchive.Checked = SetArchived
101 | ChkReadOnly.Checked = SetReadOnly
102 | ChkHidden.Checked = SetHidden
103 | ChkSystem.Checked = SetSystem
104 |
105 | TxtLFN.Visible = False
106 | End Sub
107 |
108 | Private Sub BtnUpdate_Click(sender As Object, e As EventArgs) Handles BtnUpdate.Click
109 | ApplyUpdate()
110 |
111 | DialogResult = DialogResult.OK
112 | Me.Close()
113 | End Sub
114 |
115 | Private Sub FilePropertiesEditForm_Load(sender As Object, e As EventArgs) Handles Me.Load
116 | SuppressEvent(True)
117 |
118 | SetCreatedDateValue(Nothing)
119 | SetLastAccessedDateValue(Nothing)
120 | SetLastWrittenDateValue(New Date(1980, 1, 1, 0, 0, 0))
121 |
122 | InitMultiple(True)
123 |
124 | PopulateForm()
125 |
126 | SuppressEvent(False)
127 | End Sub
128 | End Class
129 |
--------------------------------------------------------------------------------
/DiskImageTool/Forms/Derived/NewDirectoryForm.vb:
--------------------------------------------------------------------------------
1 | Imports DiskImageTool.DiskImage
2 | Public Class NewDirectoryForm
3 | Inherits FilePropertiesForm
4 |
5 | Private _NewDirectoryEntry As DirectoryEntryBase
6 | Private _NewFilename As String
7 | Private _Updated As Boolean = False
8 |
9 | Public Sub New()
10 | MyBase.New()
11 |
12 | MyBase.Text = "New Directory"
13 | BtnUpdate.Text = "Add"
14 | End Sub
15 |
16 | Public ReadOnly Property NewDirectoryData As Byte()
17 | Get
18 | Return _NewDirectoryEntry.Data
19 | End Get
20 | End Property
21 |
22 | Public ReadOnly Property NewFilename As String
23 | Get
24 | Return _NewFilename
25 | End Get
26 | End Property
27 |
28 | Public ReadOnly Property Updated As Boolean
29 | Get
30 | Return _Updated
31 | End Get
32 | End Property
33 |
34 | Private Sub ApplyUpdate()
35 | _Updated = True
36 |
37 | _NewDirectoryEntry = New DirectoryEntryBase With {
38 | .FileSize = 0,
39 | .IsDirectory = True
40 | }
41 |
42 | If RadioFileShort.Checked Then
43 | ApplyFileNameUpdateShort(_NewDirectoryEntry)
44 | _NewFilename = _NewDirectoryEntry.GetFileName
45 | Else
46 | _NewFilename = TxtLFN.Text
47 | End If
48 |
49 | ApplyFileDatesUpdate(_NewDirectoryEntry)
50 | ApplyAttributesUpdate(_NewDirectoryEntry)
51 | End Sub
52 |
53 | Private Sub PopulateForm()
54 | Dim Maxlength As Integer = 8
55 | IsVolumeLabel = False
56 | Deleted = False
57 |
58 | TxtExtension.Visible = True
59 | MskExtensionHex.Visible = True
60 | TxtExtension.Text = ""
61 | MskExtensionHex.SetHex(New Byte(2) {32, 32, 32})
62 |
63 | FlowLayoutFileNameType.Visible = True
64 | RadioFileShort.Checked = True
65 |
66 | MskFileHex.MaskLength = Maxlength
67 | MskFileHex.Width = (Maxlength * 3 - 1) * 7 + 8
68 | MskFileHex.SetHex(New Byte(7) {32, 32, 32, 32, 32, 32, 32, 32})
69 | TxtFile.PromptChar = " "
70 | TxtFile.Width = MskFileHex.Width
71 |
72 | TxtFile.Mask = ">" & Strings.StrDup(8, "C")
73 | TxtFile.Text = ""
74 |
75 | TxtLFN.Text = ""
76 |
77 | GroupFileName.Text = "Directory Name"
78 |
79 | ChkArchive.Checked = False
80 | ChkReadOnly.Checked = False
81 | ChkHidden.Checked = False
82 | ChkSystem.Checked = False
83 | ChkNTExtensions.Checked = False
84 |
85 | ToggleFileType(True)
86 | End Sub
87 |
88 | Private Sub BtnUpdate_Click(sender As Object, e As EventArgs) Handles BtnUpdate.Click
89 | ApplyUpdate()
90 |
91 | DialogResult = DialogResult.OK
92 | Me.Close()
93 | End Sub
94 |
95 | Private Sub NewDirectoryForm_Load(sender As Object, e As EventArgs) Handles Me.Load
96 | SuppressEvent(True)
97 |
98 | SetCreatedDateValue(Nothing)
99 | SetLastAccessedDateValue(Nothing)
100 | SetLastWrittenDateValue(Now)
101 |
102 | InitMultiple(False)
103 |
104 | PopulateForm()
105 |
106 | SuppressEvent(False)
107 | End Sub
108 | End Class
109 |
--------------------------------------------------------------------------------
/DiskImageTool/Forms/FileDropForm.Designer.vb:
--------------------------------------------------------------------------------
1 | _
2 | Partial Class FileDropForm
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 | _
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 | _
24 | Private Sub InitializeComponent()
25 | Me.LabelDropMessage = New System.Windows.Forms.Label()
26 | Me.SuspendLayout()
27 | '
28 | 'LabelDropMessage
29 | '
30 | Me.LabelDropMessage.AllowDrop = True
31 | Me.LabelDropMessage.Anchor = System.Windows.Forms.AnchorStyles.None
32 | Me.LabelDropMessage.AutoSize = True
33 | Me.LabelDropMessage.BackColor = System.Drawing.SystemColors.Window
34 | Me.LabelDropMessage.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
35 | Me.LabelDropMessage.Location = New System.Drawing.Point(26, 89)
36 | Me.LabelDropMessage.Name = "LabelDropMessage"
37 | Me.LabelDropMessage.Size = New System.Drawing.Size(256, 16)
38 | Me.LabelDropMessage.TabIndex = 9
39 | Me.LabelDropMessage.Text = "Drag && Drop Files and Folders Here"
40 | Me.LabelDropMessage.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
41 | '
42 | 'FileDropForm
43 | '
44 | Me.AllowDrop = True
45 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
46 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
47 | Me.BackColor = System.Drawing.SystemColors.Window
48 | Me.ClientSize = New System.Drawing.Size(309, 195)
49 | Me.Controls.Add(Me.LabelDropMessage)
50 | Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
51 | Me.MaximizeBox = False
52 | Me.MinimizeBox = False
53 | Me.Name = "FileDropForm"
54 | Me.ShowIcon = False
55 | Me.ShowInTaskbar = False
56 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
57 | Me.ResumeLayout(False)
58 | Me.PerformLayout()
59 |
60 | End Sub
61 |
62 | Friend WithEvents LabelDropMessage As Label
63 | End Class
64 |
--------------------------------------------------------------------------------
/DiskImageTool/Forms/FileDropForm.vb:
--------------------------------------------------------------------------------
1 | Public Class FileDropForm
2 |
3 | Private _FileNames() As String
4 |
5 | Public ReadOnly Property FileNames As String()
6 | Get
7 | Return _FileNames
8 | End Get
9 | End Property
10 |
11 | Private Sub FileDropForm_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
12 | If e.KeyCode = Keys.Escape Then
13 | Me.DialogResult = DialogResult.Cancel
14 | Me.Close()
15 | End If
16 | End Sub
17 |
18 | Private Sub FileDropForm_DragEnter(sender As Object, e As DragEventArgs) Handles Me.DragEnter, LabelDropMessage.DragEnter
19 | If e.Data.GetDataPresent(DataFormats.FileDrop) Then
20 | e.Effect = DragDropEffects.Copy
21 | End If
22 | End Sub
23 |
24 | Private Sub LabelDropMessage_DragDrop(sender As Object, e As DragEventArgs) Handles Me.DragDrop, LabelDropMessage.DragDrop
25 | _FileNames = e.Data.GetData(DataFormats.FileDrop)
26 | Me.DialogResult = DialogResult.OK
27 | Me.Close()
28 | End Sub
29 | End Class
--------------------------------------------------------------------------------
/DiskImageTool/Forms/FloppyReadOptionsForm.vb:
--------------------------------------------------------------------------------
1 | Imports DiskImageTool.DiskImage.FloppyDiskFunctions
2 |
3 | Public Class FloppyReadOptionsForm
4 | Private _DiskFormat As FloppyDiskFormat = FloppyDiskFormat.FloppyUnknown
5 |
6 | Public Sub New(DetectedType As FloppyDiskFormat)
7 |
8 | ' This call is required by the designer.
9 | InitializeComponent()
10 |
11 | ' Add any initialization after the InitializeComponent() call.
12 | PopulateCombo(DetectedType)
13 | End Sub
14 |
15 | Public ReadOnly Property DiskFormat As FloppyDiskFormat
16 | Get
17 | Return _DiskFormat
18 | End Get
19 | End Property
20 |
21 | Private Sub PopulateCombo(DetectedType As FloppyDiskFormat)
22 | Dim DiskTypeItem As ComboDiskTypeItem
23 | ComboDiskType.BeginUpdate()
24 | ComboDiskType.Items.Clear()
25 |
26 | If DetectedType = FloppyDiskFormat.FloppyUnknown Then
27 | lblMessage.Text = "Warning: Unable to determine the floppy disk type."
28 | DiskTypeItem = New ComboDiskTypeItem(DetectedType, False)
29 | Dim Index = ComboDiskType.Items.Add(DiskTypeItem)
30 | ComboDiskType.SelectedIndex = Index
31 | Else
32 | lblMessage.Text = ""
33 | End If
34 |
35 | Dim Items = System.Enum.GetValues(GetType(FloppyDiskFormat))
36 | For Each DiskFormat As FloppyDiskFormat In Items
37 | If (DiskFormat <> FloppyDiskFormat.FloppyUnknown And IsDiskFormatValidForRead(DiskFormat)) Or DetectedType = DiskFormat Then
38 | DiskTypeItem = New ComboDiskTypeItem(DiskFormat, DiskFormat = DetectedType)
39 | Dim Index = ComboDiskType.Items.Add(DiskTypeItem)
40 | If DiskFormat = DetectedType Then
41 | ComboDiskType.SelectedIndex = Index
42 | End If
43 | End If
44 | Next
45 |
46 | ComboDiskType.EndUpdate()
47 | End Sub
48 |
49 | Private Sub BtnOK_Click(sender As Object, e As EventArgs) Handles BtnOK.Click
50 | If ComboDiskType.SelectedItem Is Nothing Then
51 | _DiskFormat = FloppyDiskFormat.FloppyUnknown
52 | Else
53 | Dim DiskTypeItem As ComboDiskTypeItem = ComboDiskType.SelectedItem
54 | _DiskFormat = DiskTypeItem.Format
55 | End If
56 | End Sub
57 |
58 | Private Sub ComboDiskType_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboDiskType.SelectedIndexChanged
59 | If ComboDiskType.SelectedItem Is Nothing Then
60 | BtnOK.Enabled = False
61 | Else
62 | Dim DiskTypeItem As ComboDiskTypeItem = ComboDiskType.SelectedItem
63 | BtnOK.Enabled = DiskTypeItem.Format <> FloppyDiskFormat.FloppyUnknown
64 | End If
65 | End Sub
66 |
67 | Private Class ComboDiskTypeItem
68 | Public Sub New(Format As FloppyDiskFormat, Detected As Boolean)
69 | _Detected = Detected
70 | _Format = Format
71 | End Sub
72 |
73 | Public Property Detected As Boolean
74 |
75 | Public Property Format As FloppyDiskFormat
76 |
77 | Public Overrides Function ToString() As String
78 | Dim FormatName As String
79 |
80 | If _Format = FloppyDiskFormat.FloppyUnknown Then
81 | FormatName = "Unknown"
82 | Else
83 | FormatName = GetFloppyDiskFormatName(_Format) & " Floppy"
84 | End If
85 |
86 | Return FormatName & IIf(_Detected, " (Detected)", "")
87 | End Function
88 | End Class
89 |
90 | End Class
--------------------------------------------------------------------------------
/DiskImageTool/Forms/FloppyWriteOptionsForm.vb:
--------------------------------------------------------------------------------
1 | Imports DiskImageTool.DiskImage.FloppyDiskFunctions
2 |
3 | Public Class FloppyWriteOptionsForm
4 | Public Structure FloppyWriteOptions
5 | Dim Format As Boolean
6 | Dim Verify As Boolean
7 | Dim Cancelled As Boolean
8 | End Structure
9 |
10 | Private _WriteOptions As FloppyWriteOptions
11 |
12 | Public Sub New(DoFormat As Boolean, DetectedFormat As FloppyDiskFormat, DiskFormat As FloppyDiskFormat)
13 |
14 | ' This call is required by the designer.
15 | InitializeComponent()
16 |
17 | ' Add any initialization after the InitializeComponent() call.
18 | _WriteOptions.Cancelled = True
19 | Dim ImageFormatName = GetFloppyDiskFormatName(DiskFormat) & " Floppy"
20 |
21 | Dim DetectedFormatName As String
22 | If DetectedFormat = -2 Then
23 | DetectedFormatName = "Unformatted"
24 | ElseIf DetectedFormat = -1 Then
25 | DetectedFormatName = "Unknown"
26 | Else
27 | DetectedFormatName = GetFloppyDiskFormatName(DetectedFormat) & " Floppy"
28 | End If
29 | lblImageType.Text = ImageFormatName
30 | lblDiskFormat.Text = DetectedFormatName
31 | CheckFormat.Checked = DoFormat
32 | CheckVerify.Checked = True
33 | End Sub
34 |
35 | Public ReadOnly Property WriteOptions As FloppyWriteOptions
36 | Get
37 | Return _WriteOptions
38 | End Get
39 | End Property
40 |
41 | Private Sub BtnOK_Click(sender As Object, e As EventArgs) Handles BtnOK.Click
42 | _WriteOptions.Format = CheckFormat.Checked
43 | _WriteOptions.Verify = CheckVerify.Checked
44 | _WriteOptions.Cancelled = False
45 | End Sub
46 |
47 | Private Sub BtnCancel_Click(sender As Object, e As EventArgs) Handles BtnCancel.Click
48 | _WriteOptions.Format = CheckFormat.Checked
49 | _WriteOptions.Verify = CheckVerify.Checked
50 | _WriteOptions.Cancelled = True
51 | End Sub
52 |
53 |
54 | End Class
--------------------------------------------------------------------------------
/DiskImageTool/Forms/HexSearchForm.vb:
--------------------------------------------------------------------------------
1 | Imports System.ComponentModel
2 |
3 | Public Class HexSearchForm
4 | Public Sub New(HexSearch As HexSearch)
5 |
6 | ' This call is required by the designer.
7 | InitializeComponent()
8 |
9 | ' Add any initialization after the InitializeComponent() call.
10 | If HexSearch.SearchHex Then
11 | RadBtnHex.Checked = True
12 | ChkCaseSensitive.Enabled = False
13 | ChkCaseSensitive.Checked = False
14 | Else
15 | RadBtnText.Checked = True
16 | ChkCaseSensitive.Enabled = True
17 | ChkCaseSensitive.Checked = HexSearch.CaseSensitive
18 | End If
19 | TextSearch.Text = HexSearch.SearchString
20 | BtnOK.Enabled = TextSearch.Text.Length > 0
21 | End Sub
22 |
23 | Public Function Search() As HexSearch
24 | Return New HexSearch With {
25 | .SearchHex = RadBtnHex.Checked,
26 | .SearchString = TextSearch.Text.Trim,
27 | .CaseSensitive = ChkCaseSensitive.Checked
28 | }
29 | End Function
30 |
31 | Private Function CheckHex() As Boolean
32 | Dim Result As Boolean = True
33 |
34 | For Counter = 0 To TextSearch.Text.Length - 1
35 | Dim C = TextSearch.Text.Substring(Counter, 1)
36 | Result = (C >= "0" And C <= "9") Or (C >= "a" And C <= "f") Or (C >= "A" And C <= "F") Or C = Chr(13) Or C = Chr(10) Or C = " "
37 | If Not Result Then
38 | Exit For
39 | End If
40 | Next
41 |
42 | Return Result
43 | End Function
44 |
45 | Private Sub HexSearchForm_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
46 | If Me.DialogResult = DialogResult.OK Then
47 | If RadBtnHex.Checked Then
48 | If Not CheckHex() Then
49 | MsgBox("Invalid Search String", MsgBoxStyle.Exclamation)
50 | e.Cancel = True
51 | End If
52 | End If
53 | End If
54 | End Sub
55 |
56 | Private Sub RadBtn_CheckedChanged(sender As Object, e As EventArgs) Handles RadBtnText.CheckedChanged, RadBtnHex.CheckedChanged
57 | ChkCaseSensitive.Enabled = RadBtnText.Checked
58 | End Sub
59 |
60 | Private Sub TextSearch_TextChanged(sender As Object, e As EventArgs) Handles TextSearch.TextChanged
61 | BtnOK.Enabled = TextSearch.Text.Length > 0
62 | End Sub
63 | End Class
64 |
65 | Public Class HexSearch
66 | Public Sub New()
67 | _CaseSensitive = False
68 | _SearchHex = False
69 | _SearchString = ""
70 | End Sub
71 |
72 | Public Property CaseSensitive As Boolean
73 | Public Property SearchHex As Boolean
74 | Public Property SearchString As String
75 | End Class
76 |
--------------------------------------------------------------------------------
/DiskImageTool/Forms/ImageLoadForm.Designer.vb:
--------------------------------------------------------------------------------
1 | _
2 | Partial Class ImageLoadForm
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 | _
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 | _
24 | Private Sub InitializeComponent()
25 | Me.LblScanning = New System.Windows.Forms.Label()
26 | Me.BackgroundWorker1 = New System.ComponentModel.BackgroundWorker()
27 | Me.lblScanning2 = New System.Windows.Forms.Label()
28 | Me.SuspendLayout()
29 | '
30 | 'LblScanning
31 | '
32 | Me.LblScanning.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
33 | Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
34 | Me.LblScanning.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
35 | Me.LblScanning.Location = New System.Drawing.Point(12, 25)
36 | Me.LblScanning.Name = "LblScanning"
37 | Me.LblScanning.Size = New System.Drawing.Size(168, 16)
38 | Me.LblScanning.TabIndex = 0
39 | Me.LblScanning.Text = "Scanning ... 0 files"
40 | Me.LblScanning.TextAlign = System.Drawing.ContentAlignment.TopCenter
41 | '
42 | 'BackgroundWorker1
43 | '
44 | Me.BackgroundWorker1.WorkerReportsProgress = True
45 | Me.BackgroundWorker1.WorkerSupportsCancellation = True
46 | '
47 | 'lblScanning2
48 | '
49 | Me.lblScanning2.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
50 | Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
51 | Me.lblScanning2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
52 | Me.lblScanning2.Location = New System.Drawing.Point(12, 50)
53 | Me.lblScanning2.Name = "lblScanning2"
54 | Me.lblScanning2.Size = New System.Drawing.Size(168, 16)
55 | Me.lblScanning2.TabIndex = 1
56 | Me.lblScanning2.Text = "0 images loaded"
57 | Me.lblScanning2.TextAlign = System.Drawing.ContentAlignment.TopCenter
58 | '
59 | 'ImageLoadForm
60 | '
61 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
62 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
63 | Me.ClientSize = New System.Drawing.Size(192, 95)
64 | Me.Controls.Add(Me.lblScanning2)
65 | Me.Controls.Add(Me.LblScanning)
66 | Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
67 | Me.MaximizeBox = False
68 | Me.MinimizeBox = False
69 | Me.Name = "ImageLoadForm"
70 | Me.ShowIcon = False
71 | Me.ShowInTaskbar = False
72 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
73 | Me.Text = "Scan Files"
74 | Me.ResumeLayout(False)
75 |
76 | End Sub
77 |
78 | Friend WithEvents LblScanning As Label
79 | Friend WithEvents BackgroundWorker1 As System.ComponentModel.BackgroundWorker
80 | Friend WithEvents lblScanning2 As Label
81 | End Class
82 |
--------------------------------------------------------------------------------
/DiskImageTool/Forms/ItemScanForm.Designer.vb:
--------------------------------------------------------------------------------
1 | _
2 | Partial Class ItemScanForm
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 | _
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 | _
24 | Private Sub InitializeComponent()
25 | Me.LblScanning = New System.Windows.Forms.Label()
26 | Me.BackgroundWorker1 = New System.ComponentModel.BackgroundWorker()
27 | Me.SuspendLayout()
28 | '
29 | 'LblScanning
30 | '
31 | Me.LblScanning.Anchor = System.Windows.Forms.AnchorStyles.None
32 | Me.LblScanning.AutoSize = True
33 | Me.LblScanning.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
34 | Me.LblScanning.Location = New System.Drawing.Point(40, 25)
35 | Me.LblScanning.Name = "LblScanning"
36 | Me.LblScanning.Size = New System.Drawing.Size(112, 16)
37 | Me.LblScanning.TabIndex = 0
38 | Me.LblScanning.Text = "Scanning ... 100%"
39 | '
40 | 'BackgroundWorker1
41 | '
42 | Me.BackgroundWorker1.WorkerReportsProgress = True
43 | Me.BackgroundWorker1.WorkerSupportsCancellation = True
44 | '
45 | 'ItemScanForm
46 | '
47 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
48 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
49 | Me.ClientSize = New System.Drawing.Size(192, 67)
50 | Me.Controls.Add(Me.LblScanning)
51 | Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
52 | Me.MaximizeBox = False
53 | Me.MinimizeBox = False
54 | Me.Name = "ItemScanForm"
55 | Me.ShowIcon = False
56 | Me.ShowInTaskbar = False
57 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
58 | Me.Text = "Scan Images"
59 | Me.ResumeLayout(False)
60 | Me.PerformLayout()
61 |
62 | End Sub
63 |
64 | Friend WithEvents LblScanning As Label
65 | Friend WithEvents BackgroundWorker1 As System.ComponentModel.BackgroundWorker
66 | End Class
67 |
--------------------------------------------------------------------------------
/DiskImageTool/Forms/SaveAllForm.vb:
--------------------------------------------------------------------------------
1 | Public Enum MyMsgBoxResult
2 | Ok = 1
3 | Cancel = 2
4 | Abort = 3
5 | Retry = 4
6 | Ignore = 5
7 | Yes = 6
8 | No = 7
9 | YesToAll = 4
10 | NoToAll = 5
11 | End Enum
12 |
13 | Public Class SaveAllForm
14 | Private _Result As MyMsgBoxResult = MyMsgBoxResult.Cancel
15 |
16 | Public Sub New(Caption As String)
17 |
18 | ' This call is required by the designer.
19 | InitializeComponent()
20 |
21 | ' Add any initialization after the InitializeComponent() call.
22 | LblCaption.Text = Caption
23 | End Sub
24 |
25 | Public Property Result As MyMsgBoxResult
26 | Get
27 | Return _Result
28 | End Get
29 | Set
30 | _Result = Value
31 | End Set
32 | End Property
33 |
34 | #Region "Events"
35 |
36 | Private Sub Button_Click(sender As Object, e As EventArgs) Handles BtnYes.Click, BtnNo.Click, BtnCancel.Click, BtnYesToAll.Click, BtnNoToall.Click
37 | If sender Is BtnYes Then
38 | _Result = MyMsgBoxResult.Yes
39 | ElseIf sender Is BtnNo Then
40 | _Result = MyMsgBoxResult.No
41 | ElseIf sender Is BtnCancel Then
42 | _Result = MyMsgBoxResult.Cancel
43 | ElseIf sender Is BtnYesToAll Then
44 | _Result = MyMsgBoxResult.YesToAll
45 | ElseIf sender Is BtnNoToall Then
46 | _Result = MyMsgBoxResult.NoToAll
47 | End If
48 |
49 | Me.Close()
50 | End Sub
51 |
52 | Private Sub SaveAllForm_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
53 | e.Graphics.DrawImage(SystemIcons.Question.ToBitmap, 22, 24)
54 | End Sub
55 |
56 | #End Region
57 |
58 | End Class
--------------------------------------------------------------------------------
/DiskImageTool/Forms/TextViewForm.vb:
--------------------------------------------------------------------------------
1 | Public Class TextViewForm
2 | Private m_SaveFileName As String
3 |
4 | Public Sub New(Caption As String, Content As String, Editable As Boolean, EnableSave As Boolean, Optional SaveFileName As String = "")
5 |
6 | ' This call is required by the designer.
7 | InitializeComponent()
8 |
9 | ' Add any initialization after the InitializeComponent() call.
10 | Me.Text = Caption
11 | TextBox1.Text = Content
12 | TextBox1.SelectionStart = 0
13 | TextBox1.ReadOnly = Not Editable
14 |
15 | m_SaveFileName = SaveFileName
16 |
17 | If Not EnableSave Then
18 | Panel1.Visible = False
19 | TextBox1.Height = Me.ClientSize.Height - TextBox1.Top * 2
20 | End If
21 | End Sub
22 |
23 | Private Sub TextViewForm_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
24 | If e.KeyCode = Keys.Escape Then
25 | Me.Close()
26 | End If
27 | End Sub
28 |
29 | Private Sub BtnSave_Click(sender As Object, e As EventArgs) Handles BtnSave.Click
30 | Dim Dialog = New SaveFileDialog With {
31 | .FileName = m_SaveFileName,
32 | .DefaultExt = "txt",
33 | .Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*"
34 | }
35 |
36 | If Dialog.ShowDialog = DialogResult.OK Then
37 | IO.File.WriteAllText(Dialog.FileName, TextBox1.Text)
38 | End If
39 | End Sub
40 | End Class
--------------------------------------------------------------------------------
/DiskImageTool/Forms/UndeleteForm.vb:
--------------------------------------------------------------------------------
1 | Public Class UndeleteForm
2 | Private Const VALID_CHARS As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
3 | Public Sub New(Filename As String)
4 |
5 | ' This call is required by the designer.
6 | InitializeComponent()
7 |
8 | ' Add any initialization after the InitializeComponent() call.
9 | Filename = "?" & Filename.Substring(1)
10 | Me.LabelFileName.Text = Filename
11 | End Sub
12 |
13 | Public ReadOnly Property FirstChar As Byte
14 | Get
15 | If TextBox1.Text = "" Then
16 | Return 0
17 | Else
18 | Return Asc(TextBox1.Text)
19 | End If
20 | End Get
21 | End Property
22 |
23 | Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress
24 | Dim Value = Asc(e.KeyChar)
25 |
26 | If Value > 96 And Value < 123 Then
27 | Value -= 32
28 | e.KeyChar = Chr(Value)
29 | ElseIf Value > 255 Then
30 | e.KeyChar = Chr(0)
31 | ElseIf Value < 33 And Value <> 8 Then
32 | e.KeyChar = Chr(0)
33 | ElseIf DiskImage.DirectoryEntry.InvalidFileChars.Contains(Value) Then
34 | e.KeyChar = Chr(0)
35 | End If
36 | End Sub
37 | End Class
--------------------------------------------------------------------------------
/DiskImageTool/Forms/VolumeSerialNumberForm.vb:
--------------------------------------------------------------------------------
1 | Public Class VolumeSerialNumberForm
2 | Public Sub New()
3 |
4 | ' This call is required by the designer.
5 | InitializeComponent()
6 |
7 | ' Add any initialization after the InitializeComponent() call.
8 |
9 | End Sub
10 |
11 | Public Function GetValue() As Date
12 | Return New Date(DTDate.Value.Year, DTDate.Value.Month, DTDate.Value.Day, DTTime.Value.Hour, DTTime.Value.Minute, DTTime.Value.Second, CInt(NumMS.Value))
13 | End Function
14 |
15 | Private Sub VolumeSerialNumberForm_Load(sender As Object, e As EventArgs) Handles Me.Load
16 | DTDate.Value = Date.Today
17 | DTTime.Value = Date.Now
18 | NumMS.Value = Date.Now.Millisecond
19 | End Sub
20 |
21 | End Class
--------------------------------------------------------------------------------
/DiskImageTool/Github.vb:
--------------------------------------------------------------------------------
1 | Module Github
2 | Private Const REPOSITORY = "https://api.github.com/repos/Digitoxin1/DiskImageTool"
3 | Private Const CHANGELOG_URL = REPOSITORY & "/releases?per_page=100"
4 | Private Const UPDATE_URL = REPOSITORY & "/releases/latest"
5 | Private Const USER_AGENT = "DiskImageTool"
6 |
7 | Public Function GetAppUpdateResponse() As String
8 | Dim Response As Net.HttpWebResponse
9 | Dim ResponseText As String = ""
10 | Dim CachePath = IO.Path.Combine(IO.Path.GetTempPath(), "DiskImageTool", "AppUpdateResponse.cache")
11 | Dim ETag = My.Settings.AppUpdateETag
12 | Dim NotModified As Boolean = False
13 |
14 | If Not IO.File.Exists(CachePath) Then
15 | ETag = ""
16 | End If
17 |
18 | Dim Request As Net.HttpWebRequest = Net.WebRequest.Create(UPDATE_URL)
19 | Request.UserAgent = USER_AGENT
20 | If ETag <> "" Then
21 | Request.Headers.Add("if-none-match", ETag)
22 | End If
23 |
24 | Try
25 | Response = Request.GetResponse
26 | Dim Reader As New IO.StreamReader(Response.GetResponseStream)
27 | ResponseText = Reader.ReadToEnd
28 |
29 | My.Settings.AppUpdateETag = Response.Headers.Item("etag")
30 | IO.File.WriteAllText(CachePath, ResponseText)
31 |
32 | Catch ex As Net.WebException
33 | If ex.Response IsNot Nothing Then
34 | Response = CType(ex.Response, Net.HttpWebResponse)
35 | If Response.StatusCode = Net.HttpStatusCode.NotModified Then
36 | NotModified = True
37 | End If
38 | End If
39 | Catch ex As Exception
40 | DebugException(ex)
41 | End Try
42 |
43 | If NotModified Then
44 | Try
45 | ResponseText = IO.File.ReadAllText(CachePath)
46 | Catch ex As Exception
47 | DebugException(ex)
48 | End Try
49 | End If
50 |
51 | Return ResponseText
52 | End Function
53 |
54 | Public Function GetChangeLogResponse() As String
55 | Dim Response As Net.HttpWebResponse
56 | Dim ResponseText As String = ""
57 | Dim CachePath = IO.Path.Combine(IO.Path.GetTempPath(), "DiskImageTool", "ChangeLogResponse.cache")
58 | Dim ETag = My.Settings.ChangeLogETag
59 | Dim NotModified As Boolean = False
60 |
61 | If Not IO.File.Exists(CachePath) Then
62 | ETag = ""
63 | End If
64 |
65 | Dim Request As Net.HttpWebRequest = Net.WebRequest.Create(CHANGELOG_URL)
66 | Request.UserAgent = USER_AGENT
67 | If ETag <> "" Then
68 | Request.Headers.Add("if-none-match", ETag)
69 | End If
70 |
71 | Try
72 | Response = Request.GetResponse
73 | Dim Reader As New IO.StreamReader(Response.GetResponseStream)
74 | ResponseText = Reader.ReadToEnd
75 |
76 | My.Settings.ChangeLogETag = Response.Headers.Item("etag")
77 | IO.File.WriteAllText(CachePath, ResponseText)
78 |
79 | Catch ex As Net.WebException
80 | If ex.Response IsNot Nothing Then
81 | Response = CType(ex.Response, Net.HttpWebResponse)
82 | If Response.StatusCode = Net.HttpStatusCode.NotModified Then
83 | NotModified = True
84 | End If
85 | End If
86 | Catch ex As Exception
87 | DebugException(ex)
88 | End Try
89 |
90 | If NotModified Then
91 | Try
92 | ResponseText = IO.File.ReadAllText(CachePath)
93 | Catch ex As Exception
94 | DebugException(ex)
95 | End Try
96 | End If
97 |
98 | Return ResponseText
99 | End Function
100 | End Module
101 |
--------------------------------------------------------------------------------
/DiskImageTool/HexBox2/ByteCollection.vb:
--------------------------------------------------------------------------------
1 | Namespace Hb.Windows.Forms
2 | '''
3 | ''' Represents a collection of bytes.
4 | '''
5 | Public Class ByteCollection
6 | Inherits CollectionBase
7 | '''
8 | ''' Initializes a new instance of ByteCollection class.
9 | '''
10 | Public Sub New()
11 | End Sub
12 |
13 | '''
14 | ''' Initializes a new instance of ByteCollection class.
15 | '''
16 | ''' an array of bytes to add to collection
17 | Public Sub New(bs As Byte())
18 | AddRange(bs)
19 | End Sub
20 |
21 | '''
22 | ''' Gets or sets the value of a byte
23 | '''
24 | Default Public Property Item(index As Integer) As Byte
25 | Get
26 | Return List(index)
27 | End Get
28 | Set(value As Byte)
29 | List(index) = value
30 | End Set
31 | End Property
32 |
33 | '''
34 | ''' Adds a byte into the collection.
35 | '''
36 | ''' the byte to add
37 | Public Sub Add(b As Byte)
38 | List.Add(b)
39 | End Sub
40 |
41 | '''
42 | ''' Adds a range of bytes to the collection.
43 | '''
44 | ''' the bytes to add
45 | Public Sub AddRange(bs As Byte())
46 | InnerList.AddRange(bs)
47 | End Sub
48 |
49 | '''
50 | ''' Returns true, if the byte exists in the collection.
51 | '''
52 | Public Function Contains(b As Byte) As Boolean
53 | Return InnerList.Contains(b)
54 | End Function
55 |
56 | '''
57 | ''' Copies the content of the collection into the given array.
58 | '''
59 | Public Sub CopyTo(bs As Byte(), index As Integer)
60 | InnerList.CopyTo(bs, index)
61 | End Sub
62 |
63 | '''
64 | ''' Gets all bytes in the array
65 | '''
66 | ''' an array of bytes.
67 | Public Function GetBytes() As Byte()
68 | Dim bytes = New Byte(Count - 1) {}
69 | InnerList.CopyTo(0, bytes, 0, bytes.Length)
70 | Return bytes
71 | End Function
72 |
73 | '''
74 | ''' Returns the index of the given byte.
75 | '''
76 | Public Function IndexOf(b As Byte) As Integer
77 | Return InnerList.IndexOf(b)
78 | End Function
79 |
80 | '''
81 | ''' Inserts a byte to the collection.
82 | '''
83 | ''' the index
84 | ''' a byte to insert
85 | Public Sub Insert(index As Integer, b As Byte)
86 | InnerList.Insert(index, b)
87 | End Sub
88 |
89 | '''
90 | ''' Inserts a range of bytes to the collection.
91 | '''
92 | ''' the index of start byte
93 | ''' an array of bytes to insert
94 | Public Sub InsertRange(index As Integer, bs As Byte())
95 | InnerList.InsertRange(index, bs)
96 | End Sub
97 |
98 | '''
99 | ''' Removes a byte from the collection.
100 | '''
101 | ''' the byte to remove
102 | Public Sub Remove(b As Byte)
103 | List.Remove(b)
104 | End Sub
105 |
106 | '''
107 | ''' Removes a range of bytes from the collection.
108 | '''
109 | ''' the index of the start byte
110 | ''' the count of the bytes to remove
111 | Public Sub RemoveRange(index As Integer, count As Integer)
112 | InnerList.RemoveRange(index, count)
113 | End Sub
114 |
115 | '''
116 | ''' Copies the content of the collection into an array.
117 | '''
118 | ''' the array containing all bytes.
119 | Public Function ToArray() As Byte()
120 | Dim data = New Byte(Count - 1) {}
121 | CopyTo(data, 0)
122 | Return data
123 | End Function
124 | End Class
125 | End Namespace
126 |
--------------------------------------------------------------------------------
/DiskImageTool/HexBox2/BytePositionInfo.vb:
--------------------------------------------------------------------------------
1 | Namespace Hb.Windows.Forms
2 | '''
3 | ''' Represents a position in the HexBox control
4 | '''
5 | Friend Structure BytePositionInfo
6 | Private ReadOnly _characterPosition As Integer
7 | Private ReadOnly _index As Long
8 |
9 | Public Sub New(index As Long, characterPosition As Integer)
10 | _index = index
11 | _characterPosition = characterPosition
12 | End Sub
13 |
14 | Public ReadOnly Property CharacterPosition As Integer
15 | Get
16 | Return _characterPosition
17 | End Get
18 | End Property
19 |
20 | Public ReadOnly Property Index As Long
21 | Get
22 | Return _index
23 | End Get
24 | End Property
25 | End Structure
26 | End Namespace
--------------------------------------------------------------------------------
/DiskImageTool/HexBox2/DataBlock.vb:
--------------------------------------------------------------------------------
1 | Namespace Hb.Windows.Forms
2 | Friend MustInherit Class DataBlock
3 | Friend _map As Forms.DataMap
4 | Friend _nextBlock As DataBlock
5 | Friend _previousBlock As DataBlock
6 |
7 | Public MustOverride ReadOnly Property Length As Long
8 |
9 | Public ReadOnly Property Map As Forms.DataMap
10 | Get
11 | Return _map
12 | End Get
13 | End Property
14 |
15 | Public ReadOnly Property NextBlock As DataBlock
16 | Get
17 | Return _nextBlock
18 | End Get
19 | End Property
20 |
21 | Public ReadOnly Property PreviousBlock As DataBlock
22 | Get
23 | Return _previousBlock
24 | End Get
25 | End Property
26 |
27 | Public MustOverride Sub RemoveBytes(position As Long, count As Long)
28 | End Class
29 | End Namespace
30 |
--------------------------------------------------------------------------------
/DiskImageTool/HexBox2/FileDataBlock.vb:
--------------------------------------------------------------------------------
1 | Namespace Hb.Windows.Forms
2 | Friend NotInheritable Class FileDataBlock
3 | Inherits Forms.DataBlock
4 |
5 | Private _fileOffset As Long
6 | Private _length As Long
7 |
8 | Public Sub New(fileOffset As Long, length As Long)
9 | _fileOffset = fileOffset
10 | _length = length
11 | End Sub
12 |
13 | Public ReadOnly Property FileOffset As Long
14 | Get
15 | Return _fileOffset
16 | End Get
17 | End Property
18 |
19 | Public Overrides ReadOnly Property Length As Long
20 | Get
21 | Return _length
22 | End Get
23 | End Property
24 |
25 | Public Overrides Sub RemoveBytes(position As Long, count As Long)
26 | If position > _length Then
27 | Throw New ArgumentOutOfRangeException("position")
28 | End If
29 |
30 | If position + count > _length Then
31 | Throw New ArgumentOutOfRangeException("count")
32 | End If
33 |
34 | Dim prefixLength = position
35 | Dim prefixFileOffset = _fileOffset
36 |
37 | Dim suffixLength = _length - count - prefixLength
38 | Dim suffixFileOffset = _fileOffset + position + count
39 |
40 | If prefixLength > 0 AndAlso suffixLength > 0 Then
41 | _fileOffset = prefixFileOffset
42 | _length = prefixLength
43 | MyBase._map.AddAfter(Me, New FileDataBlock(suffixFileOffset, suffixLength))
44 | Return
45 | End If
46 |
47 | If prefixLength > 0 Then
48 | _fileOffset = prefixFileOffset
49 | _length = prefixLength
50 | Else
51 | _fileOffset = suffixFileOffset
52 | _length = suffixLength
53 | End If
54 | End Sub
55 |
56 | Public Sub RemoveBytesFromEnd(count As Long)
57 | If count > _length Then
58 | Throw New ArgumentOutOfRangeException("count")
59 | End If
60 |
61 | _length -= count
62 | End Sub
63 |
64 | Public Sub RemoveBytesFromStart(count As Long)
65 | If count > _length Then
66 | Throw New ArgumentOutOfRangeException("count")
67 | End If
68 |
69 | _fileOffset += count
70 | _length -= count
71 | End Sub
72 |
73 | Public Sub SetFileOffset(value As Long)
74 | _fileOffset = value
75 | End Sub
76 | End Class
77 | End Namespace
78 |
--------------------------------------------------------------------------------
/DiskImageTool/HexBox2/FindOptions.vb:
--------------------------------------------------------------------------------
1 | Imports System.Text
2 |
3 | Namespace Hb.Windows.Forms
4 | '''
5 | ''' Defines the type of the Find operation.
6 | '''
7 | Public Enum FindType
8 | '''
9 | ''' Used for Text Find operations
10 | '''
11 | Text
12 |
13 | '''
14 | ''' Used for Hex Find operations
15 | '''
16 | Hex
17 | End Enum
18 |
19 | '''
20 | ''' Defines all state information nee
21 | '''
22 | Public Class FindOptions
23 | '''
24 | ''' Gets the Find buffer used for case insensitive Find operations. This is the binary representation of Text.
25 | '''
26 | Private _FindBuffer As Byte()
27 |
28 | '''
29 | ''' Gets the Find buffer used for case sensitive Find operations. This is the binary representation of Text in lower case format.
30 | '''
31 | Private _FindBufferLowerCase As Byte()
32 |
33 | '''
34 | ''' Gets the Find buffer used for case sensitive Find operations. This is the binary representation of Text in upper case format.
35 | '''
36 | Private _FindBufferUpperCase As Byte()
37 |
38 | '''
39 | ''' Contains the MatchCase value
40 | '''
41 | Private _matchCase As Boolean
42 |
43 | '''
44 | ''' Contains the text that should be found.
45 | '''
46 | Private _text As String
47 |
48 | '''
49 | ''' Gets or sets the hex buffer that should be found. Only used, when Type is FindType.Hex.
50 | '''
51 | Public Property Hex As Byte()
52 |
53 | '''
54 | ''' Gets or sets whether the Find options are valid
55 | '''
56 | Public Property IsValid As Boolean
57 |
58 | '''
59 | ''' Gets or sets the value, whether the Find operation is case sensitive or not.
60 | '''
61 | Public Property MatchCase As Boolean
62 | Get
63 | Return _matchCase
64 | End Get
65 | Set(value As Boolean)
66 | _matchCase = value
67 | UpdateFindBuffer()
68 | End Set
69 | End Property
70 |
71 | '''
72 | ''' Gets or sets the text that should be found. Only used, when Type is FindType.Hex.
73 | '''
74 | Public Property Text As String
75 | Get
76 | Return _text
77 | End Get
78 | Set(value As String)
79 | _text = value
80 | UpdateFindBuffer()
81 | End Set
82 | End Property
83 |
84 | '''
85 | ''' Gets or sets the type what should be searched.
86 | '''
87 | Public Property Type As FindType
88 |
89 | Friend Property FindBuffer As Byte()
90 | Get
91 | Return _FindBuffer
92 | End Get
93 | Private Set(value As Byte())
94 | _FindBuffer = value
95 | End Set
96 | End Property
97 |
98 | Friend Property FindBufferLowerCase As Byte()
99 | Get
100 | Return _FindBufferLowerCase
101 | End Get
102 | Private Set(value As Byte())
103 | _FindBufferLowerCase = value
104 | End Set
105 | End Property
106 |
107 | Friend Property FindBufferUpperCase As Byte()
108 | Get
109 | Return _FindBufferUpperCase
110 | End Get
111 | Private Set(value As Byte())
112 | _FindBufferUpperCase = value
113 | End Set
114 | End Property
115 |
116 | '''
117 | ''' Updates the find buffer.
118 | '''
119 | Private Sub UpdateFindBuffer()
120 | Dim text = If(Not Equals(Me.Text, Nothing), Me.Text, String.Empty)
121 | FindBuffer = Encoding.ASCII.GetBytes(text)
122 | FindBufferLowerCase = Encoding.ASCII.GetBytes(text.ToLower())
123 | FindBufferUpperCase = Encoding.ASCII.GetBytes(text.ToUpper())
124 | End Sub
125 | End Class
126 | End Namespace
127 |
--------------------------------------------------------------------------------
/DiskImageTool/HexBox2/HexCasing.vb:
--------------------------------------------------------------------------------
1 | Namespace Hb.Windows.Forms
2 | '''
3 | ''' Specifies the case of hex characters in the HexBox control
4 | '''
5 | Public Enum HexCasing
6 | '''
7 | ''' Converts all characters to uppercase.
8 | '''
9 | Upper = 0
10 |
11 | '''
12 | ''' Converts all characters to lowercase.
13 | '''
14 | Lower = 1
15 | End Enum
16 | End Namespace
--------------------------------------------------------------------------------
/DiskImageTool/HexBox2/IByteCharConverter.vb:
--------------------------------------------------------------------------------
1 | Namespace Hb.Windows.Forms
2 | '''
3 | ''' The interface for objects that can translate between characters and bytes.
4 | '''
5 | Public Interface IByteCharConverter
6 | '''
7 | ''' Returns the byte to use when the character passed across is entered during editing.
8 | '''
9 | '''
10 | '''
11 | Function ToByte(c As Char) As Byte
12 |
13 | '''
14 | ''' Returns the character to display for the byte passed across.
15 | '''
16 | '''
17 | '''
18 | Function ToChar(b As Byte) As Char
19 | End Interface
20 | End Namespace
21 |
--------------------------------------------------------------------------------
/DiskImageTool/HexBox2/IByteProvider.vb:
--------------------------------------------------------------------------------
1 | Namespace Hb.Windows.Forms
2 | '''
3 | ''' Defines a byte provider for HexBox control
4 | '''
5 | Public Interface IByteProvider
6 | '''
7 | ''' Occurs, when bytes are changed.
8 | '''
9 | Event Changed As EventHandler
10 |
11 | '''
12 | ''' Occurs, when the Length property changed.
13 | '''
14 | Event LengthChanged As EventHandler
15 |
16 | '''
17 | ''' Returns the total length of bytes the byte provider is providing.
18 | '''
19 | ReadOnly Property Length As Long
20 |
21 | '''
22 | ''' Applies changes.
23 | '''
24 | Sub ApplyChanges()
25 |
26 | '''
27 | ''' Deletes bytes from the provider
28 | '''
29 | ''' the start index of the bytes to delete
30 | ''' the length of the bytes to delete
31 | ''' This method must raise the LengthChanged event.
32 | Sub DeleteBytes(index As Long, length As Long)
33 |
34 | '''
35 | ''' True, when changes are done.
36 | '''
37 | Function HasChanges() As Boolean
38 |
39 | '''
40 | ''' Inserts bytes into the provider
41 | '''
42 | '''
43 | '''
44 | ''' This method must raise the LengthChanged event.
45 | Sub InsertBytes(index As Long, bs As Byte())
46 |
47 | '''
48 | ''' Reads a byte from the provider
49 | '''
50 | ''' the index of the byte to read
51 | ''' the byte to read
52 | Function ReadByte(index As Long) As Byte
53 |
54 | '''
55 | ''' Returns a value if the DeleteBytes methods is supported by the provider.
56 | '''
57 | ''' True, when it´s supported.
58 | Function SupportsDeleteBytes() As Boolean
59 |
60 | '''
61 | ''' Returns a value if the InsertBytes methods is supported by the provider.
62 | '''
63 | ''' True, when it´s supported.
64 | Function SupportsInsertBytes() As Boolean
65 |
66 | '''
67 | ''' Returns a value if the WriteByte methods is supported by the provider.
68 | '''
69 | ''' True, when it´s supported.
70 | Function SupportsWriteByte() As Boolean
71 |
72 | '''
73 | ''' Writes a byte into the provider
74 | '''
75 | ''' the index of the byte to write
76 | ''' the byte to write
77 | Sub WriteByte(index As Long, value As Byte)
78 | End Interface
79 | End Namespace
80 |
--------------------------------------------------------------------------------
/DiskImageTool/HexBox2/MemoryDataBlock.vb:
--------------------------------------------------------------------------------
1 | Namespace Hb.Windows.Forms
2 | Friend NotInheritable Class MemoryDataBlock
3 | Inherits Forms.DataBlock
4 |
5 | Private _data As Byte()
6 |
7 | Public Sub New(data As Byte)
8 | _data = New Byte() {data}
9 | End Sub
10 |
11 | Public Sub New(data As Byte())
12 | If data Is Nothing Then
13 | Throw New ArgumentNullException("data")
14 | End If
15 |
16 | _data = CType(data.Clone(), Byte())
17 | End Sub
18 |
19 | Public ReadOnly Property Data As Byte()
20 | Get
21 | Return _data
22 | End Get
23 | End Property
24 |
25 | Public Overrides ReadOnly Property Length As Long
26 | Get
27 | Return _data.LongLength
28 | End Get
29 | End Property
30 |
31 | Public Sub AddByteToEnd(value As Byte)
32 | Dim newData = New Byte(_data.LongLength + 1 - 1) {}
33 | _data.CopyTo(newData, 0)
34 | newData(newData.LongLength - 1) = value
35 | _data = newData
36 | End Sub
37 |
38 | Public Sub AddByteToStart(value As Byte)
39 | Dim newData = New Byte(_data.LongLength + 1 - 1) {}
40 | newData(0) = value
41 | _data.CopyTo(newData, 1)
42 | _data = newData
43 | End Sub
44 |
45 | Public Sub InsertBytes(position As Long, data As Byte())
46 | Dim newData = New Byte(_data.LongLength + data.LongLength - 1) {}
47 |
48 | If position > 0 Then
49 | Array.Copy(_data, 0, newData, 0, position)
50 | End If
51 |
52 | Array.Copy(data, 0, newData, position, data.LongLength)
53 |
54 | If position < _data.LongLength Then
55 | Array.Copy(_data, position, newData, position + data.LongLength, _data.LongLength - position)
56 | End If
57 |
58 | _data = newData
59 | End Sub
60 |
61 | Public Overrides Sub RemoveBytes(position As Long, count As Long)
62 | Dim newData = New Byte(_data.LongLength - count - 1) {}
63 |
64 | If position > 0 Then
65 | Array.Copy(_data, 0, newData, 0, position)
66 | End If
67 |
68 | If position + count < _data.LongLength Then
69 | Array.Copy(_data, position + count, newData, position, newData.LongLength - position)
70 | End If
71 |
72 | _data = newData
73 | End Sub
74 | End Class
75 | End Namespace
76 |
--------------------------------------------------------------------------------
/DiskImageTool/HexBox2/NativeMethods.vb:
--------------------------------------------------------------------------------
1 | Imports System.Runtime.InteropServices
2 |
3 | Namespace Hb.Windows.Forms
4 | Friend Module NativeMethods
5 | ' Key definitions
6 | Public Const WM_CHAR As Integer = &H102
7 | Public Const WM_KEYDOWN As Integer = &H100
8 | Public Const WM_KEYUP As Integer = &H101
9 |
10 | ' Caret definitions
11 |
12 | Public Function CreateCaret(hWnd As IntPtr, hBitmap As IntPtr, nWidth As Integer, nHeight As Integer) As Boolean
13 | End Function
14 |
15 |
16 | Public Function DestroyCaret() As Boolean
17 | End Function
18 |
19 |
20 | Public Function SetCaretPos(X As Integer, Y As Integer) As Boolean
21 | End Function
22 |
23 |
24 | Public Function ShowCaret(hWnd As IntPtr) As Boolean
25 | End Function
26 | End Module
27 | End Namespace
--------------------------------------------------------------------------------
/DiskImageTool/HexBox2/Util.vb:
--------------------------------------------------------------------------------
1 | Namespace Hb.Windows.Forms
2 | Friend Module Util
3 | '''
4 | ''' Contains true, if we are in design mode of Visual Studio
5 | '''
6 | Private ReadOnly _designMode As Boolean
7 |
8 | '''
9 | ''' Initializes an instance of Util class
10 | '''
11 | Sub New()
12 | ' design mode is true if host process is: Visual Studio, Visual Studio Express Versions (C#, VB, C++) or SharpDevelop
13 | Dim designerHosts = New List(Of String)() From {
14 | "devenv",
15 | "vcsexpress",
16 | "vbexpress",
17 | "vcexpress",
18 | "sharpdevelop"
19 | }
20 | Using process = Diagnostics.Process.GetCurrentProcess()
21 | Dim processName = process.ProcessName.ToLower()
22 | _designMode = designerHosts.Contains(processName)
23 | End Using
24 | End Sub
25 |
26 | '''
27 | ''' Gets true, if we are in design mode of Visual Studio
28 | '''
29 | '''
30 | ''' In Visual Studio 2008 SP1 the designer is crashing sometimes on windows forms.
31 | ''' The DesignMode property of Control class is buggy and cannot be used, so use our own implementation instead.
32 | '''
33 | Public ReadOnly Property DesignMode As Boolean
34 | Get
35 | Return _designMode
36 | End Get
37 | End Property
38 | End Module
39 | End Namespace
40 |
--------------------------------------------------------------------------------
/DiskImageTool/HexView/HexViewData.vb:
--------------------------------------------------------------------------------
1 | Imports DiskImageTool.DiskImage
2 | Imports DiskImageTool.Hb.Windows.Forms
3 |
4 | Public Class HexViewData
5 | Private ReadOnly _HexViewSectorData As HexViewSectorData
6 | Public Sub New(HexViewSectorData As HexViewSectorData, Index As Integer)
7 | _HexViewSectorData = HexViewSectorData
8 | _Index = Index
9 | _SectorBlock = _HexViewSectorData.SectorData.GetBlock(Index)
10 | _ByteProvider = New MyByteProvider(_HexViewSectorData.SectorData.SectorData, _SectorBlock.Offset, _SectorBlock.Size)
11 | End Sub
12 | Public ReadOnly Property ByteProvider As IByteProvider
13 |
14 | Public ReadOnly Property Disk As DiskImage.Disk
15 | Get
16 | Return _HexViewSectorData.Disk
17 | End Get
18 | End Property
19 | Public ReadOnly Property Index As Integer
20 | Public ReadOnly Property SectorBlock As SectorBlock
21 |
22 | Public Overrides Function ToString() As String
23 | Dim Sector = _SectorBlock.SectorStart
24 | Dim SectorEnd = _SectorBlock.SectorStart + _SectorBlock.SectorCount - 1
25 |
26 | Dim Cluster As UShort
27 | Dim ClusterEnd As UShort
28 | If _HexViewSectorData.Disk.IsValidImage Then
29 | Cluster = _HexViewSectorData.Disk.BPB.SectorToCluster(Sector)
30 | ClusterEnd = _HexViewSectorData.Disk.BPB.SectorToCluster(SectorEnd)
31 | Else
32 | Cluster = 0
33 | ClusterEnd = 0
34 | End If
35 |
36 | Dim Header As String = "Sector " & Sector & IIf(SectorEnd > Sector, "-" & SectorEnd, "")
37 | If Cluster > 0 Then
38 | Header = "Cluster " & Cluster & IIf(ClusterEnd > Cluster, "-" & ClusterEnd, "") & "; " & Header
39 | End If
40 | If _SectorBlock.Description <> "" Then
41 | Header = _SectorBlock.Description & " (" & Header & ")"
42 | End If
43 |
44 | Return Header
45 | End Function
46 | End Class
47 |
--------------------------------------------------------------------------------
/DiskImageTool/HexView/HexViewFunctions.vb:
--------------------------------------------------------------------------------
1 | Imports System.Globalization
2 | Imports System.Runtime.InteropServices
3 | Imports System.Text.RegularExpressions
4 | Imports System.Threading
5 | Imports DiskImageTool.Hb.Windows.Forms
6 |
7 | Namespace HexView
8 | Module HexViewFunctions
9 | Public Function ClipboardHasHex() As Boolean
10 | Dim DataObject = Clipboard.GetDataObject()
11 |
12 | If DataObject.GetDataPresent(GetType(String)) Then
13 | Dim Hex = CStr(DataObject.GetData(GetType(String)))
14 | Return ConvertHexToBytes(Hex) IsNot Nothing
15 | End If
16 |
17 | Return False
18 | End Function
19 | Private Function ConvertHexToByte(Hex As String, ByRef b As Byte) As Boolean
20 | Return Byte.TryParse(Hex, NumberStyles.HexNumber, Thread.CurrentThread.CurrentCulture, b)
21 | End Function
22 |
23 | Public Function ConvertHexToBytes(Hex As String) As Byte()
24 | If String.IsNullOrEmpty(Hex) Then
25 | Return Nothing
26 | End If
27 |
28 | Hex = Hex.Trim()
29 | Hex = Hex.Replace(" ", "")
30 | Hex = Hex.Replace(Chr(13), "")
31 | Hex = Hex.Replace(Chr(10), "")
32 | Hex = Hex.Replace(Chr(9), "")
33 |
34 | Dim regex = New Regex("^[0-9A-F]*$", RegexOptions.IgnoreCase)
35 |
36 | Dim HexArray As String()
37 | If regex.IsMatch(Hex) Then
38 | If Hex.Length Mod 2 = 1 Then
39 | Hex = "0" & Hex
40 | End If
41 | HexArray = New String(Hex.Length / 2 - 1) {}
42 | For i As Integer = 0 To Hex.Length / 2 - 1
43 | HexArray(i) = Hex.Substring(i * 2, 2)
44 | Next
45 | Else
46 | Return Nothing
47 | End If
48 |
49 | Dim ByteArray = New Byte(HexArray.Length - 1) {}
50 | Dim b As Byte = Nothing
51 | For j = 0 To HexArray.Length - 1
52 | Dim HexValue = HexArray(j)
53 |
54 | If Not ConvertHexToByte(HexValue, b) Then
55 | Return Nothing
56 | End If
57 |
58 | ByteArray(j) = b
59 | Next
60 |
61 | Return ByteArray
62 | End Function
63 |
64 | Public Sub CopyHex(HexBox As HexBox, Formatted As Boolean)
65 | Dim Capacity As Integer = HexBox.SelectionLength * 2 + HexBox.SelectionLength
66 | If Formatted Then
67 | Capacity += HexBox.SelectionLength \ 16
68 | End If
69 | Dim SB = New System.Text.StringBuilder(Capacity)
70 | For Counter = 0 To HexBox.SelectionLength - 1
71 | Dim B = HexBox.ByteProvider.ReadByte(HexBox.SelectionStart + Counter)
72 | SB.Append(B.ToString("X2"))
73 | If Formatted AndAlso (Counter + 1) Mod 16 = 0 Then
74 | SB.Append(vbNewLine)
75 | Else
76 | SB.Append(" ")
77 | End If
78 | Next
79 | Clipboard.SetText(SB.ToString)
80 | End Sub
81 | End Module
82 | End Namespace
83 |
--------------------------------------------------------------------------------
/DiskImageTool/HexView/HexViewHighlightRegion.vb:
--------------------------------------------------------------------------------
1 | Public Class HexViewHighlightRegion
2 | Implements IEquatable(Of HexViewHighlightRegion)
3 | Implements IComparable(Of HexViewHighlightRegion)
4 |
5 | Public Sub New(Start As Long, Size As Long, ForeColor As Color)
6 | _Start = Start
7 | _Size = Size
8 | _ForeColor = ForeColor
9 | _BackColor = Color.White
10 | _Description = ""
11 | End Sub
12 |
13 | Public Sub New(Start As Long, Size As Long, ForeColor As Color, Description As String)
14 | _Start = Start
15 | _Size = Size
16 | _ForeColor = ForeColor
17 | _BackColor = Color.White
18 | _Description = Description
19 | End Sub
20 |
21 | Public Sub New(Start As Long, Size As Long, ForeColor As Color, BackColor As Color)
22 | _Start = Start
23 | _Size = Size
24 | _ForeColor = ForeColor
25 | _BackColor = BackColor
26 | _Description = ""
27 | End Sub
28 |
29 | Public Sub New(Start As Long, Size As Long, ForeColor As Color, BackColor As Color, Description As String)
30 | _Start = Start
31 | _Size = Size
32 | _ForeColor = ForeColor
33 | _BackColor = BackColor
34 | _Description = Description
35 | End Sub
36 |
37 | Public ReadOnly Property BackColor As Color
38 | Public ReadOnly Property Description As String
39 | Public ReadOnly Property ForeColor As Color
40 | Public ReadOnly Property Size As Long
41 | Public ReadOnly Property Start As Long
42 |
43 | Public Function CompareTo(comparePart As HexViewHighlightRegion) As Integer Implements IComparable(Of HexViewHighlightRegion).CompareTo
44 | If comparePart Is Nothing Then
45 | Return 1
46 | Else
47 |
48 | Return Me.Start.CompareTo(comparePart.Start)
49 | End If
50 | End Function
51 |
52 | Public Overloads Function Equals(other As HexViewHighlightRegion) As Boolean Implements IEquatable(Of HexViewHighlightRegion).Equals
53 | If other Is Nothing Then
54 | Return False
55 | End If
56 | Return (Me.Start.Equals(other.Start))
57 | End Function
58 | End Class
--------------------------------------------------------------------------------
/DiskImageTool/HexView/HexViewRegionDescription.vb:
--------------------------------------------------------------------------------
1 | Public Class HexViewRegionDescription
2 | Public Sub New(Start As Long, Size As Long, Text As String)
3 | _Start = Start
4 | _Size = Size
5 | _Text = Text
6 | End Sub
7 | Public ReadOnly Property Size As Long
8 | Public ReadOnly Property Start As Long
9 | Public ReadOnly Property Text As String
10 | End Class
11 |
--------------------------------------------------------------------------------
/DiskImageTool/HexView/HexViewSectorData.vb:
--------------------------------------------------------------------------------
1 | Imports DiskImageTool.DiskImage
2 |
3 | Public Class HexViewSectorData
4 | Public Sub New(Disk As Disk)
5 | _Disk = Disk
6 | _SectorData = New SectorData(Disk)
7 | _HighlightedRegionList = New List(Of HighlightedRegions)
8 | End Sub
9 |
10 | Public Sub New(Disk As Disk, ClusterChain As List(Of UShort))
11 | _Disk = Disk
12 | _SectorData = New SectorData(Disk)
13 | _SectorData.AddBlocksByChain(ClusterListToSectorList(_Disk.BPB, ClusterChain))
14 | _HighlightedRegionList = New List(Of HighlightedRegions)
15 | End Sub
16 |
17 | Public Sub New(Disk As Disk, SectorChain As List(Of UInteger))
18 | _Disk = Disk
19 | _SectorData = New SectorData(Disk)
20 | _SectorData.AddBlocksByChain(SectorChain)
21 | _HighlightedRegionList = New List(Of HighlightedRegions)
22 | End Sub
23 |
24 | Public Sub New(Disk As Disk, Offset As UInteger, Length As UInteger)
25 | _Disk = Disk
26 | _SectorData = New SectorData(Disk)
27 | _SectorData.AddBlockByOffset(Offset, Length)
28 | _HighlightedRegionList = New List(Of HighlightedRegions)
29 | End Sub
30 |
31 | Public Property Description As String
32 | Public ReadOnly Property Disk As Disk
33 | Public ReadOnly Property HighlightedRegionList As List(Of HighlightedRegions)
34 | Public ReadOnly Property SectorData As SectorData
35 | End Class
36 |
--------------------------------------------------------------------------------
/DiskImageTool/HexView/HighlightedRegions.vb:
--------------------------------------------------------------------------------
1 | Public Class HighlightedRegions
2 | Inherits List(Of HexViewHighlightRegion)
3 |
4 | Public Sub AddBootSectorOffset(Offset As DiskImage.BootSector.BootSectorOffsets, ForeColor As Color)
5 | Dim Name As String = [Enum].GetName(GetType(DiskImage.BootSector.BootSectorOffsets), Offset)
6 | Dim Size As DiskImage.BootSector.BootSectorSizes
7 |
8 | If Not [Enum].TryParse(Name, Size) Then
9 | Size = 0
10 | End If
11 |
12 | Me.Add(New HexViewHighlightRegion(Offset, Size, ForeColor, DiskImage.BootSectorDescription(Offset)))
13 | End Sub
14 |
15 | Public Sub AddBootSectorOffset(Description As String, Offset As DiskImage.BootSector.BootSectorOffsets, Size As DiskImage.BootSector.BootSectorSizes, ForeColor As Color)
16 | Me.Add(New HexViewHighlightRegion(Offset, Size, ForeColor, Description))
17 | End Sub
18 |
19 | Public Sub AddBPBoffset(Offset As DiskImage.BiosParameterBlock.BPBOoffsets, ForeColor As Color)
20 | Dim Name As String = [Enum].GetName(GetType(DiskImage.BiosParameterBlock.BPBOoffsets), Offset)
21 | Dim Size As DiskImage.BiosParameterBlock.BPBSizes
22 |
23 | If Not [Enum].TryParse(Name, Size) Then
24 | Size = 0
25 | End If
26 |
27 | Me.Add(New HexViewHighlightRegion(Offset, Size, ForeColor, DiskImage.BPBDescription(Offset)))
28 | End Sub
29 |
30 | Public Sub AddDirectoryEntryLFNOffset(Start As Long, Offset As DiskImage.DirectoryEntry.LFNOffsets, ForeColor As Color)
31 | Dim Name As String = [Enum].GetName(GetType(DiskImage.DirectoryEntry.LFNOffsets), Offset)
32 | Dim Size As DiskImage.DirectoryEntry.LFNSizes
33 |
34 | If Not [Enum].TryParse(Name, Size) Then
35 | Size = 0
36 | End If
37 |
38 | Me.Add(New HexViewHighlightRegion(Start + Offset, Size, ForeColor, DiskImage.DirectorytEntryLFNDescription(Offset)))
39 | End Sub
40 |
41 | Public Sub AddDirectoryEntryOffset(Start As Long, Offset As DiskImage.DirectoryEntry.DirectoryEntryOffsets, ForeColor As Color)
42 | Dim Name As String = [Enum].GetName(GetType(DiskImage.DirectoryEntry.DirectoryEntryOffsets), Offset)
43 | Dim Size As DiskImage.DirectoryEntry.DirectoryEntrySizes
44 |
45 | If Not [Enum].TryParse(Name, Size) Then
46 | Size = 0
47 | End If
48 |
49 | Me.Add(New HexViewHighlightRegion(Start + Offset, Size, ForeColor, DiskImage.DirectorytEntryDescription(Offset)))
50 | End Sub
51 |
52 | Public Function AddItem(Start As Long, Size As Long, ForeColor As Color) As HexViewHighlightRegion
53 | Return AddItem(Start, Size, ForeColor, Color.White, "")
54 | End Function
55 |
56 | Public Function AddItem(Start As Long, Size As Long, ForeColor As Color, Description As String) As HexViewHighlightRegion
57 | Return AddItem(Start, Size, ForeColor, Color.White, Description)
58 | End Function
59 |
60 | Public Function AddItem(Start As Long, Size As Long, ForeColor As Color, BackColor As Color) As HexViewHighlightRegion
61 | Return AddItem(Start, Size, ForeColor, BackColor, "")
62 | End Function
63 |
64 | Public Function AddItem(Start As Long, Size As Long, ForeColor As Color, BackColor As Color, Description As String) As HexViewHighlightRegion
65 | Dim HexViewHighlightRegion As New HexViewHighlightRegion(Start, Size, ForeColor, BackColor, Description)
66 | Me.Add(HexViewHighlightRegion)
67 |
68 | Return HexViewHighlightRegion
69 | End Function
70 | End Class
71 |
--------------------------------------------------------------------------------
/DiskImageTool/HexView/MyByteProvider.vb:
--------------------------------------------------------------------------------
1 | Imports DiskImageTool.DiskImage
2 | Imports DiskImageTool.Hb.Windows.Forms
3 |
4 | Public Class MyByteProvider
5 | Implements IByteProvider
6 |
7 | Private ReadOnly _FloppyImage As IFloppyImage
8 | Private ReadOnly _Offset As UInteger
9 | Private ReadOnly _Size As UInteger
10 | Private _hasChanges As Boolean
11 | Public Event Changed As EventHandler Implements IByteProvider.Changed
12 | Public Event LengthChanged As EventHandler Implements IByteProvider.LengthChanged
13 |
14 | Public Sub New(FloppyImage As IFloppyImage, Offset As UInteger, Size As UInteger)
15 | _FloppyImage = FloppyImage
16 | _Offset = Offset
17 | _Size = Size
18 |
19 | AddHandler FloppyImage.History.DataChanged, AddressOf DataBytes_DataChanged
20 | End Sub
21 |
22 | Protected Overrides Sub Finalize()
23 | MyBase.Finalize()
24 |
25 | RemoveHandler _FloppyImage.History.DataChanged, AddressOf DataBytes_DataChanged
26 | End Sub
27 |
28 | Public ReadOnly Property Length As Long Implements IByteProvider.Length
29 | Get
30 | Return _Size
31 | End Get
32 | End Property
33 |
34 | Public Sub ApplyChanges() Implements IByteProvider.ApplyChanges
35 | _hasChanges = False
36 | End Sub
37 |
38 | Public Sub DeleteBytes(index As Long, length As Long) Implements IByteProvider.DeleteBytes
39 | 'Not Implmented
40 | End Sub
41 |
42 | Public Function HasChanges() As Boolean Implements IByteProvider.HasChanges
43 | Return _hasChanges
44 | End Function
45 |
46 | Public Sub InsertBytes(index As Long, bs As Byte()) Implements IByteProvider.InsertBytes
47 | 'Not Implmented
48 | End Sub
49 |
50 | Public Function ReadByte(index As Long) As Byte Implements IByteProvider.ReadByte
51 | Return _FloppyImage.GetByte(_Offset + index)
52 | End Function
53 |
54 | Public Function SupportsDeleteBytes() As Boolean Implements IByteProvider.SupportsDeleteBytes
55 | Return False
56 | End Function
57 |
58 | Public Function SupportsInsertBytes() As Boolean Implements IByteProvider.SupportsInsertBytes
59 | Return False
60 | End Function
61 |
62 | Public Function SupportsWriteByte() As Boolean Implements IByteProvider.SupportsWriteByte
63 | Return True
64 | End Function
65 |
66 | Public Sub WriteByte(index As Long, value As Byte) Implements IByteProvider.WriteByte
67 | Dim Offset As UInteger = _Offset + index
68 | _FloppyImage.SetBytes(value, Offset)
69 | End Sub
70 |
71 | Private Sub DataBytes_DataChanged(sender As Object, e As EventArgs)
72 | _hasChanges = True
73 | RaiseEvent Changed(Me, EventArgs.Empty)
74 | End Sub
75 | End Class
76 |
77 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageData.vb:
--------------------------------------------------------------------------------
1 | Public Class ImageData
2 | Private ReadOnly _Filters() As Boolean
3 |
4 | Public Sub New(SourceFile As String)
5 | _AppliedFilters = 0
6 | _BatchUpdated = False
7 | _BottomIndex = -1
8 | _Compressed = False
9 | _CompressedFile = ""
10 | _DiskType = ""
11 | _FATIndex = 0
12 | _SourceFile = SourceFile
13 | _Modifications = Nothing
14 | _OEMName = ""
15 | _ReadOnly = False
16 | _Scanned = False
17 | _SortHistory = Nothing
18 | _InvalidImage = False
19 | _Loaded = False
20 | _Checksum = 0
21 | _ExternalModified = False
22 | _XDFMiniDisk = False
23 | _XDFOffset = 0
24 | _XDFLength = 0
25 |
26 | Dim FilterCount As Integer = Filters.FilterGetCount()
27 | ReDim _Filters(FilterCount - 1)
28 | For Counter = 0 To FilterCount - 1
29 | _Filters(Counter) = False
30 | Next
31 | End Sub
32 |
33 | Public Property [ReadOnly] As Boolean
34 | Public Property AppliedFilters As Integer
35 | Public Property BatchUpdated As Boolean
36 | Public Property BottomIndex As Integer
37 | Public Property CachedRootDir As Byte()
38 | Public Property Checksum As UInteger
39 | Public Property Compressed As Boolean
40 | Public Property CompressedFile As String
41 | Public Property DiskType As String
42 | Public Property ExternalModified As Boolean
43 | Public Property FATIndex As UShort
44 | Public Property InvalidImage As Boolean
45 | Public Property Loaded As Boolean
46 | Public Property Modifications As Stack(Of DiskImage.DataChange())
47 | Public Property OEMName As String
48 | Public Property Scanned As Boolean
49 | Public Property SortHistory As List(Of SortEntity)
50 | Public Property SourceFile As String
51 | Public Shared Property StringOffset As Integer = 0
52 | Public Property XDFLength As UInteger
53 | Public Property XDFMiniDisk As Boolean
54 | Public Property XDFOffset As UInteger
55 |
56 | Public Property Filter(FilterType As Filters.FilterTypes) As Boolean
57 | Get
58 | Return _Filters(FilterType)
59 | End Get
60 |
61 | Set(value As Boolean)
62 | _Filters(FilterType) = value
63 | End Set
64 | End Property
65 |
66 | Public Function DisplayPath() As String
67 | Dim FullPath = _SourceFile
68 | If _Compressed Then
69 | FullPath = IO.Path.Combine(FullPath, Replace(_CompressedFile, "/", "\"))
70 | End If
71 | Return FullPath
72 | End Function
73 |
74 | Public Function FileName() As String
75 | If _Compressed Then
76 | Return IO.Path.GetFileName(_CompressedFile)
77 | Else
78 | Return IO.Path.GetFileName(_SourceFile)
79 | End If
80 | End Function
81 |
82 | Public Function GetSaveFile() As String
83 | Dim FilePath As String
84 |
85 | If _Compressed Then
86 | FilePath = IO.Path.Combine(IO.Path.GetDirectoryName(_SourceFile), _CompressedFile)
87 | Else
88 | FilePath = _SourceFile
89 | End If
90 |
91 | 'Dim ImageType = GetImageTypeFromFileName(FileName)
92 |
93 | 'If ImageType = FloppyImageType.TranscopyImage Then
94 | ' FilePath = Path.GetFileNameWithoutExtension(FilePath) & ".ima"
95 | 'End If
96 |
97 | Return FilePath
98 | End Function
99 |
100 | Public Overrides Function ToString() As String
101 | Return Right(DisplayPath, Len(DisplayPath) - _StringOffset).Replace("\", " > ") '& IIf(_Modified, " *", "")
102 | End Function
103 |
104 | End Class
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/86F/86FFloppyImage.vb:
--------------------------------------------------------------------------------
1 | Imports System.Security.Cryptography
2 | Imports DiskImageTool.Bitstream
3 | Imports DiskImageTool.DiskImage
4 |
5 | Namespace ImageFormats
6 | Namespace D86F
7 | Public Class D86FFloppyImage
8 | Inherits MappedFloppyImage
9 | Implements IFloppyImage
10 |
11 | Private ReadOnly _Image As D86FImage
12 |
13 | Public Sub New(Image As D86FImage, DiskFormat As FloppyDiskFormat, BytesPerSector As UInteger)
14 | MyBase.New(Image, BytesPerSector)
15 |
16 | _Image = Image
17 |
18 | InitDiskFormat(DiskFormat)
19 | End Sub
20 |
21 | Public Overrides ReadOnly Property HasWeakBits As Boolean Implements IFloppyImage.HasWeakBits
22 | Get
23 | Return _Image.HasSurfaceData
24 | End Get
25 | End Property
26 |
27 | Public Overrides ReadOnly Property HasWeakBitsSupport As Boolean Implements IFloppyImage.HasWeakBitsSupport
28 | Get
29 | Return True
30 | End Get
31 | End Property
32 |
33 | Public ReadOnly Property Image As D86FImage
34 | Get
35 | Return _Image
36 | End Get
37 | End Property
38 |
39 | Public Overrides ReadOnly Property ImageType As FloppyImageType Implements IFloppyImage.ImageType
40 | Get
41 | Return FloppyImageType.D86FImage
42 | End Get
43 | End Property
44 |
45 | Public Overrides Function GetCRC32() As String Implements IFloppyImage.GetCRC32
46 | Using Hasher As CRC32Hash = CRC32Hash.Create()
47 | Return BitstreamCalculateHash(_Image, Hasher)
48 | End Using
49 | End Function
50 |
51 | Public Overrides Function GetMD5Hash() As String Implements IFloppyImage.GetMD5Hash
52 | Using Hasher As MD5 = MD5.Create()
53 | Return BitstreamCalculateHash(_Image, Hasher)
54 | End Using
55 | End Function
56 |
57 | Public Overrides Function GetSHA1Hash() As String Implements IFloppyImage.GetSHA1Hash
58 | Using Hasher As SHA1 = SHA1.Create()
59 | Return BitstreamCalculateHash(_Image, Hasher)
60 | End Using
61 | End Function
62 | End Class
63 | End Namespace
64 | End Namespace
65 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/86F/86FLoader.vb:
--------------------------------------------------------------------------------
1 | Imports DiskImageTool.DiskImage.FloppyDiskFunctions
2 |
3 | Namespace ImageFormats
4 | Namespace D86F
5 | Module D86FLoader
6 | Public Function ImageLoad(Data() As Byte) As D86FFloppyImage
7 | Dim Image As D86FFloppyImage = Nothing
8 |
9 | Dim D86FImage = New D86FImage()
10 | Dim Result = D86FImage.Load(Data)
11 | If Result Then
12 | Dim BytesPerSector As UInteger = Bitstream.GetBytesPerSector(D86FImage)
13 | Dim DiskFormat As FloppyDiskFormat = Bitstream.BitstreamGetImageFormat(D86FImage, BytesPerSector)
14 | If DiskFormat <> FloppyDiskFormat.FloppyUnknown Then
15 | Image = New D86FFloppyImage(D86FImage, DiskFormat, BytesPerSector)
16 | End If
17 | End If
18 |
19 | Return Image
20 | End Function
21 | End Module
22 | End Namespace
23 | End Namespace
24 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/86F/Enums.vb:
--------------------------------------------------------------------------------
1 | Namespace ImageFormats
2 | Namespace D86F
3 | Public Enum BitRate As Byte
4 | BitRate500 = 0
5 | BitRate300 = 1
6 | BitRate250 = 2
7 | BitRate1000 = 3
8 | BitRate2000 = 5
9 | End Enum
10 |
11 | Public Enum DiskFlags As UShort
12 | HasSurfaceData = 1
13 | Sides = 8
14 | WriteProtect = 16
15 | BitcellMode = 128
16 | DiskType = 256
17 | ReverseEndian = 2048
18 | AlternateBitcellCalculation = 4096
19 | End Enum
20 |
21 | Public Enum DiskHole As Byte
22 | DD = 0
23 | HD = 1
24 | ED = 2
25 | ED2000 = 3
26 | End Enum
27 |
28 | Public Enum DiskType As Byte
29 | FixedRPM = 0
30 | Zoned = 1
31 | End Enum
32 |
33 | Public Enum Encoding As Byte
34 | FM = 0
35 | MFM = 1
36 | M2MF = 2
37 | GCR = 3
38 | End Enum
39 |
40 | Public Enum RPM As Byte
41 | RPM300 = 0
42 | RPM360 = 1
43 | End Enum
44 |
45 | Public Enum ZoneType As Byte
46 | PreApple1 = 0
47 | PreApple2 = 1
48 | Apple = 2
49 | Commodore64 = 3
50 | End Enum
51 |
52 | End Namespace
53 | End Namespace
54 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/86F/Functions.vb:
--------------------------------------------------------------------------------
1 | Namespace ImageFormats
2 | Namespace D86F
3 | Module Functions
4 | Public Function GetBitRate(BitRate As BitRate, IsMFM As Boolean) As UShort
5 | Dim Result As UShort
6 |
7 | Select Case BitRate
8 | Case BitRate.BitRate250
9 | Result = 250
10 | Case BitRate.BitRate300
11 | Result = 300
12 | Case BitRate.BitRate500
13 | Result = 500
14 | Case BitRate.BitRate1000
15 | Result = 1000
16 | Case BitRate.BitRate2000
17 | Result = 2000
18 | Case Else
19 | Result = 250
20 | End Select
21 |
22 | If Not IsMFM Then
23 | Result /= 2
24 | End If
25 |
26 | Return Result
27 | End Function
28 |
29 | Public Function GetBitRate(BitRate As UShort, IsMFM As Boolean) As BitRate
30 | Dim Result As BitRate
31 |
32 | BitRate = Bitstream.RoundBitRate(BitRate)
33 |
34 | If Not IsMFM Then
35 | BitRate *= 2
36 | End If
37 |
38 | Select Case BitRate
39 | Case 250
40 | Result = D86F.BitRate.BitRate250
41 | Case 300
42 | Result = D86F.BitRate.BitRate300
43 | Case 500
44 | Result = D86F.BitRate.BitRate500
45 | Case 1000
46 | Result = D86F.BitRate.BitRate1000
47 | Case 2000
48 | Result = D86F.BitRate.BitRate2000
49 | Case Else
50 | Result = D86F.BitRate.BitRate250
51 | End Select
52 |
53 | Return Result
54 | End Function
55 |
56 | Public Function GetRPM(RPM As RPM) As UShort
57 | Select Case RPM
58 | Case RPM.RPM300
59 | Return 300
60 | Case RPM.RPM360
61 | Return 360
62 | Case Else
63 | Return 300
64 | End Select
65 | End Function
66 |
67 | Public Function GetRPM(RPM As UShort) As RPM
68 | RPM = Bitstream.RoundRPM(RPM)
69 |
70 | Select Case RPM
71 | Case 300
72 | Return D86F.RPM.RPM300
73 | Case 360
74 | Return D86F.RPM.RPM360
75 | Case Else
76 | Return D86F.RPM.RPM300
77 | End Select
78 | End Function
79 | End Module
80 | End Namespace
81 | End Namespace
82 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/HFE/Enums.vb:
--------------------------------------------------------------------------------
1 | Namespace ImageFormats
2 | Namespace HFE
3 | Public Module Enums
4 | Public Enum HFEFloppyinterfaceMode As Byte
5 | IBMPC_DD_FLOPPYMODE = &H0
6 | IBMPC_HD_FLOPPYMODE = &H1
7 | ATARIST_DD_FLOPPYMODE = &H2
8 | ATARIST_HD_FLOPPYMODE = &H3
9 | AMIGA_DD_FLOPPYMODE = &H4
10 | AMIGA_HD_FLOPPYMODE = &H5
11 | CPC_DD_FLOPPYMODE = &H6
12 | GENERIC_SHUGGART_DD_FLOPPYMODE = &H7
13 | IBMPC_ED_FLOPPYMODE = &H8
14 | MSX2_DD_FLOPPYMODE = &H9
15 | C64_DD_FLOPPYMODE = &HA
16 | EMU_SHUGART_FLOPPYMODE = &HB
17 | S950_DD_FLOPPYMODE = &HC
18 | S950_HD_FLOPPYMODE = &HD
19 | DISABLE_FLOPPYMODE = &HFE
20 | End Enum
21 |
22 | Public Enum HFETrackEncoding As Byte
23 | ISOIBM_MFM_ENCODING = &H0
24 | AMIGA_MFM_ENCODING = &H1
25 | ISOIBM_FM_ENCODING = &H2
26 | EMU_FM_ENCODING = &H3
27 | UNKNOWN_ENCODING = &HFF
28 | End Enum
29 |
30 | Public Enum HFEVersion As Byte
31 | HFE_V1 = 1
32 | HFE_V2 = 2
33 | HFE_V3 = 3
34 | End Enum
35 | End Module
36 | End Namespace
37 | End Namespace
38 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/HFE/HFEFloppyImage.vb:
--------------------------------------------------------------------------------
1 | Imports System.Security.Cryptography
2 | Imports DiskImageTool.Bitstream
3 | Imports DiskImageTool.DiskImage
4 |
5 | Namespace ImageFormats
6 | Namespace HFE
7 | Public Class HFEFloppyImage
8 | Inherits MappedFloppyImage
9 | Implements IFloppyImage
10 |
11 | Private ReadOnly _Image As HFEImage
12 |
13 | Public Sub New(Image As HFEImage, DiskFormat As FloppyDiskFormat, BytesPerSector As UInteger)
14 | MyBase.New(Image, BytesPerSector)
15 |
16 | _Image = Image
17 |
18 | InitDiskFormat(DiskFormat)
19 | End Sub
20 |
21 | Public ReadOnly Property Image As HFEImage
22 | Get
23 | Return _Image
24 | End Get
25 | End Property
26 |
27 | Public Overrides ReadOnly Property ImageType As FloppyImageType Implements IFloppyImage.ImageType
28 | Get
29 | Return FloppyImageType.HFEImage
30 | End Get
31 | End Property
32 |
33 | Public Overrides Function GetCRC32() As String Implements IFloppyImage.GetCRC32
34 | Using Hasher As CRC32Hash = CRC32Hash.Create()
35 | Return BitstreamCalculateHash(_Image, Hasher)
36 | End Using
37 | End Function
38 |
39 | Public Overrides Function GetMD5Hash() As String Implements IFloppyImage.GetMD5Hash
40 | Using Hasher As MD5 = MD5.Create()
41 | Return BitstreamCalculateHash(_Image, Hasher)
42 | End Using
43 | End Function
44 |
45 | Public Overrides Function GetSHA1Hash() As String Implements IFloppyImage.GetSHA1Hash
46 | Using Hasher As SHA1 = SHA1.Create()
47 | Return BitstreamCalculateHash(_Image, Hasher)
48 | End Using
49 | End Function
50 | End Class
51 | End Namespace
52 | End Namespace
53 |
54 |
55 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/HFE/HFELoader.vb:
--------------------------------------------------------------------------------
1 | Imports DiskImageTool.DiskImage.FloppyDiskFunctions
2 |
3 | Namespace ImageFormats
4 | Namespace HFE
5 | Module HFELoader
6 | Public Function ImageLoad(Data() As Byte) As HFEFloppyImage
7 | Dim Image As HFEFloppyImage = Nothing
8 |
9 | Dim HFEImage = New HFEImage
10 | Dim Result = HFEImage.Load(Data)
11 | If Result Then
12 | Dim BytesPerSector As UInteger = Bitstream.GetBytesPerSector(HFEImage)
13 | Dim DiskFormat As FloppyDiskFormat = Bitstream.BitstreamGetImageFormat(HFEImage, BytesPerSector)
14 | If DiskFormat <> FloppyDiskFormat.FloppyUnknown Then
15 | Image = New HFEFloppyImage(HFEImage, DiskFormat, BytesPerSector)
16 | End If
17 | End If
18 |
19 | Return Image
20 | End Function
21 | End Module
22 | End Namespace
23 | End Namespace
24 |
25 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/HFE/HFETrack.vb:
--------------------------------------------------------------------------------
1 | Imports DiskImageTool.Bitstream
2 |
3 | Namespace ImageFormats
4 | Namespace HFE
5 | Public Class HFETrack
6 | Implements IBitstreamTrack
7 |
8 | Private _Bitstream As BitArray
9 |
10 | Public Sub New(Track As UShort, Side As Byte)
11 | _Track = Track
12 | _Side = Side
13 | _Bitstream = New BitArray(0)
14 | _MFMData = Nothing
15 | _RPM = 0
16 | _BitRate = 0
17 | End Sub
18 |
19 | Public Property BitRate As UInt16 Implements IBitstreamTrack.BitRate
20 |
21 | Public Property Bitstream As BitArray Implements IBitstreamTrack.Bitstream
22 | Get
23 | Return _Bitstream
24 | End Get
25 | Set
26 | _Bitstream = Value
27 | '_Length = _Bitstream.Length \ 8
28 | _Length = Math.Ceiling(_Bitstream.Length / 8)
29 | End Set
30 | End Property
31 |
32 | Public ReadOnly Property BitstreamTrackType As BitstreamTrackType Implements IBitstreamTrack.TrackType
33 | Get
34 | If _MFMData IsNot Nothing AndAlso _MFMData.Sectors.Count > 0 Then
35 | Return BitstreamTrackType.MFM
36 | Else
37 | Return BitstreamTrackType.Other
38 | End If
39 | End Get
40 | End Property
41 |
42 | Public ReadOnly Property Decoded As Boolean Implements IBitstreamTrack.Decoded
43 | Get
44 | Return _MFMData IsNot Nothing AndAlso _MFMData.Sectors.Count > 0
45 | End Get
46 | End Property
47 |
48 | Public Property Length As UInt16
49 |
50 | Public Property MFMData As IBM_MFM.IBM_MFM_Track Implements IBitstreamTrack.MFMData
51 |
52 | Public Property RPM As UInt16 Implements IBitstreamTrack.RPM
53 |
54 | Public Property Side As Byte Implements IBitstreamTrack.Side
55 |
56 | Public Property Track As UShort Implements IBitstreamTrack.Track
57 |
58 | Private ReadOnly Property IBitstreamTrack_SurfaceData As BitArray Implements IBitstreamTrack.SurfaceData
59 | Get
60 | Return Nothing
61 | End Get
62 | End Property
63 | End Class
64 | End Namespace
65 | End Namespace
66 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/IMD/Enums.vb:
--------------------------------------------------------------------------------
1 | Namespace ImageFormats
2 | Namespace IMD
3 | Public Enum TrackMode As Byte
4 | FM500kbps = 0
5 | FM300kbps = 1
6 | FM250kbps = 2
7 | MFM500kbps = 3
8 | MFM300kbps = 4
9 | MFM250kbps = 5
10 | End Enum
11 |
12 | Public Enum SectorSize As Byte
13 | SectorSize128 = 0
14 | SectorSize256 = 1
15 | Sectorsize512 = 2
16 | SectorSize1024 = 3
17 | SectorSize2048 = 4
18 | SectorSize4096 = 5
19 | SectorSize8192 = 6
20 | End Enum
21 |
22 | Public Enum DataFormat
23 | Unavailable = 0
24 | Normal = 1
25 | NormalCompressed = 2
26 | Deleted = 3
27 | DeletedCompressed = 4
28 | NormalError = 5
29 | NormalErrorCompressed = 6
30 | DeletedError = 7
31 | DeletedErrorCompressed = 8
32 | End Enum
33 | End Namespace
34 | End Namespace
35 |
36 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/IMD/IMDLoader.vb:
--------------------------------------------------------------------------------
1 | Imports DiskImageTool.DiskImage.FloppyDiskFunctions
2 |
3 | Namespace ImageFormats
4 | Namespace IMD
5 | Module IMDLoader
6 | Public Function ImageLoad(Data() As Byte) As IMDFloppyImage
7 | Dim Image As IMDFloppyImage = Nothing
8 |
9 | Dim IMD = New IMDImage()
10 | Dim Result = IMD.Load(Data)
11 | If Result Then
12 | Dim BytesPerSector As UInteger = Bitstream.GetBytesPerSector(IMD)
13 | Dim DiskFormat = GetImageFormat(IMD)
14 | If DiskFormat <> FloppyDiskFormat.FloppyUnknown Then
15 | Image = New IMDFloppyImage(IMD, DiskFormat, BytesPerSector)
16 | End If
17 | End If
18 |
19 | Return Image
20 | End Function
21 |
22 | Private Function GetImageFormat(IMD As IMDImage) As FloppyDiskFormat
23 | Dim DiskFormat As FloppyDiskFormat
24 | Dim SectorCount As Byte
25 |
26 | Dim TotalSize As UShort = 0
27 | If IMD.TrackCount > 0 Then
28 | For Each Sector In IMD.Tracks.Item(0).Sectors
29 | If Not Sector.ChecksumError Then
30 | TotalSize += Sector.Data.Length
31 | End If
32 | Next
33 | End If
34 | SectorCount = TotalSize \ 512
35 |
36 | If IMD.TrackCount >= 79 Then
37 | If SectorCount >= 36 Then
38 | DiskFormat = FloppyDiskFormat.Floppy2880
39 | ElseIf SectorCount >= 18 Then
40 | DiskFormat = FloppyDiskFormat.Floppy1440
41 | ElseIf SectorCount >= 15 Then
42 | DiskFormat = FloppyDiskFormat.Floppy1200
43 | Else
44 | DiskFormat = FloppyDiskFormat.Floppy720
45 | End If
46 | Else
47 | If IMD.SideCount = 1 Then
48 | If SectorCount < 9 Then
49 | DiskFormat = FloppyDiskFormat.Floppy160
50 | Else
51 | DiskFormat = FloppyDiskFormat.Floppy180
52 | End If
53 | Else
54 | If SectorCount < 9 Then
55 | DiskFormat = FloppyDiskFormat.Floppy320
56 | Else
57 | DiskFormat = FloppyDiskFormat.Floppy360
58 | End If
59 | End If
60 | End If
61 |
62 | Return DiskFormat
63 | End Function
64 | End Module
65 | End Namespace
66 | End Namespace
67 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/IMD/IMDSector.vb:
--------------------------------------------------------------------------------
1 |
2 | Namespace ImageFormats
3 | Namespace IMD
4 | Public Class IMDSector
5 | Private _Data As Byte()
6 |
7 | Public Sub New(Size As UShort)
8 | _Data = New Byte(Size - 1) {}
9 | _Deleted = False
10 | _ChecksumError = False
11 | _Compressed = False
12 | _Unavailable = False
13 | _CompressedValue = 0
14 | End Sub
15 |
16 | Public Sub New(Size As UShort, Format As DataFormat)
17 | _Data = New Byte(Size - 1) {}
18 | _Unavailable = (Format = DataFormat.Unavailable)
19 | _Compressed = (Format = DataFormat.DeletedCompressed Or Format = DataFormat.DeletedErrorCompressed Or Format = DataFormat.NormalCompressed Or Format = DataFormat.NormalErrorCompressed)
20 | _Deleted = (Format = DataFormat.Deleted Or Format = DataFormat.DeletedCompressed Or Format = DataFormat.DeletedError Or Format = DataFormat.DeletedErrorCompressed)
21 | _ChecksumError = (Format = DataFormat.DeletedError Or Format = DataFormat.DeletedErrorCompressed Or Format = DataFormat.NormalError Or Format = DataFormat.NormalErrorCompressed)
22 | _CompressedValue = 0
23 | End Sub
24 |
25 | Public Property ChecksumError As Boolean
26 |
27 | Public Property Compressed As Boolean
28 |
29 | Public Property CompressedValue As Byte
30 |
31 | Public Property Data As Byte()
32 | Get
33 | Return _Data
34 | End Get
35 | Set
36 | _Data = Value
37 | UpdateDataProperties()
38 | End Set
39 | End Property
40 |
41 | Public Property Deleted As Boolean
42 | Public Property SectorId As Byte
43 | Public Property Side As Byte
44 | Public Property Track As Byte
45 | Public Property Unavailable As Boolean
46 |
47 | Public Function GetFormat() As DataFormat
48 | If _Unavailable Then
49 | Return DataFormat.Unavailable
50 | ElseIf _Compressed And _Deleted And _ChecksumError Then
51 | Return DataFormat.DeletedErrorCompressed
52 | ElseIf _Compressed And _Deleted Then
53 | Return DataFormat.DeletedCompressed
54 | ElseIf _Compressed And _ChecksumError Then
55 | Return DataFormat.NormalErrorCompressed
56 | ElseIf _Compressed Then
57 | Return DataFormat.NormalCompressed
58 | ElseIf _Deleted And _ChecksumError Then
59 | Return DataFormat.DeletedError
60 | ElseIf _Deleted Then
61 | Return DataFormat.Deleted
62 | ElseIf _ChecksumError Then
63 | Return DataFormat.NormalError
64 | Else
65 | Return DataFormat.Normal
66 | End If
67 | End Function
68 |
69 | Private Sub UpdateDataProperties()
70 | Dim CompressedValue As Byte = 0
71 | Dim Compressed As Boolean = True
72 |
73 | For i = 0 To _Data.Length - 1
74 | If i = 0 Then
75 | CompressedValue = _Data(i)
76 | ElseIf CompressedValue <> _Data(i) Then
77 | Compressed = False
78 | CompressedValue = 0
79 | Exit For
80 | End If
81 | Next
82 |
83 | Me.Compressed = Compressed
84 | Me.CompressedValue = CompressedValue
85 | End Sub
86 | End Class
87 | End Namespace
88 | End Namespace
89 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/IMD/IMDTrack.vb:
--------------------------------------------------------------------------------
1 | Namespace ImageFormats
2 | Namespace IMD
3 | Public Class IMDTrack
4 | Public Sub New()
5 | _Sectors = New List(Of IMDSector)
6 | _FirstSector = -1
7 | _LastSector = -1
8 | End Sub
9 |
10 | Public Property FirstSector As Integer
11 | Public Property LastSector As Integer
12 | Public Property Mode As TrackMode
13 | Public Property Sectors As List(Of IMDSector)
14 | Public Property SectorSize As SectorSize
15 | Public Property Side As Byte
16 | Public Property Track As Byte
17 |
18 | Public Sub AddSector(Sector As IMDSector)
19 | _Sectors.Add(Sector)
20 |
21 | If _FirstSector = -1 Or Sector.SectorId < _FirstSector Then
22 | _FirstSector = Sector.SectorId
23 | End If
24 |
25 | If Sector.SectorId > _LastSector Then
26 | _LastSector = Sector.SectorId
27 | End If
28 | End Sub
29 |
30 | Public Function GetSizeBytes() As UShort
31 | Select Case _SectorSize
32 | Case SectorSize.SectorSize128
33 | Return 128
34 | Case SectorSize.SectorSize256
35 | Return 256
36 | Case SectorSize.Sectorsize512
37 | Return 512
38 | Case SectorSize.SectorSize1024
39 | Return 1024
40 | Case SectorSize.SectorSize2048
41 | Return 2048
42 | Case SectorSize.SectorSize4096
43 | Return 4096
44 | Case SectorSize.SectorSize8192
45 | Return 8192
46 | Case Else
47 | Return 0
48 | End Select
49 | End Function
50 |
51 | Public Function IsMFM() As Boolean
52 | Return _Mode = TrackMode.MFM250kbps Or _Mode = TrackMode.MFM300kbps Or _Mode = TrackMode.MFM500kbps
53 | End Function
54 | End Class
55 | End Namespace
56 | End Namespace
57 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/MFM/MFMFloppyImage.vb:
--------------------------------------------------------------------------------
1 | Imports System.Security.Cryptography
2 | Imports DiskImageTool.Bitstream
3 | Imports DiskImageTool.DiskImage
4 |
5 | Namespace ImageFormats
6 | Namespace MFM
7 | Public Class MFMFloppyImage
8 | Inherits MappedFloppyImage
9 | Implements IFloppyImage
10 |
11 | Private ReadOnly _Image As MFMImage
12 |
13 | Public Sub New(Image As MFMImage, DiskFormat As FloppyDiskFormat, BytesPerSector As UInteger)
14 | MyBase.New(Image, BytesPerSector)
15 |
16 | _Image = Image
17 |
18 | InitDiskFormat(DiskFormat)
19 | End Sub
20 |
21 | Public ReadOnly Property Image As MFMImage
22 | Get
23 | Return _Image
24 | End Get
25 | End Property
26 |
27 | Public Overrides ReadOnly Property ImageType As FloppyImageType Implements IFloppyImage.ImageType
28 | Get
29 | Return FloppyImageType.MFMImage
30 | End Get
31 | End Property
32 |
33 | Public Overrides Function GetCRC32() As String Implements IFloppyImage.GetCRC32
34 | Using Hasher As CRC32Hash = CRC32Hash.Create()
35 | Return BitstreamCalculateHash(_Image, Hasher)
36 | End Using
37 | End Function
38 |
39 | Public Overrides Function GetMD5Hash() As String Implements IFloppyImage.GetMD5Hash
40 | Using Hasher As MD5 = MD5.Create()
41 | Return BitstreamCalculateHash(_Image, Hasher)
42 | End Using
43 | End Function
44 |
45 | Public Overrides Function GetSHA1Hash() As String Implements IFloppyImage.GetSHA1Hash
46 | Using Hasher As SHA1 = SHA1.Create()
47 | Return BitstreamCalculateHash(_Image, Hasher)
48 | End Using
49 | End Function
50 | End Class
51 | End Namespace
52 | End Namespace
53 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/MFM/MFMLoader.vb:
--------------------------------------------------------------------------------
1 | Imports DiskImageTool.DiskImage.FloppyDiskFunctions
2 |
3 | Namespace ImageFormats
4 | Namespace MFM
5 | Module MFMLoader
6 | Public Function ImageLoad(Data() As Byte) As MFMFloppyImage
7 | Dim Image As MFMFloppyImage = Nothing
8 |
9 | Dim MFMImage = New MFMImage
10 | Dim Result = MFMImage.Load(Data)
11 | If Result Then
12 | Dim BytesPerSector As UInteger = Bitstream.GetBytesPerSector(MFMImage)
13 | Dim DiskFormat As FloppyDiskFormat = Bitstream.BitstreamGetImageFormat(MFMImage, BytesPerSector)
14 | If DiskFormat <> FloppyDiskFormat.FloppyUnknown Then
15 | Image = New MFMFloppyImage(MFMImage, DiskFormat, BytesPerSector)
16 | End If
17 | End If
18 |
19 | Return Image
20 | End Function
21 | End Module
22 | End Namespace
23 | End Namespace
24 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/MFM/MFMTrack.vb:
--------------------------------------------------------------------------------
1 | Imports DiskImageTool.Bitstream
2 |
3 | Namespace ImageFormats
4 | Namespace MFM
5 | Public Class MFMTrack
6 | Implements IBitstreamTrack
7 |
8 | Private _Bitstream As BitArray
9 |
10 | Public Sub New(Track As UShort, Side As Byte)
11 | _Track = Track
12 | _Side = Side
13 | _Offset = 0
14 | _Bitstream = New BitArray(0)
15 | _MFMData = Nothing
16 | _RPM = 0
17 | _BitRate = 0
18 | End Sub
19 |
20 | Public Property BitRate As UInt16 Implements IBitstreamTrack.BitRate
21 |
22 | Public Property Bitstream As BitArray Implements IBitstreamTrack.Bitstream
23 | Get
24 | Return _Bitstream
25 | End Get
26 | Set
27 | _Bitstream = Value
28 | '_Length = _Bitstream.Length \ 8
29 | _Length = Math.Ceiling(_Bitstream.Length / 8)
30 | End Set
31 | End Property
32 |
33 | Public ReadOnly Property BitstreamTrackType As BitstreamTrackType Implements IBitstreamTrack.TrackType
34 | Get
35 | If _MFMData IsNot Nothing AndAlso _MFMData.Sectors.Count > 0 Then
36 | Return BitstreamTrackType.MFM
37 | Else
38 | Return BitstreamTrackType.Other
39 | End If
40 | End Get
41 | End Property
42 |
43 | Public ReadOnly Property Decoded As Boolean Implements IBitstreamTrack.Decoded
44 | Get
45 | Return _MFMData IsNot Nothing AndAlso _MFMData.Sectors.Count > 0
46 | End Get
47 | End Property
48 |
49 | Public Property Length As UInt16
50 |
51 | Public Property MFMData As IBM_MFM.IBM_MFM_Track Implements IBitstreamTrack.MFMData
52 |
53 | Public Property Offset As UInt32
54 |
55 | Public Property RPM As UInt16 Implements IBitstreamTrack.RPM
56 |
57 | Public Property Side As Byte Implements IBitstreamTrack.Side
58 |
59 | Public Property Track As UShort Implements IBitstreamTrack.Track
60 |
61 | Private ReadOnly Property IBitstreamTrack_SurfaceData As BitArray Implements IBitstreamTrack.SurfaceData
62 | Get
63 | Return Nothing
64 | End Get
65 | End Property
66 | End Class
67 | End Namespace
68 | End Namespace
69 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/PRI/Enums.vb:
--------------------------------------------------------------------------------
1 | Namespace ImageFormats
2 | Namespace PRI
3 | Public Structure ReadResponse
4 | Dim ChecksumVerified As Boolean
5 | Dim Offset As UInt32
6 | End Structure
7 | End Namespace
8 | End Namespace
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/PRI/PRIAltBitClock.vb:
--------------------------------------------------------------------------------
1 | Namespace ImageFormats
2 | Namespace PRI
3 | Public Class PRIAltBitClock
4 | Public Property BitOffset As UInteger
5 | Public Property NewBitClock As UInteger
6 | End Class
7 | End Namespace
8 | End Namespace
9 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/PRI/PRIChunk.vb:
--------------------------------------------------------------------------------
1 | Namespace ImageFormats
2 | Namespace PRI
3 | Public Class PRIChunk
4 | Private _ChunkCRC As UInt32 = 0
5 | Private _ChunkData As Byte()
6 | Private _ChunkID As Byte()
7 |
8 | Public Sub New()
9 | _ChunkID = New Byte(3) {}
10 | _ChunkData = New Byte(-1) {}
11 | End Sub
12 |
13 | Public Sub New(ChunkID As String)
14 | _ChunkID = Text.Encoding.UTF8.GetBytes(Left(ChunkID, 4))
15 | _ChunkData = New Byte(-1) {}
16 | End Sub
17 |
18 | Public Sub New(ChunkID As String, ChunkData() As Byte)
19 | _ChunkID = Text.Encoding.UTF8.GetBytes(Left(ChunkID, 4))
20 | _ChunkData = ChunkData
21 | End Sub
22 |
23 | Public Property ChunkData As Byte()
24 | Get
25 | Return _ChunkData
26 | End Get
27 | Set
28 | _ChunkData = Value
29 | End Set
30 | End Property
31 |
32 | Public Property ChunkID As String
33 | Get
34 | Return Text.Encoding.UTF8.GetString(_ChunkID, 0, 4)
35 | End Get
36 | Set(value As String)
37 | _ChunkID = Text.Encoding.UTF8.GetBytes(Left(value, 4))
38 | End Set
39 | End Property
40 |
41 | Public ReadOnly Property ChunkSize As UInt32
42 | Get
43 | Return _ChunkData.Length
44 | End Get
45 | End Property
46 |
47 | Public Function ReadFromBuffer(Buffer() As Byte, Offset As UInt32) As ReadResponse
48 | Dim Response As ReadResponse
49 |
50 | Array.Copy(Buffer, Offset, _ChunkID, 0, 4)
51 |
52 | Dim ChunkSize = MyBitConverter.ToUInt32(Buffer, True, Offset + 4)
53 |
54 | If ChunkSize <= Buffer.Length - Offset - 12 Then
55 | _ChunkData = New Byte(ChunkSize - 1) {}
56 | Array.Copy(Buffer, Offset + 8, _ChunkData, 0, ChunkSize)
57 | _ChunkCRC = MyBitConverter.ToUInt32(Buffer, True, Offset + 8 + ChunkSize)
58 | End If
59 |
60 | Response.Offset = Offset + 12 + ChunkSize
61 | Response.ChecksumVerified = CheckCRC()
62 |
63 | Return Response
64 | End Function
65 |
66 | Public Function ToBytes() As Byte()
67 | Dim ChunkSize = BitConverter.GetBytes(MyBitConverter.SwapEndian(CUInt(_ChunkData.Length)))
68 |
69 | Dim Buffer(_ChunkData.Length + 12 - 1) As Byte
70 |
71 | Array.Copy(_ChunkID, 0, Buffer, 0, 4)
72 | Array.Copy(ChunkSize, 0, Buffer, 4, 4)
73 | If _ChunkData.Length > 0 Then
74 | Array.Copy(_ChunkData, 0, Buffer, 8, _ChunkData.Length)
75 | End If
76 |
77 | Dim ChunkCRC = PSI_CRC(Buffer, Buffer.Length - 4)
78 | Dim CRCBytes = BitConverter.GetBytes(MyBitConverter.SwapEndian(ChunkCRC))
79 |
80 | Array.Copy(CRCBytes, 0, Buffer, 8 + _ChunkData.Length, 4)
81 |
82 | Return Buffer
83 | End Function
84 |
85 | Private Function CheckCRC() As Boolean
86 | Dim Buffer = ToBytes()
87 | Dim CRC = MyBitConverter.ToUInt32(Buffer, True, Buffer.Length - 4)
88 |
89 | Return (_ChunkCRC = CRC)
90 | End Function
91 |
92 | Private Function PSI_CRC(buf() As Byte, cnt As Integer) As UInteger
93 | Dim i As Integer
94 | Dim j As Integer
95 | Dim crc As UInteger = 0
96 |
97 | For i = 0 To cnt - 1
98 | crc = crc Xor (CUInt(buf(i)) << 24)
99 |
100 | For j = 0 To 7
101 | If (crc And &H80000000UI) <> 0 Then
102 | crc = (crc << 1) Xor &H1EDC6F41UI
103 | Else
104 | crc <<= 1
105 | End If
106 | Next
107 | Next
108 |
109 | Return crc And &HFFFFFFFFUI
110 | End Function
111 | End Class
112 | End Namespace
113 | End Namespace
114 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/PRI/PRIFileHeader.vb:
--------------------------------------------------------------------------------
1 | Namespace ImageFormats
2 | Namespace PRI
3 | Public Class PRIFileHeader
4 | Private ReadOnly _ChunkData() As Byte
5 |
6 | Public Sub New()
7 | _ChunkData = New Byte(3) {}
8 | Version = 0
9 | Reserved = 0
10 | End Sub
11 |
12 | Public Sub New(ChunkData() As Byte)
13 | _ChunkData = ChunkData
14 | End Sub
15 |
16 | Public ReadOnly Property ChunkData As Byte()
17 | Get
18 | Return _ChunkData
19 | End Get
20 | End Property
21 |
22 | Public Property Reserved As UShort
23 | Get
24 | Return MyBitConverter.ToUInt16(_ChunkData, True, 2)
25 | End Get
26 | Set(value As UShort)
27 | Dim Buffer = BitConverter.GetBytes(MyBitConverter.SwapEndian(value))
28 | Array.Copy(Buffer, 0, _ChunkData, 2, 2)
29 | End Set
30 | End Property
31 |
32 | Public Property Version As UShort
33 | Get
34 | Return MyBitConverter.ToUInt16(_ChunkData, True, 0)
35 | End Get
36 | Set(value As UShort)
37 | Dim Buffer = BitConverter.GetBytes(MyBitConverter.SwapEndian(value))
38 | Array.Copy(Buffer, 0, _ChunkData, 0, 2)
39 | End Set
40 | End Property
41 | End Class
42 | End Namespace
43 | End Namespace
44 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/PRI/PRIFloppyImage.vb:
--------------------------------------------------------------------------------
1 | Imports System.Security.Cryptography
2 | Imports DiskImageTool.Bitstream
3 | Imports DiskImageTool.DiskImage
4 |
5 | Namespace ImageFormats
6 | Namespace PRI
7 | Public Class PRIFloppyImage
8 | Inherits MappedFloppyImage
9 | Implements IFloppyImage
10 |
11 | Private ReadOnly _Image As PRIImage
12 |
13 | Public Sub New(Image As PRIImage, DiskFormat As FloppyDiskFormat, BytesPerSector As UInteger)
14 | MyBase.New(Image, BytesPerSector)
15 |
16 | _Image = Image
17 |
18 | InitDiskFormat(DiskFormat)
19 | End Sub
20 |
21 | Public Overrides ReadOnly Property HasWeakBits As Boolean Implements IFloppyImage.HasWeakBits
22 | Get
23 | Return _Image.HasWeakBits
24 | End Get
25 | End Property
26 |
27 | Public Overrides ReadOnly Property HasWeakBitsSupport As Boolean Implements IFloppyImage.HasWeakBitsSupport
28 | Get
29 | Return True
30 | End Get
31 | End Property
32 |
33 | Public ReadOnly Property Image As PRIImage
34 | Get
35 | Return _Image
36 | End Get
37 | End Property
38 |
39 | Public Overrides ReadOnly Property ImageType As FloppyImageType Implements IFloppyImage.ImageType
40 | Get
41 | Return FloppyImageType.PRIImage
42 | End Get
43 | End Property
44 |
45 | Public Overrides Function GetCRC32() As String Implements IFloppyImage.GetCRC32
46 | Using Hasher As CRC32Hash = CRC32Hash.Create()
47 | Return BitstreamCalculateHash(_Image, Hasher)
48 | End Using
49 | End Function
50 |
51 | Public Overrides Function GetMD5Hash() As String Implements IFloppyImage.GetMD5Hash
52 | Using Hasher As MD5 = MD5.Create()
53 | Return BitstreamCalculateHash(_Image, Hasher)
54 | End Using
55 | End Function
56 |
57 | Public Overrides Function GetSHA1Hash() As String Implements IFloppyImage.GetSHA1Hash
58 | Using Hasher As SHA1 = SHA1.Create()
59 | Return BitstreamCalculateHash(_Image, Hasher)
60 | End Using
61 | End Function
62 | End Class
63 | End Namespace
64 | End Namespace
65 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/PRI/PRILoader.vb:
--------------------------------------------------------------------------------
1 | Imports DiskImageTool.DiskImage.FloppyDiskFunctions
2 |
3 | Namespace ImageFormats
4 | Namespace PRI
5 | Module PRILoader
6 | Public Function ImageLoad(Data() As Byte) As PRIFloppyImage
7 | Dim Image As PRIFloppyImage = Nothing
8 |
9 | Dim PRI = New PRIImage()
10 | Dim Result = PRI.Load(Data)
11 | If Result Then
12 | Dim BytesPerSector As UInteger = Bitstream.GetBytesPerSector(PRI)
13 | Dim DiskFormat = Bitstream.BitstreamGetImageFormat(PRI, BytesPerSector)
14 | If DiskFormat <> FloppyDiskFormat.FloppyUnknown Then
15 | Image = New PRIFloppyImage(PRI, DiskFormat, BytesPerSector)
16 | End If
17 | End If
18 |
19 | Return Image
20 | End Function
21 | End Module
22 | End Namespace
23 | End Namespace
24 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/PSI/Enums.vb:
--------------------------------------------------------------------------------
1 | Namespace ImageFormats
2 | Namespace PSI
3 | Public Enum DefaultSectorFormat As UInt16
4 | IBM_FM = 256
5 | IBM_MFM_DD = 512
6 | IBM_MFM_HD = 513
7 | IBM_MFM_ED = 514
8 | MAG_GCR = 768
9 | End Enum
10 |
11 | Public Enum GCRSectorFlags As Byte
12 | IDFieldChecksumError = 1
13 | DataFieldCChecksumError = 2
14 | MissingDataMark = 4
15 | End Enum
16 |
17 | Public Enum MFMEncodingSubtype As Byte
18 | DoubleDensity = 0
19 | HighDensity = 1
20 | ExtraDensity = 2
21 | End Enum
22 |
23 | Public Enum MFMSectorFlags As Byte
24 | IDFieldCRCError = 1
25 | DataFieldCRCError = 2
26 | DeletedDAM = 4
27 | MissingDAM = 8
28 | End Enum
29 |
30 | Public Enum SectorFlags As Byte
31 | Compressed = 1
32 | AlternateSector = 2
33 | DataCRCError = 4
34 | End Enum
35 |
36 | Public Structure ReadResponse
37 | Dim ChecksumVerified As Boolean
38 | Dim Offset As UInt32
39 | End Structure
40 | End Namespace
41 | End Namespace
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/PSI/GCRSectorHeader.vb:
--------------------------------------------------------------------------------
1 | Namespace ImageFormats
2 | Namespace PSI
3 | Public Class GCRSectorHeader
4 | Private ReadOnly _ChunkData() As Byte
5 |
6 | Public Sub New()
7 | _ChunkData = New Byte(17) {}
8 | End Sub
9 |
10 | Public Sub New(ChunkData() As Byte)
11 | _ChunkData = ChunkData
12 | End Sub
13 |
14 | Public ReadOnly Property ChunkData As Byte()
15 | Get
16 | Return _ChunkData
17 | End Get
18 | End Property
19 |
20 | Public Property Cylinder As UShort
21 | Get
22 | Return MyBitConverter.ToUInt16(_ChunkData, True, 0)
23 | End Get
24 | Set(value As UShort)
25 | Dim Buffer = BitConverter.GetBytes(MyBitConverter.SwapEndian(value))
26 | Array.Copy(Buffer, 0, _ChunkData, 0, 2)
27 | End Set
28 | End Property
29 |
30 | Public Property Flags As GCRSectorFlags
31 | Get
32 | Return _ChunkData(5)
33 | End Get
34 | Set(value As GCRSectorFlags)
35 | _ChunkData(5) = value
36 | End Set
37 | End Property
38 |
39 | Public Property Head As Byte
40 | Get
41 | Return _ChunkData(2)
42 | End Get
43 | Set(value As Byte)
44 | _ChunkData(2) = value
45 | End Set
46 | End Property
47 |
48 | Public Property Sector As Byte
49 | Get
50 | Return _ChunkData(3)
51 | End Get
52 | Set(value As Byte)
53 | _ChunkData(3) = value
54 | End Set
55 | End Property
56 |
57 | Public Property SectorFormat As Byte
58 | Get
59 | Return _ChunkData(4)
60 | End Get
61 | Set(value As Byte)
62 | _ChunkData(4) = value
63 | End Set
64 | End Property
65 |
66 | Public Property TagData As Byte()
67 | Get
68 | Dim Buffer(11) As Byte
69 | Array.Copy(_ChunkData, 6, Buffer, 0, Buffer.Length)
70 | Return Buffer
71 | End Get
72 | Set(value As Byte())
73 | Array.Copy(value, 0, _ChunkData, 6, 12)
74 | End Set
75 | End Property
76 | End Class
77 | End Namespace
78 | End Namespace
79 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/PSI/IBMSectorHeader.vb:
--------------------------------------------------------------------------------
1 | Namespace ImageFormats
2 | Namespace PSI
3 | Public Class IBMSectorHeader
4 | Private ReadOnly _ChunkData() As Byte
5 |
6 | Public Sub New()
7 | _ChunkData = New Byte(5) {}
8 | End Sub
9 |
10 | Public Sub New(ChunkData() As Byte)
11 | _ChunkData = ChunkData
12 | End Sub
13 |
14 | Public ReadOnly Property ChunkData As Byte()
15 | Get
16 | Return _ChunkData
17 | End Get
18 | End Property
19 |
20 | Public Property Cylinder As Byte
21 | Get
22 | Return _ChunkData(0)
23 | End Get
24 | Set(value As Byte)
25 | _ChunkData(0) = value
26 | End Set
27 | End Property
28 |
29 | Public Property DataFieldCRCError() As Boolean
30 | Get
31 | Return (Flags And MFMSectorFlags.DataFieldCRCError) > 0
32 | End Get
33 | Set(value As Boolean)
34 | Flags = MyBitConverter.ToggleBit(Flags, MFMSectorFlags.DataFieldCRCError, value)
35 | End Set
36 | End Property
37 |
38 | Public Property DeletedDAM() As Boolean
39 | Get
40 | Return (Flags And MFMSectorFlags.DeletedDAM) > 0
41 | End Get
42 | Set(value As Boolean)
43 | Flags = MyBitConverter.ToggleBit(Flags, MFMSectorFlags.DeletedDAM, value)
44 | End Set
45 | End Property
46 |
47 | Public Property EncodingSubType As MFMEncodingSubtype
48 | Get
49 | Return _ChunkData(5)
50 | End Get
51 | Set(value As MFMEncodingSubtype)
52 | _ChunkData(5) = value
53 | End Set
54 | End Property
55 |
56 | Public Property Flags As MFMSectorFlags
57 | Get
58 | Return _ChunkData(4)
59 | End Get
60 | Set(value As MFMSectorFlags)
61 | _ChunkData(4) = value
62 | End Set
63 | End Property
64 |
65 | Public Property Head As Byte
66 | Get
67 | Return _ChunkData(1)
68 | End Get
69 | Set(value As Byte)
70 | _ChunkData(1) = value
71 | End Set
72 | End Property
73 |
74 | Public Property IDFieldCRCError() As Boolean
75 | Get
76 | Return (Flags And MFMSectorFlags.IDFieldCRCError) > 0
77 | End Get
78 | Set(value As Boolean)
79 | Flags = MyBitConverter.ToggleBit(Flags, MFMSectorFlags.IDFieldCRCError, value)
80 | End Set
81 | End Property
82 |
83 | Public Property MissingDAM() As Boolean
84 | Get
85 | Return (Flags And MFMSectorFlags.MissingDAM) > 0
86 | End Get
87 | Set(value As Boolean)
88 | Flags = MyBitConverter.ToggleBit(Flags, MFMSectorFlags.MissingDAM, value)
89 | End Set
90 | End Property
91 |
92 | Public Property Sector As Byte
93 | Get
94 | Return _ChunkData(2)
95 | End Get
96 | Set(value As Byte)
97 | _ChunkData(2) = value
98 | End Set
99 | End Property
100 |
101 | Public Property Size As Byte
102 | Get
103 | Return _ChunkData(3)
104 | End Get
105 | Set(value As Byte)
106 | _ChunkData(3) = value
107 | End Set
108 | End Property
109 | End Class
110 | End Namespace
111 | End Namespace
112 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/PSI/PSIChunk.vb:
--------------------------------------------------------------------------------
1 | Namespace ImageFormats
2 | Namespace PSI
3 | Public Class PSIChunk
4 | Private _ChunkCRC As UInt32 = 0
5 | Private _ChunkData As Byte()
6 | Private _ChunkID As Byte()
7 |
8 | Public Sub New()
9 | _ChunkID = New Byte(3) {}
10 | _ChunkData = New Byte(-1) {}
11 | End Sub
12 |
13 | Public Sub New(ChunkID As String)
14 | _ChunkID = Text.Encoding.UTF8.GetBytes(Left(ChunkID, 4))
15 | _ChunkData = New Byte(-1) {}
16 | End Sub
17 |
18 | Public Sub New(ChunkID As String, ChunkData() As Byte)
19 | _ChunkID = Text.Encoding.UTF8.GetBytes(Left(ChunkID, 4))
20 | _ChunkData = ChunkData
21 | End Sub
22 |
23 | Public Property ChunkData As Byte()
24 | Get
25 | Return _ChunkData
26 | End Get
27 | Set
28 | _ChunkData = Value
29 | End Set
30 | End Property
31 |
32 | Public Property ChunkID As String
33 | Get
34 | Return Text.Encoding.UTF8.GetString(_ChunkID, 0, 4)
35 | End Get
36 | Set(value As String)
37 | _ChunkID = Text.Encoding.UTF8.GetBytes(Left(value, 4))
38 | End Set
39 | End Property
40 |
41 | Public ReadOnly Property ChunkSize As UInt32
42 | Get
43 | Return _ChunkData.Length
44 | End Get
45 | End Property
46 |
47 | Public Function ReadFromBuffer(Buffer() As Byte, Offset As UInt32) As ReadResponse
48 | Dim Response As ReadResponse
49 |
50 | Array.Copy(Buffer, Offset, _ChunkID, 0, 4)
51 |
52 | Dim ChunkSize = MyBitConverter.ToUInt32(Buffer, True, Offset + 4)
53 |
54 | If ChunkSize <= Buffer.Length - Offset - 12 Then
55 | _ChunkData = New Byte(ChunkSize - 1) {}
56 | Array.Copy(Buffer, Offset + 8, _ChunkData, 0, ChunkSize)
57 | _ChunkCRC = MyBitConverter.ToUInt32(Buffer, True, Offset + 8 + ChunkSize)
58 | End If
59 |
60 | Response.Offset = Offset + 12 + ChunkSize
61 | Response.ChecksumVerified = CheckCRC()
62 |
63 | Return Response
64 | End Function
65 |
66 | Public Function ToBytes() As Byte()
67 | Dim ChunkSize = BitConverter.GetBytes(MyBitConverter.SwapEndian(CUInt(_ChunkData.Length)))
68 |
69 | Dim Buffer(_ChunkData.Length + 12 - 1) As Byte
70 |
71 | Array.Copy(_ChunkID, 0, Buffer, 0, 4)
72 | Array.Copy(ChunkSize, 0, Buffer, 4, 4)
73 | If _ChunkData.Length > 0 Then
74 | Array.Copy(_ChunkData, 0, Buffer, 8, _ChunkData.Length)
75 | End If
76 |
77 | Dim ChunkCRC = PSI_CRC(Buffer, Buffer.Length - 4)
78 | Dim CRCBytes = BitConverter.GetBytes(MyBitConverter.SwapEndian(ChunkCRC))
79 |
80 | Array.Copy(CRCBytes, 0, Buffer, 8 + _ChunkData.Length, 4)
81 |
82 | Return Buffer
83 | End Function
84 |
85 | Private Function CheckCRC() As Boolean
86 | Dim Buffer = ToBytes()
87 | Dim CRC = MyBitConverter.ToUInt32(Buffer, True, Buffer.Length - 4)
88 |
89 | Return (_ChunkCRC = CRC)
90 | End Function
91 |
92 | Private Function PSI_CRC(buf() As Byte, cnt As Integer) As UInteger
93 | Dim i As Integer
94 | Dim j As Integer
95 | Dim crc As UInteger = 0
96 |
97 | For i = 0 To cnt - 1
98 | crc = crc Xor (CUInt(buf(i)) << 24)
99 |
100 | For j = 0 To 7
101 | If (crc And &H80000000UI) <> 0 Then
102 | crc = (crc << 1) Xor &H1EDC6F41UI
103 | Else
104 | crc <<= 1
105 | End If
106 | Next
107 | Next
108 |
109 | Return crc And &HFFFFFFFFUI
110 | End Function
111 | End Class
112 | End Namespace
113 | End Namespace
114 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/PSI/PSIFileHeader.vb:
--------------------------------------------------------------------------------
1 | Namespace ImageFormats
2 | Namespace PSI
3 | Public Class PSIFileHeader
4 | Private ReadOnly _ChunkData() As Byte
5 |
6 | Public Sub New()
7 | _ChunkData = New Byte(3) {}
8 | End Sub
9 |
10 | Public Sub New(ChunkData() As Byte)
11 | _ChunkData = ChunkData
12 | End Sub
13 |
14 | Public ReadOnly Property ChunkData As Byte()
15 | Get
16 | Return _ChunkData
17 | End Get
18 | End Property
19 |
20 | Public Property DefaultSectorFormat As DefaultSectorFormat
21 | Get
22 | Return MyBitConverter.ToUInt16(_ChunkData, True, 2)
23 | End Get
24 | Set(value As DefaultSectorFormat)
25 | Dim Buffer = BitConverter.GetBytes(MyBitConverter.SwapEndian(value))
26 | Array.Copy(Buffer, 0, _ChunkData, 2, 2)
27 | End Set
28 | End Property
29 |
30 | Public Property FormatVersion As UShort
31 | Get
32 | Return MyBitConverter.ToUInt16(_ChunkData, True, 0)
33 | End Get
34 | Set(value As UShort)
35 | Dim Buffer = BitConverter.GetBytes(MyBitConverter.SwapEndian(value))
36 | Array.Copy(Buffer, 0, _ChunkData, 0, 2)
37 | End Set
38 | End Property
39 | End Class
40 | End Namespace
41 | End Namespace
42 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/PSI/PSILoader.vb:
--------------------------------------------------------------------------------
1 | Imports DiskImageTool.DiskImage.FloppyDiskFunctions
2 |
3 | Namespace ImageFormats
4 | Namespace PSI
5 | Module PSILoader
6 | Public Function ImageLoad(Data() As Byte) As PSIFloppyImage
7 | Dim Image As PSIFloppyImage = Nothing
8 |
9 | Dim PSI = New PSISectorImage()
10 | Dim Result = PSI.Load(Data)
11 | If Result Then
12 | If PSI.Header.DefaultSectorFormat = DefaultSectorFormat.IBM_MFM_DD _
13 | Or PSI.Header.DefaultSectorFormat = DefaultSectorFormat.IBM_MFM_HD _
14 | Or PSI.Header.DefaultSectorFormat = DefaultSectorFormat.IBM_MFM_ED Then
15 |
16 | Dim BytesPerSector As UInteger = Bitstream.GetBytesPerSector(PSI)
17 | Dim DiskFormat = GetImageFormat(PSI)
18 | If DiskFormat <> FloppyDiskFormat.FloppyUnknown Then
19 | Image = New PSIFloppyImage(PSI, DiskFormat, BytesPerSector)
20 | End If
21 | End If
22 | End If
23 |
24 | Return Image
25 | End Function
26 |
27 | Private Function GetImageFormat(PSI As PSISectorImage) As FloppyDiskFormat
28 | Dim DiskFormat As FloppyDiskFormat
29 | Dim SectorCount As Byte
30 |
31 | Dim TotalSize As UShort = 0
32 | For Each Sector In PSI.Sectors
33 | If Sector.Track = 0 And Sector.Side = 0 Then
34 | If Not Sector.HasDataCRCError Then
35 | TotalSize += Sector.Size
36 | End If
37 | End If
38 | Next
39 | SectorCount = TotalSize \ 512
40 |
41 | If PSI.Header.DefaultSectorFormat = DefaultSectorFormat.IBM_MFM_DD Then
42 | If PSI.TrackCount >= 79 Then
43 | DiskFormat = FloppyDiskFormat.Floppy720
44 | Else
45 | If PSI.SideCount = 1 Then
46 | If SectorCount < 9 Then
47 | DiskFormat = FloppyDiskFormat.Floppy160
48 | Else
49 | DiskFormat = FloppyDiskFormat.Floppy180
50 | End If
51 | Else
52 | If SectorCount < 9 Then
53 | DiskFormat = FloppyDiskFormat.Floppy320
54 | Else
55 | DiskFormat = FloppyDiskFormat.Floppy360
56 | End If
57 | End If
58 | End If
59 | ElseIf PSI.Header.DefaultSectorFormat = DefaultSectorFormat.IBM_MFM_HD Then
60 | If SectorCount > 15 Then
61 | DiskFormat = FloppyDiskFormat.Floppy1440
62 | Else
63 | DiskFormat = FloppyDiskFormat.Floppy1200
64 | End If
65 | Else
66 | DiskFormat = FloppyDiskFormat.Floppy2880
67 | End If
68 |
69 | Return DiskFormat
70 | End Function
71 | End Module
72 | End Namespace
73 | End Namespace
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/PSI/PSITrackInfo.vb:
--------------------------------------------------------------------------------
1 | Namespace ImageFormats
2 | Namespace PSI
3 | Public Class PSITrackInfo
4 | Public Sub New()
5 | _FirstSector = -1
6 | _LastSector = -1
7 | _SectorSize = -1
8 | End Sub
9 |
10 | Public Property FirstSector As Integer
11 | Public Property LastSector As Integer
12 | Public Property SectorSize As Integer
13 | End Class
14 | End Namespace
15 | End Namespace
16 |
17 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/TC/Enums.vb:
--------------------------------------------------------------------------------
1 | Namespace ImageFormats
2 | Namespace TC
3 | Public Enum TransCopyDiskType As Byte
4 | Unknown = &HFF
5 | MFMHighDensity = &H2
6 | MFMDoubleDensity360RPM = &H3
7 | AppleIIGCR = &H4
8 | FMSingleDensity = &H5
9 | CommodoreGCR = &H6
10 | MFMDoubleDensity = &H7
11 | CommodoreAmiga = &H8
12 | AtariFM = &HC
13 | End Enum
14 |
15 | Public Enum TransCopyTrackFlags As Byte
16 | KeepTrackLength = 1
17 | CopyAcrossIndex = 2
18 | CopyWeakBits = 4
19 | VerifyWrite = 8
20 | Bit4 = 16
21 | LengthTolerance = 32
22 | Bit6 = 64
23 | NoAddressMarks = 128
24 | End Enum
25 | End Namespace
26 | End Namespace
27 |
28 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/TC/TCLoader.vb:
--------------------------------------------------------------------------------
1 | Imports DiskImageTool.DiskImage.FloppyDiskFunctions
2 |
3 | Namespace ImageFormats
4 | Namespace TC
5 | Module TCLoader
6 | Public Function ImageLoad(Data() As Byte) As TranscopyFloppyImage
7 | Dim Image As TranscopyFloppyImage = Nothing
8 |
9 | Dim tc = New TransCopyImage()
10 | Dim Result = tc.Load(Data)
11 | If Result Then
12 | Dim BytesPerSector As UInteger = Bitstream.GetBytesPerSector(tc)
13 | Dim DiskFormat = Bitstream.BitstreamGetImageFormat(tc, BytesPerSector)
14 | If DiskFormat <> FloppyDiskFormat.FloppyUnknown Then
15 | Image = New TranscopyFloppyImage(tc, DiskFormat, BytesPerSector)
16 | End If
17 | End If
18 |
19 | Return Image
20 | End Function
21 | End Module
22 | End Namespace
23 | End Namespace
24 |
--------------------------------------------------------------------------------
/DiskImageTool/ImageFormats/TC/TranscopyFloppyImage.vb:
--------------------------------------------------------------------------------
1 | Imports System.Security.Cryptography
2 | Imports DiskImageTool.Bitstream
3 | Imports DiskImageTool.DiskImage
4 |
5 | Namespace ImageFormats
6 | Namespace TC
7 | Public Class TranscopyFloppyImage
8 | Inherits MappedFloppyImage
9 | Implements IFloppyImage
10 |
11 | Private ReadOnly _Image As TransCopyImage
12 |
13 | Public Sub New(Image As TransCopyImage, DiskFormat As FloppyDiskFormat, BytesPerSector As UInteger)
14 | MyBase.New(Image, BytesPerSector)
15 |
16 | _Image = Image
17 |
18 | InitDiskFormat(DiskFormat)
19 | End Sub
20 |
21 | Public ReadOnly Property Image As TransCopyImage
22 | Get
23 | Return _Image
24 | End Get
25 | End Property
26 |
27 | Public Overrides ReadOnly Property ImageType As FloppyImageType Implements IFloppyImage.ImageType
28 | Get
29 | Return FloppyImageType.TranscopyImage
30 | End Get
31 | End Property
32 |
33 | Public Overrides Function GetCRC32() As String Implements IFloppyImage.GetCRC32
34 | Using Hasher As CRC32Hash = CRC32Hash.Create()
35 | Return BitstreamCalculateHash(_Image, Hasher)
36 | End Using
37 | End Function
38 |
39 | Public Overrides Function GetMD5Hash() As String Implements IFloppyImage.GetMD5Hash
40 | Using Hasher As MD5 = MD5.Create()
41 | Return BitstreamCalculateHash(_Image, Hasher)
42 | End Using
43 | End Function
44 |
45 | Public Overrides Function GetSHA1Hash() As String Implements IFloppyImage.GetSHA1Hash
46 | Using Hasher As SHA1 = SHA1.Create()
47 | Return BitstreamCalculateHash(_Image, Hasher)
48 | End Using
49 | End Function
50 | End Class
51 | End Namespace
52 | End Namespace
--------------------------------------------------------------------------------
/DiskImageTool/Lib/CRC32.vb:
--------------------------------------------------------------------------------
1 | Public Class CRC32
2 | Shared ReadOnly table As UInteger()
3 |
4 | Shared Sub New()
5 | Dim poly As UInteger = &HEDB88320UI
6 | table = New UInteger(255) {}
7 | Dim temp As UInteger
8 | For i As UInteger = 0 To table.Length - 1
9 | temp = i
10 | For j As Integer = 8 To 1 Step -1
11 | If (temp And 1) = 1 Then
12 | temp = CUInt((temp >> 1) Xor poly)
13 | Else
14 | temp >>= 1
15 | End If
16 | Next
17 | table(i) = temp
18 | Next
19 | End Sub
20 |
21 | Public Shared Function ComputeChecksum(bytes As Byte()) As UInteger
22 | Dim crc As UInteger = &HFFFFFFFFUI
23 | For i As Integer = 0 To bytes.Length - 1
24 | Dim index As Byte = CByte(((crc) And &HFF) Xor bytes(i))
25 | crc = CUInt((crc >> 8) Xor table(index))
26 | Next
27 | Return Not crc
28 | End Function
29 |
30 | End Class
--------------------------------------------------------------------------------
/DiskImageTool/Lib/CRC32Hash.vb:
--------------------------------------------------------------------------------
1 | Imports System.Security.Cryptography
2 |
3 | '''
4 | ''' HashAlgorithm implementation for CRC-32.
5 | '''
6 | Public Class CRC32Hash
7 | Inherits HashAlgorithm
8 | ' Shared, pre-computed lookup table for efficiency
9 | Private Shared ReadOnly _crc32Table As UInteger()
10 |
11 | ' Current hash value
12 | Private _crc32Value As UInteger
13 |
14 | ' True if HashCore has been called
15 | Private _hashCoreCalled As Boolean
16 |
17 | ' True if HashFinal has been called
18 | Private _hashFinalCalled As Boolean
19 |
20 | Overloads Shared Function Create() As CRC32Hash
21 | Return New CRC32Hash()
22 | End Function
23 |
24 | '''
25 | ''' Initializes the shared lookup table.
26 | '''
27 | Shared Sub New()
28 | Dim poly As UInteger = &HEDB88320UI
29 | _crc32Table = New UInteger(255) {}
30 | Dim temp As UInteger
31 | For i As UInteger = 0 To _crc32Table.Length - 1
32 | temp = i
33 | For j As Integer = 8 To 1 Step -1
34 | If (temp And 1) = 1 Then
35 | temp = CUInt((temp >> 1) Xor poly)
36 | Else
37 | temp >>= 1
38 | End If
39 | Next
40 | _crc32Table(i) = temp
41 | Next
42 | End Sub
43 | '''
44 | ''' Initializes a new instance.
45 | '''
46 | Public Sub New()
47 | InitializeVariables()
48 | End Sub
49 |
50 | '''
51 | ''' Returns the hash as an array of bytes.
52 | '''
53 | Public Overrides ReadOnly Property Hash As Byte()
54 | Get
55 | If Not _hashCoreCalled Then
56 | Throw New NullReferenceException()
57 | End If
58 |
59 | If Not _hashFinalCalled Then
60 | ' Note: Not CryptographicUnexpectedOperationException because
61 | ' that can't be instantiated on Silverlight 4
62 | Throw New CryptographicException("Hash must be finalized before the hash value is retrieved.")
63 | End If
64 |
65 | ' Convert complement of hash code to byte array
66 | Dim bytes = BitConverter.GetBytes(Not _crc32Value)
67 |
68 | ' Reverse for proper endianness, and return
69 | Array.Reverse(bytes)
70 | Return bytes
71 | End Get
72 | End Property
73 |
74 | ' Return size of hash in bits.
75 | Public Overrides ReadOnly Property HashSize As Integer
76 | Get
77 | Return 32
78 | End Get
79 | End Property
80 |
81 | '''
82 | ''' Initializes internal state.
83 | '''
84 | Public Overrides Sub Initialize()
85 | InitializeVariables()
86 | End Sub
87 |
88 | '''
89 | ''' Updates the hash code for the provided data.
90 | '''
91 | ''' Data.
92 | ''' Start position.
93 | ''' Number of bytes.
94 | Protected Overrides Sub HashCore(array As Byte(), ibStart As Integer, cbSize As Integer)
95 | If array Is Nothing Then
96 | Throw New ArgumentNullException("array")
97 | End If
98 |
99 | If _hashFinalCalled Then
100 | Throw New CryptographicException("Hash not valid for use in specified state.")
101 | End If
102 |
103 | _hashCoreCalled = True
104 |
105 | For i As Integer = ibStart To ibStart + cbSize - 1
106 | Dim index As Byte = CByte(((_crc32Value) And &HFF) Xor array(i))
107 | _crc32Value = CUInt((_crc32Value >> 8) Xor _crc32Table(index))
108 | Next
109 | End Sub
110 |
111 | '''
112 | ''' Finalizes the hash code and returns it.
113 | '''
114 | '''
115 | Protected Overrides Function HashFinal() As Byte()
116 | _hashFinalCalled = True
117 |
118 | Return Hash
119 | End Function
120 |
121 | '''
122 | ''' Initializes variables.
123 | '''
124 | Private Sub InitializeVariables()
125 | _crc32Value = &HFFFFFFFFUI
126 | _hashCoreCalled = False
127 | _hashFinalCalled = False
128 | End Sub
129 | End Class
130 |
--------------------------------------------------------------------------------
/DiskImageTool/Lib/HashFunctions.vb:
--------------------------------------------------------------------------------
1 | Imports System.Security.Cryptography
2 | Imports System.Text
3 |
4 | Module HashFunctions
5 | Public Function HashBytesToString(b() As Byte) As String
6 | Dim sBuilder As New StringBuilder()
7 |
8 | For n As Integer = 0 To b.Length - 1
9 | sBuilder.Append(b(n).ToString("X2"))
10 | Next n
11 |
12 | Return sBuilder.ToString
13 | End Function
14 |
15 | Public Function CRC32Hash(Data() As Byte) As String
16 | Using Hasher As CRC32Hash = DiskImageTool.CRC32Hash.Create()
17 | Return HashBytesToString(Hasher.ComputeHash(Data))
18 | End Using
19 | End Function
20 |
21 | Public Function MD5Hash(Data() As Byte) As String
22 | Using Hasher As MD5 = MD5.Create()
23 | Return HashBytesToString(Hasher.ComputeHash(Data))
24 | End Using
25 | End Function
26 |
27 | Public Function SHA1Hash(Data() As Byte) As String
28 | Using Hasher As SHA1 = SHA1.Create()
29 | Return HashBytesToString(Hasher.ComputeHash(Data))
30 | End Using
31 | End Function
32 | End Module
33 |
--------------------------------------------------------------------------------
/DiskImageTool/Lib/ListViewHeader.vb:
--------------------------------------------------------------------------------
1 | Public Class ListViewHeader
2 | Inherits System.Windows.Forms.NativeWindow
3 |
4 | Private Declare Function GetWindow Lib "user32" Alias "GetWindow" (hwnd As IntPtr, wCmd As Integer) As IntPtr
5 | Private Const GW_CHILD As Integer = 5
6 | Private ReadOnly ptrHWnd As IntPtr
7 |
8 | Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
9 | Select Case m.Msg
10 | Case Is = &H20 ' WM_SETCURSOR
11 | m.Msg = 0
12 | End Select
13 |
14 | MyBase.WndProc(m)
15 | End Sub
16 |
17 | Protected Overrides Sub Finalize()
18 | Me.ReleaseHandle()
19 | MyBase.Finalize()
20 | End Sub
21 |
22 | Public Sub New(Handle As IntPtr)
23 | ptrHWnd = GetWindow(Handle, GW_CHILD)
24 | Me.AssignHandle(ptrHWnd)
25 | End Sub
26 | End Class
27 |
--------------------------------------------------------------------------------
/DiskImageTool/Lib/WindowsAPI.vb:
--------------------------------------------------------------------------------
1 | Namespace WindowsAPI
2 | Public Enum FlashWindowFlags As UInteger
3 | ' Stop flashing. The system restores the window to its original state.
4 | FLASHW_STOP = 0
5 | ' Flash the window caption.
6 | FLASHW_CAPTION = 1
7 | ' Flash the taskbar button.
8 | FLASHW_TRAY = 2
9 | ' Flash both the window caption and taskbar button.
10 | ' This is equivalent to setting the FLASHW_CAPTION | FLASHW_TRAY flags.
11 | FLASHW_ALL = 3
12 | ' Flash continuously, until the FLASHW_STOP flag is set.
13 | FLASHW_TIMER = 4
14 | ' Flash continuously until the window comes to the foreground.
15 | FLASHW_TIMERNOFG = 12
16 | End Enum
17 | Public Structure FLASHWINFO
18 | Public cbSize As UInteger
19 | Public hwnd As IntPtr
20 | Public dwFlags As FlashWindowFlags
21 | Public uCount As UInteger
22 | Public dwTimeout As UInteger
23 | End Structure
24 | Module WindowsAPI
25 |
26 | Private Function FlashWindowEx(ByRef fwInfo As FLASHWINFO) As Boolean
27 | End Function
28 |
29 |
30 | Public Function GetForegroundWindow() As Integer
31 | End Function
32 |
33 |
34 | Public Function SetForegroundWindow(hWnd As Integer) As Integer
35 | End Function
36 |
37 | Public Function FlashWindow(ByRef handle As IntPtr, FlashTitleBar As Boolean, FlashTray As Boolean, FlashCount As Integer, Continuous As Boolean) As Boolean
38 | If handle = Nothing Then
39 | Return False
40 | End If
41 |
42 | Try
43 | Dim fwi As New FLASHWINFO
44 | With fwi
45 | .hwnd = handle
46 | If FlashTitleBar Then
47 | .dwFlags = .dwFlags Or FlashWindowFlags.FLASHW_CAPTION
48 | End If
49 | If FlashTray Then
50 | .dwFlags = .dwFlags Or FlashWindowFlags.FLASHW_TRAY
51 | End If
52 | .uCount = CUInt(FlashCount)
53 | If Continuous Then
54 | .dwFlags = .dwFlags Or FlashWindowFlags.FLASHW_TIMERNOFG
55 | End If
56 | .dwTimeout = 0 ' Use the default cursor blink rate.
57 | .cbSize = CUInt(System.Runtime.InteropServices.Marshal.SizeOf(fwi))
58 | End With
59 |
60 | Return FlashWindowEx(fwi)
61 | Catch
62 | Return False
63 | End Try
64 | End Function
65 |
66 | Public Function FlashWindowStop(ByRef handle As IntPtr) As Boolean
67 | If handle = Nothing Then
68 | Return False
69 | End If
70 |
71 | Try
72 | Dim fwi As New FLASHWINFO
73 | With fwi
74 | .hwnd = handle
75 | .dwFlags = .dwFlags Or FlashWindowFlags.FLASHW_STOP
76 | .uCount = 0
77 | .dwTimeout = 0 ' Use the default cursor blink rate.
78 | .cbSize = CUInt(System.Runtime.InteropServices.Marshal.SizeOf(fwi))
79 | End With
80 |
81 | Return FlashWindowEx(fwi)
82 | Catch
83 | Return False
84 | End Try
85 | End Function
86 | End Module
87 | End Namespace
88 |
--------------------------------------------------------------------------------
/DiskImageTool/LoadedFiles.vb:
--------------------------------------------------------------------------------
1 | Public Class LoadedFiles
2 | Private ReadOnly _FileNames As Dictionary(Of String, ImageData)
3 |
4 | Public Sub New()
5 | _FileNames = New Dictionary(Of String, ImageData)
6 | End Sub
7 |
8 | Public ReadOnly Property FileNames As Dictionary(Of String, ImageData)
9 | Get
10 | Return _FileNames
11 | End Get
12 | End Property
13 |
14 | Public Function Add(Key As String, FileName As String, Compressed As Boolean, Optional CompressedFile As String = "") As ImageData
15 | If Not _FileNames.ContainsKey(Key) Then
16 | Dim ImageData = New ImageData(FileName)
17 | If Compressed Then
18 | ImageData.Compressed = True
19 | ImageData.CompressedFile = CompressedFile
20 | End If
21 |
22 | _FileNames.Add(Key, ImageData)
23 |
24 | Return ImageData
25 | End If
26 |
27 | Return Nothing
28 | End Function
29 | End Class
30 |
--------------------------------------------------------------------------------
/DiskImageTool/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | End Sub
32 |
33 | _
34 | Protected Overrides Sub OnCreateMainForm()
35 | Me.MainForm = Global.DiskImageTool.MainForm
36 | End Sub
37 |
38 | _
39 | Protected Overrides Function OnInitialize(ByVal commandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String)) As Boolean
40 | Me.MinimumSplashScreenDisplayTime = 0
41 | Return MyBase.OnInitialize(commandLineArgs)
42 | End Function
43 | End Class
44 | End Namespace
45 |
--------------------------------------------------------------------------------
/DiskImageTool/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | MainForm
5 | false
6 | 0
7 | true
8 | 0
9 | true
10 | false
11 |
--------------------------------------------------------------------------------
/DiskImageTool/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System.Reflection
2 | Imports System.Runtime.InteropServices
3 |
4 | ' General Information about an assembly is controlled through the following
5 | ' set of attributes. Change these attribute values to modify the information
6 | ' associated with an assembly.
7 |
8 | ' Review the values of the assembly attributes
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | 'The following GUID is for the ID of the typelib if this project is exposed to COM
20 |
21 |
22 | ' Version information for an assembly consists of the following four values:
23 | '
24 | ' Major Version
25 | ' Minor Version
26 | ' Build Number
27 | ' Revision
28 | '
29 | ' You can specify all the values or you can default the Build and Revision Numbers
30 | ' by using the '*' as shown below:
31 | '
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/DiskImageTool/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Imports System
15 |
16 | Namespace My.Resources
17 |
18 | 'This class was auto-generated by the StronglyTypedResourceBuilder
19 | 'class via a tool like ResGen or Visual Studio.
20 | 'To add or remove a member, edit your .ResX file then rerun ResGen
21 | 'with the /str option, or rebuild your VS project.
22 | '''
23 | ''' A strongly-typed resource class, for looking up localized strings, etc.
24 | '''
25 | _
29 | Friend Module Resources
30 |
31 | Private resourceMan As Global.System.Resources.ResourceManager
32 |
33 | Private resourceCulture As Global.System.Globalization.CultureInfo
34 |
35 | '''
36 | ''' Returns the cached ResourceManager instance used by this class.
37 | '''
38 | _
39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
40 | Get
41 | If Object.ReferenceEquals(resourceMan, Nothing) Then
42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("DiskImageTool.Resources", GetType(Resources).Assembly)
43 | resourceMan = temp
44 | End If
45 | Return resourceMan
46 | End Get
47 | End Property
48 |
49 | '''
50 | ''' Overrides the current thread's CurrentUICulture property for all
51 | ''' resource lookups using this strongly typed resource class.
52 | '''
53 | _
54 | Friend Property Culture() As Global.System.Globalization.CultureInfo
55 | Get
56 | Return resourceCulture
57 | End Get
58 | Set
59 | resourceCulture = value
60 | End Set
61 | End Property
62 | End Module
63 | End Namespace
64 |
--------------------------------------------------------------------------------
/DiskImageTool/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 0
7 |
8 |
9 | 0
10 |
11 |
12 | True
13 |
14 |
15 | False
16 |
17 |
18 | True
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | True
28 |
29 |
30 | True
31 |
32 |
33 |
--------------------------------------------------------------------------------
/DiskImageTool/My Project/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
50 |
58 |
59 |
73 |
--------------------------------------------------------------------------------
/DiskImageTool/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DiskImageTool
2 | View and manipulate floppy disk images
3 |
4 | This is a personal project of mine. I decided to make the source code available in case anyone finds it useful, but at no time should it be considered production quality.
5 |
6 | What does DiskImageTool do?
7 |
8 | 1. It allows you to view and perform simple repairs on IBM PC formatted floppy disk images.
9 | 2. You can easily copy files and folders in and out of images by dragging and dropping.
10 | 3. Convert between multiple image formats
11 | 4. Create new disk images
12 | 5. File properties editor
13 | 6. Boot sector editor
14 | 7. File Allocation Table (FAT) editor
15 | 8. Full featured Hex editor. Focus on individual regions of the disk or view and edit the entire disk.
16 | 9. Text file viewer
17 | 10. Raw track viewer
18 | 11. Easily repair a modified boot sector OEM Name using a built in database of suggestions.
19 | 12. Clean up modifications made by Windows to the boot sector and directory entries with one click.
20 | 13. Open hundreds of images at one time and use powerful filters to narrow down your search to the ones that need your attention.
21 |
22 | DiskImageTool suports the following image formats:
23 | 1. Basic Sector Images (.ima, .img, .vfd, .flp, .160, .180, .320, .360, .720, .120, .144, .288, .dmf, .xdf)
24 | 2. WinImage Compressed Disk Image (.imz)
25 | 3. ImageDisk Sector Image (.imd)
26 | 4. PCE Sector Image (.psi)
27 | 5. PCE Bitstream Image (.pri)
28 | 6. 86Box 86F Image (.86f)
29 | 7. HxC HFE v1 Image (.hfe)
30 | 8. HxC MFM Image (.mfm)
31 | 9. Transcopy Image (.tc)
32 |
33 | DiskImageTool can also open the above image types from within Zip files.
34 |
35 | Suggestions for new features are welcome.
36 |
37 | I have a discord channel set up for the discussion of DiskImageTool at [#diskimagetool](https://discord.gg/7BNMJuf4CR)
38 |
39 | [Download the latest release here](https://github.com/Digitoxin1/DiskImageTool/releases/latest)
40 |
41 | ---
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------