/// <summary>
 /// Constructor allowing the Message and InnerException property to be set.
 /// </summary>
 /// <param name="message">String setting the message of the exception.</param>
 /// <param name="assemblyName">String setting the assembly name of the exception.</param>
 /// <param name="typeName">String setting the type name of the exception.</param>
 /// <param name="publisherFormat">String setting the publisher format of the exception.</param>
 /// <param name="inner">Sets a reference to the InnerException.</param>
 public CustomPublisherException(String message, String assemblyName, String typeName, PublisherFormat publisherFormat, Exception inner)
     : base(message, inner)
 {
     this.assemblyName = assemblyName;
     this.typeName = typeName;
     this.publisherFormat = publisherFormat;
 }
        public override FileFormat Match(FileFormatScanJob job)
        {
            if (!ValidateStartBytes(job))
            {
                return(null);
            }

            var hasQuill    = false;
            var hasContents = false;
            var hasEnvelope = false;

            using (var file = new CompoundFile(job.Stream))
            {
                var items = new List <CFItem>();

                file.RootStorage.VisitEntries((item) => items.Add(item), true);

                foreach (var item in items)
                {
                    if (string.Compare(item.Name, "Quill", StringComparison.Ordinal) == 0)
                    {
                        hasQuill = true;
                    }
                    else if (item.Name.IndexOf("Contents", StringComparison.Ordinal) > -1)
                    {
                        hasContents = true;
                    }
                    else if (item.Name.IndexOf("Envelope", StringComparison.Ordinal) > -1)
                    {
                        hasEnvelope = true;
                    }
                }
            }

            if (hasQuill && hasContents && hasEnvelope)
            {
                var fingerprint = new PublisherFormat();

                return(fingerprint);
            }

            return(null);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Constructor allowing the Message and InnerException property to be set.
 /// </summary>
 /// <param name="message">String setting the message of the exception.</param>
 /// <param name="assemblyName">String setting the assembly name of the exception.</param>
 /// <param name="typeName">String setting the type name of the exception.</param>
 /// <param name="publisherFormat">String setting the publisher format of the exception.</param>
 /// <param name="inner">Sets a reference to the InnerException.</param>
 public CustomPublisherException(string message, string assemblyName, string typeName, PublisherFormat publisherFormat, Exception inner) : base(message, inner)
 {
     this.assemblyName    = assemblyName;
     this.typeName        = typeName;
     this.publisherFormat = publisherFormat;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Constructor used for deserialization of the exception class.
 /// </summary>
 /// <param name="info">Represents the SerializationInfo of the exception.</param>
 /// <param name="context">Represents the context information of the exception.</param>
 protected CustomPublisherException(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     assemblyName    = info.GetString("assemblyName");
     typeName        = info.GetString("typeName");
     publisherFormat = (PublisherFormat)info.GetValue("publisherFormat", typeof(PublisherFormat));
 }