From 33595fdfeb76ad40b3a3f1f6f85c2d9be54ea8a2 Mon Sep 17 00:00:00 2001 From: moosecrab Date: Mon, 10 May 2021 19:45:49 -0700 Subject: [PATCH] Initial commit --- .gitignore | 381 +++++++++++++++++++ dupecheck.sln | 20 + dupecheck/Module1.vb | 165 ++++++++ dupecheck/My Project/Application.Designer.vb | 13 + dupecheck/My Project/Application.myapp | 10 + dupecheck/My Project/AssemblyInfo.vb | 35 ++ dupecheck/My Project/Resources.Designer.vb | 62 +++ dupecheck/My Project/Resources.resx | 117 ++++++ dupecheck/My Project/Settings.Designer.vb | 73 ++++ dupecheck/My Project/Settings.settings | 7 + dupecheck/dupecheck.vbproj | 116 ++++++ 11 files changed, 999 insertions(+) create mode 100755 .gitignore create mode 100755 dupecheck.sln create mode 100755 dupecheck/Module1.vb create mode 100755 dupecheck/My Project/Application.Designer.vb create mode 100755 dupecheck/My Project/Application.myapp create mode 100755 dupecheck/My Project/AssemblyInfo.vb create mode 100755 dupecheck/My Project/Resources.Designer.vb create mode 100755 dupecheck/My Project/Resources.resx create mode 100755 dupecheck/My Project/Settings.Designer.vb create mode 100755 dupecheck/My Project/Settings.settings create mode 100755 dupecheck/dupecheck.vbproj diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..84d2a02 --- /dev/null +++ b/.gitignore @@ -0,0 +1,381 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,dotnetcore +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,dotnetcore + +### DotnetCore ### +# .NET Core build folders +bin/ +obj/ + +# Common node modules locations +/node_modules +/wwwroot/node_modules + +### VisualStudio ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.[ji][sn][of][no] +coverage*.xml + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +### VisualStudio Patch ### +# Additional files built by Visual Studio +*.tlog + +# End of https://www.toptal.com/developers/gitignore/api/visualstudio,dotnetcore diff --git a/dupecheck.sln b/dupecheck.sln new file mode 100755 index 0000000..da52962 --- /dev/null +++ b/dupecheck.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "dupecheck", "dupecheck\dupecheck.vbproj", "{839762D1-B14B-4086-8E4B-09A1738841D3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {839762D1-B14B-4086-8E4B-09A1738841D3}.Debug|x86.ActiveCfg = Debug|x86 + {839762D1-B14B-4086-8E4B-09A1738841D3}.Debug|x86.Build.0 = Debug|x86 + {839762D1-B14B-4086-8E4B-09A1738841D3}.Release|x86.ActiveCfg = Release|x86 + {839762D1-B14B-4086-8E4B-09A1738841D3}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/dupecheck/Module1.vb b/dupecheck/Module1.vb new file mode 100755 index 0000000..6df6822 --- /dev/null +++ b/dupecheck/Module1.vb @@ -0,0 +1,165 @@ +Module Module1 + + Class fileobj + Implements IEquatable(Of fileobj) + + Public Overrides Function GetHashCode() As Integer + Return 0 + End Function + + Public Overloads Function Equals(other As fileobj) As Boolean Implements System.IEquatable(Of fileobj).Equals + + Return Me.size = other.size AndAlso + Me.middlebytes = other.middlebytes AndAlso + Me.md5.SequenceEqual(other.md5) + + End Function + + Property name As String + Sub New(filename As String) + Me.name = filename + End Sub + + Private _size As Long + Private havesize As Boolean = False + Public ReadOnly Property size() As Long + Get + If Not havesize Then + Me._size = FileIO.FileSystem.GetFileInfo(Me.name).Length + havesize = True + End If + Return _size + End Get + End Property + + Private _middlebytes As UInteger + Private havemiddlebytes As Boolean = False + Public ReadOnly Property middlebytes() As UInteger + Get + If Not havemiddlebytes Then + Try + Dim fs As New IO.FileStream(Me.name, IO.FileMode.Open, IO.FileAccess.Read) + Dim buf(3) As Byte + If Me._size >= 4 Then + fs.Seek(Me._size / 2, IO.SeekOrigin.Begin) + fs.Read(buf, 0, 4) + Else + fs.Read(buf, 0, Me._size) + End If + fs.Close() + + _middlebytes = BitConverter.ToUInt32(buf, 0) + + Me.havemiddlebytes = True + Catch ex As Exception + Console.WriteLine("Couldn't open file {0}", Me.name) + Console.WriteLine(ex.ToString) + End Try + End If + Return _middlebytes + End Get + End Property + + Private _md5 As Byte() + Private havemd5 As Boolean = False + Public ReadOnly Property md5() As Byte() + Get + If Not havemd5 Then + Dim hashr As System.Security.Cryptography.MD5 = System.Security.Cryptography.MD5.Create + Dim fs As New IO.FileStream(Me.name, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read) + hashr.ComputeHash(fs) + _md5 = hashr.Hash + fs.Close() + End If + Return _md5 + End Get + End Property + + End Class + + MustInherit Class rule + + Enum RuleAction + Ignore + Keep + Delete + End Enum + + Public action As RuleAction + Public text As String + + + Shared Function parse(def As String) As rule + Dim newrule As rule = Nothing + + Dim splitrule As String() = def.ToLowerInvariant.Split(" ") + If splitrule.Length < 2 Then + Throw New Exception("An action and type are both required") + End If + + Select Case splitrule(1) + Case "regex" + newrule = New regexrule(def) + Case Else + Throw New Exception("Unknown filter type """ & splitrule(1) & """") + End Select + + Select Case splitrule(0) + Case "ignore" + newrule.action = RuleAction.Ignore + Case "keep" + newrule.action = RuleAction.Keep + Case "delete" + newrule.action = RuleAction.Delete + Case Else + Throw New Exception("Unknown action type """ & splitrule(0) & """") + End Select + + Return newrule + End Function + + MustOverride Function filtergroup(g As IEnumerable(Of fileobj)) As List(Of fileobj) + + End Class + + Class regexrule + Inherits rule + + Public Sub New(def As String) + + End Sub + + Public Overrides Function filtergroup(g As IEnumerable(Of fileobj)) As List(Of fileobj) + + End Function + + End Class + + Dim allfilelist As New List(Of fileobj) + Dim rulelist As New List(Of rule) + + Sub Main() + Dim dir As String = "V:\4chan\gf" + Console.WriteLine("Enumerating files...") + For Each f In FileIO.FileSystem.GetFiles(dir, FileIO.SearchOption.SearchAllSubDirectories).ToList + allfilelist.Add(New fileobj(f)) + Next + + Console.WriteLine("Total files: {0:n0}", allfilelist.Count) + Console.WriteLine("Checking for duplicates...") + + Dim dupegroups = From file In allfilelist Group By file Into Group Where Group.Count > 1 + + Console.WriteLine("Duplicates: {0:n0}", dupegroups.Count) + + While True + + End While + + Console.WriteLine() + Console.WriteLine("Press enter to exit") + Console.ReadLine() + End Sub + + +End Module diff --git a/dupecheck/My Project/Application.Designer.vb b/dupecheck/My Project/Application.Designer.vb new file mode 100755 index 0000000..db8b8b3 --- /dev/null +++ b/dupecheck/My Project/Application.Designer.vb @@ -0,0 +1,13 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/dupecheck/My Project/Application.myapp b/dupecheck/My Project/Application.myapp new file mode 100755 index 0000000..23b627f --- /dev/null +++ b/dupecheck/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + false + false + 0 + true + 0 + 2 + true + diff --git a/dupecheck/My Project/AssemblyInfo.vb b/dupecheck/My Project/AssemblyInfo.vb new file mode 100755 index 0000000..f7867df --- /dev/null +++ b/dupecheck/My Project/AssemblyInfo.vb @@ -0,0 +1,35 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/dupecheck/My Project/Resources.Designer.vb b/dupecheck/My Project/Resources.Designer.vb new file mode 100755 index 0000000..1651925 --- /dev/null +++ b/dupecheck/My Project/Resources.Designer.vb @@ -0,0 +1,62 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("dupecheck.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/dupecheck/My Project/Resources.resx b/dupecheck/My Project/Resources.resx new file mode 100755 index 0000000..ffecec8 --- /dev/null +++ b/dupecheck/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/dupecheck/My Project/Settings.Designer.vb b/dupecheck/My Project/Settings.Designer.vb new file mode 100755 index 0000000..1e3a249 --- /dev/null +++ b/dupecheck/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.dupecheck.My.MySettings + Get + Return Global.dupecheck.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/dupecheck/My Project/Settings.settings b/dupecheck/My Project/Settings.settings new file mode 100755 index 0000000..377f56d --- /dev/null +++ b/dupecheck/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dupecheck/dupecheck.vbproj b/dupecheck/dupecheck.vbproj new file mode 100755 index 0000000..7b06433 --- /dev/null +++ b/dupecheck/dupecheck.vbproj @@ -0,0 +1,116 @@ + + + + Debug + x86 + + + + + {839762D1-B14B-4086-8E4B-09A1738841D3} + Exe + dupecheck.Module1 + dupecheck + dupecheck + 512 + Console + v4.0 + Client + + + x86 + true + full + true + true + bin\Debug\ + dupecheck.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + x86 + pdbonly + false + true + true + bin\Release\ + dupecheck.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + + + + + + + + + + + + + + + + + + + + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + \ No newline at end of file