From 15ccbd6bdcef362d03154b7aad88f374fdcd8bbc Mon Sep 17 00:00:00 2001 From: Manuel Kamper Date: Fri, 5 Apr 2019 21:16:57 +0200 Subject: [PATCH] FileAssoc Icons --- Mk0.Software.ImageSorter/FileAssociation.cs | 11 ++++--- Mk0.Software.ImageSorter/Main.Designer.cs | 2 +- Mk0.Software.ImageSorter/Main.cs | 28 +++++++++--------- .../dll/Mk0.GUI.Banner.dll | Bin 8192 -> 8192 bytes 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Mk0.Software.ImageSorter/FileAssociation.cs b/Mk0.Software.ImageSorter/FileAssociation.cs index 72e0789..7971504 100644 --- a/Mk0.Software.ImageSorter/FileAssociation.cs +++ b/Mk0.Software.ImageSorter/FileAssociation.cs @@ -1,9 +1,5 @@ using Microsoft.Win32; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Mk0.Tools.FileAssociaton { @@ -22,7 +18,8 @@ namespace Mk0.Tools.FileAssociaton extension, progId, fileTypeDescription, - applicationFilePath); + applicationFilePath, + iconPath); if (madeChanges) { @@ -40,12 +37,14 @@ namespace Mk0.Tools.FileAssociaton //add or update reg } - private static bool SetAssociation(string extension, string progId, string fileTypeDescription, string applicationFilePath) + private static bool SetAssociation(string extension, string progId, string fileTypeDescription, string applicationFilePath, string iconPath) { + //todo add file assoc icon bool madeChanges = false; madeChanges |= SetKeyDefaultValue(@"Software\Classes\" + extension, progId); madeChanges |= SetKeyDefaultValue(@"Software\Classes\" + progId, fileTypeDescription); madeChanges |= SetKeyDefaultValue($@"Software\Classes\{progId}\shell\open\command", "\"" + applicationFilePath + "\" \"%1\""); + madeChanges |= SetKeyDefaultValue($@"Software\Classes\{progId}\DefaultIcon", "\"" + iconPath + "\""); return madeChanges; } diff --git a/Mk0.Software.ImageSorter/Main.Designer.cs b/Mk0.Software.ImageSorter/Main.Designer.cs index 9a63f5e..61ca9af 100644 --- a/Mk0.Software.ImageSorter/Main.Designer.cs +++ b/Mk0.Software.ImageSorter/Main.Designer.cs @@ -473,7 +473,7 @@ this.MinimumSize = new System.Drawing.Size(983, 605); this.Name = "Main"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Image Sorter v1.30 | © 2015-2019 by manuelkamper.com"; + this.Text = "Image Sorter v1.31 | © 2015-2019 by manuelkamper.com"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Main_FormClosing); this.Load += new System.EventHandler(this.Main_Load); this.Shown += new System.EventHandler(this.Main_Shown); diff --git a/Mk0.Software.ImageSorter/Main.cs b/Mk0.Software.ImageSorter/Main.cs index d75d780..29b60ba 100644 --- a/Mk0.Software.ImageSorter/Main.cs +++ b/Mk0.Software.ImageSorter/Main.cs @@ -320,24 +320,24 @@ namespace Mk0.Software.ImageSorter if (Properties.Settings.Default.fileAssociation) { ExtractAssocIcons(); - FileAssociation.Add("Image_Sorter", ".jpg", Application.ExecutablePath, "JPG Bild", $@"{Application.StartupPath}\AssocIcons\jpg.ico"); - FileAssociation.Add("Image_Sorter", ".png", Application.ExecutablePath, "PNG Bild", $@"{Application.StartupPath}\AssocIcons\png.ico"); - FileAssociation.Add("Image_Sorter", ".gif", Application.ExecutablePath, "GIF Bild", $@"{Application.StartupPath}\AssocIcons\gif.ico"); - FileAssociation.Add("Image_Sorter", ".jpeg", Application.ExecutablePath, "JPEG Bild", $@"{Application.StartupPath}\AssocIcons\jpeg.ico"); - FileAssociation.Add("Image_Sorter", ".bmp", Application.ExecutablePath, "BMP Bild", $@"{Application.StartupPath}\AssocIcons\bmp.ico"); - FileAssociation.Add("Image_Sorter", ".tif", Application.ExecutablePath, "TIF Bild", $@"{Application.StartupPath}\AssocIcons\tif.ico"); - FileAssociation.Add("Image_Sorter", ".tiff", Application.ExecutablePath, "TIFF Bild", $@"{Application.StartupPath}\AssocIcons\tiff.ico"); + FileAssociation.Add("Image_Sorter_JPG", ".jpg", Application.ExecutablePath, "JPG Bild", $@"{Application.StartupPath}\AssocIcons\jpg.ico"); + FileAssociation.Add("Image_Sorter_PNG", ".png", Application.ExecutablePath, "PNG Bild", $@"{Application.StartupPath}\AssocIcons\png.ico"); + FileAssociation.Add("Image_Sorter_GIF", ".gif", Application.ExecutablePath, "GIF Bild", $@"{Application.StartupPath}\AssocIcons\gif.ico"); + FileAssociation.Add("Image_Sorter_JPEG", ".jpeg", Application.ExecutablePath, "JPEG Bild", $@"{Application.StartupPath}\AssocIcons\jpeg.ico"); + FileAssociation.Add("Image_Sorter_BMP", ".bmp", Application.ExecutablePath, "BMP Bild", $@"{Application.StartupPath}\AssocIcons\bmp.ico"); + FileAssociation.Add("Image_Sorter_TIF", ".tif", Application.ExecutablePath, "TIF Bild", $@"{Application.StartupPath}\AssocIcons\tif.ico"); + FileAssociation.Add("Image_Sorter_TIFF", ".tiff", Application.ExecutablePath, "TIFF Bild", $@"{Application.StartupPath}\AssocIcons\tiff.ico"); } else { Directory.Delete($@"{Application.StartupPath}\AssocIcons", true); - FileAssociation.Remove("Image_Sorter", ".jpg", Application.ExecutablePath, "JPG Bild", $@"{Application.StartupPath}\AssocIcons\jpg.ico"); - FileAssociation.Remove("Image_Sorter", ".png", Application.ExecutablePath, "PNG Bild", $@"{Application.StartupPath}\AssocIcons\png.ico"); - FileAssociation.Remove("Image_Sorter", ".gif", Application.ExecutablePath, "GIF Bild", $@"{Application.StartupPath}\AssocIcons\gif.ico"); - FileAssociation.Remove("Image_Sorter", ".jpeg", Application.ExecutablePath, "JPEG Bild", $@"{Application.StartupPath}\AssocIcons\jpeg.ico"); - FileAssociation.Remove("Image_Sorter", ".bmp", Application.ExecutablePath, "BMP Bild", $@"{Application.StartupPath}\AssocIcons\bmp.ico"); - FileAssociation.Remove("Image_Sorter", ".tif", Application.ExecutablePath, "TIF Bild", $@"{Application.StartupPath}\AssocIcons\tif.ico"); - FileAssociation.Remove("Image_Sorter", ".tiff", Application.ExecutablePath, "TIFF Bild", $@"{Application.StartupPath}\AssocIcons\tiff.ico"); + FileAssociation.Remove("Image_Sorter_JPG", ".jpg", Application.ExecutablePath, "JPG Bild", $@"{Application.StartupPath}\AssocIcons\jpg.ico"); + FileAssociation.Remove("Image_Sorter_PNG", ".png", Application.ExecutablePath, "PNG Bild", $@"{Application.StartupPath}\AssocIcons\png.ico"); + FileAssociation.Remove("Image_Sorter_GIF", ".gif", Application.ExecutablePath, "GIF Bild", $@"{Application.StartupPath}\AssocIcons\gif.ico"); + FileAssociation.Remove("Image_Sorter_JPEG", ".jpeg", Application.ExecutablePath, "JPEG Bild", $@"{Application.StartupPath}\AssocIcons\jpeg.ico"); + FileAssociation.Remove("Image_Sorter_BMP", ".bmp", Application.ExecutablePath, "BMP Bild", $@"{Application.StartupPath}\AssocIcons\bmp.ico"); + FileAssociation.Remove("Image_Sorter_TIF", ".tif", Application.ExecutablePath, "TIF Bild", $@"{Application.StartupPath}\AssocIcons\tif.ico"); + FileAssociation.Remove("Image_Sorter_TIFF", ".tiff", Application.ExecutablePath, "TIFF Bild", $@"{Application.StartupPath}\AssocIcons\tiff.ico"); } CheckSubfolders(); diff --git a/Mk0.Software.ImageSorter/dll/Mk0.GUI.Banner.dll b/Mk0.Software.ImageSorter/dll/Mk0.GUI.Banner.dll index 35e70ab28c3af22263510c7742ce37c9fb90dfd5..190af6eb97892d41867e0c2a3b0858686a8b3c48 100644 GIT binary patch delta 1402 zcmZ9Me`u6-9LL|^=jW|$*Ikdh?b+|Ub2HsF$5t(@)G_}s(>l*GwR3Haku3CN=l;k^ zx5G8ul5l*962dk|LNNq6B_<(r6bysVKLX_vwn6?gNJfdY+Scd$y>AP8{&+o~*XR9t zzI^X_?s@vR_isOU#+VHaEsvZnXVW8Jzr_-qu?^y?G)uYT&5*}V zq6QNUwZP{-fblW6c|58yHpKVp?|33i4D{)|-gNmL{YFXyj6OdhQ2{(r)wrTLmfwm* z5OC}|mqz~^sHA~f`0e5Yj_tRro?bB=kKgl5mWB+mKo#Y{rtW{eT)5U}u4S8?1_NVq zhwxKk0sNNXW!3zi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