private static bool SetAssociation(FileAssociationModel faMdl) { bool madeChanges = false; madeChanges |= SetKeyDefaultValue(GenerateSoftwareClassesPath(faMdl.Extension), faMdl.ProgId); madeChanges |= SetKeyDefaultValue(GenerateSoftwareClassesPath(faMdl.ProgId), faMdl.FileTypeDescription); madeChanges |= SetKeyDefaultValue(GenerateShellOpenCommandPath(faMdl.ProgId), "\"" + faMdl.ExecutableFilePath + "\" \"%1\""); madeChanges |= SetKeyDefaultValue(GenerateDefaultIconCommandPath(faMdl.ProgId), faMdl.DefaultIconFilePath); return(madeChanges); }
public static bool IsApplicationProgramAlreadyAssociatedWith() { FileAssociationModel[] fam = new FileAssociationModel[] { ResourcesUtil.GetFileAssociationProjectDesignerModel(), ResourcesUtil.GetFileAssociationBatchFileModel(), }; foreach (FileAssociationModel f in fam) { if (!RegistryValueExists(REGISTRY_ROOT_TYPE.HKCU, GenerateSoftwareClassesPath(f.ProgId), null)) { return(false); } } return(true); }