Skip to content

Latest commit

 

History

History
110 lines (99 loc) · 5.65 KB

README.md

File metadata and controls

110 lines (99 loc) · 5.65 KB

PropertiesDotNet Build status

An advanced properties window made in VB.Net

Gitter

Screenshots

PropertiesDotNet main window Hash generator window Folder deleting window Folder copying window File compress dialog

Download

Get the latest version here, and the latest build from commit here (note that these builds are built for the Debug config and so are not optimised)

If getting the latest build from commit, download PropertiesDotNet-Ookii.Dialogs.dll for full functionality.

Credits/Acknowledgements

Icons

Getting open with program

NTFS Compression

Hash Generating

Imports System
Imports System.Collections.Generic
Imports System.Drawing
Imports System.Windows.Forms
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.ComponentModel
Imports System.Security
Imports System.Security.Cryptography

Namespace NTFSCompress
    Public Partial Class MainForm
        Inherits Form
        Public Sub New()
            InitializeComponent()
        End Sub
        Private Sub BackgroundWorker_DoWork(sender As Object, e As DoWorkEventArgs)
            Dim buffer As Byte()
            Dim oldBuffer As Byte()
            Dim bytesRead As Integer
            Dim oldBytesRead As Integer
            Dim size As Long
            Dim totalBytesRead As Long = 0
            Using stream As Stream = File.OpenRead(DirectCast(e.Argument, String))
                Using hashAlgorithm As HashAlgorithm = MD5.Create()
                    size = stream.Length
                    buffer = New Byte(4095) {}
                    bytesRead = stream.Read(buffer, 0, buffer.Length)
                    totalBytesRead += bytesRead
                    Do
                        oldBytesRead = bytesRead
                        oldBuffer = buffer
                        buffer = New Byte(4095) {}
                        bytesRead = stream.Read(buffer, 0, buffer.Length)
                        totalBytesRead += bytesRead
                        If bytesRead = 0 Then
                            hashAlgorithm.TransformFinalBlock(oldBuffer, 0, oldBytesRead)
                        Else
                            hashAlgorithm.TransformBlock(oldBuffer, 0, oldBytesRead, oldBuffer, 0)
                        End If
                        BackgroundWorker.ReportProgress(CInt(Math.Truncate(CDbl(totalBytesRead) * 100 / size)))
                    Loop While bytesRead <> 0
                    e.Result = hashAlgorithm.Hash
                End Using
            End Using
        End Sub
    End Class
End Namespace

Compile requirements

See CompileInstructions.md