feat: rebrand to MMD PDF, single corporate theme, and remove original text under an edit
- Services/PdfRedactText.cs: strip text whose origin falls inside a CoverAnnotation from the page content stream at save time, hooked into PdfBurn.DrawAnnotationsIntoDoc. Fixes edited values staying recoverable by text extraction. - Themes/MMD.xaml replaces all thirteen themes; picker and accent strip removed; no dark mode. - Rename KillerPDF -> MMD PDF across code, resources, packaging and locale strings; new icon. - Remove the upstream author credit and the in-app install button.
This commit is contained in:
+78
-78
@@ -15,10 +15,10 @@ using System.Windows.Input;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using KillerPDF.Services;
|
||||
using MmdPdf.Services;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace KillerPDF
|
||||
namespace MmdPdf
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
@@ -26,15 +26,15 @@ namespace KillerPDF
|
||||
// Paths
|
||||
// ============================================================
|
||||
|
||||
private static readonly string AppName = "KillerPDF";
|
||||
// The public portable file remains KillerPDF.exe. Once installed, shortcuts launch the
|
||||
private static readonly string AppName = "MmdPdf";
|
||||
// The public portable file remains MmdPdf.exe. Once installed, shortcuts launch the
|
||||
// loose-file application directly so installed startup never pays launcher/extraction cost.
|
||||
private static readonly string ExeName = "KillerPDF.App.exe";
|
||||
private static readonly string ExeName = "MmdPdf.App.exe";
|
||||
private static readonly string InstallDir = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||
"Programs", AppName);
|
||||
private static readonly string InstallExe = Path.Combine(InstallDir, ExeName);
|
||||
private static readonly string LegacyUserInstallExe = Path.Combine(InstallDir, "KillerPDF.exe");
|
||||
private static readonly string LegacyUserInstallExe = Path.Combine(InstallDir, "MmdPdf.exe");
|
||||
private static readonly string FileIconPath = Path.Combine(InstallDir, "pdf-file.ico");
|
||||
|
||||
private static readonly string StartMenuDir = Path.Combine(
|
||||
@@ -49,7 +49,7 @@ namespace KillerPDF
|
||||
private static readonly string MachineInstallDir = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), AppName);
|
||||
private static readonly string MachineInstallExe = Path.Combine(MachineInstallDir, ExeName);
|
||||
private static readonly string LegacyMachineInstallExe = Path.Combine(MachineInstallDir, "KillerPDF.exe");
|
||||
private static readonly string LegacyMachineInstallExe = Path.Combine(MachineInstallDir, "MmdPdf.exe");
|
||||
private static readonly string MachineFileIconPath = Path.Combine(MachineInstallDir, "pdf-file.ico");
|
||||
private static readonly string MachineStartMenuDir = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.CommonPrograms), AppName);
|
||||
@@ -148,7 +148,7 @@ namespace KillerPDF
|
||||
// Headless CLI commands (see Features/Cli/CliRunner.cs; --batch-resave in
|
||||
// BatchRunner.cs). Checked before the single-instance mutex so CLI runs work
|
||||
// while a GUI instance is open, never forward to it, and never show a window.
|
||||
if (KillerPDF.Features.CliRunner.TryRunCli(e.Args, out int cliExit))
|
||||
if (MmdPdf.Features.CliRunner.TryRunCli(e.Args, out int cliExit))
|
||||
{
|
||||
Shutdown(cliExit);
|
||||
return;
|
||||
@@ -206,8 +206,8 @@ namespace KillerPDF
|
||||
// Single-instance IPC (mutex + named pipe)
|
||||
// ============================================================
|
||||
|
||||
private const string MutexName = @"Local\KillerPDF.SingleInstance";
|
||||
private const string PipeName = "KillerPDF.OpenPipe";
|
||||
private const string MutexName = @"Local\MmdPdf.SingleInstance";
|
||||
private const string PipeName = "MmdPdf.OpenPipe";
|
||||
private Mutex? _instanceMutex;
|
||||
|
||||
private void StartPipeServer()
|
||||
@@ -215,7 +215,7 @@ namespace KillerPDF
|
||||
var t = new System.Threading.Thread(RunPipeServer)
|
||||
{
|
||||
IsBackground = true,
|
||||
Name = "KillerPDF-IPC",
|
||||
Name = "MmdPdf-IPC",
|
||||
};
|
||||
t.Start();
|
||||
}
|
||||
@@ -355,7 +355,7 @@ namespace KillerPDF
|
||||
|
||||
var win = new Window
|
||||
{
|
||||
Title = CrashText("Str_Crash_Title", "KillerPDF - Unexpected Error"),
|
||||
Title = CrashText("Str_Crash_Title", "MmdPdf - Unexpected Error"),
|
||||
Width = 680,
|
||||
Height = 520,
|
||||
MinWidth = 480,
|
||||
@@ -388,7 +388,7 @@ namespace KillerPDF
|
||||
titleBar.Children.Add(xBtn);
|
||||
titleBar.Children.Add(new TextBlock
|
||||
{
|
||||
Text = CrashText("Str_Crash_Title", "KillerPDF - Unexpected Error"),
|
||||
Text = CrashText("Str_Crash_Title", "MmdPdf - Unexpected Error"),
|
||||
Foreground = dimText,
|
||||
FontSize = 12,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
@@ -517,7 +517,7 @@ namespace KillerPDF
|
||||
$"```\n{stack}\n```\n\n" +
|
||||
$"_Log folder: `{CrashReporter.LogDir}`_");
|
||||
Process.Start(new ProcessStartInfo(
|
||||
$"https://github.com/SteveTheKiller/KillerPDF/issues/new?title={title}&body={body}")
|
||||
$"https://github.com/SteveTheKiller/MmdPdf/issues/new?title={title}&body={body}")
|
||||
{ UseShellExecute = true });
|
||||
}
|
||||
catch { }
|
||||
@@ -628,7 +628,7 @@ namespace KillerPDF
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
var ver = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
sb.AppendLine($"KillerPDF v{ver?.ToString(3)}");
|
||||
sb.AppendLine($"MmdPdf v{ver?.ToString(3)}");
|
||||
sb.AppendLine($"Time : {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
sb.AppendLine($"OS : {Environment.OSVersion}");
|
||||
sb.AppendLine();
|
||||
@@ -654,11 +654,11 @@ namespace KillerPDF
|
||||
catch { return false; }
|
||||
}
|
||||
|
||||
/// <summary>True when KillerPDF is already installed machine-wide.</summary>
|
||||
/// <summary>True when MmdPdf is already installed machine-wide.</summary>
|
||||
internal static bool MachineInstallExists() =>
|
||||
File.Exists(MachineInstallExe) || File.Exists(LegacyMachineInstallExe);
|
||||
|
||||
/// <summary>True when KillerPDF is already installed for the current user.</summary>
|
||||
/// <summary>True when MmdPdf is already installed for the current user.</summary>
|
||||
internal static bool UserInstallExists() =>
|
||||
File.Exists(InstallExe) || File.Exists(LegacyUserInstallExe);
|
||||
|
||||
@@ -678,7 +678,7 @@ namespace KillerPDF
|
||||
if (!runningMachine && !runningUser) return;
|
||||
|
||||
string other = runningMachine ? "per-user" : "all-users";
|
||||
if (MessageBox.Show($"KillerPDF is installed twice. Remove the other {other} copy now?\n\nYour settings will not be removed.",
|
||||
if (MessageBox.Show($"MmdPdf is installed twice. Remove the other {other} copy now?\n\nYour settings will not be removed.",
|
||||
$"{AppName} installation conflict", MessageBoxButton.YesNo, MessageBoxImage.Warning) != MessageBoxResult.Yes) return;
|
||||
|
||||
if (runningMachine)
|
||||
@@ -706,15 +706,15 @@ namespace KillerPDF
|
||||
try { Directory.Delete(MachineStartMenuDir, recursive: false); } catch { }
|
||||
UnregisterFileHandler(Registry.LocalMachine);
|
||||
Services.ProtocolRegistrar.Unregister(Registry.LocalMachine);
|
||||
try { Registry.LocalMachine.DeleteSubKeyTree(@"Software\KillerPDF"); } catch { }
|
||||
try { Registry.LocalMachine.DeleteSubKeyTree(@"Software\MmdPdf"); } catch { }
|
||||
try { Registry.LocalMachine.DeleteSubKeyTree(
|
||||
@"Software\Microsoft\Windows\CurrentVersion\Uninstall\KillerPDF"); } catch { }
|
||||
@"Software\Microsoft\Windows\CurrentVersion\Uninstall\MmdPdf"); } catch { }
|
||||
try { if (Directory.Exists(MachineInstallDir)) Directory.Delete(MachineInstallDir, true); } catch { }
|
||||
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Installs KillerPDF, offers to set it as the default PDF handler, then relaunches from
|
||||
/// Installs MmdPdf, offers to set it as the default PDF handler, then relaunches from
|
||||
/// the installed location. Returns false if the install did not happen, so the caller can
|
||||
/// put the portable badge back rather than leaving the user with a half-finished state.
|
||||
///
|
||||
@@ -730,8 +730,8 @@ namespace KillerPDF
|
||||
{
|
||||
KillerDialog.Show(Current.MainWindow,
|
||||
Current.TryFindResource("Str_Dlg_OneInstallOnly") as string ??
|
||||
"KillerPDF is already installed for everyone on this computer. Update that installation, or uninstall it before choosing a per-user install. KillerPDF will not create two installed copies.",
|
||||
Current.TryFindResource("Str_Dlg_InstallTitle") as string ?? "Install KillerPDF",
|
||||
"MmdPdf is already installed for everyone on this computer. Update that installation, or uninstall it before choosing a per-user install. MmdPdf will not create two installed copies.",
|
||||
Current.TryFindResource("Str_Dlg_InstallTitle") as string ?? "Install MmdPdf",
|
||||
MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return false;
|
||||
}
|
||||
@@ -770,7 +770,7 @@ namespace KillerPDF
|
||||
// directly, the same way Uninstall() does.
|
||||
var res = KillerDialog.Show(null,
|
||||
Current.TryFindResource("Str_Dlg_SetDefaultPdfMsg") as string
|
||||
?? "Would you like to set KillerPDF as your default PDF viewer?",
|
||||
?? "Would you like to set MmdPdf as your default PDF viewer?",
|
||||
AppName, MessageBoxButton.YesNo);
|
||||
if (res == MessageBoxResult.Yes)
|
||||
Process.Start(new ProcessStartInfo("ms-settings:defaultapps")
|
||||
@@ -793,7 +793,7 @@ namespace KillerPDF
|
||||
{
|
||||
try
|
||||
{
|
||||
string? path = Environment.GetEnvironmentVariable("KILLERPDF_LAUNCHER_PATH");
|
||||
string? path = Environment.GetEnvironmentVariable("MMDPDF_LAUNCHER_PATH");
|
||||
return !string.IsNullOrWhiteSpace(path) && File.Exists(path) ? Path.GetFullPath(path) : null;
|
||||
}
|
||||
catch { return null; }
|
||||
@@ -846,13 +846,13 @@ namespace KillerPDF
|
||||
try { if (Directory.Exists(InstallDir)) Directory.Delete(InstallDir, true); } catch { }
|
||||
try
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(@"Software\KillerPDF", writable: true);
|
||||
using var key = Registry.CurrentUser.OpenSubKey(@"Software\MmdPdf", writable: true);
|
||||
key?.DeleteValue("Installed", throwOnMissingValue: false);
|
||||
key?.DeleteValue("InstallPath", throwOnMissingValue: false);
|
||||
}
|
||||
catch { }
|
||||
try { Registry.CurrentUser.DeleteSubKeyTree(
|
||||
@"Software\Microsoft\Windows\CurrentVersion\Uninstall\KillerPDF",
|
||||
@"Software\Microsoft\Windows\CurrentVersion\Uninstall\MmdPdf",
|
||||
throwOnMissingSubKey: false); }
|
||||
catch { }
|
||||
}
|
||||
@@ -865,7 +865,7 @@ namespace KillerPDF
|
||||
/// Machine-wide install. Runs elevated with no UI by definition, so the exit code is the
|
||||
/// only signal a deployment tool - or RunElevatedSilentInstall - gets back.
|
||||
///
|
||||
/// File associations are registered in HKLM so every account sees KillerPDF in Open With
|
||||
/// File associations are registered in HKLM so every account sees MmdPdf in Open With
|
||||
/// and Default apps. Windows still leaves the actual default choice to each user.
|
||||
/// </summary>
|
||||
private static void DoSilentInstall()
|
||||
@@ -914,19 +914,19 @@ namespace KillerPDF
|
||||
/// </summary>
|
||||
internal static readonly string TempDir = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||
"KillerPDF", "Temp");
|
||||
"MmdPdf", "Temp");
|
||||
|
||||
private static readonly List<string> _sessionTemps = [];
|
||||
|
||||
/// <summary>
|
||||
/// Creates a tracked temp path of the form killerpdf_<tag>_<guid>.pdf
|
||||
/// under %LOCALAPPDATA%\KillerPDF\Temp\.
|
||||
/// Creates a tracked temp path of the form mmdpdf_<tag>_<guid>.pdf
|
||||
/// under %LOCALAPPDATA%\MmdPdf\Temp\.
|
||||
/// All registered paths are deleted when CleanupSessionTemps() is called.
|
||||
/// </summary>
|
||||
internal static string MakeTempFile(string tag)
|
||||
{
|
||||
try { Directory.CreateDirectory(TempDir); } catch { }
|
||||
var path = Path.Combine(TempDir, $"killerpdf_{tag}_{Guid.NewGuid():N}.pdf");
|
||||
var path = Path.Combine(TempDir, $"mmdpdf_{tag}_{Guid.NewGuid():N}.pdf");
|
||||
lock (_sessionTemps) _sessionTemps.Add(path);
|
||||
return path;
|
||||
}
|
||||
@@ -943,7 +943,7 @@ namespace KillerPDF
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes killerpdf_*.pdf files left over from previous crashed sessions.
|
||||
/// Deletes mmdpdf_*.pdf files left over from previous crashed sessions.
|
||||
/// Sweeps both the current TempDir and the legacy %TEMP% location.
|
||||
/// Locked files (still open by another instance) are silently skipped.
|
||||
/// </summary>
|
||||
@@ -953,7 +953,7 @@ namespace KillerPDF
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(TempDir))
|
||||
foreach (var f in Directory.GetFiles(TempDir, "killerpdf_*.pdf"))
|
||||
foreach (var f in Directory.GetFiles(TempDir, "mmdpdf_*.pdf"))
|
||||
try { File.Delete(f); } catch { }
|
||||
}
|
||||
catch { }
|
||||
@@ -961,7 +961,7 @@ namespace KillerPDF
|
||||
// Legacy %TEMP% location - sweep once for users upgrading from older builds
|
||||
try
|
||||
{
|
||||
foreach (var f in Directory.GetFiles(Path.GetTempPath(), "killerpdf_*.pdf"))
|
||||
foreach (var f in Directory.GetFiles(Path.GetTempPath(), "mmdpdf_*.pdf"))
|
||||
try { File.Delete(f); } catch { }
|
||||
}
|
||||
catch { }
|
||||
@@ -971,7 +971,7 @@ namespace KillerPDF
|
||||
{
|
||||
try
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(@"Software\KillerPDF\Settings");
|
||||
using var key = Registry.CurrentUser.OpenSubKey(@"Software\MmdPdf\Settings");
|
||||
return key?.GetValue(name) as string;
|
||||
}
|
||||
catch { return null; }
|
||||
@@ -981,7 +981,7 @@ namespace KillerPDF
|
||||
{
|
||||
try
|
||||
{
|
||||
using var key = Registry.CurrentUser.CreateSubKey(@"Software\KillerPDF\Settings");
|
||||
using var key = Registry.CurrentUser.CreateSubKey(@"Software\MmdPdf\Settings");
|
||||
key.SetValue(name, value);
|
||||
}
|
||||
catch { /* best-effort */ }
|
||||
@@ -991,23 +991,23 @@ namespace KillerPDF
|
||||
{
|
||||
try
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(@"Software\KillerPDF\Settings", writable: true);
|
||||
using var key = Registry.CurrentUser.OpenSubKey(@"Software\MmdPdf\Settings", writable: true);
|
||||
key?.DeleteValue(name, throwOnMissingValue: false);
|
||||
}
|
||||
catch { /* best-effort */ }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wipes all persisted KillerPDF state: settings (registry), downloaded OCR language packs, the
|
||||
/// Wipes all persisted MmdPdf state: settings (registry), downloaded OCR language packs, the
|
||||
/// native OCR cache, and temp files. Best-effort - files locked this session (e.g. loaded native
|
||||
/// DLLs) are skipped and clear on the next restart. The user's actual PDFs are never touched.
|
||||
/// </summary>
|
||||
internal static void ClearAllData()
|
||||
{
|
||||
try { Registry.CurrentUser.DeleteSubKeyTree(@"Software\KillerPDF\Settings", throwOnMissingSubKey: false); } catch { }
|
||||
try { Registry.CurrentUser.DeleteSubKeyTree(@"Software\MmdPdf\Settings", throwOnMissingSubKey: false); } catch { }
|
||||
|
||||
string localKp = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "KillerPDF");
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "MmdPdf");
|
||||
TryDeleteDir(Path.Combine(localKp, "tessdata")); // downloaded language packs + bundled English
|
||||
TryDeleteDir(Path.Combine(localKp, "ocr")); // native Tesseract cache
|
||||
TryDeleteDir(TempDir); // temp working files
|
||||
@@ -1015,7 +1015,7 @@ namespace KillerPDF
|
||||
// Legacy temp PDFs that may linger in %TEMP%.
|
||||
try
|
||||
{
|
||||
foreach (var f in Directory.GetFiles(Path.GetTempPath(), "killerpdf_*.pdf"))
|
||||
foreach (var f in Directory.GetFiles(Path.GetTempPath(), "mmdpdf_*.pdf"))
|
||||
try { File.Delete(f); } catch { }
|
||||
}
|
||||
catch { }
|
||||
@@ -1079,7 +1079,7 @@ namespace KillerPDF
|
||||
|
||||
private static bool IsInstalled()
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(@"Software\KillerPDF");
|
||||
using var key = Registry.CurrentUser.OpenSubKey(@"Software\MmdPdf");
|
||||
if (key is null) return false;
|
||||
return key.GetValue("Installed") is int i && i == 1;
|
||||
}
|
||||
@@ -1089,7 +1089,7 @@ namespace KillerPDF
|
||||
using var key = Registry.CurrentUser.OpenSubKey(
|
||||
@"Software\Microsoft\Windows\Shell\Associations\FileAssociations\.pdf\UserChoice");
|
||||
return key?.GetValue("ProgId") is string progId &&
|
||||
progId.Equals("KillerPDF.pdf", StringComparison.OrdinalIgnoreCase);
|
||||
progId.Equals("MmdPdf.pdf", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
@@ -1215,7 +1215,7 @@ namespace KillerPDF
|
||||
{
|
||||
Text = alreadyInstalled
|
||||
? "A newer version is available. Install it or run without updating."
|
||||
: "Install KillerPDF on this computer, or run it without installing.",
|
||||
: "Install MmdPdf on this computer, or run it without installing.",
|
||||
Foreground = Brushes.White,
|
||||
TextWrapping = TextWrapping.Wrap,
|
||||
Margin = new Thickness(0, 0, 0, 16)
|
||||
@@ -1427,7 +1427,7 @@ namespace KillerPDF
|
||||
|
||||
var titleText = new TextBlock
|
||||
{
|
||||
Text = $"About KillerPDF",
|
||||
Text = $"About MmdPdf",
|
||||
Foreground = fg, VerticalAlignment = VerticalAlignment.Center,
|
||||
Margin = new Thickness(12, 0, 0, 0), FontSize = 13, FontWeight = FontWeights.SemiBold
|
||||
};
|
||||
@@ -1503,7 +1503,7 @@ namespace KillerPDF
|
||||
};
|
||||
var cardContent = new StackPanel();
|
||||
cardContent.Children.Add(MakeRow("VERSION", $"v{version}", fgDim, accent,
|
||||
onClick: () => OpenUrl($"https://github.com/SteveTheKiller/KillerPDF/releases/tag/v{version}")));
|
||||
onClick: () => OpenUrl($"https://github.com/SteveTheKiller/MmdPdf/releases/tag/v{version}")));
|
||||
cardContent.Children.Add(MakeRow("PUBLISHER", sigInfo, fgDim, fg));
|
||||
cardContent.Children.Add(MakeRow("THUMBPRINT", thumbInfo, fgDim, fg, mono, wrap: true));
|
||||
cardContent.Children.Add(MakeRow("EXE SHA256", sha256, fgDim, fg, mono, wrap: true));
|
||||
@@ -1521,9 +1521,9 @@ namespace KillerPDF
|
||||
okBtn.Margin = new Thickness(0, 12, 0, 0);
|
||||
okBtn.Click += (_, __) => dlg!.Close();
|
||||
|
||||
// KillerPDF logo - clickable link to product site
|
||||
// MmdPdf logo - clickable link to product site
|
||||
var logo = new TextBlock { FontSize = 22, FontWeight = FontWeights.Bold, Margin = new Thickness(0, 0, 0, 4) };
|
||||
var logoHl = new Hyperlink(new Run("KillerPDF"))
|
||||
var logoHl = new Hyperlink(new Run("MmdPdf"))
|
||||
{
|
||||
Foreground = accent,
|
||||
TextDecorations = null
|
||||
@@ -1539,7 +1539,7 @@ namespace KillerPDF
|
||||
Foreground = accent,
|
||||
TextDecorations = null
|
||||
};
|
||||
ktHl.Click += (_, _) => OpenUrl("https://killertools.net");
|
||||
ktHl.Click += (_, _) => OpenUrl("https://baobab-ts.com");
|
||||
tagline.Inlines.Add(ktHl);
|
||||
tagline.Inlines.Add(new Run(".") { Foreground = fgDim });
|
||||
|
||||
@@ -1612,7 +1612,7 @@ namespace KillerPDF
|
||||
"Security check failed: pdfium.dll integrity verification failed.\n\n" +
|
||||
$"Expected: {BuildInfo.PdfiumSha256}\n" +
|
||||
$"Actual : {actual}\n\n" +
|
||||
"The bundled PDF engine may have been tampered with. KillerPDF will exit.",
|
||||
"The bundled PDF engine may have been tampered with. MmdPdf will exit.",
|
||||
$"{AppName} - Security", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return false;
|
||||
}
|
||||
@@ -1638,7 +1638,7 @@ namespace KillerPDF
|
||||
{
|
||||
MessageBox.Show(
|
||||
"Installation refused: the running EXE does not carry a valid Authenticode " +
|
||||
"signature.\n\nOnly signed builds of KillerPDF can be installed.",
|
||||
"signature.\n\nOnly signed builds of MmdPdf can be installed.",
|
||||
AppName, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
@@ -1679,7 +1679,7 @@ namespace KillerPDF
|
||||
{
|
||||
MessageBox.Show(
|
||||
"Couldn't write the installed copy at:\n" + InstallExe +
|
||||
"\n\nClose any open KillerPDF window (and check Task Manager for KillerPDF.exe), " +
|
||||
"\n\nClose any open MmdPdf window (and check Task Manager for MmdPdf.exe), " +
|
||||
"then run the installer again.",
|
||||
AppName, MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
@@ -1714,7 +1714,7 @@ namespace KillerPDF
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register KillerPDF under either HKCU for a per-user install or HKLM for a machine-wide
|
||||
/// Register MmdPdf under either HKCU for a per-user install or HKLM for a machine-wide
|
||||
/// install. This advertises the handler without changing any user's chosen PDF default.
|
||||
/// </summary>
|
||||
private static void RegisterFileHandler(RegistryKey root, string exePath, string iconPath)
|
||||
@@ -1725,42 +1725,42 @@ namespace KillerPDF
|
||||
: $"{exePath},0";
|
||||
|
||||
// ProgID definition
|
||||
using (var k = root.CreateSubKey(@"Software\Classes\KillerPDF.pdf"))
|
||||
using (var k = root.CreateSubKey(@"Software\Classes\MmdPdf.pdf"))
|
||||
k.SetValue("", "PDF Document");
|
||||
|
||||
using (var k = root.CreateSubKey(
|
||||
@"Software\Classes\KillerPDF.pdf\DefaultIcon"))
|
||||
@"Software\Classes\MmdPdf.pdf\DefaultIcon"))
|
||||
k.SetValue("", iconRef);
|
||||
|
||||
using (var k = root.CreateSubKey(
|
||||
@"Software\Classes\KillerPDF.pdf\shell\open\command"))
|
||||
@"Software\Classes\MmdPdf.pdf\shell\open\command"))
|
||||
k.SetValue("", $"\"{exePath}\" \"%1\"");
|
||||
|
||||
// Associate .pdf extension - adds KillerPDF to the "Open with" list
|
||||
// Associate .pdf extension - adds MmdPdf to the "Open with" list
|
||||
using (var k = root.CreateSubKey(
|
||||
@"Software\Classes\.pdf\OpenWithProgids"))
|
||||
k.SetValue("KillerPDF.pdf", new byte[0], RegistryValueKind.None);
|
||||
k.SetValue("MmdPdf.pdf", new byte[0], RegistryValueKind.None);
|
||||
|
||||
// RegisteredApplications capability (used by Default Programs UI)
|
||||
using (var k = root.CreateSubKey(
|
||||
@"Software\KillerPDF\Capabilities"))
|
||||
@"Software\MmdPdf\Capabilities"))
|
||||
{
|
||||
k.SetValue("ApplicationName", AppName);
|
||||
k.SetValue("ApplicationDescription", "Lightweight PDF viewer and editor");
|
||||
}
|
||||
using (var k = root.CreateSubKey(
|
||||
@"Software\KillerPDF\Capabilities\FileAssociations"))
|
||||
k.SetValue(".pdf", "KillerPDF.pdf");
|
||||
@"Software\MmdPdf\Capabilities\FileAssociations"))
|
||||
k.SetValue(".pdf", "MmdPdf.pdf");
|
||||
|
||||
// #183: without this the killerpdf:// handler never appears in Windows Settings >
|
||||
// #183: without this the mmdpdf:// handler never appears in Windows Settings >
|
||||
// Default apps > Choose defaults by link type. Maps the scheme to its ProgID
|
||||
// (Software\Classes\killerpdf, written by ProtocolRegistrar).
|
||||
// (Software\Classes\mmdpdf, written by ProtocolRegistrar).
|
||||
using (var k = root.CreateSubKey(
|
||||
@"Software\KillerPDF\Capabilities\UrlAssociations"))
|
||||
@"Software\MmdPdf\Capabilities\UrlAssociations"))
|
||||
k.SetValue(Services.ProtocolRegistrar.Scheme, Services.ProtocolRegistrar.Scheme);
|
||||
|
||||
using (var k = root.CreateSubKey(@"Software\RegisteredApplications"))
|
||||
k.SetValue(AppName, @"Software\KillerPDF\Capabilities");
|
||||
k.SetValue(AppName, @"Software\MmdPdf\Capabilities");
|
||||
|
||||
// Tell the shell file associations have changed
|
||||
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, IntPtr.Zero, IntPtr.Zero);
|
||||
@@ -1768,12 +1768,12 @@ namespace KillerPDF
|
||||
|
||||
private static void UnregisterFileHandler(RegistryKey root)
|
||||
{
|
||||
try { root.DeleteSubKeyTree(@"Software\Classes\KillerPDF.pdf", false); } catch { }
|
||||
try { root.DeleteSubKeyTree(@"Software\KillerPDF\Capabilities", false); } catch { }
|
||||
try { root.DeleteSubKeyTree(@"Software\Classes\MmdPdf.pdf", false); } catch { }
|
||||
try { root.DeleteSubKeyTree(@"Software\MmdPdf\Capabilities", false); } catch { }
|
||||
try
|
||||
{
|
||||
using var k = root.OpenSubKey(@"Software\Classes\.pdf\OpenWithProgids", writable: true);
|
||||
k?.DeleteValue("KillerPDF.pdf", throwOnMissingValue: false);
|
||||
k?.DeleteValue("MmdPdf.pdf", throwOnMissingValue: false);
|
||||
}
|
||||
catch { }
|
||||
try
|
||||
@@ -1852,7 +1852,7 @@ namespace KillerPDF
|
||||
RegisterFileHandler(registryRoot, exePath, iconPath);
|
||||
Services.ProtocolRegistrar.Register(registryRoot, exePath);
|
||||
|
||||
using (var key = registryRoot.CreateSubKey(@"Software\KillerPDF"))
|
||||
using (var key = registryRoot.CreateSubKey(@"Software\MmdPdf"))
|
||||
{
|
||||
key.SetValue("Installed", 1);
|
||||
key.SetValue("InstallPath", exePath);
|
||||
@@ -1860,7 +1860,7 @@ namespace KillerPDF
|
||||
}
|
||||
|
||||
using (var key = registryRoot.CreateSubKey(
|
||||
@"Software\Microsoft\Windows\CurrentVersion\Uninstall\KillerPDF"))
|
||||
@"Software\Microsoft\Windows\CurrentVersion\Uninstall\MmdPdf"))
|
||||
{
|
||||
key.SetValue("DisplayName", AppName);
|
||||
key.SetValue("DisplayVersion", Assembly.GetExecutingAssembly().GetName().Version?.ToString(3) ?? "");
|
||||
@@ -1884,7 +1884,7 @@ namespace KillerPDF
|
||||
if (RelaunchMachineUninstallElevatedIfNeeded(machine)) return;
|
||||
|
||||
var res = MessageBox.Show(
|
||||
"Uninstall KillerPDF from this computer?",
|
||||
"Uninstall MmdPdf from this computer?",
|
||||
$"{AppName} Uninstall",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Question);
|
||||
@@ -1896,10 +1896,10 @@ namespace KillerPDF
|
||||
try { File.Delete(DesktopLnk); } catch { }
|
||||
|
||||
// Registry cleanup
|
||||
try { Registry.CurrentUser.DeleteSubKeyTree(@"Software\KillerPDF"); } catch { }
|
||||
try { Registry.CurrentUser.DeleteSubKeyTree(@"Software\MmdPdf"); } catch { }
|
||||
Services.ProtocolRegistrar.Unregister();
|
||||
try { Registry.CurrentUser.DeleteSubKeyTree(
|
||||
@"Software\Microsoft\Windows\CurrentVersion\Uninstall\KillerPDF"); } catch { }
|
||||
@"Software\Microsoft\Windows\CurrentVersion\Uninstall\MmdPdf"); } catch { }
|
||||
UnregisterFileHandler(Registry.CurrentUser);
|
||||
|
||||
// Machine-wide half. Only reachable when Add/Remove Programs launched the Program Files
|
||||
@@ -1911,13 +1911,13 @@ namespace KillerPDF
|
||||
try { Directory.Delete(MachineStartMenuDir, recursive: false); } catch { }
|
||||
UnregisterFileHandler(Registry.LocalMachine);
|
||||
Services.ProtocolRegistrar.Unregister(Registry.LocalMachine); // #183
|
||||
try { Registry.LocalMachine.DeleteSubKeyTree(@"Software\KillerPDF"); } catch { }
|
||||
try { Registry.LocalMachine.DeleteSubKeyTree(@"Software\MmdPdf"); } catch { }
|
||||
try { Registry.LocalMachine.DeleteSubKeyTree(
|
||||
@"Software\Microsoft\Windows\CurrentVersion\Uninstall\KillerPDF"); } catch { }
|
||||
@"Software\Microsoft\Windows\CurrentVersion\Uninstall\MmdPdf"); } catch { }
|
||||
}
|
||||
|
||||
// Self-delete: deferred via cmd batch so the EXE can exit first
|
||||
string bat = Path.Combine(Path.GetTempPath(), "killerpdf_uninstall.bat");
|
||||
string bat = Path.Combine(Path.GetTempPath(), "mmdpdf_uninstall.bat");
|
||||
File.WriteAllText(bat,
|
||||
"@echo off\r\n" +
|
||||
"ping -n 3 127.0.0.1 >nul\r\n" +
|
||||
@@ -1929,7 +1929,7 @@ namespace KillerPDF
|
||||
UseShellExecute = true
|
||||
});
|
||||
|
||||
MessageBox.Show(Application.Current.TryFindResource("Str_Dlg_Uninstalled") as string ?? "KillerPDF has been uninstalled.", AppName,
|
||||
MessageBox.Show(Application.Current.TryFindResource("Str_Dlg_Uninstalled") as string ?? "MmdPdf has been uninstalled.", AppName,
|
||||
MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user