annotate Xml/IBBXmlResolver.cs @ 51:c3b217a708f4

Re #24: Add limits * Add an absolute limit that isn't affected by the number it is a limit against * Add hashcode and equals implementations
author IBBoard <dev@ibboard.co.uk>
date Tue, 20 Oct 2009 19:48:37 +0000
parents cc7fae81afec
children 0f88d32b22cc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
0352fa33ee8f Closes #8 - license code
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
1 // This file (IBBXmlResolver.cs) is a part of the IBBoard library and is copyright 2009 IBBoard.
0352fa33ee8f Closes #8 - license code
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
2 //
0352fa33ee8f Closes #8 - license code
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
3 // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license.
0352fa33ee8f Closes #8 - license code
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
4
37
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
5 using System;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
6 using System.Xml;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
7
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
8 namespace IBBoard.Xml
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
9 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
10 /// <summary>
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
11 /// Summary description for IBBXmlResolver.
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
12 /// </summary>
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
13 public class IBBXmlResolver : XmlUrlResolver
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
14 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
15 private string baseFilePath = "";
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
16
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
17 public IBBXmlResolver(string basePath)
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
18 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
19 baseFilePath = basePath;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
20 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
21
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
22 public override Uri ResolveUri(Uri baseUri, string relativeUri)
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
23 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
24 if (relativeUri.StartsWith("dtds/"))
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
25 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
26 //Uri uri = base.ResolveUri(baseUri, relativeUri);
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
27 return new Uri(Uri.UriSchemeFile + "://" + baseFilePath + Constants.DirectoryString + relativeUri);
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
28 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
29 else
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
30 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
31 return base.ResolveUri(baseUri, relativeUri);
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
32 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
33 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
34 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
35 }