Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ImportedProjects
SVG
Commits
4a6fe6ff
Commit
4a6fe6ff
authored
Apr 22, 2008
by
davescriven
Browse files
Added custom entity support to SvgHandler.
parent
4c059047
Changes
2
Hide whitespace changes
Inline
Side-by-side
Document Structure/SvgDocument.cs
View file @
4a6fe6ff
...
...
@@ -69,13 +69,18 @@ namespace Svg
/// <returns>An <see cref="SvgDocument"/> with the contents loaded.</returns>
/// <exception cref="FileNotFoundException">The document at the specified <paramref name="path"/> cannot be found.</exception>
public
static
SvgDocument
Open
(
string
path
)
{
return
Open
(
path
,
null
);
}
public
static
SvgDocument
Open
(
string
path
,
Dictionary
<
string
,
string
>
entities
)
{
if
(!
File
.
Exists
(
path
))
{
throw
new
FileNotFoundException
(
"The specified document cannot be found."
,
path
);
}
return
Open
(
File
.
OpenRead
(
path
));
return
Open
(
File
.
OpenRead
(
path
)
,
entities
);
}
public
static
SvgDocument
Open
(
Stream
stream
)
...
...
Web/SvgHandler.cs
View file @
4a6fe6ff
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Collections.Specialized
;
using
System.Drawing
;
using
System.Drawing.Imaging
;
using
System.IO
;
using
System.Threading
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Threading
;
using
System.Web
;
namespace
Svg.Web
...
...
@@ -111,7 +113,15 @@ namespace Svg.Web
{
try
{
SvgDocument
document
=
SvgDocument
.
Open
(
this
.
_state
.
_context
.
Request
.
PhysicalPath
);
Dictionary
<
string
,
string
>
entities
=
new
Dictionary
<
string
,
string
>();
NameValueCollection
queryString
=
this
.
_state
.
_context
.
Request
.
QueryString
;
for
(
int
i
=
0
;
i
<
queryString
.
Count
;
i
++)
{
entities
.
Add
(
queryString
.
Keys
[
i
],
queryString
[
i
]);
}
SvgDocument
document
=
SvgDocument
.
Open
(
this
.
_state
.
_context
.
Request
.
PhysicalPath
,
entities
);
using
(
Bitmap
bitmap
=
document
.
Draw
())
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment