Compare commits
18 Commits
Author | SHA1 | Date |
---|---|---|
Manuel Kamper | 6f1e371d33 | |
Manuel Kamper | be84e1e144 | |
Manuel Kamper | 33941b3518 | |
Manuel Kamper | 4df68efc51 | |
Manuel Kamper | aa070cd06b | |
Manuel Kamper | d29d4298eb | |
Manuel Kamper | 9c62348c7c | |
Manuel Kamper | ca035abae6 | |
Manuel Kamper | ad9d216657 | |
Manuel Kamper | e1e31c34ad | |
Manuel Kamper | 64da2fc385 | |
Manuel Kamper | fbac50019c | |
Manuel Kamper | 7ebf9eea1d | |
Manuel Kamper | 73dec49ac7 | |
Manuel Kamper | 7b74eca31b | |
Manuel Kamper | 0ab311b800 | |
Manuel Kamper | f5fb5d9fbb | |
Manuel Kamper | f1c0c98c40 |
|
@ -38,6 +38,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
this.buttonSave = new System.Windows.Forms.Button();
|
||||
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.checkBoxAutoLoad = new System.Windows.Forms.CheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
|
@ -60,7 +61,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 88);
|
||||
this.label2.Location = new System.Drawing.Point(12, 67);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(75, 13);
|
||||
this.label2.TabIndex = 2;
|
||||
|
@ -68,14 +69,14 @@ namespace Mk0.Software.Bildduplikate
|
|||
//
|
||||
// textBoxPath1
|
||||
//
|
||||
this.textBoxPath1.Location = new System.Drawing.Point(15, 104);
|
||||
this.textBoxPath1.Location = new System.Drawing.Point(15, 83);
|
||||
this.textBoxPath1.Name = "textBoxPath1";
|
||||
this.textBoxPath1.Size = new System.Drawing.Size(206, 20);
|
||||
this.textBoxPath1.TabIndex = 3;
|
||||
//
|
||||
// textBoxPath2
|
||||
//
|
||||
this.textBoxPath2.Location = new System.Drawing.Point(15, 143);
|
||||
this.textBoxPath2.Location = new System.Drawing.Point(15, 122);
|
||||
this.textBoxPath2.Name = "textBoxPath2";
|
||||
this.textBoxPath2.Size = new System.Drawing.Size(206, 20);
|
||||
this.textBoxPath2.TabIndex = 4;
|
||||
|
@ -83,7 +84,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(12, 127);
|
||||
this.label3.Location = new System.Drawing.Point(12, 106);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(29, 13);
|
||||
this.label3.TabIndex = 5;
|
||||
|
@ -101,7 +102,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
//
|
||||
// numericUpDown1
|
||||
//
|
||||
this.numericUpDown1.Location = new System.Drawing.Point(248, 104);
|
||||
this.numericUpDown1.Location = new System.Drawing.Point(248, 83);
|
||||
this.numericUpDown1.Maximum = new decimal(new int[] {
|
||||
1000,
|
||||
0,
|
||||
|
@ -124,17 +125,28 @@ namespace Mk0.Software.Bildduplikate
|
|||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(245, 88);
|
||||
this.label4.Location = new System.Drawing.Point(245, 67);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(228, 13);
|
||||
this.label4.TabIndex = 8;
|
||||
this.label4.Text = "Amount of images loaded per request from API:";
|
||||
//
|
||||
// checkBoxAutoLoad
|
||||
//
|
||||
this.checkBoxAutoLoad.AutoSize = true;
|
||||
this.checkBoxAutoLoad.Location = new System.Drawing.Point(246, 122);
|
||||
this.checkBoxAutoLoad.Name = "checkBoxAutoLoad";
|
||||
this.checkBoxAutoLoad.Size = new System.Drawing.Size(179, 17);
|
||||
this.checkBoxAutoLoad.TabIndex = 9;
|
||||
this.checkBoxAutoLoad.Text = "Load images from API on startup";
|
||||
this.checkBoxAutoLoad.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// API
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(476, 180);
|
||||
this.Controls.Add(this.checkBoxAutoLoad);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.numericUpDown1);
|
||||
this.Controls.Add(this.buttonSave);
|
||||
|
@ -168,5 +180,6 @@ namespace Mk0.Software.Bildduplikate
|
|||
private System.Windows.Forms.Button buttonSave;
|
||||
private System.Windows.Forms.NumericUpDown numericUpDown1;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.CheckBox checkBoxAutoLoad;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Mk0.Software.Bildduplikate
|
||||
|
@ -12,15 +13,42 @@ namespace Mk0.Software.Bildduplikate
|
|||
textBoxPath1.Text = Properties.Settings.Default.ReplacePath;
|
||||
textBoxPath2.Text = Properties.Settings.Default.ReplaceWith;
|
||||
numericUpDown1.Value = Properties.Settings.Default.imagesFromAPI;
|
||||
checkBoxAutoLoad.Checked = Properties.Settings.Default.autoload;
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
Properties.Settings.Default.ApiUrl = textBoxApiUrl.Text.Trim();
|
||||
Properties.Settings.Default.ReplacePath = textBoxPath1.Text.Trim();
|
||||
Properties.Settings.Default.ReplaceWith = textBoxPath2.Text.Trim();
|
||||
Properties.Settings.Default.imagesFromAPI = (int)numericUpDown1.Value;
|
||||
Properties.Settings.Default.Save();
|
||||
if (!CheckWebsite(textBoxApiUrl.Text.Trim() + "?test"))
|
||||
{
|
||||
MessageBox.Show("The URL of the API is not valid!" + Environment.NewLine + "Settings not saved!", "No valid API", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
Properties.Settings.Default.ApiUrl = textBoxApiUrl.Text.Trim();
|
||||
Properties.Settings.Default.ReplacePath = textBoxPath1.Text.Trim();
|
||||
Properties.Settings.Default.ReplaceWith = textBoxPath2.Text.Trim();
|
||||
Properties.Settings.Default.imagesFromAPI = (int)numericUpDown1.Value;
|
||||
Properties.Settings.Default.autoload = checkBoxAutoLoad.Checked;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
public bool CheckWebsite(string URL)
|
||||
{
|
||||
try
|
||||
{
|
||||
WebClient wc = new WebClient();
|
||||
string HTMLSource = wc.DownloadString(URL);
|
||||
if (HTMLSource.Contains("API is working properly"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,9 @@
|
|||
<setting name="imagesFromAPI" serializeAs="String">
|
||||
<value>100</value>
|
||||
</setting>
|
||||
<setting name="autoload" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
</Mk0.Software.Bildduplikate.Properties.Settings>
|
||||
</userSettings>
|
||||
<runtime>
|
||||
|
|
|
@ -41,10 +41,11 @@ namespace Mk0.Software.Bildduplikate
|
|||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.buttonReload = new System.Windows.Forms.Button();
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
this.buttonAPISetting = new System.Windows.Forms.Button();
|
||||
this.buttonAPILoad = new System.Windows.Forms.Button();
|
||||
this.richTextBoxDesc1 = new System.Windows.Forms.RichTextBox();
|
||||
this.richTextBoxDesc2 = new System.Windows.Forms.RichTextBox();
|
||||
this.buttonAPISetting = new System.Windows.Forms.Button();
|
||||
this.buttonAPILoad = new System.Windows.Forms.Button();
|
||||
this.buttonUndo = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
|
@ -119,7 +120,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
// buttonKeinDuplikat
|
||||
//
|
||||
this.buttonKeinDuplikat.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.buttonKeinDuplikat.Location = new System.Drawing.Point(372, 12);
|
||||
this.buttonKeinDuplikat.Location = new System.Drawing.Point(385, 12);
|
||||
this.buttonKeinDuplikat.Name = "buttonKeinDuplikat";
|
||||
this.buttonKeinDuplikat.Size = new System.Drawing.Size(217, 23);
|
||||
this.buttonKeinDuplikat.TabIndex = 8;
|
||||
|
@ -191,26 +192,6 @@ namespace Mk0.Software.Bildduplikate
|
|||
this.splitContainer2.TabIndex = 12;
|
||||
this.splitContainer2.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
|
||||
//
|
||||
// buttonAPISetting
|
||||
//
|
||||
this.buttonAPISetting.Location = new System.Drawing.Point(174, 12);
|
||||
this.buttonAPISetting.Name = "buttonAPISetting";
|
||||
this.buttonAPISetting.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonAPISetting.TabIndex = 13;
|
||||
this.buttonAPISetting.Text = "API Setting";
|
||||
this.buttonAPISetting.UseVisualStyleBackColor = true;
|
||||
this.buttonAPISetting.Click += new System.EventHandler(this.ButtonAPI_Click);
|
||||
//
|
||||
// buttonAPILoad
|
||||
//
|
||||
this.buttonAPILoad.Location = new System.Drawing.Point(255, 12);
|
||||
this.buttonAPILoad.Name = "buttonAPILoad";
|
||||
this.buttonAPILoad.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonAPILoad.TabIndex = 14;
|
||||
this.buttonAPILoad.Text = "Load API";
|
||||
this.buttonAPILoad.UseVisualStyleBackColor = true;
|
||||
this.buttonAPILoad.Click += new System.EventHandler(this.ButtonAPILoad_Click);
|
||||
//
|
||||
// richTextBoxDesc1
|
||||
//
|
||||
this.richTextBoxDesc1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
|
@ -242,11 +223,45 @@ namespace Mk0.Software.Bildduplikate
|
|||
this.richTextBoxDesc2.Text = "";
|
||||
this.richTextBoxDesc2.Visible = false;
|
||||
//
|
||||
// buttonAPISetting
|
||||
//
|
||||
this.buttonAPISetting.Location = new System.Drawing.Point(174, 12);
|
||||
this.buttonAPISetting.Name = "buttonAPISetting";
|
||||
this.buttonAPISetting.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonAPISetting.TabIndex = 13;
|
||||
this.buttonAPISetting.Text = "API Setting";
|
||||
this.buttonAPISetting.UseVisualStyleBackColor = true;
|
||||
this.buttonAPISetting.Click += new System.EventHandler(this.ButtonAPI_Click);
|
||||
//
|
||||
// buttonAPILoad
|
||||
//
|
||||
this.buttonAPILoad.Location = new System.Drawing.Point(255, 12);
|
||||
this.buttonAPILoad.Name = "buttonAPILoad";
|
||||
this.buttonAPILoad.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonAPILoad.TabIndex = 14;
|
||||
this.buttonAPILoad.Text = "Load API";
|
||||
this.buttonAPILoad.UseVisualStyleBackColor = true;
|
||||
this.buttonAPILoad.Visible = false;
|
||||
this.buttonAPILoad.Click += new System.EventHandler(this.ButtonAPILoad_Click);
|
||||
//
|
||||
// buttonUndo
|
||||
//
|
||||
this.buttonUndo.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.buttonUndo.Location = new System.Drawing.Point(608, 12);
|
||||
this.buttonUndo.Name = "buttonUndo";
|
||||
this.buttonUndo.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonUndo.TabIndex = 15;
|
||||
this.buttonUndo.Text = "undo";
|
||||
this.buttonUndo.UseVisualStyleBackColor = true;
|
||||
this.buttonUndo.Visible = false;
|
||||
this.buttonUndo.Click += new System.EventHandler(this.ButtonUndo_Click);
|
||||
//
|
||||
// Main
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(984, 551);
|
||||
this.Controls.Add(this.buttonUndo);
|
||||
this.Controls.Add(this.buttonAPILoad);
|
||||
this.Controls.Add(this.buttonAPISetting);
|
||||
this.Controls.Add(this.splitContainer2);
|
||||
|
@ -260,7 +275,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
this.MinimumSize = new System.Drawing.Size(1000, 590);
|
||||
this.Name = "Main";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Bildduplikate v1.5 by kmpr.at";
|
||||
this.Text = "Bildduplikate v1.10 by kmpr.at";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Main_FormClosing);
|
||||
this.Shown += new System.EventHandler(this.Main_Shown);
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
|
||||
|
@ -295,6 +310,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
private System.Windows.Forms.Button buttonAPILoad;
|
||||
private System.Windows.Forms.RichTextBox richTextBoxDesc1;
|
||||
private System.Windows.Forms.RichTextBox richTextBoxDesc2;
|
||||
private System.Windows.Forms.Button buttonUndo;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@ namespace Mk0.Software.Bildduplikate
|
|||
private int line = 0, total = 0, offset = 0;
|
||||
private string file;
|
||||
private bool api = false;
|
||||
private int worst = 0;
|
||||
private int lastStep = 0;
|
||||
|
||||
private List<Duplicate> duplicates = new List<Duplicate>();
|
||||
|
||||
|
@ -99,8 +101,8 @@ namespace Mk0.Software.Bildduplikate
|
|||
string size1, size2;
|
||||
if (f1.Length == f2.Length)
|
||||
{
|
||||
size1 = @"\b " + FormatSize(f1.Length) + @" \b0 ";
|
||||
size2 = @"\b " + FormatSize(f2.Length) + @" \b0 ";
|
||||
size1 = @" \b " + FormatSize(f1.Length) + @" \b0 ";
|
||||
size2 = @" \b " + FormatSize(f2.Length) + @" \b0 ";
|
||||
dup1++;
|
||||
dup1++;
|
||||
dup2++;
|
||||
|
@ -108,7 +110,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
}
|
||||
else if (f1.Length > f2.Length)
|
||||
{
|
||||
size1 = @"\b " + FormatSize(f1.Length) + @" \b0 ";
|
||||
size1 = @" \b " + FormatSize(f1.Length) + @" \b0 ";
|
||||
size2 = FormatSize(f2.Length);
|
||||
dup1++;
|
||||
dup1++;
|
||||
|
@ -116,17 +118,17 @@ namespace Mk0.Software.Bildduplikate
|
|||
else
|
||||
{
|
||||
size1 = FormatSize(f1.Length);
|
||||
size2 = @"\b " + FormatSize(f2.Length) + @" \b0 ";
|
||||
size2 = @" \b " + FormatSize(f2.Length) + @" \b0 ";
|
||||
dup2++;
|
||||
dup2++;
|
||||
}
|
||||
|
||||
string filePath1 = Path.GetDirectoryName(Duplicates.ElementAt(lineDup).Path1);
|
||||
string filePath2 = Path.GetDirectoryName(Duplicates.ElementAt(lineDup).Path2);
|
||||
string filePath1 = GetRtfUnicodeEscapedString(Path.GetDirectoryName(Duplicates.ElementAt(lineDup).Path1));
|
||||
string filePath2 = GetRtfUnicodeEscapedString(Path.GetDirectoryName(Duplicates.ElementAt(lineDup).Path2));
|
||||
if (filePath1 == filePath2)
|
||||
{
|
||||
filePath1 = @"\b " + GetRtfUnicodeEscapedString(filePath1) + @" \b0 ";
|
||||
filePath2 = @"\b " + GetRtfUnicodeEscapedString(filePath2) + @" \b0 ";
|
||||
filePath1 = @" \b " + filePath1 + @" \b0 ";
|
||||
filePath2 = @" \b " + filePath2 + @" \b0 ";
|
||||
dup1++;
|
||||
dup2++;
|
||||
}
|
||||
|
@ -135,32 +137,65 @@ namespace Mk0.Software.Bildduplikate
|
|||
string fileName2 = Path.GetFileName(Duplicates.ElementAt(lineDup).Path2);
|
||||
if (fileName1 == fileName2)
|
||||
{
|
||||
fileName1 = @"\b " + GetRtfUnicodeEscapedString(fileName1) + @" \b0 ";
|
||||
fileName2 = @"\b " + GetRtfUnicodeEscapedString(fileName2) + @" \b0 ";
|
||||
fileName1 = @" \b " + GetRtfUnicodeEscapedString(fileName1) + @" \b0 ";
|
||||
fileName2 = @" \b " + GetRtfUnicodeEscapedString(fileName2) + @" \b0 ";
|
||||
dup1++;
|
||||
dup2++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fileName1.Count(Char.IsDigit) < fileName2.Count(Char.IsDigit))
|
||||
{
|
||||
fileName1 = @" \b " + GetRtfUnicodeEscapedString(fileName1) + @" \b0 ";
|
||||
fileName2 = GetRtfUnicodeEscapedString(fileName2);
|
||||
dup1++;
|
||||
}
|
||||
else if (fileName2.Count(Char.IsDigit) < fileName1.Count(Char.IsDigit))
|
||||
{
|
||||
fileName1 = GetRtfUnicodeEscapedString(fileName1);
|
||||
fileName2 = @" \b " + GetRtfUnicodeEscapedString(fileName2) + @" \b0 ";
|
||||
dup2++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fileName1.Length > fileName2.Length)
|
||||
{
|
||||
fileName1 = GetRtfUnicodeEscapedString(fileName1);
|
||||
fileName2 = @" \b " + GetRtfUnicodeEscapedString(fileName2) + @" \b0 ";
|
||||
dup2++;
|
||||
}
|
||||
else if (fileName2.Length > fileName1.Length)
|
||||
{
|
||||
fileName1 = @" \b " + GetRtfUnicodeEscapedString(fileName1) + @" \b0 ";
|
||||
fileName2 = GetRtfUnicodeEscapedString(fileName2);
|
||||
dup1++;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DateTime lastTime1 = f1.LastWriteTime;
|
||||
DateTime lastTime2 = f2.LastWriteTime;
|
||||
string lastTime1str, lastTime2str;
|
||||
if (lastTime1 == lastTime2)
|
||||
{
|
||||
lastTime1str = @"\b " + lastTime1.ToString() + @" \b0 ";
|
||||
lastTime2str = @"\b " + lastTime2.ToString() + @" \b0 ";
|
||||
lastTime1str = @" \b " + lastTime1.ToString() + @" \b0 ";
|
||||
lastTime2str = @" \b " + lastTime2.ToString() + @" \b0 ";
|
||||
dup1++;
|
||||
dup2++;
|
||||
}
|
||||
else if (lastTime1 > lastTime2)
|
||||
{
|
||||
lastTime1str = @"\b " + lastTime1.ToString() + @" \b0 ";
|
||||
lastTime1str = @" \b " + lastTime1.ToString() + @" \b0 ";
|
||||
lastTime2str = lastTime2.ToString();
|
||||
dup1++;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastTime1str = lastTime1.ToString();
|
||||
lastTime2str = @"\b " + lastTime2.ToString() + @" \b0 ";
|
||||
lastTime2str = @" \b " + lastTime2.ToString() + @" \b0 ";
|
||||
dup2++;
|
||||
}
|
||||
|
||||
|
@ -171,8 +206,8 @@ namespace Mk0.Software.Bildduplikate
|
|||
{
|
||||
if (img1.Height == img2.Height && img1.Width == img2.Width)
|
||||
{
|
||||
res1str = @"\b " + img1.Width + "x" + img1.Height + " @ " + res1 + " DPI" + @" \b0 ";
|
||||
res2str = @"\b " + img2.Width + "x" + img2.Height + " @ " + res2 + " DPI" + @" \b0 ";
|
||||
res1str = @" \b " + img1.Width + "x" + img1.Height + " @ " + res1 + " DPI" + @" \b0 ";
|
||||
res2str = @" \b " + img2.Width + "x" + img2.Height + " @ " + res2 + " DPI" + @" \b0 ";
|
||||
dup1++;
|
||||
dup1++;
|
||||
dup2++;
|
||||
|
@ -180,7 +215,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
}
|
||||
else if (img1.Height > img2.Height && img1.Width > img2.Width)
|
||||
{
|
||||
res1str = @"\b " + img1.Width + "x" + img1.Height + " @ " + res1 + " DPI" + @" \b0 ";
|
||||
res1str = @" \b " + img1.Width + "x" + img1.Height + " @ " + res1 + " DPI" + @" \b0 ";
|
||||
res2str = img2.Width + "x" + img2.Height + " @ " + res2 + " DPI";
|
||||
dup1++;
|
||||
dup1++;
|
||||
|
@ -188,7 +223,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
else if (img2.Height > img1.Height && img2.Width > img1.Width)
|
||||
{
|
||||
res1str = img1.Width + "x" + img1.Height + " @ " + res1 + " DPI";
|
||||
res2str = @"\b " + img2.Width + "x" + img2.Height + " @ " + res2 + " DPI" + @" \b0 ";
|
||||
res2str = @" \b " + img2.Width + "x" + img2.Height + " @ " + res2 + " DPI" + @" \b0 ";
|
||||
dup2++;
|
||||
dup2++;
|
||||
}
|
||||
|
@ -200,7 +235,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
}
|
||||
else if (res1 > res2)
|
||||
{
|
||||
res1str = @"\b " + img1.Width + "x" + img1.Height + " @ " + res1 + " DPI" + @" \b0 ";
|
||||
res1str = @" \b " + img1.Width + "x" + img1.Height + " @ " + res1 + " DPI" + @" \b0 ";
|
||||
res2str = img2.Width + "x" + img2.Height + " @ " + res2 + " DPI";
|
||||
dup1++;
|
||||
dup1++;
|
||||
|
@ -208,13 +243,13 @@ namespace Mk0.Software.Bildduplikate
|
|||
else
|
||||
{
|
||||
res1str = img1.Width + "x" + img1.Height + " @ " + res1 + " DPI";
|
||||
res2str = @"\b " + img2.Width + "x" + img2.Height + " @ " + res2 + " DPI" + @" \b0 ";
|
||||
res2str = @" \b " + img2.Width + "x" + img2.Height + " @ " + res2 + " DPI" + @" \b0 ";
|
||||
dup2++;
|
||||
dup2++;
|
||||
}
|
||||
|
||||
richTextBoxDesc1.Rtf = @"{\rtf1\utf-8 " + filePath1 + @"\line " + fileName1 + @"\line " + size1 + @"\line " + lastTime1str + @"\line " + res1str + " }";
|
||||
richTextBoxDesc2.Rtf = @"{\rtf1\utf-8 " + filePath2 + @"\line " + fileName2 + @"\line " + size2 + @"\line " + lastTime2str + @"\line " + res2str + " }";
|
||||
richTextBoxDesc1.Rtf = @"{\rtf1\ansi " + filePath1 + @" \line " + fileName1 + @" \line " + size1 + @" \line " + lastTime1str + @" \line " + res1str + " }";
|
||||
richTextBoxDesc2.Rtf = @"{\rtf1\ansi " + filePath2 + @" \line " + fileName2 + @" \line " + size2 + @" \line " + lastTime2str + @" \line " + res2str + " }";
|
||||
richTextBoxDesc1.SelectAll();
|
||||
richTextBoxDesc1.SelectionAlignment = HorizontalAlignment.Right;
|
||||
label3.Text = total + " Duplikate";
|
||||
|
@ -231,7 +266,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
|
||||
string json = webClient.UploadString(Properties.Settings.Default.ApiUrl + "?isDuplicate", "{\"duplicateId\":" + Duplicates.ElementAt(lineDup).ID + "}");
|
||||
var resObj = new JavaScriptSerializer().Deserialize<APIResponse>(json);
|
||||
if (resObj.response_code != "200") { MessageBox.Show("Fehler", resObj.response_desc, MessageBoxButtons.OK, MessageBoxIcon.Error); }
|
||||
if (resObj.response_code != "200") { MessageBox.Show(resObj.response_desc, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); }
|
||||
else
|
||||
{
|
||||
total--;
|
||||
|
@ -258,11 +293,6 @@ namespace Mk0.Software.Bildduplikate
|
|||
if (api)
|
||||
{
|
||||
ButtonAPILoad_Click(null, null);
|
||||
if (Duplicates.Count > lineDup)
|
||||
{
|
||||
UIElementsVisible(false);
|
||||
MessageBox.Show("Alle Duplikate von API abgearbeitet", "Fertig!", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -283,16 +313,19 @@ namespace Mk0.Software.Bildduplikate
|
|||
{
|
||||
buttonDel1.Font = new Font(buttonDel1.Font.Name, buttonDel1.Font.Size, FontStyle.Bold);
|
||||
buttonDel2.Font = new Font(buttonDel2.Font.Name, buttonDel2.Font.Size, FontStyle.Regular);
|
||||
worst = 1;
|
||||
}
|
||||
else if (dup2 < dup1)
|
||||
{
|
||||
buttonDel1.Font = new Font(buttonDel1.Font.Name, buttonDel1.Font.Size, FontStyle.Regular);
|
||||
buttonDel2.Font = new Font(buttonDel2.Font.Name, buttonDel2.Font.Size, FontStyle.Bold);
|
||||
worst = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonDel1.Font = new Font(buttonDel1.Font.Name, buttonDel1.Font.Size, FontStyle.Regular);
|
||||
buttonDel2.Font = new Font(buttonDel2.Font.Name, buttonDel2.Font.Size, FontStyle.Regular);
|
||||
worst = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -364,18 +397,20 @@ namespace Mk0.Software.Bildduplikate
|
|||
webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
|
||||
string json = webClient.UploadString(Properties.Settings.Default.ApiUrl + "?noDuplicate", "{\"duplicateId\":" + Duplicates.ElementAt(line).ID + "}");
|
||||
var resObj = new JavaScriptSerializer().Deserialize<APIResponse>(json);
|
||||
if (resObj.response_code != "200") { MessageBox.Show("Fehler", resObj.response_desc, MessageBoxButtons.OK, MessageBoxIcon.Error); }
|
||||
if (resObj.response_code != "200") { MessageBox.Show(resObj.response_desc, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); }
|
||||
else
|
||||
{
|
||||
total--;
|
||||
line++;
|
||||
LoadDuplicates(line, api);
|
||||
lastStep = 1;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Fehler bei der Kommunikation mit der API:" + Environment.NewLine + ex.ToString(), "API Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
buttonUndo.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -383,6 +418,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
total--;
|
||||
line++;
|
||||
LoadDuplicates(line, api);
|
||||
lastStep = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -401,14 +437,17 @@ namespace Mk0.Software.Bildduplikate
|
|||
webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
|
||||
string json = webClient.UploadString(Properties.Settings.Default.ApiUrl + "?isDuplicate", "{\"duplicateId\":" + Duplicates.ElementAt(line).ID + "}");
|
||||
var resObj = new JavaScriptSerializer().Deserialize<APIResponse>(json);
|
||||
if (resObj.response_code != "200") { MessageBox.Show("Fehler", resObj.response_desc, MessageBoxButtons.OK, MessageBoxIcon.Error); }
|
||||
if (resObj.response_code != "200") { MessageBox.Show(resObj.response_desc, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); }
|
||||
else
|
||||
{
|
||||
File.Delete(Duplicates.ElementAt(line).Path1);
|
||||
total--;
|
||||
line++;
|
||||
LoadDuplicates(line, api);
|
||||
lastStep = 2;
|
||||
}
|
||||
//todo erst einkommentieren, wenn es die möglichkeit gibt, gelöschte wiederherzustellen
|
||||
//buttonUndo.Visible = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -422,6 +461,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
line++;
|
||||
total--;
|
||||
LoadDuplicates(line);
|
||||
lastStep = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -440,14 +480,17 @@ namespace Mk0.Software.Bildduplikate
|
|||
webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
|
||||
string json = webClient.UploadString(Properties.Settings.Default.ApiUrl + "?isDuplicate", "{\"duplicateId\":" + Duplicates.ElementAt(line).ID + "}");
|
||||
var resObj = new JavaScriptSerializer().Deserialize<APIResponse>(json);
|
||||
if (resObj.response_code != "200") { MessageBox.Show("Fehler", resObj.response_desc, MessageBoxButtons.OK, MessageBoxIcon.Error); }
|
||||
if (resObj.response_code != "200") { MessageBox.Show(resObj.response_desc, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); }
|
||||
else
|
||||
{
|
||||
File.Delete(Duplicates.ElementAt(line).Path2);
|
||||
total--;
|
||||
line++;
|
||||
LoadDuplicates(line, api);
|
||||
lastStep = 2;
|
||||
}
|
||||
//todo erst einkommentieren, wenn es die möglichkeit gibt, gelöschte wiederherzustellen
|
||||
//buttonUndo.Visible = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -461,6 +504,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
line++;
|
||||
total--;
|
||||
LoadDuplicates(line);
|
||||
lastStep = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -497,7 +541,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
{
|
||||
ButtonDel2_Click(sender, e);
|
||||
}
|
||||
else if (e.KeyCode == Keys.D0 || e.KeyCode == Keys.NumPad0)
|
||||
else if (e.KeyCode == Keys.D0 || e.KeyCode == Keys.NumPad0 || e.KeyCode == Keys.K)
|
||||
{
|
||||
ButtonKeinDuplikat_Click(sender, e);
|
||||
}
|
||||
|
@ -505,6 +549,42 @@ namespace Mk0.Software.Bildduplikate
|
|||
{
|
||||
ButtonReload_Click(sender, e);
|
||||
}
|
||||
else if (e.KeyCode == Keys.D)
|
||||
{
|
||||
DeleteWorstDuplicate();
|
||||
}
|
||||
else if (e.KeyCode == Keys.A)
|
||||
{
|
||||
ButtonAPI_Click(sender, e);
|
||||
}
|
||||
else if (e.KeyCode == Keys.C)
|
||||
{
|
||||
ButtonCSV_Click(sender, e);
|
||||
}
|
||||
else if (e.KeyCode == Keys.L)
|
||||
{
|
||||
ButtonAPILoad_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the most probably worst duplicate
|
||||
/// </summary>
|
||||
private void DeleteWorstDuplicate()
|
||||
{
|
||||
if (worst == 1)
|
||||
{
|
||||
ButtonDel1_Click(null, null);
|
||||
}
|
||||
else if (worst == 2)
|
||||
{
|
||||
ButtonDel2_Click(null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
ButtonDel2_Click(null, null);
|
||||
//MessageBox.Show("Keines der beiden Bilder konnte als besser oder schlechter erkannt werden, bitte wählen sie selbst!", "Ooops...", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -516,6 +596,18 @@ namespace Mk0.Software.Bildduplikate
|
|||
{
|
||||
API api = new API();
|
||||
api.ShowDialog();
|
||||
if (Properties.Settings.Default.ApiUrl != String.Empty)
|
||||
{
|
||||
buttonAPILoad.Visible = true;
|
||||
if (Properties.Settings.Default.autoload)
|
||||
{
|
||||
ButtonAPILoad_Click(null, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonAPILoad.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -531,7 +623,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
|
||||
string json = webClient.UploadString(Properties.Settings.Default.ApiUrl + "?getDuplicates", "{\"amount\":" + Properties.Settings.Default.imagesFromAPI + "}");
|
||||
var resObj = new JavaScriptSerializer().Deserialize<APIResponse>(json);
|
||||
if (resObj.response_code != "200") { MessageBox.Show("Fehler", resObj.response_desc, MessageBoxButtons.OK, MessageBoxIcon.Error); }
|
||||
if (resObj.response_code != "200") { MessageBox.Show(resObj.response_desc, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); }
|
||||
else
|
||||
{
|
||||
Duplicates.Clear();
|
||||
|
@ -550,13 +642,21 @@ namespace Mk0.Software.Bildduplikate
|
|||
webClient2.Headers[HttpRequestHeader.ContentType] = "application/json";
|
||||
string json2 = webClient.UploadString(Properties.Settings.Default.ApiUrl + "?totalDuplicates", "");
|
||||
var resObj2 = new JavaScriptSerializer().Deserialize<APIResponse>(json2);
|
||||
if (resObj2.response_code != "200") { MessageBox.Show("Fehler", resObj2.response_desc, MessageBoxButtons.OK, MessageBoxIcon.Error); }
|
||||
if (resObj2.response_code != "200") { MessageBox.Show(resObj2.response_desc, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); }
|
||||
else
|
||||
{
|
||||
total = int.Parse(resObj2.totalDuplicates);
|
||||
}
|
||||
|
||||
LoadDuplicates(line, true);
|
||||
if (total == 0)
|
||||
{
|
||||
UIElementsVisible(false);
|
||||
MessageBox.Show("Alle Duplikate von API abgearbeitet", "Fertig!", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadDuplicates(line, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -624,6 +724,59 @@ namespace Mk0.Software.Bildduplikate
|
|||
Left = Properties.Settings.Default.lastLeft;
|
||||
}
|
||||
}
|
||||
|
||||
if (Properties.Settings.Default.ApiUrl != String.Empty)
|
||||
{
|
||||
buttonAPILoad.Visible = true;
|
||||
if (Properties.Settings.Default.autoload)
|
||||
{
|
||||
ButtonAPILoad_Click(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Undo last processing step
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonUndo_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (lastStep == 1)
|
||||
{
|
||||
//undo mark as non-duplicate
|
||||
try
|
||||
{
|
||||
WebClient webClient = new WebClient();
|
||||
webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
|
||||
string json = webClient.UploadString(Properties.Settings.Default.ApiUrl + "?undoDuplicate", "{\"duplicateId\":" + Duplicates.ElementAt(line - 1).ID + "}");
|
||||
var resObj = new JavaScriptSerializer().Deserialize<APIResponse>(json);
|
||||
if (resObj.response_code != "200") { MessageBox.Show(resObj.response_desc, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); }
|
||||
else
|
||||
{
|
||||
File.Delete(Duplicates.ElementAt(line).Path2);
|
||||
total++;
|
||||
line--;
|
||||
LoadDuplicates(line, api);
|
||||
lastStep = 1;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Fehler bei der Kommunikation mit der API:" + Environment.NewLine + ex.ToString(), "API Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
buttonUndo.Visible = false;
|
||||
}
|
||||
else if (lastStep == 2)
|
||||
{
|
||||
//undo delete duplicate
|
||||
lastStep = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Keine Aktion die Rückgängig gemacht werden kann. Undo funktioniert grundsätzlich nur bei API Bildvergleichen, nicht bei CSV.", "Nix da", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
//lastStep = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.5.0.0</ApplicationVersion>
|
||||
<ApplicationVersion>1.10.0.0</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
|
|
|
@ -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.5.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.5.0.0")]
|
||||
[assembly: AssemblyVersion("1.10.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.10.0.0")]
|
||||
|
|
|
@ -130,5 +130,17 @@ namespace Mk0.Software.Bildduplikate.Properties {
|
|||
this["imagesFromAPI"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool autoload {
|
||||
get {
|
||||
return ((bool)(this["autoload"]));
|
||||
}
|
||||
set {
|
||||
this["autoload"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,5 +29,8 @@
|
|||
<Setting Name="imagesFromAPI" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">100</Value>
|
||||
</Setting>
|
||||
<Setting Name="autoload" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
21
README.md
21
README.md
|
@ -1 +1,20 @@
|
|||
This program allows to compare possible image duplicates from a CSV (you can use python script https://git.kmpr.at/kamp/SimilarImages to find them and generate the CSV file) or an API (https://git.kmpr.at/kamp/DuplicateAPI which can be fed by the same python script) and delete one of the duplicates.
|
||||
# Bildduplikate
|
||||
|
||||
## About
|
||||
This program allows to compare possible image duplicates from a CSV (you can use python script https://git.kmpr.at/kamp/SimilarImages to find them and generate the CSV file) or an API (https://git.kmpr.at/kamp/DuplicateAPI which can be fed by the same python script) and delete one of the duplicates or mark the duplicates as non-duplicates (for API).
|
||||
|
||||
## Features
|
||||
* Can read possible duplicates from a CSV files
|
||||
* Can read possible duplicates from an API
|
||||
* suggestion of most probably "worse" duplicate to delete
|
||||
* keyboard control functions for faster processing
|
||||
|
||||
## Keyboard Control
|
||||
[1] - delete first possible duplicate
|
||||
[2] - delete second possible duplicate
|
||||
[0] or [K] - mark images as non-duplicates
|
||||
[D] delete most probably worst indicated duplicate (which has the bold delete button)
|
||||
[A] Opens API Settings
|
||||
[C] Load CSV
|
||||
[R] Reload
|
||||
[L] Load from API
|
Loading…
Reference in New Issue