From a8c55ae8fec58b3aacd1cf311a8ac9c2dda503ff Mon Sep 17 00:00:00 2001 From: Patrick Barron Date: Thu, 9 Nov 2023 14:46:13 -0500 Subject: Remove RSSDP --- RSSDP/DisposableManagedObjectBase.cs | 76 ------------------------------------ 1 file changed, 76 deletions(-) delete mode 100644 RSSDP/DisposableManagedObjectBase.cs (limited to 'RSSDP/DisposableManagedObjectBase.cs') diff --git a/RSSDP/DisposableManagedObjectBase.cs b/RSSDP/DisposableManagedObjectBase.cs deleted file mode 100644 index 5d7da4124..000000000 --- a/RSSDP/DisposableManagedObjectBase.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text; - -namespace Rssdp.Infrastructure -{ - /// - /// Correctly implements the interface and pattern for an object containing only managed resources, and adds a few common niceties not on the interface such as an property. - /// - public abstract class DisposableManagedObjectBase : IDisposable - { - /// - /// Override this method and dispose any objects you own the lifetime of if disposing is true; - /// - /// True if managed objects should be disposed, if false, only unmanaged resources should be released. - protected abstract void Dispose(bool disposing); - - /// - /// Throws and if the property is true. - /// - /// - /// Thrown if the property is true. - /// - protected virtual void ThrowIfDisposed() - { - if (this.IsDisposed) - { - throw new ObjectDisposedException(this.GetType().FullName); - } - } - - /// - /// Sets or returns a boolean indicating whether or not this instance has been disposed. - /// - /// - public bool IsDisposed - { - get; - private set; - } - - public string BuildMessage(string header, Dictionary values) - { - var builder = new StringBuilder(); - - const string ArgFormat = "{0}: {1}\r\n"; - - builder.AppendFormat(CultureInfo.InvariantCulture, "{0}\r\n", header); - - foreach (var pair in values) - { - builder.AppendFormat(CultureInfo.InvariantCulture, ArgFormat, pair.Key, pair.Value); - } - - builder.Append("\r\n"); - - return builder.ToString(); - } - - /// - /// Disposes this object instance and all internally managed resources. - /// - /// - /// Sets the property to true. Does not explicitly throw an exception if called multiple times, but makes no promises about behavior of derived classes. - /// - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", Justification = "We do exactly as asked, but CA doesn't seem to like us also setting the IsDisposed property. Too bad, it's a good idea and shouldn't cause an exception or anything likely to interfere with the dispose process.")] - public void Dispose() - { - IsDisposed = true; - - Dispose(true); - } - } -} -- cgit v1.2.3