Files
kua-agent 6610acfa44 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.
2026-08-27 07:37:09 +02:00

61 lines
2.3 KiB
C#

using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Text;
namespace MmdPdf.Services
{
/// <summary>
/// Opt-in startup timing used by the release benchmark. Normal launches do no file I/O.
/// Set MMDPDF_STARTUP_TRACE to an output path before starting the process.
/// </summary>
internal static class StartupTrace
{
private const string TraceEnvironmentVariable = "MMDPDF_STARTUP_TRACE";
private static readonly object Gate = new object();
private static readonly Stopwatch Clock = Stopwatch.StartNew();
private static readonly string? OutputPath = Environment.GetEnvironmentVariable(TraceEnvironmentVariable);
private static bool _headerWritten;
internal static bool Enabled => !string.IsNullOrWhiteSpace(OutputPath);
internal static void Mark(string stage)
{
if (!Enabled) return;
try
{
lock (Gate)
{
var directory = Path.GetDirectoryName(OutputPath!);
if (!string.IsNullOrEmpty(directory)) Directory.CreateDirectory(directory);
var sb = new StringBuilder();
if (!_headerWritten)
{
_headerWritten = true;
var process = Process.GetCurrentProcess();
sb.Append("# MmdPdf startup trace | pid=")
.Append(process.Id)
.Append(" | processStartUtc=")
.Append(process.StartTime.ToUniversalTime().ToString("O", CultureInfo.InvariantCulture))
.Append(" | traceStartUtc=")
.Append(DateTime.UtcNow.ToString("O", CultureInfo.InvariantCulture))
.AppendLine();
}
sb.Append(Clock.Elapsed.TotalMilliseconds.ToString("F3", CultureInfo.InvariantCulture))
.Append('\t')
.AppendLine(stage);
File.AppendAllText(OutputPath!, sb.ToString(), new UTF8Encoding(false));
}
}
catch
{
// Diagnostics must never make startup fail.
}
}
}
}