Browse Source

using ILSpyX build info in generated diagrammers

removing unused code
pull/3324/head
Holger Schmidt 8 months ago
parent
commit
42a745679f
  1. 44
      ICSharpCode.ILSpyX/MermaidDiagrammer/AssemblyInfo.cs
  2. 4
      ICSharpCode.ILSpyX/MermaidDiagrammer/Generator.Run.cs
  3. 4
      ICSharpCode.ILSpyX/MermaidDiagrammer/html/template.html

44
ICSharpCode.ILSpyX/MermaidDiagrammer/AssemblyInfo.cs

@ -1,44 +0,0 @@
// Copyright (c) 2024 Holger Schmidt
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.Diagnostics;
using System.Reflection;
namespace ICSharpCode.ILSpyX.MermaidDiagrammer
{
internal static class AssemblyInfo
{
internal static readonly string Location;
internal static readonly string? Version;
static AssemblyInfo()
{
Assembly assembly = Assembly.GetExecutingAssembly();
Location = assembly.Location;
var version = assembly.GetName().Version?.ToString();
Version = version == null ? null : version.Remove(version.LastIndexOf('.'));
}
internal static string? GetProductVersion()
{
try
{ return FileVersionInfo.GetVersionInfo(Location).ProductVersion ?? Version; }
catch { return Version; }
}
}
}

4
ICSharpCode.ILSpyX/MermaidDiagrammer/Generator.Run.cs

@ -70,7 +70,7 @@ namespace ICSharpCode.ILSpyX.MermaidDiagrammer
jsonModel = new { jsonModel = new {
diagrammer.SourceAssemblyName, diagrammer.SourceAssemblyName,
diagrammer.SourceAssemblyVersion, diagrammer.SourceAssemblyVersion,
BuilderVersion = AssemblyInfo.Version, BuilderVersion = DecompilerVersionInfo.FullVersionWithCommitHash,
RepoUrl, RepoUrl,
// pre-serialize to a string so that we don't have to re-serialize it in the JS build task // pre-serialize to a string so that we don't have to re-serialize it in the JS build task
Model = Serialize(jsonModel) Model = Serialize(jsonModel)
@ -110,7 +110,7 @@ namespace ICSharpCode.ILSpyX.MermaidDiagrammer
var html = htmlTemplate var html = htmlTemplate
.Replace("{{SourceAssemblyName}}", model.SourceAssemblyName) .Replace("{{SourceAssemblyName}}", model.SourceAssemblyName)
.Replace("{{SourceAssemblyVersion}}", model.SourceAssemblyVersion) .Replace("{{SourceAssemblyVersion}}", model.SourceAssemblyVersion)
.Replace("{{BuilderVersion}}", AssemblyInfo.Version) .Replace("{{BuilderVersion}}", DecompilerVersionInfo.FullVersionWithCommitHash)
.Replace("{{RepoUrl}}", RepoUrl) .Replace("{{RepoUrl}}", RepoUrl)
.Replace("{{Model}}", modelJson); .Replace("{{Model}}", modelJson);

4
ICSharpCode.ILSpyX/MermaidDiagrammer/html/template.html

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>{{SourceAssemblyName}} class diagrammer - netAmermaid</title> <title>{{SourceAssemblyName}} class diagrammer - ILSpy</title>
<link rel="icon" type="image/x-icon" href="ILSpy.ico" /> <link rel="icon" type="image/x-icon" href="ILSpy.ico" />
<link rel="stylesheet" href="styles.css" type="text/css" /> <link rel="stylesheet" href="styles.css" type="text/css" />
<style id="filter-width"></style> <style id="filter-width"></style>
@ -173,7 +173,7 @@
title="For off-line use, download a copy and save it with the diagrammer - at the bottom of which you find a script with a reference to the mermaid CDN. Replace its 'src' with the path to your local copy.">📥</a> title="For off-line use, download a copy and save it with the diagrammer - at the bottom of which you find a script with a reference to the mermaid CDN. Replace its 'src' with the path to your local copy.">📥</a>
</span> </span>
<span> <span>
using <a class="project" target="_blank" href="{{RepoUrl}}#readme" title="🤿 get learned and find out about or 🔱 fork the project">netAmermaid</a> v{{BuilderVersion}} using <a class="project" target="_blank" href="{{RepoUrl}}#readme" title="🤿 get learned and find out about or 🔱 fork the project">ICSharpCode.ILSpyX</a> v{{BuilderVersion}}
<a target="_blank" href="{{RepoUrl}}/tree/v{{BuilderVersion}}#readme" title="the manual for v{{BuilderVersion}}">📜</a> <a target="_blank" href="{{RepoUrl}}/tree/v{{BuilderVersion}}#readme" title="the manual for v{{BuilderVersion}}">📜</a>
<a target="_blank" href="{{RepoUrl}}/discussions" title="🤔 ask questions, share and discuss 💡 ideas">💬</a> <a target="_blank" href="{{RepoUrl}}/discussions" title="🤔 ask questions, share and discuss 💡 ideas">💬</a>
<a target="_blank" href="{{RepoUrl}}/issues" title="🦟 feed bugs to the fishes and request 🌱 new features"><span class="mano-a-borsa"></span></a> <a target="_blank" href="{{RepoUrl}}/issues" title="🦟 feed bugs to the fishes and request 🌱 new features"><span class="mano-a-borsa"></span></a>

Loading…
Cancel
Save