From 058ea34f41fb21f85e10bfce11d242ac4b2ef847 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Mon, 8 Nov 2010 21:46:36 +0000 Subject: [PATCH] Print useful information in ToString() method. Updated license text. --- Source/OpenTK/Graphics/GraphicsContext.cs | 64 ++++++++++++++++++++--- 1 file changed, 58 insertions(+), 6 deletions(-) diff --git a/Source/OpenTK/Graphics/GraphicsContext.cs b/Source/OpenTK/Graphics/GraphicsContext.cs index 54b859d5..38817755 100644 --- a/Source/OpenTK/Graphics/GraphicsContext.cs +++ b/Source/OpenTK/Graphics/GraphicsContext.cs @@ -1,9 +1,28 @@ -#region --- License --- -/* Licensed under the MIT/X11 license. - * Copyright (c) 2006-2008 the OpenTK Team. - * This notice may not be removed from any source distribution. - * See license.txt for licensing detailed licensing details. - */ +#region License +// +// The Open Toolkit Library License +// +// Copyright (c) 2006 - 2010 the Open Toolkit library. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// #endregion using System; @@ -190,6 +209,39 @@ namespace OpenTK.Graphics #endregion + #region Public Members + + /// + /// Returns a representing this instance. + /// + /// A that contains a string representation of this instance. + public override string ToString() + { + return (this as IGraphicsContextInternal).Context.ToString(); + } + + /// + /// Returns the hash code for this instance. + /// + /// A System.Int32 with the hash code of this instance. + public override int GetHashCode() + { + return (this as IGraphicsContextInternal).Context.GetHashCode(); + } + + /// + /// Compares two instances. + /// + /// The instance to compare to. + /// True, if obj is equal to this instance; false otherwise. + public override bool Equals(object obj) + { + return (obj is GraphicsContext) && + (this as IGraphicsContextInternal).Context == (obj as IGraphicsContextInternal).Context; + } + + #endregion + #region Private Members static IGraphicsContext FindSharedContext()