From b4bd102b17cf93d57eb397d373b439839cecc480 Mon Sep 17 00:00:00 2001 From: thepra Date: Tue, 10 Nov 2026 06:48:23 +0100 Subject: [PATCH] The release and knowledge tools follow the house rules too Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01W4YtEJrgxG12Pc39Fai8Bd --- tools/knowledge.cs | 2 +- tools/release.cs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/knowledge.cs b/tools/knowledge.cs index 0c605b7..406a264 100644 --- a/tools/knowledge.cs +++ b/tools/knowledge.cs @@ -59,7 +59,7 @@ using (var input = File.OpenRead(download)) using (var file = File.Create(Path.Combine(output, "ip2asn.bin"))) AsnTable.Write(file, sourceDate, Sources.IpToAsn(input)); foreach (var stale in new[] { "networks.bin", "carriers.json", "registry.bin" }) File.Delete(Path.Combine(output, stale)); -string sha; +var sha = default(string); using (var input = File.OpenRead(download)) sha = Convert.ToHexStringLower(SHA256.HashData(input)); File.WriteAllText(Path.Combine(output, "SOURCE.txt"), $"iptoasn.com, Public Domain Dedication and License (PDDL) 1.0\n{Fallback}\nlast-modified {sourceDate:O}\nsha256 {sha}\n"); Report(); diff --git a/tools/release.cs b/tools/release.cs index 609d212..1d21940 100644 --- a/tools/release.cs +++ b/tools/release.cs @@ -365,7 +365,7 @@ string Reset(string folder) return folder; } -string Size(string file) => $"{new FileInfo(file).Length / 1024.0 / 1024.0:0.0} MB"; +string Size(string file) => $"{new FileInfo(file).Length.ToMegabytes()} MB"; string Option(string key) { @@ -404,3 +404,8 @@ static string FindRoot() while (dir is not null && !File.Exists(Path.Combine(dir.FullName, "MeWeb.slnx"))) dir = dir.Parent; return dir?.FullName ?? throw new InvalidOperationException("run from inside the repository (MeWeb.slnx not found)"); } + +static class NumbersExtensions +{ + public static string ToMegabytes(this long bytes) => (bytes / 1048576.0).ToString("0.0", System.Globalization.CultureInfo.InvariantCulture); +}