Support ancient .NET in Reports

This commit is contained in:
Matt Nadareski
2024-02-28 23:57:08 -05:00
parent 010a2d4cec
commit af86287af4
2 changed files with 23 additions and 3 deletions

View File

@@ -60,7 +60,7 @@ namespace SabreTools.Reports.Formats
{ {
WriteMidSeparator(xtw, baddumpCol, nodumpCol); WriteMidSeparator(xtw, baddumpCol, nodumpCol);
WriteIndividual(xtw, stat, baddumpCol, nodumpCol); WriteIndividual(xtw, stat, baddumpCol, nodumpCol);
// If we have anything but the last value, write the separator // If we have anything but the last value, write the separator
if (i < Statistics.Count - 1) if (i < Statistics.Count - 1)
{ {
@@ -77,7 +77,9 @@ namespace SabreTools.Reports.Formats
} }
WriteFooter(xtw); WriteFooter(xtw);
#if NET452_OR_GREATER
xtw.Dispose(); xtw.Dispose();
#endif
fs.Dispose(); fs.Dispose();
} }
catch (Exception ex) when (!throwOnError) catch (Exception ex) when (!throwOnError)
@@ -216,8 +218,12 @@ body {
xtw.WriteStartElement("tr"); xtw.WriteStartElement("tr");
if (isDirectory) if (isDirectory)
xtw.WriteAttributeString("class", "dir"); xtw.WriteAttributeString("class", "dir");
#if NET20 || NET35
xtw.WriteElementString("td", isDirectory ? stat.DisplayName.Remove(0, 5) : stat.DisplayName);
#else
xtw.WriteElementString("td", isDirectory ? WebUtility.HtmlEncode(stat.DisplayName.Remove(0, 5)) : WebUtility.HtmlEncode(stat.DisplayName)); xtw.WriteElementString("td", isDirectory ? WebUtility.HtmlEncode(stat.DisplayName.Remove(0, 5)) : WebUtility.HtmlEncode(stat.DisplayName));
#endif
xtw.WriteStartElement("td"); xtw.WriteStartElement("td");
xtw.WriteAttributeString("align", "right"); xtw.WriteAttributeString("align", "right");

View File

@@ -1,10 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks> <!-- Assembly Properties -->
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64</RuntimeIdentifiers>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>1.1.2</Version>
<!-- Package Properties -->
<Authors>Matt Nadareski</Authors>
<Copyright>Copyright (c)2016-2024 Matt Nadareski</Copyright>
<PackageProjectUrl>https://github.com/SabreTools/</PackageProjectUrl>
<RepositoryUrl>https://github.com/SabreTools/SabreTools</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>