Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Lexz-08 authored Apr 13, 2023
1 parent 1c97a1e commit a26ced4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# icon-associator
## Description
Makes creating and removing file associations easier.<br>
Also calls `SHChangeNotify()` to automatically update your file associations, and can even help sometimes if you have associated another program with a different file type, and the association for that isn't updating.

## How To Use
This code is made assuming you have already referenced `icon-associator.dll` in your project, and is using `System.Windows.Forms.dll` for the example.<br>
Also, the two examples for adding and removing file associations should not be added in the same code block, they should be separate, as the removal would negate the addition, making usage of this library useless.
```csharp
str_ExampleExtension = ".example";

FileAssociation association = FileAssociation.CreateOpenInfo(
Application.ExecutablePath, str_ExampleExtension,
// returns "<EXECUTABLE_PATH>" "%1" with <EXECUTABLE_PATH> being the file path to your .exe
FileAssociation.DefaultCLI(Application.ExecutablePath)
);

// add the association to your device registry if not already there
if (!AssociationManager.CheckForAssociationInfo(association))
AssociationManager.AddAssociationInfo(association);

// remove the association from your device registry if there
if (AssociationManager.CheckForAssociationInfo(association))
AssociationManager.RemoveAssociationInfo(association);
```

0 comments on commit a26ced4

Please sign in to comment.