From 46083a6dfa11c25c707b52f745c4bdcb62e10a0d Mon Sep 17 00:00:00 2001 From: Jim Schaad Date: Sun, 22 Dec 2019 14:54:21 -0800 Subject: [PATCH] Remove all of the compiler warnings Remove all of the compiler warnings from the build. Remove all of the obsolete media types so we better match the IANA registry. --- .../CoAP.Server/CoAP.Server.Std10.csproj | 1 + CoAP.Example/CoAP.Server/ExampleServer.cs | 1 - CoAP.NET/Channel/UDPChannel.cs | 6 ++ CoAP.NET/CoAP.Std10.csproj | 7 +- CoAP.NET/DTLS/DTLSClient.cs | 2 + CoAP.NET/DTLS/DTLSClientChannel.cs | 100 ++++-------------- CoAP.NET/DTLS/DTLSSession.cs | 2 +- CoAP.NET/Deduplication/SweepDeduplicator.cs | 2 +- CoAP.NET/EndPoint/Resources/Resource.cs | 100 ++++++------------ CoAP.NET/MediaType.cs | 100 +----------------- 10 files changed, 72 insertions(+), 249 deletions(-) diff --git a/CoAP.Example/CoAP.Server/CoAP.Server.Std10.csproj b/CoAP.Example/CoAP.Server/CoAP.Server.Std10.csproj index 6264cfe..dbdeca6 100644 --- a/CoAP.Example/CoAP.Server/CoAP.Server.Std10.csproj +++ b/CoAP.Example/CoAP.Server/CoAP.Server.Std10.csproj @@ -12,6 +12,7 @@ + diff --git a/CoAP.Example/CoAP.Server/ExampleServer.cs b/CoAP.Example/CoAP.Server/ExampleServer.cs index 23135fa..f5182a0 100644 --- a/CoAP.Example/CoAP.Server/ExampleServer.cs +++ b/CoAP.Example/CoAP.Server/ExampleServer.cs @@ -13,7 +13,6 @@ public static void Main(String[] args) server.Add(new HelloWorldResource("hello")); server.Add(new FibonacciResource("fibonacci")); server.Add(new StorageResource("storage")); - server.Add(new ImageResource("image")); server.Add(new MirrorResource("mirror")); server.Add(new LargeResource("large")); server.Add(new CarelessResource("careless")); diff --git a/CoAP.NET/Channel/UDPChannel.cs b/CoAP.NET/Channel/UDPChannel.cs index e3b99cd..c53f63a 100644 --- a/CoAP.NET/Channel/UDPChannel.cs +++ b/CoAP.NET/Channel/UDPChannel.cs @@ -238,7 +238,9 @@ private void StartMulticastSocket(SocketSet info) SocketOptionName.AddMembership, mc); } +#pragma warning disable 168 catch (SocketException e) { +#pragma warning restore 168 #if LOG_UDP_CHANNEL _Log.Info( m => m( @@ -252,7 +254,9 @@ private void StartMulticastSocket(SocketSet info) } } } +#pragma warning disable 168 catch (SocketException e) { +#pragma warning restore 168 #if LOG_UDP_CHANNEL _Log.Info( m => m($"Start Multicast: Address {info._localEP.Address} had an exception ${e.ToString()}")); @@ -285,7 +289,9 @@ private void StartMulticastSocket(SocketSet info) } } } +#pragma warning disable 168 catch (SocketException e) { +#pragma warning restore 168 #if LOG_UDP_CHANNEL _Log.Info(m => m($"Start Multicast: Address {info._localEP.Address} had an exception ${e.ToString()}")); #endif diff --git a/CoAP.NET/CoAP.Std10.csproj b/CoAP.NET/CoAP.Std10.csproj index 36f4212..40cb70a 100644 --- a/CoAP.NET/CoAP.Std10.csproj +++ b/CoAP.NET/CoAP.Std10.csproj @@ -7,8 +7,8 @@ netcoreapp2.0;net462;netstandard2.0 Com.AugustCellars.CoAP Com.AugustCellars.CoAP - 1.6.0.0 - 1.6.0.0 + 1.7.0.0 + 1.7.0.0 Jim Schaad C# Implementation of CoAP An implementation of various CoAP standards. Both client and server sides are included. @@ -22,6 +22,9 @@ This project is built on the CoAP.NET project of smeshlink which in turn is based on Californium. As this project did not seem to be maintained any more and I wanted a version in order to test the newer items that are coming out of the IETF CORE working group, I have captured it and started exanding it. It is intented primarily for research and verification work. +1.7 + - Remove the media types that had been previously marked as obsolete. + - Internal cleanup work. 1.6 - Use cache key fields for matching blockwise transfers. - Some corrections for blockwise transfers over TCP diff --git a/CoAP.NET/DTLS/DTLSClient.cs b/CoAP.NET/DTLS/DTLSClient.cs index c8e27d8..b983058 100644 --- a/CoAP.NET/DTLS/DTLSClient.cs +++ b/CoAP.NET/DTLS/DTLSClient.cs @@ -325,7 +325,9 @@ internal class MyTlsAuthentication { private readonly TlsContext _mContext; public EventHandler TlsEventHandler; +#if SUPPORT_RPK || SUPPORT_TLS_CWT private KeySet _serverKeys; +#endif private TlsKeyPair TlsKey { get; set; } #if SUPPORT_TLS_CWT public KeySet CwtTrustKeySet { get; set; } diff --git a/CoAP.NET/DTLS/DTLSClientChannel.cs b/CoAP.NET/DTLS/DTLSClientChannel.cs index bd72b05..57b47da 100644 --- a/CoAP.NET/DTLS/DTLSClientChannel.cs +++ b/CoAP.NET/DTLS/DTLSClientChannel.cs @@ -4,6 +4,7 @@ using System.Net; using System.Net.Sockets; using Com.AugustCellars.CoAP.Channel; +using Com.AugustCellars.CoAP.Log; using Com.AugustCellars.COSE; #if SUPPORT_TLS_CWT using Com.AugustCellars.WebToken; @@ -20,65 +21,20 @@ internal class DTLSClientChannel : IChannel public const Int32 DefaultReceivePacketSize = 4096; private readonly System.Net.EndPoint _localEndPoint; - private Int32 _receiveBufferSize = DefaultReceivePacketSize; - private Int32 _sendBufferSize; - private Int32 _receivePacketSize; private readonly int _port; private UDPChannel _udpChannel; private readonly TlsKeyPair _userKey; public KeySet CwtTrustKeySet { get; set; } public EventHandler TlsEventHandler; + private readonly ILogger _log = LogManager.GetLogger(nameof(DTLSClientChannel)); -#if false - /// - /// Create a client only channel and use a randomly assigned port on - /// the client UDP port. - /// - /// Authentication Key - public DTLSClientChannel(OneKey userKey) : this(userKey, 0) - { - } - - /// - /// Create a client only channel and use a given point - /// - /// Authentication Key - /// client side UDP port - public DTLSClientChannel(OneKey userKey, Intint32 port) - { - _port = port; - _userKey = userKey; - } -#endif public DTLSClientChannel(TlsKeyPair userKey, int port) { _port = port; _userKey = userKey ?? throw new ArgumentNullException(nameof(userKey)); } -#if false -#if SUPPORT_TLS_CWT - public DTLSClientChannel(CWT cwt, OneKey userKey, KeySet cwtTrustKeys, int port) - { - _port = port; - _userKey = userKey; - _userCwt = cwt; - CwtTrustKeySet = cwtTrustKeys; - } -#endif - - /// - /// Create a client only channel and use a given endpoint - /// - /// Authentication Key - /// client side endpoint - public DTLSClientChannel(OneKey userKey, System.Net.EndPoint ep) - { - _localEndPoint = ep; - _userKey = userKey; - } -#endif /// /// Create a client only channel and use a given endpoint @@ -96,36 +52,25 @@ public DTLSClientChannel(TlsKeyPair userKey, System.Net.EndPoint ep) public event EventHandler DataReceived; /// - public System.Net.EndPoint LocalEndPoint { - get =>_udpChannel == null ? (_localEndPoint ?? new IPEndPoint(IPAddress.IPv6Any, _port)) : _udpChannel.LocalEndPoint; - } + public System.Net.EndPoint LocalEndPoint => _udpChannel == null ? (_localEndPoint ?? new IPEndPoint(IPAddress.IPv6Any, _port)) : _udpChannel.LocalEndPoint; /// /// Gets or sets the . /// - public Int32 ReceiveBufferSize { - get => _receiveBufferSize; - set => _receiveBufferSize = value; - } + public int ReceiveBufferSize { get; set; } = DefaultReceivePacketSize; /// /// Gets or sets the . /// - public Int32 SendBufferSize { - get => _sendBufferSize; - set => _sendBufferSize = value; - } + public int SendBufferSize { get; set; } /// /// Gets or sets the size of buffer for receiving packet. /// The default value is . /// - public Int32 ReceivePacketSize { - get => _receivePacketSize; - set => _receivePacketSize = value; - } + public int ReceivePacketSize { get; set; } - private Int32 _running; + private int _running; /// public bool AddMulticastAddress(IPEndPoint ep) @@ -159,12 +104,13 @@ public void Start() } /// - /// Tell the channel to stop processing data cand clean itself up. + /// Tell the channel to stop processing data and clean itself up. /// public void Stop() { - if (System.Threading.Interlocked.Exchange(ref _running, 0) == 0) + if (System.Threading.Interlocked.Exchange(ref _running, 0) == 0) { return; + } lock (_sessionList) { foreach (DTLSSession session in _sessionList) { @@ -228,24 +174,23 @@ public ISession GetSession(System.Net.EndPoint ep) #endif session = new DTLSSession(ipEndPoint, DataReceived, _userKey); #if SUPPORT_TLS_CWT - } + } #endif session.TlsEventHandler += OnTlsEvent; AddSession(session); - session.Connect(_udpChannel); } catch { - ; + _log.Error("Failed to establish a DTLS session"); } return session; } - private void OnTlsEvent(Object o, TlsEvent e) + private void OnTlsEvent(object o, TlsEvent e) { EventHandler handler = TlsEventHandler; if (handler != null) { @@ -258,6 +203,7 @@ private void OnTlsEvent(Object o, TlsEvent e) /// Send data through the DTLS channel to other side /// /// Data to be sent + /// What session was the request on /// Where to send it public void Send(byte[] data, ISession sessionReceive, System.Net.EndPoint ep) { @@ -270,9 +216,7 @@ public void Send(byte[] data, ISession sessionReceive, System.Net.EndPoint ep) DTLSSession session = FindSession(ipEndPoint); if (session == null) { -#if DEBUG - Console.WriteLine("We should have already setup a session"); -#endif + _log.Warn("Setup a new session - "); // Create a new session to send with if we don't already have one @@ -282,9 +226,8 @@ public void Send(byte[] data, ISession sessionReceive, System.Net.EndPoint ep) session.Connect(_udpChannel); } else if (session != sessionReceive) { -#if DEBUG - Console.WriteLine("Don't send because the sessions are different"); -#endif + _log.Warn("Don't send because the sessions are different"); + return; } // Queue the data onto the session. @@ -293,14 +236,12 @@ public void Send(byte[] data, ISession sessionReceive, System.Net.EndPoint ep) session.WriteData(); } catch (Exception e) { -#if DEBUG - Console.WriteLine("Error in DTLSClientChannel Sending - " + e.ToString()); -#endif + _log.Error($"Error in DTLSClientChannel Sending - {e}"); throw; } } - private void ReceiveData(Object sender, DataReceivedEventArgs e) + private void ReceiveData(object sender, DataReceivedEventArgs e) { lock (_sessionList) { foreach (DTLSSession session in _sessionList) { @@ -330,8 +271,9 @@ private DTLSSession FindSession(IPEndPoint ipEndPoint) lock (_sessionList) { foreach (DTLSSession session in _sessionList) { - if (session.EndPoint.Equals(ipEndPoint)) + if (session.EndPoint.Equals(ipEndPoint)) { return session; + } } } return null; diff --git a/CoAP.NET/DTLS/DTLSSession.cs b/CoAP.NET/DTLS/DTLSSession.cs index b6e0c96..4241941 100644 --- a/CoAP.NET/DTLS/DTLSSession.cs +++ b/CoAP.NET/DTLS/DTLSSession.cs @@ -27,7 +27,7 @@ public class DTLSSession : ISecureSession private readonly EventHandler _dataReceived; - private readonly EventHandler _sessionEvents; + // private readonly EventHandler _sessionEvents; public EventHandler TlsEventHandler; #if SUPPORT_TLS_CWT diff --git a/CoAP.NET/Deduplication/SweepDeduplicator.cs b/CoAP.NET/Deduplication/SweepDeduplicator.cs index 34a58da..2667d2f 100644 --- a/CoAP.NET/Deduplication/SweepDeduplicator.cs +++ b/CoAP.NET/Deduplication/SweepDeduplicator.cs @@ -34,7 +34,7 @@ class SweepDeduplicator : IDeduplicator = new ConcurrentDictionary(); private Timer _timer; private readonly ICoapConfig _config; - private int _period; + // private int _period; public SweepDeduplicator(ICoapConfig config) { diff --git a/CoAP.NET/EndPoint/Resources/Resource.cs b/CoAP.NET/EndPoint/Resources/Resource.cs index e404177..f9224b5 100644 --- a/CoAP.NET/EndPoint/Resources/Resource.cs +++ b/CoAP.NET/EndPoint/Resources/Resource.cs @@ -15,7 +15,6 @@ using System.Text; using Com.AugustCellars.CoAP.Log; using Com.AugustCellars.CoAP.Observe; -using Com.AugustCellars.CoAP.Util; using Com.AugustCellars.CoAP.Server.Resources; using Com.AugustCellars.CoAP.Net; using Com.AugustCellars.CoAP.Threading; @@ -27,13 +26,12 @@ namespace Com.AugustCellars.CoAP.EndPoint.Resources /// public partial class RemoteResource : IComparable, IResource { - private static ILogger log = LogManager.GetLogger(typeof(Resource)); + private static readonly ILogger log = LogManager.GetLogger(typeof(Resource)); private Int32 _totalSubResourceCount; private HashSet _attributes; private RemoteResource _parent; private SortedDictionary _subResources; - private Boolean _hidden; /// /// Initialize a resource. @@ -51,22 +49,19 @@ public RemoteResource(String resourceIdentifier) : this(resourceIdentifier, fals public RemoteResource(String resourceIdentifier, Boolean hidden) { Name = resourceIdentifier; - _hidden = hidden; + Hidden = hidden; _attributes = new HashSet(); } /// - public String Uri - { - get => Path + Name; - } + public string Uri => Path + Name; /// /// Gets the URI of this resource. /// - public String Path + public string Path { - get => String.Empty; + get => string.Empty; set => throw new NotSupportedException(); } @@ -83,12 +78,6 @@ public IResource Parent /// public ResourceAttributes Attributes { get; } = new ResourceAttributes(); - [Obsolete("Use Attributes")] - public ICollection LinkAttributes - { - get { return _attributes; } - } - [Obsolete("use Attributes.Get()")] public IList GetAttributes(String name) { @@ -100,36 +89,24 @@ public IList GetAttributes(String name) return newList.AsReadOnly(); } - [Obsolete("use Attributes.Add()")] - public Boolean SetAttribute(LinkAttribute attr) + private Boolean SetAttribute(LinkAttribute attr) { Attributes.Add(attr.Name, attr.Value.ToString()); return true; } - [Obsolete("use Attributes.Clear()")] - public Boolean ClearAttribute(String name) + private Boolean ClearAttribute(String name) { Attributes.Clear(name); return true; } /// - public Boolean Visible - { - get => !_hidden; - } + public bool Visible => !Hidden; - public Boolean Hidden - { - get { return _hidden; } - set { _hidden = value; } - } + public bool Hidden { get; set; } - public IList ResourceTypes - { - get { return GetStringValues(GetAttributes(LinkFormat.ResourceType)); } - } + public IList ResourceTypes => Attributes.GetValues(LinkFormat.ResourceType).ToList(); /// /// Gets or sets the type attribute of this resource. @@ -147,25 +124,15 @@ public string ResourceType /// /// Gets or sets the title attribute of this resource. /// - public String Title + public string Title { - get - { - IList attrs = GetAttributes(LinkFormat.Title); - return attrs.Count == 0 ? null : attrs[0].StringValue; - } - set - { - ClearAttribute(LinkFormat.Title); - SetAttribute(new LinkAttribute(LinkFormat.Title, value)); - } + get => Attributes.Title; + set => Attributes.Title = value; } - public IList InterfaceDescriptions - { - get { return GetStringValues(GetAttributes(LinkFormat.InterfaceDescription)); } - } + public IList InterfaceDescriptions => Attributes.GetValues(LinkFormat.InterfaceDescription).ToList(); +#if false /// /// Gets or sets the interface description attribute of this resource. /// @@ -178,11 +145,14 @@ public String InterfaceDescription } set { SetAttribute(new LinkAttribute(LinkFormat.InterfaceDescription, value)); } } +#endif +#if false public IList GetContentTypeCodes { get { return GetIntValues(GetAttributes(LinkFormat.ContentType)); } } +#endif /// /// Gets or sets the content type code attribute of this resource. @@ -190,7 +160,7 @@ public IList GetContentTypeCodes [Obsolete("Use Attributes.GetContentTypes()")] public Int32 ContentTypeCode { - get + get { IList attrs = GetAttributes(LinkFormat.ContentType); return attrs.Count == 0 ? 0 : attrs[0].IntValue; @@ -203,12 +173,8 @@ public Int32 ContentTypeCode /// public Int32 MaximumSizeEstimate { - get - { - IList attrs = GetAttributes(LinkFormat.MaxSizeEstimate); - return attrs.Count == 0 ? -1 : attrs[0].IntValue; - } - set { SetAttribute(new LinkAttribute(LinkFormat.MaxSizeEstimate, value)); } + get => Attributes.MaximumSizeEstimate; + set => Attributes.MaximumSizeEstimate = value; } /// @@ -216,12 +182,8 @@ public Int32 MaximumSizeEstimate /// public Boolean Observable { - get { return GetAttributes(LinkFormat.Observable).Count > 0; } - set - { - if (value) SetAttribute(new LinkAttribute(LinkFormat.Observable, value)); - else ClearAttribute(LinkFormat.Observable); - } + get => Attributes.Observable; + set => Attributes.Observable = value; } /// @@ -414,12 +376,16 @@ private void Print(StringBuilder sb, Int32 indent) if (title != null) sb.AppendFormat(" {0}", title); sb.AppendLine(); - foreach (LinkAttribute attr in LinkAttributes) { - if (attr.Name.Equals(LinkFormat.Title)) continue; - for (Int32 i = 0; i < indent + 3; i++) sb.Append(" "); - sb.AppendFormat("- "); - attr.Serialize(sb); - sb.AppendLine(); + foreach (string key in Attributes.Keys) { + if (key.Equals(LinkFormat.Title)) continue; + + foreach (string val in Attributes.GetValues(key)) { + for (Int32 i = 0; i < indent + 3; i++) sb.Append(" "); + for (Int32 i = 0; i < indent + 3; i++) sb.Append(" "); + sb.Append($"{key} = {val}"); + sb.AppendLine(); + + } } if (_subResources != null) diff --git a/CoAP.NET/MediaType.cs b/CoAP.NET/MediaType.cs index a94b9a9..57d912e 100644 --- a/CoAP.NET/MediaType.cs +++ b/CoAP.NET/MediaType.cs @@ -30,21 +30,6 @@ public class MediaType /// public const int TextPlain = 0; /// - /// text/xml - /// - [Obsolete("Media type was never registered")] - public const int TextXml = 1; - /// - /// text/csv - /// - [Obsolete("Media type was never registered")] - public const int TextCsv = 2; - /// - /// text/html - /// - [Obsolete("Media type was never registered")] - public const int TextHtml = 3; - /// /// Application/cose; cose-type="cose-encrypt0" /// public const int ApplicationCoseEncrypt0 = 16; @@ -57,36 +42,6 @@ public class MediaType /// public const int ApplicationCoseSign1 = 18; /// - /// image/gif - /// - [Obsolete("Media type was never registered")] - public const int ImageGif = 21; - /// - /// image/jpeg - /// - [Obsolete("Media type was never registered")] - public const int ImageJpeg = 22; - /// - /// image/png - /// - [Obsolete("Media type was never registered")] - public const int ImagePng = 23; - /// - /// image/tiff - /// - [Obsolete("Media type was never registered")] - public const int ImageTiff = 24; - /// - /// audio/raw - /// - [Obsolete("Media type was never registered")] - public const int AudioRaw = 25; - /// - /// video/raw - /// - [Obsolete("Media type was never registered")] - public const int VideoRaw = 26; - /// /// application/link-format /// public const int ApplicationLinkFormat = 40; @@ -99,40 +54,10 @@ public class MediaType /// public const int ApplicationOctetStream = 42; /// - /// application/rdf+xml - /// - [Obsolete("Media type was never registered")] - public const int ApplicationRdfXml = 43; - /// - /// application/soap+xml - /// - [Obsolete("Media type was never registered")] - public const int ApplicationSoapXml = 44; - /// - /// application/atom+xml - /// - [Obsolete("Media type was never registered")] - public const int ApplicationAtomXml = 45; - /// - /// application/xmpp+xml - /// - [Obsolete("Media type was never registered")] - public const int ApplicationXmppXml = 46; - /// /// application/exi /// public const int ApplicationExi = 47; /// - /// application/fastinfoset - /// - [Obsolete("Media type was never registered")] - public const int ApplicationFastinfoset = 48; - /// - /// application/soap+fastinfoset - /// - [Obsolete("Media type was never registered")] - public const int ApplicationSoapFastinfoset = 49; - /// /// application/json [RFC 7159] /// public const int ApplicationJson = 50; @@ -141,11 +66,6 @@ public class MediaType /// public const int ApplicationJsonPatchJson = 51; /// - /// application/x-obix-binary - /// - [Obsolete("Media type was never registered")] - public const int ApplicationXObixBinary = 51; - /// /// application/merge-patch+json [RFC 7396] /// public const int ApplicationMergePatchJson = 52; @@ -214,27 +134,10 @@ public MediaTypeInfo(string[] contentType, bool isText=false, bool isCbor=false) static MediaType() { registry.Add(TextPlain, new MediaTypeInfo(new string[] { "text/plain", "txt" }, true)); - registry.Add(TextXml, new MediaTypeInfo(new string[] { "text/xml", "xml" }, true)); - registry.Add(TextCsv, new MediaTypeInfo(new string[] { "text/csv", "csv" }, true)); - registry.Add(TextHtml, new MediaTypeInfo(new string[] { "text/html", "html" }, true)); - - registry.Add(ImageGif, new MediaTypeInfo(new string[] { "image/gif", "gif" })); - registry.Add(ImageJpeg, new MediaTypeInfo(new string[] { "image/jpeg", "jpg" })); - registry.Add(ImagePng, new MediaTypeInfo(new string[] { "image/png", "png" })); - registry.Add(ImageTiff, new MediaTypeInfo(new string[] { "image/tiff", "tif" })); - registry.Add(AudioRaw, new MediaTypeInfo(new string[] { "audio/raw", "raw" })); - registry.Add(VideoRaw, new MediaTypeInfo(new string[] { "video/raw", "raw" })); registry.Add(ApplicationLinkFormat, new MediaTypeInfo(new string[] { "application/link-format", "wlnk" }, true)); registry.Add(ApplicationXml, new MediaTypeInfo(new string[] { "application/xml", "xml" }, true)); registry.Add(ApplicationOctetStream, new MediaTypeInfo(new string[] { "application/octet-stream", "bin" })); - registry.Add(ApplicationRdfXml, new MediaTypeInfo(new string[] {"application/rdf+xml", "rdf"}, true)); - registry.Add(ApplicationSoapXml, new MediaTypeInfo(new string[] {"application/soap+xml", "soap"}, true)); - registry.Add(ApplicationAtomXml, new MediaTypeInfo(new string[] {"application/atom+xml", "atom"}, true)); - registry.Add(ApplicationXmppXml, new MediaTypeInfo(new string[] {"application/xmpp+xml", "xmpp"}, true)); - registry.Add(ApplicationFastinfoset, new MediaTypeInfo(new string[] { "application/fastinfoset", "finf"})); - registry.Add(ApplicationSoapFastinfoset, new MediaTypeInfo(new string[] {"application/soap+fastinfoset", "soap.finf"})); - registry.Add(ApplicationXObixBinary, new MediaTypeInfo(new string[] { "application/x-obix-binary", "obix" })); registry.Add(ApplicationExi, new MediaTypeInfo(new string[] { "application/exi", "exi" })); registry.Add(ApplicationJson, new MediaTypeInfo(new string[] { "application/json", "json" }, false)); // Compressed w/ deflate @@ -246,9 +149,10 @@ static MediaType() /// /// The media type to be checked /// True iff the media type is a type of image + [Obsolete("No image media types exist anymore - only returns false")] public static Boolean IsImage(int mediaType) { - return mediaType >= ImageGif && mediaType <= ImageTiff; + return false; } public static Boolean IsPrintable(int mediaType)