Volian.Base.Library & Baseline

This commit is contained in:
2026-08-11 07:33:32 -04:00
parent 6d7d127b63
commit b1427f4997
26 changed files with 389 additions and 1239 deletions
+10 -17
View File
@@ -1,11 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using iTextSharp.text.factories;
using Microsoft.Win32;
using System.Text.RegularExpressions;
using System.IO;
using iTextSharp.text;
@@ -53,7 +47,7 @@ namespace Volian.Base.Library
_MyLog.WarnFormat("PROMS Font Folder = {0}", _PromsFontDir); // C2019-028 Add info in the error log
}
}
int profileDepth1 = ProfileTimer.Push(">>>> RegisterDirectory " + _PromsFontDir);
int profileDepth1 = ProfileTimer.Push($">>>> RegisterDirectory {_PromsFontDir}");
//_MyLog.DebugFormat("Register this Font Folder = {0}", _PromsFontDir); // debug
iTextSharp.text.FontFactory.RegisterDirectory(_PromsFontDir);
ProfileTimer.Pop(profileDepth1);
@@ -70,7 +64,7 @@ namespace Volian.Base.Library
_MyLog.WarnFormat("Problem with Font {0} in {1}", fontName, _PromsFontDir);
if (_PromsFontDir != FontFind.FontDir)
{
int profileDepth2 = ProfileTimer.Push(">>>> RegisterDirectory " + FontFind.FontDir);
int profileDepth2 = ProfileTimer.Push($">>>> RegisterDirectory {FontFind.FontDir}");
//_MyLog.DebugFormat("Register this Font Folder = {0}", FontFind.FontDir); // debug
iTextSharp.text.FontFactory.RegisterDirectory(FontFind.FontDir);
ProfileTimer.Pop(profileDepth2);
@@ -109,14 +103,13 @@ namespace Volian.Base.Library
}
ProfileTimer.Pop(profileDepth);
}
private static RegistryKey _FontKey = Registry.LocalMachine.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("Windows NT").OpenSubKey("CurrentVersion").OpenSubKey("Fonts");
public static RegistryKey FontKey
{ get { return _FontKey; } }
/// <summary>
/// Try to register a particular font, if it fails register the entire font folder
/// </summary>
/// <param name="fontName">FontName - Used to find a font file.</param>
public static void RegisterFont(string fontName)
private static readonly RegistryKey _FontKey = Registry.LocalMachine.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("Windows NT").OpenSubKey("CurrentVersion").OpenSubKey("Fonts");
public static RegistryKey FontKey => _FontKey;
/// <summary>
/// Try to register a particular font, if it fails register the entire font folder
/// </summary>
/// <param name="fontName">FontName - Used to find a font file.</param>
public static void RegisterFont(string fontName)
{
if (!FontFactory.IsRegistered(fontName))
{
@@ -128,7 +121,7 @@ namespace Volian.Base.Library
try // B2019-118 Add error handling for FontFacory.Register (Windows Registry contains a node that
// points to a file that no longer exists
{
FontFactory.Register(fontFile.Contains("\\") ? fontFile : FontFind.FontDir + "\\" + fontFile);
FontFactory.Register(fontFile.Contains("\\") ? fontFile : $"{FontFind.FontDir}\\{fontFile}");
}
catch (Exception ex) // catch any exception and add the error to the error log.
{