Skip to content

Commit

Permalink
Added new containers, improved properties, and minor bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Winterleaf committed Apr 24, 2013
1 parent 99d8f5d commit 5817cf3
Show file tree
Hide file tree
Showing 633 changed files with 132,084 additions and 110,163 deletions.
28,987 changes: 19,874 additions & 9,113 deletions Engine/lib/DNT/Classes/SafeNativeMethods.cs

Large diffs are not rendered by default.

52,339 changes: 29,063 additions & 23,276 deletions Engine/lib/DNT/Classes/TorqueScriptTemplate.cs

Large diffs are not rendered by default.

73 changes: 65 additions & 8 deletions Engine/lib/DNT/Classes/myExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,51 @@ namespace WinterLeaf.Classes
/// </summary>
public static class MyExtensions
{
/// <summary>
/// Converts string to a Vector of Bools
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static VectorBool AsVectorBool(this string value)
{
return new VectorBool(value);
}

/// <summary>
/// Converts string to a Vector of Ints
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static VectorInt AsVectorInt(this string value)
{
return new VectorInt(value);
}

/// <summary>
/// Converts string to a Vector of Floats.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static VectorFloat AsVectorFloat(this string value)
{
return new VectorFloat(value);
}


/// <summary>
/// Converts string to an EaseF
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static EaseF AsEaseF(this string value)
{
return new EaseF(value);
}

/// <summary>
/// Converts string to a sByte
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static sbyte AsSbyte(this string value)
{
if (value.Trim().ToLower() == "true")
Expand All @@ -97,28 +124,53 @@ public static sbyte AsSbyte(this string value)
return s;
}
throw new Exception("Failed to parse sbyte.");

}

/// <summary>
/// Converts String to a RectF
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static RectF AsRectF(this string value)
{
return new RectF(value);
}

/// <summary>
/// Converts string to a RectI
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static RectI AsRectI(this string value)
{
return new RectI(value);
}

/// <summary>
/// Converts RectF to a string
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static string AsString(this RectF value)
{
return value.AsString();
}

/// <summary>
/// Converts a Polyhedron to a string
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static string AsPolyhedron(this Polyhedron value)
{
return value.AsString();
}

/// <summary>
/// Converts string to a Polyhedron
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static Polyhedron AsPolyhedron(this string value)
{
return new Polyhedron(value);
Expand Down Expand Up @@ -244,7 +296,12 @@ public static string AsString(this Int32 value)
return value.ToString(CultureInfo.GetCultureInfo("en"));
}

static public string AsString(this sbyte value)
/// <summary>
/// Converts sByte to string
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static string AsString(this sbyte value)
{
return value.ToString(CultureInfo.GetCultureInfo("en"));
}
Expand Down Expand Up @@ -316,7 +373,7 @@ public static string AsString(this UInt16 value)
/// <returns> float </returns>
public static string AsString(this float value)
{
return ((double)value).ToString("0.000", CultureInfo.GetCultureInfo("en"));
return ((double) value).ToString("0.000", CultureInfo.GetCultureInfo("en"));
}

/// <summary>
Expand Down Expand Up @@ -425,7 +482,7 @@ public static int AsInt(this string value)
double d;
if (double.TryParse(value, out d))
{
return (int)d;
return (int) d;
}

throw new Exception("Failed to cast string to int");
Expand All @@ -441,7 +498,7 @@ public static Byte AsByte(this string value)
if (value.Trim() == "")
return 0;
Byte i;
return Byte.TryParse(value, out i) ? i : (byte)0;
return Byte.TryParse(value, out i) ? i : (byte) 0;
}

/// <summary>
Expand Down Expand Up @@ -470,7 +527,7 @@ public static uint AsUint(this string value)

int i;
if (int.TryParse(value, NumberStyles.Number, CultureInfo.GetCultureInfo("en"), out i))
return (uint)i;
return (uint) i;
throw new Exception("Failed to cast string to uint");
}

Expand All @@ -486,7 +543,7 @@ public static float AsFloat(this string value)
double v;
if (double.TryParse(value, NumberStyles.Number | NumberStyles.AllowExponent, CultureInfo.GetCultureInfo("en"), out v))
{
return (float)v;
return (float) v;
}
float f;
if (float.TryParse(value, NumberStyles.Number | NumberStyles.AllowExponent, CultureInfo.GetCultureInfo("en"), out f))
Expand Down
Loading

0 comments on commit 5817cf3

Please sign in to comment.