Compare commits

...

2 Commits

4 changed files with 152 additions and 52 deletions

View File

@ -40,12 +40,18 @@ namespace Mk0.Software.Bildduplikate
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.label3 = new System.Windows.Forms.Label();
this.buttonReload = new System.Windows.Forms.Button();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.SuspendLayout();
//
// buttonCSV
@ -60,8 +66,8 @@ namespace Mk0.Software.Bildduplikate
//
// buttonDel1
//
this.buttonDel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonDel1.Location = new System.Drawing.Point(12, 359);
this.buttonDel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDel1.Location = new System.Drawing.Point(313, 3);
this.buttonDel1.Name = "buttonDel1";
this.buttonDel1.Size = new System.Drawing.Size(75, 23);
this.buttonDel1.TabIndex = 2;
@ -72,8 +78,7 @@ namespace Mk0.Software.Bildduplikate
//
// buttonDel2
//
this.buttonDel2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDel2.Location = new System.Drawing.Point(404, 359);
this.buttonDel2.Location = new System.Drawing.Point(0, 3);
this.buttonDel2.Name = "buttonDel2";
this.buttonDel2.Size = new System.Drawing.Size(75, 23);
this.buttonDel2.TabIndex = 3;
@ -84,20 +89,19 @@ namespace Mk0.Software.Bildduplikate
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 385);
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label1.Location = new System.Drawing.Point(-219, 29);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(35, 13);
this.label1.Size = new System.Drawing.Size(604, 50);
this.label1.TabIndex = 4;
this.label1.Text = "label1";
this.label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.label1.Visible = false;
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(401, 385);
this.label2.Location = new System.Drawing.Point(3, 29);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(35, 13);
this.label2.TabIndex = 5;
@ -173,29 +177,61 @@ namespace Mk0.Software.Bildduplikate
this.label3.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.label3.Visible = false;
//
// buttonReload
//
this.buttonReload.Location = new System.Drawing.Point(93, 12);
this.buttonReload.Name = "buttonReload";
this.buttonReload.Size = new System.Drawing.Size(75, 23);
this.buttonReload.TabIndex = 11;
this.buttonReload.Text = "reload";
this.buttonReload.UseVisualStyleBackColor = true;
this.buttonReload.Click += new System.EventHandler(this.ButtonReload_Click);
//
// splitContainer2
//
this.splitContainer2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.splitContainer2.Location = new System.Drawing.Point(12, 362);
this.splitContainer2.Name = "splitContainer2";
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.buttonDel1);
this.splitContainer2.Panel1.Controls.Add(this.label1);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.buttonDel2);
this.splitContainer2.Panel2.Controls.Add(this.label2);
this.splitContainer2.Size = new System.Drawing.Size(775, 81);
this.splitContainer2.SplitterDistance = 388;
this.splitContainer2.TabIndex = 12;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.splitContainer2);
this.Controls.Add(this.buttonReload);
this.Controls.Add(this.label3);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.buttonKeinDuplikat);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.buttonDel2);
this.Controls.Add(this.buttonDel1);
this.Controls.Add(this.buttonCSV);
this.Name = "Form1";
this.Text = "Bildduplikate by kmpr.at";
this.Text = "Bildduplikate v1.1 by kmpr.at";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
this.splitContainer2.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
@ -212,6 +248,8 @@ namespace Mk0.Software.Bildduplikate
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button buttonReload;
private System.Windows.Forms.SplitContainer splitContainer2;
}
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
@ -14,7 +15,7 @@ namespace Mk0.Software.Bildduplikate
private int line = 0, total = 0;
private string file;
List<Duplicate> duplicates = new List<Duplicate>();
private List<Duplicate> duplicates = new List<Duplicate>();
public Form1()
{
@ -39,7 +40,9 @@ namespace Mk0.Software.Bildduplikate
private void LoadCSV(string fileName)
{
line = 0;
total = 0;
file = fileName;
duplicates.Clear();
using (StreamReader reader = new StreamReader(fileName))
{
@ -56,47 +59,59 @@ namespace Mk0.Software.Bildduplikate
total = duplicates.Count;
LoadDuplicates(line);
buttonDel1.Visible = true;
buttonDel2.Visible = true;
buttonKeinDuplikat.Visible = true;
pictureBox1.Visible = true;
pictureBox2.Visible = true;
label1.Visible = true;
label2.Visible = true;
label3.Visible = true;
}
private void LoadDuplicates(int line)
private void LoadDuplicates(int lineDup)
{
if(File.Exists(duplicates.ElementAt(line).Path1) && File.Exists(duplicates.ElementAt(line).Path2))
if (duplicates.Count > lineDup)
{
Image img1 = GetCopyImage(duplicates.ElementAt(line).Path1);
Image img2 = GetCopyImage(duplicates.ElementAt(line).Path2);
pictureBox1.Image = img1;
pictureBox2.Image = img2;
FileInfo f1 = new FileInfo(duplicates.ElementAt(line).Path1);
FileInfo f2 = new FileInfo(duplicates.ElementAt(line).Path2);
label1.Text = Path.GetFileName(duplicates.ElementAt(line).Path1) + Environment.NewLine + FormatSize(f1.Length) + Environment.NewLine + f1.LastWriteTime;
label2.Text = Path.GetFileName(duplicates.ElementAt(line).Path2) + Environment.NewLine + FormatSize(f2.Length) + Environment.NewLine + f2.LastWriteTime;
label3.Text = total + " Duplikate";
if (File.Exists(duplicates.ElementAt(lineDup).Path1) && File.Exists(duplicates.ElementAt(lineDup).Path2))
{
Image img1 = GetCopyImage(duplicates.ElementAt(lineDup).Path1);
Image img2 = GetCopyImage(duplicates.ElementAt(lineDup).Path2);
pictureBox1.Image = img1;
pictureBox2.Image = img2;
FileInfo f1 = new FileInfo(duplicates.ElementAt(lineDup).Path1);
FileInfo f2 = new FileInfo(duplicates.ElementAt(lineDup).Path2);
label1.Text = Path.GetFileName(duplicates.ElementAt(lineDup).Path1) + Environment.NewLine + FormatSize(f1.Length) + Environment.NewLine + f1.LastWriteTime;
label2.Text = Path.GetFileName(duplicates.ElementAt(lineDup).Path2) + Environment.NewLine + FormatSize(f2.Length) + Environment.NewLine + f2.LastWriteTime;
label3.Text = total + " Duplikate";
UIElementsVisible(true);
}
else
{
File_DeleteLine(lineDup);
total--;
line++;
LoadDuplicates(line);
}
}
else
{
File_DeleteLine(line);
total--;
line++;
LoadDuplicates(line);
MessageBox.Show("Alle Duplikate in CSV abgearbeitet", "Fertig!", MessageBoxButtons.OK, MessageBoxIcon.Information);
UIElementsVisible(false);
}
}
private void UIElementsVisible(bool vis)
{
label1.Visible = vis;
label2.Visible = vis;
label3.Visible = vis;
buttonDel1.Visible = vis;
buttonDel2.Visible = vis;
buttonKeinDuplikat.Visible = vis;
pictureBox1.Visible = vis;
pictureBox2.Visible = vis;
}
private string FormatSize(long length)
{
int counter = 0;
decimal number = (decimal)length;
while (Math.Round(number / 1024) >= 1)
{
number = number / 1024;
number /= 1024;
counter++;
}
return string.Format("{0:n1}{1}", number, suffixes[counter]);
@ -137,9 +152,14 @@ namespace Mk0.Software.Bildduplikate
}
}
private void File_DeleteLine(int line)
private void ButtonReload_Click(object sender, EventArgs e)
{
line = line + 1;
LoadDuplicates(line);
}
private void File_DeleteLine(int lineFile)
{
lineFile++;
StringBuilder sb = new StringBuilder();
using (StreamReader sr = new StreamReader(file))
{
@ -147,7 +167,7 @@ namespace Mk0.Software.Bildduplikate
while (!sr.EndOfStream)
{
Countup++;
if (Countup != line)
if (Countup != lineFile)
{
using (StringWriter sw = new StringWriter(sb))
{
@ -164,6 +184,7 @@ namespace Mk0.Software.Bildduplikate
{
sw.Write(sb.ToString());
}
Debug.Print("lösche Zeile " + lineFile);
}
}
}

View File

@ -7,11 +7,27 @@
<ProjectGuid>{2DBB67D4-1312-4FCF-BA49-0A856A3EE544}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Mk0.Software.Bildduplikate</RootNamespace>
<AssemblyName>Mk0.Software.Bildduplikate</AssemblyName>
<AssemblyName>Bildduplikate</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -32,6 +48,18 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>6BCF527F7020A7756FB1D5660249CDEFD0DA95A2</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>Mk0.Software.Bildduplikate_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
@ -67,6 +95,7 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Mk0.Software.Bildduplikate_TemporaryKey.pfx" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@ -80,5 +109,17 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.8 %28x86 und x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -5,13 +5,13 @@ using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("Mk0.Software.Bildduplikate")]
[assembly: AssemblyTitle("Bildduplikate")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("kmpr.at")]
[assembly: AssemblyProduct("Mk0.Software.Bildduplikate")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCopyright("Copyright © 2022 kmpr.at")]
[assembly: AssemblyTrademark("kmpr.at")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]