forked from SharpMap/SharpMap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDuplicateLayerException.cs
More file actions
92 lines (85 loc) · 3.45 KB
/
DuplicateLayerException.cs
File metadata and controls
92 lines (85 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
using System;
using System.Runtime.Serialization;
namespace SharpMap.Layers
{
/// <summary>
/// Exception thrown when a layer with a name which is the same
/// as an existing layer is added to a <see cref="LayerCollection"/>.
/// </summary>
[Serializable]
public class DuplicateLayerException : InvalidOperationException
{
private readonly string _duplicateLayerName;
/// <summary>
/// Creates a new instance of DuplicateLayerException, indicating
/// the duplicate layer name by <paramref name="duplicateLayerName"/>.
/// </summary>
/// <param name="duplicateLayerName">
/// The existing layer name which was duplicated.
/// </param>
public DuplicateLayerException(string duplicateLayerName)
: this(duplicateLayerName, null)
{
}
/// <summary>
/// Creates a new instance of DuplicateLayerException, indicating
/// the duplicate layer name by <paramref name="duplicateLayerName"/>
/// and including a message.
/// </summary>
/// <param name="duplicateLayerName">
/// The existing layer name which was duplicated.
/// </param>
/// <param name="message">Additional information about the exception.</param>
public DuplicateLayerException(string duplicateLayerName, string message)
: this(duplicateLayerName, message, null)
{
}
/// <summary>
/// Creates a new instance of DuplicateLayerException, indicating
/// the duplicate layer name by <paramref name="duplicateLayerName"/>
/// and including a message.
/// </summary>
/// <param name="duplicateLayerName">
/// The existing layer name which was duplicated.
/// </param>
/// <param name="message">
/// Additional information about the exception.
/// </param>
/// <param name="inner">
/// An exception which caused this exception, if any.
/// </param>
public DuplicateLayerException(string duplicateLayerName, string message, Exception inner)
: base(message, inner)
{
_duplicateLayerName = duplicateLayerName;
}
/// <summary>
/// Creates a new instance of DuplicateLayerException from serialized data,
/// <paramref name="info"/>.
/// </summary>
/// <param name="info">The serialization data.</param>
/// <param name="context">Serialization context.</param>
protected DuplicateLayerException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
_duplicateLayerName = info.GetString("_duplicateLayerName");
}
/// <summary>
/// Gets the existing layer name which was duplicated.
/// </summary>
public string DuplicateLayerName
{
get { return _duplicateLayerName; }
}
/// <summary>
/// Serialization function
/// </summary>
/// <param name="info">The serialization info</param>
/// <param name="context">The streaming context</param>
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
info.AddValue("_duplicateLayerName", _duplicateLayerName);
}
}
}