Provide dummy implementations for classes not available on the iPhone.

This commit is contained in:
the_fiddler 2009-10-24 10:35:15 +00:00
parent 198c12ef35
commit f25e37c22a

93
Source/OpenTK/Minimal.cs Normal file
View file

@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK
{
// Override a number of System.* classes when compiling for
// minimal targets (e.g. MonoTouch).
// Note: the "overriden" classes must not be fully qualified for this to work!
#if IPHONE
// System.Diagnostics.Debug
static class Debug
{
public static void Write(string message) { }
public static void Write(object obj) { }
public static void WriteLine(string message) { }
public static void WriteLine(object obj) { }
public static void Print(string message) { }
public static void Print(string format, params object[] args) { }
public static void Indent() { }
public static void Unindent() { }
public static void Flush() { }
}
// System.Diagnostics.Trace
static class Trace
{
public static void Write(string message) { }
public static void Write(object obj) { }
public static void WriteLine(string message) { }
public static void WriteLine(object obj) { }
public static void Indent() { }
public static void Unindent() { }
public static void Flush() { }
}
// System.Diagnostics.Stopwatch
sealed class Stopwatch
{
DateTime start, stop;
bool running;
public void Reset()
{
start = stop = DateTime.MinValue;
running = false;
}
public void Start()
{
start = DateTime.Now;
running = true;
}
public void Stop()
{
stop = DateTime.Now;
running = false;
}
public TimeSpan Elapsed
{
get
{
if (running)
return TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks);
else
return TimeSpan.FromTicks(stop.Ticks - start.Ticks);
}
}
}
// System.Xml.XmlIgnoreAttribute
class XmlIgnoreAttribute : Attribute
{
}
// System.ComponentModel.EditorBrowrableAttribute
class EditorBrowsableAttribute : Attribute
{
public EditorBrowsableAttribute(EditorBrowsableState state) { }
}
// System.ComponentModel.EditorBrowsableState
enum EditorBrowsableState
{
Always = 0,
Never = 1,
Advanced = 2,
}
#endif
}