Photon .NET Client API
Classes | Public Member Functions | Static Public Member Functions | Static Protected Attributes | List of all members
ExitGames.Client.Photon.SupportClass Class Reference

Contains several (more or less) useful static methods, mostly used for debugging. More...

Classes

class  ThreadSafeRandom
 Class to wrap static access to the random.Next() call in a thread safe manner. More...
 

Public Member Functions

delegate int IntegerMillisecondsDelegate ()
 

Static Public Member Functions

static uint CalculateCrc (byte[] buffer, int length)
 
static List< MethodInfo > GetMethods (Type type, Type attribute)
 
static int GetTickCount ()
 Gets the local machine's "milliseconds since start" value (precision is described in remarks). More...
 
static void CallInBackground (Func< bool > myThread)
 Creates a background thread that calls the passed function in 100ms intervals, as long as that returns true. More...
 
static void CallInBackground (Func< bool > myThread, int millisecondsInterval)
 Creates a background thread that calls the passed function in 100ms intervals, as long as that returns true. More...
 
static void WriteStackTrace (System.Exception throwable, System.IO.TextWriter stream)
 Writes the exception's stack trace to the received stream. More...
 
static void WriteStackTrace (System.Exception throwable)
 Writes the exception's stack trace to the received stream. Writes to: System.Diagnostics.Debug. More...
 
static string DictionaryToString (IDictionary dictionary)
 This method returns a string, representing the content of the given IDictionary. Returns "null" if parameter is null. More...
 
static string DictionaryToString (IDictionary dictionary, bool includeTypes)
 This method returns a string, representing the content of the given IDictionary. Returns "null" if parameter is null. More...
 
static string HashtableToString (Hashtable hash)
 
static void NumberToByteArray (byte[] buffer, int index, short number)
 Inserts the number's value into the byte array, using Big-Endian order (a.k.a. Network-byte-order). More...
 
static void NumberToByteArray (byte[] buffer, int index, int number)
 Inserts the number's value into the byte array, using Big-Endian order (a.k.a. Network-byte-order). More...
 
static string ByteArrayToString (byte[] list)
 Converts a byte-array to string (useful as debugging output). Uses BitConverter.ToString(list) internally after a null-check of list. More...
 

Static Protected Attributes

static IntegerMillisecondsDelegate IntegerMilliseconds = () => (int)(Environment.TickCount)
 

Detailed Description

Contains several (more or less) useful static methods, mostly used for debugging.

Member Function Documentation

static string ExitGames.Client.Photon.SupportClass.ByteArrayToString ( byte[]  list)
inlinestatic

Converts a byte-array to string (useful as debugging output). Uses BitConverter.ToString(list) internally after a null-check of list.

Parameters
listByte-array to convert to string.
Returns
List of bytes as string.
static uint ExitGames.Client.Photon.SupportClass.CalculateCrc ( byte[]  buffer,
int  length 
)
inlinestatic
static void ExitGames.Client.Photon.SupportClass.CallInBackground ( Func< bool >  myThread)
inlinestatic

Creates a background thread that calls the passed function in 100ms intervals, as long as that returns true.

Parameters
myThread
static void ExitGames.Client.Photon.SupportClass.CallInBackground ( Func< bool >  myThread,
int  millisecondsInterval 
)
inlinestatic

Creates a background thread that calls the passed function in 100ms intervals, as long as that returns true.

Parameters
myThread
millisecondsIntervalMilliseconds to sleep between calls of myThread.
static string ExitGames.Client.Photon.SupportClass.DictionaryToString ( IDictionary  dictionary)
inlinestatic

This method returns a string, representing the content of the given IDictionary. Returns "null" if parameter is null.

Parameters
dictionaryIDictionary to return as string.
Returns
The string representation of keys and values in IDictionary.
static string ExitGames.Client.Photon.SupportClass.DictionaryToString ( IDictionary  dictionary,
bool  includeTypes 
)
inlinestatic

This method returns a string, representing the content of the given IDictionary. Returns "null" if parameter is null.

Parameters
dictionaryIDictionary to return as string.
includeTypes
static List<MethodInfo> ExitGames.Client.Photon.SupportClass.GetMethods ( Type  type,
Type  attribute 
)
inlinestatic
static int ExitGames.Client.Photon.SupportClass.GetTickCount ( )
inlinestatic

Gets the local machine's "milliseconds since start" value (precision is described in remarks).

This method uses Environment.TickCount (cheap but with only 16ms precision). PhotonPeer.LocalMsTimestampDelegate is available to set the delegate (unless already connected).

Returns
Fraction of the current time in Milliseconds (this is not a proper datetime timestamp).
static string ExitGames.Client.Photon.SupportClass.HashtableToString ( Hashtable  hash)
inlinestatic
delegate int ExitGames.Client.Photon.SupportClass.IntegerMillisecondsDelegate ( )
static void ExitGames.Client.Photon.SupportClass.NumberToByteArray ( byte[]  buffer,
int  index,
short  number 
)
inlinestatic

Inserts the number's value into the byte array, using Big-Endian order (a.k.a. Network-byte-order).

Parameters
bufferByte array to write into.
indexIndex of first position to write to.
numberNumber to write.
static void ExitGames.Client.Photon.SupportClass.NumberToByteArray ( byte[]  buffer,
int  index,
int  number 
)
inlinestatic

Inserts the number's value into the byte array, using Big-Endian order (a.k.a. Network-byte-order).

Parameters
bufferByte array to write into.
indexIndex of first position to write to.
numberNumber to write.
static void ExitGames.Client.Photon.SupportClass.WriteStackTrace ( System.Exception  throwable,
System.IO.TextWriter  stream 
)
inlinestatic

Writes the exception's stack trace to the received stream.

Parameters
throwableException to obtain information from.
streamOutput sream used to write to.
static void ExitGames.Client.Photon.SupportClass.WriteStackTrace ( System.Exception  throwable)
inlinestatic

Writes the exception's stack trace to the received stream. Writes to: System.Diagnostics.Debug.

Parameters
throwableException to obtain information from.

Member Data Documentation

IntegerMillisecondsDelegate ExitGames.Client.Photon.SupportClass.IntegerMilliseconds = () => (int)(Environment.TickCount)
staticprotected

The documentation for this class was generated from the following file: