STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
MibException.cs
Go to the documentation of this file.
1 /*
2  * Created by SharpDevelop.
3  * User: lextm
4  * Date: 2008/5/17
5  * Time: 16:33
6  *
7  * To change this template use Tools | Options | Coding | Edit Standard Headers.
8  */
9 
10 using System;
11 using System.Globalization;
12 #if (!SILVERLIGHT)
13 using System.Runtime.Serialization;
14 using System.Security.Permissions;
15 #endif
16 
17 namespace Lextm.SharpSnmpLib.Mib
18 {
22  [Serializable]
23  [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Mib")]
24  public sealed class MibException : Exception
25  {
29  public Symbol Symbol { get; private set; }
30 
34  public MibException()
35  {
36  }
37 
42  public MibException(string message) : base(message)
43  {
44  }
45 
51  public MibException(string message, Exception inner)
52  : base(message, inner)
53  {
54  }
55 #if (!SILVERLIGHT)
56  private MibException(SerializationInfo info, StreamingContext context) : base(info, context)
62  {
63  if (info == null)
64  {
65  throw new ArgumentNullException("info");
66  }
67 
68  Symbol = (Symbol)info.GetValue("Symbol", typeof(Symbol));
69  }
70 
76  [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
77  public override void GetObjectData(SerializationInfo info, StreamingContext context)
78  {
79  base.GetObjectData(info, context);
80  info.AddValue("Symbol", Symbol);
81  }
82 #endif
83 
90  public static MibException Create(string message, Symbol symbol)
91  {
92  if (symbol == null)
93  {
94  throw new ArgumentNullException("symbol");
95  }
96 
97  if (String.IsNullOrEmpty(message))
98  {
99  message = "Unknown MIB Exception";
100  }
101 
102  message = String.Format(
103  "{0} (file: \"{1}\"; row: {2}; column: {3})",
104  message,
105  symbol.File,
106  symbol.Row + 1,
107  symbol.Column + 1);
108 
109  MibException ex = new MibException(message) { Symbol = symbol };
110  return ex;
111  }
112  }
113 }
Description of MibException.
Definition: MibException.cs:24
int Row
Row number.
Definition: Symbol.cs:61
override void GetObjectData(SerializationInfo info, StreamingContext context)
Gets object data.
Definition: MibException.cs:77
MibException(string message)
Creates a SnmpException instance with a specific string.
Definition: MibException.cs:42
static MibException Create(string message, Symbol symbol)
Creates a MibException with a specific Symbol.
Definition: MibException.cs:90
MibException(string message, Exception inner)
Creates a MibException instance with a specific string and an Exception.
Definition: MibException.cs:51
int Column
Column number.
Definition: Symbol.cs:72
MibException()
Creates a MibException.
Definition: MibException.cs:34
Description of Symbol.
Definition: Symbol.cs:20