public void test() { // Initializes a new AF_FileAssociator to associate the .ABC file extension. AF_FileAssociator assoc = new AF_FileAssociator(".nlk"); // Creates a new file association for the .ABC file extension. Data is overwritten if it already exists. //assoc.AF_FileAssociatorCreate("My_App","My application's file association",new ProgramIcon(@"C:\Nlock\Lockicon.ico"),new ExecApplication(@"C:\Nlock\SimpleFacesSampleCS.exe"),new OpenWithList(new string[] { "My_App" })); assoc.Create("My_App", "My application's file association", new ProgramIcon(@"C:\Users\omdna\Desktop\Test\NLock_Native_NET\NLock\NLock\Resources\Lockicon.ico"), new ExecApplication(@"C:\Users\omdna\Desktop\Test\Iteration 2\NLockFile\NLockFile\bin\Win32_x86\NLockFile.exe"), new OpenWithList(new string[] { "My_App" })); //Console.ReadKey(); }
void c_Checked(object sender, System.Windows.RoutedEventArgs e) { var checkBox = sender as CheckBox; if (checkBox != null) { AF_FileAssociator fa = new AF_FileAssociator(checkBox.Content.ToString()); fa.Create("SafireII", "Media file", new ProgramIcon(Main.MyPath() + @"\resources\ico.ico"), new ExecApplication(Main.MyPath() + "\\Safire 2.0.exe"), new OpenWithList(new string[] { Main.MyPath() + "\\Safire 2.0.exe" })); } }
public static void SetAssociation(string Extension, string KeyName, string OpenWith, string FileDescription, string IconPath) { AF_FileAssociator assoc = new AF_FileAssociator(Extension); if (assoc.Exists) { assoc.Delete(); } // Creates a new file association for the .ABC file extension. // Data is overwritten if it already exists. assoc.Create(KeyName, FileDescription, new ProgramIcon(IconPath), new ExecApplication(OpenWith), new OpenWithList(new string[] { KeyName })); }
public void CreateAssociation() { AF_FileAssociator assoc = new AF_FileAssociator(".as3rsx"); FileInfo icon = new FileInfo(Path.Combine(PathHelper.AppDir, "rsx.ico")); Console.WriteLine("CreateAssociation " + icon.FullName); if (!icon.Exists) { object ico = LocaleHelper.GetResource("RSXPluginIcon"); Console.WriteLine("Trying to find an icon " + ico); Icon pluginIcon = (Icon)LocaleHelper.GetResource("RSXPluginIcon"); Console.WriteLine("Icon file found " + pluginIcon); pluginIcon.Save(File.Open(icon.FullName, FileMode.Create)); } assoc.Create("FlashDevelop", "Resource Project for AS3", new ProgramIcon(icon.FullName), new ExecApplication(Path.Combine(PathHelper.AppDir, "FlashDevelop.exe")), new OpenWithList(new string[] { "FlashDevelop" })); }
public static void Main() { // Initializes a new AF_FileAssociator to associate the .ABC file extension. AF_FileAssociator assoc = new AF_FileAssociator(".abc"); // Creates a new file association for the .ABC file extension. Data is overwritten if it already exists. assoc.Create("My_App", "My application's file association", new ProgramIcon(@"C:\Program Files\My_App\icon.ico"), new ExecApplication(@"C:\Program Files\My_App\myapp.exe"), new OpenWithList(new string[] { "My_App" })); // Gets each piece of association info individually, all as strings. string id = assoc.ID; string description = assoc.Description; string icon = assoc.DefaultIcon.IconPath; string execApp = assoc.Executable.Path; string[] openWithList = assoc.OpenWith.List; // Sets each peice of association info individually. ProgramIcon newDefIcon = new ProgramIcon(@"C:\Program Files\My_App\icon2.ico"); ExecApplication newExecApp = new ExecApplication(@"C:\Program Files\My_App\myapp2.exe"); OpenWithList newOpenWith = new OpenWithList(new string[] { "myapp2.exe" }); assoc.ID = "My_App_2"; assoc.Description = "My application's file association #2"; assoc.DefaultIcon = newDefIcon; assoc.Executable = newExecApp; assoc.OpenWith = newOpenWith; // Gets the extension of the associator that was set when initializing it. string extension = assoc.Extension; // Deletes any keys that were associated with the .ABC file extension. assoc.Delete(); }