Compare commits
12 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 |
|
@ -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>
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
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;
|
||||
|
@ -240,13 +241,27 @@ namespace Mk0.Software.Bildduplikate
|
|||
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.6 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
private string file;
|
||||
private bool api = false;
|
||||
private int worst = 0;
|
||||
private int lastStep = 0;
|
||||
|
||||
private List<Duplicate> duplicates = new List<Duplicate>();
|
||||
|
||||
|
@ -100,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++;
|
||||
|
@ -109,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++;
|
||||
|
@ -117,7 +118,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
else
|
||||
{
|
||||
size1 = FormatSize(f1.Length);
|
||||
size2 = @"\b " + FormatSize(f2.Length) + @" \b0 ";
|
||||
size2 = @" \b " + FormatSize(f2.Length) + @" \b0 ";
|
||||
dup2++;
|
||||
dup2++;
|
||||
}
|
||||
|
@ -126,8 +127,8 @@ namespace Mk0.Software.Bildduplikate
|
|||
string filePath2 = GetRtfUnicodeEscapedString(Path.GetDirectoryName(Duplicates.ElementAt(lineDup).Path2));
|
||||
if (filePath1 == filePath2)
|
||||
{
|
||||
filePath1 = @"\b " + filePath1 + @" \b0 ";
|
||||
filePath2 = @"\b " + filePath2 + @" \b0 ";
|
||||
filePath1 = @" \b " + filePath1 + @" \b0 ";
|
||||
filePath2 = @" \b " + filePath2 + @" \b0 ";
|
||||
dup1++;
|
||||
dup2++;
|
||||
}
|
||||
|
@ -136,8 +137,8 @@ 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++;
|
||||
}
|
||||
|
@ -145,14 +146,14 @@ namespace Mk0.Software.Bildduplikate
|
|||
{
|
||||
if (fileName1.Count(Char.IsDigit) < fileName2.Count(Char.IsDigit))
|
||||
{
|
||||
fileName1 = @"\b " + GetRtfUnicodeEscapedString(fileName1) + @" \b0 ";
|
||||
fileName1 = @" \b " + GetRtfUnicodeEscapedString(fileName1) + @" \b0 ";
|
||||
fileName2 = GetRtfUnicodeEscapedString(fileName2);
|
||||
dup1++;
|
||||
}
|
||||
else if(fileName2.Count(Char.IsDigit) < fileName1.Count(Char.IsDigit))
|
||||
else if (fileName2.Count(Char.IsDigit) < fileName1.Count(Char.IsDigit))
|
||||
{
|
||||
fileName1 = GetRtfUnicodeEscapedString(fileName1);
|
||||
fileName2 = @"\b " + GetRtfUnicodeEscapedString(fileName2) + @" \b0 ";
|
||||
fileName2 = @" \b " + GetRtfUnicodeEscapedString(fileName2) + @" \b0 ";
|
||||
dup2++;
|
||||
}
|
||||
else
|
||||
|
@ -160,12 +161,12 @@ namespace Mk0.Software.Bildduplikate
|
|||
if (fileName1.Length > fileName2.Length)
|
||||
{
|
||||
fileName1 = GetRtfUnicodeEscapedString(fileName1);
|
||||
fileName2 = @"\b " + GetRtfUnicodeEscapedString(fileName2) + @" \b0 ";
|
||||
fileName2 = @" \b " + GetRtfUnicodeEscapedString(fileName2) + @" \b0 ";
|
||||
dup2++;
|
||||
}
|
||||
else if (fileName2.Length > fileName1.Length)
|
||||
{
|
||||
fileName1 = @"\b " + GetRtfUnicodeEscapedString(fileName1) + @" \b0 ";
|
||||
fileName1 = @" \b " + GetRtfUnicodeEscapedString(fileName1) + @" \b0 ";
|
||||
fileName2 = GetRtfUnicodeEscapedString(fileName2);
|
||||
dup1++;
|
||||
}
|
||||
|
@ -180,21 +181,21 @@ namespace Mk0.Software.Bildduplikate
|
|||
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++;
|
||||
}
|
||||
|
||||
|
@ -205,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++;
|
||||
|
@ -214,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++;
|
||||
|
@ -222,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++;
|
||||
}
|
||||
|
@ -234,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++;
|
||||
|
@ -242,7 +243,7 @@ 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++;
|
||||
}
|
||||
|
@ -265,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--;
|
||||
|
@ -292,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
|
||||
{
|
||||
|
@ -401,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
|
||||
{
|
||||
|
@ -420,6 +418,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
total--;
|
||||
line++;
|
||||
LoadDuplicates(line, api);
|
||||
lastStep = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,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)
|
||||
{
|
||||
|
@ -459,6 +461,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
line++;
|
||||
total--;
|
||||
LoadDuplicates(line);
|
||||
lastStep = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -477,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)
|
||||
{
|
||||
|
@ -498,6 +504,7 @@ namespace Mk0.Software.Bildduplikate
|
|||
line++;
|
||||
total--;
|
||||
LoadDuplicates(line);
|
||||
lastStep = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,10 +557,14 @@ namespace Mk0.Software.Bildduplikate
|
|||
{
|
||||
ButtonAPI_Click(sender, e);
|
||||
}
|
||||
else if (e.KeyCode==Keys.C)
|
||||
else if (e.KeyCode == Keys.C)
|
||||
{
|
||||
ButtonCSV_Click(sender, e);
|
||||
}
|
||||
else if (e.KeyCode == Keys.L)
|
||||
{
|
||||
ButtonAPILoad_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -571,7 +582,8 @@ namespace Mk0.Software.Bildduplikate
|
|||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Ooops...", "Keines der beiden Bilder konnte als besser oder schlechter erkannt werden, bitte wählen sie selbst!", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -584,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>
|
||||
|
@ -599,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();
|
||||
|
@ -618,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)
|
||||
|
@ -692,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.6.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.6.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.6.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>
|
|
@ -7,10 +7,14 @@ This program allows to compare possible image duplicates from a CSV (you can use
|
|||
* Can read possible duplicates from a CSV files
|
||||
* Can read possible duplicates from an API
|
||||
* suggestion of most probably "worse" duplicate to delete
|
||||
* keyboar control functions for faster processing
|
||||
* 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)
|
||||
[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