Skip to content

Commit c4e12a4

Browse files
committed
v3.5.0 - Use SearchValues from .NET8 and up
Some hacks to deal with non-standard namespaces Build for .NET 9 too
1 parent 42809bb commit c4e12a4

File tree

11 files changed

+242
-152
lines changed

11 files changed

+242
-152
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A fork of the SvgNet & SvgGdi bridge (http://www.codeproject.com/KB/cs/svgnet.as
44

55
__SvgNet is now available as a Nuget:__ [SvgNet](https://www.nuget.org/packages/SvgNet/).
66

7-
__Latest version 3.4.0 is .NET Standard 2.0 and 2.1 and also .NET 8.0 (base and Windows) compatible and works with .NET Core 2.x and 3.x and .NET 5.0/6.0/7.0/8.0, but now requires .NET Framework 4.6.2 or higher__
7+
__Latest version 3.5.0 is .NET Standard 2.0 and 2.1 and also .NET 8.0 (base and Windows) compatible and works with .NET Core 2.x and 3.x and .NET 5.0/6.0/7.0/8.0, but now requires .NET Framework 4.6.2 or higher__
88

99
To build this version properly you need .NET 8.0.403+ SDK installed
1010

SvgDocTest/DocForm.Designer.cs

Lines changed: 140 additions & 81 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SvgDocTest/DocForm.cs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ public partial class DocForm : Form {
1818
[STAThread]
1919
private static void Main() => Application.Run(new DocForm());
2020

21-
private static void RefreshBrowserFrom(WebBrowser browser, string filename) {
22-
browser.Navigate(new Uri(filename));
23-
browser.Refresh(WebBrowserRefreshOption.Completely);
24-
}
25-
2621
private void Button1_Click(object sender, EventArgs e) {
2722
using (var dlg = new OpenFileDialog {
2823
AutoUpgradeEnabled = true,
@@ -96,18 +91,18 @@ private void Button2_Click(object sender, EventArgs e) {
9691
root.AddChild(grp2);
9792

9893
//output
99-
94+
SvgFactory.ResetNamespaces();
10095
string s = root.WriteSVGString(true);
101-
96+
tbIn.Text = s;
10297
tbOut.Text = s;
10398

10499
string tempFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "foo.svg");
105100

106101
using (var tw = new StreamWriter(tempFile, false))
107102
tw.Write(s);
108-
109-
svgOut.Navigate(new Uri(tempFile));
110-
svgOut.Refresh(WebBrowserRefreshOption.Completely);
103+
panelTop.Text = $"Input: {tempFile}";
104+
svgOut.RefreshFrom(tempFile);
105+
svgIn.RefreshFrom(tempFile);
111106
}
112107

113108
private void Button3_Click(object sender, EventArgs e) {
@@ -131,11 +126,12 @@ private void Button3_Click(object sender, EventArgs e) {
131126
_ = MessageBox.Show("Tests completed Ok");
132127
}
133128
private void ProcessSvgFile(string svgFileName) {
129+
panelTop.Text = $"Input: {svgFileName}";
134130
tbIn.Text = svgFileName.LoadText();
135-
RefreshBrowserFrom(svgIn, svgFileName);
136131
tbOut.Text = SvgFactory.LoadFromXML(svgFileName.LoadXml(), null).WriteSVGString(true);
137132
File.WriteAllText(_tempFileName, tbOut.Text);
138-
RefreshBrowserFrom(svgOut, _tempFileName);
133+
svgIn.RefreshFrom(svgFileName);
134+
svgOut.RefreshFrom(_tempFileName);
139135
}
140136
}
141137
}

SvgDocTest/Extensions.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System;
2+
using System.Windows.Forms;
3+
4+
namespace SvgDocTest {
5+
public static class Extensions {
6+
public static void RefreshFrom(this WebBrowser browser, string filename) {
7+
browser.Navigate(new Uri(filename));
8+
browser.Refresh(WebBrowserRefreshOption.Completely);
9+
}
10+
}
11+
}

SvgDotNetCoreTest/SvgDotNetCoreTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
44
<LangVersion>12</LangVersion>
5-
<TargetFrameworks>net8.0-windows</TargetFrameworks>
5+
<TargetFrameworks>net8.0-windows;net9.0-windows</TargetFrameworks>
66
</PropertyGroup>
77
<ItemGroup>
88
<Compile Include="..\TestShared\TestShared.cs" Link="TestShared.cs" />

0 commit comments

Comments
 (0)