/// <summary>Initializes a new instance of the InvalidContentException class with information on serialization and streaming context for the related content item.</summary> /// <param name="serializationInfo">Information necessary for serialization and deserialization of the content item.</param> /// <param name="streamingContext">Information necessary for the source and destination of a given serialized stream. Also provides an additional caller-defined context.</param> protected InvalidContentException(SerializationInfo serializationInfo, StreamingContext streamingContext) : base(serializationInfo, streamingContext) { if (serializationInfo == null) { throw new ArgumentNullException("serializationInfo"); } this.contentIdentity = (ContentIdentity)serializationInfo.GetValue("ContentIdentity", typeof(ContentIdentity)); }
/// <summary>Initializes a new instance of ExternalReference, specifying the file path relative to another content item.</summary> /// <param name="filename">The name of the referenced file.</param> /// <param name="relativeToContent">The content that the path specified in filename is relative to.</param> public ExternalReference(string filename, ContentIdentity relativeToContent) { if (filename != null) { if (filename.Length == 0) { throw new ArgumentNullException("filename"); } if (relativeToContent == null) { throw new ArgumentNullException("relativeToContent"); } if (string.IsNullOrEmpty(relativeToContent.SourceFilename)) { throw new ArgumentNullException("relativeToContent.SourceFilename"); } string directoryName = Path.GetDirectoryName(relativeToContent.SourceFilename); string path = Path.Combine(directoryName, filename); this.filename = PathUtils.GetFullPath(path); } }
/// <summary>Initializes a new instance of the InvalidContentException class with the specified error message, the identity of the content throwing the exception, and a reference to the inner exception that is the cause of this exception.</summary> /// <param name="message">A message that describes the error.</param> /// <param name="contentIdentity">Information about the content item that caused this error, including the file name. In some cases, a location within the file (of the problem) is specified.</param> /// <param name="innerException">The exception that is the cause of the current exception. If innerException is not a null reference, the current exception is raised in a catch block that handles the inner exception.</param> public InvalidContentException(string message, ContentIdentity contentIdentity, Exception innerException) : base(message, innerException) { this.contentIdentity = contentIdentity; }
/// <summary>Initializes a new instance of the InvalidContentException class with the specified error message and the identity of the content throwing the exception.</summary> /// <param name="message">A message that describes the error.</param> /// <param name="contentIdentity">Information about the content item that caused this error, including the file name. In some cases, a location within the file (of the problem) is specified.</param> public InvalidContentException(string message, ContentIdentity contentIdentity) : base(message) { this.contentIdentity = contentIdentity; }