FileAssoc Icons
This commit is contained in:
parent
ea50fadffe
commit
15ccbd6bdc
@ -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;
|
||||
}
|
||||
|
||||
|
2
Mk0.Software.ImageSorter/Main.Designer.cs
generated
2
Mk0.Software.ImageSorter/Main.Designer.cs
generated
@ -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);
|
||||
|
@ -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();
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user