BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | List of all members
BrawlLib.Internal.QuaternionStringConverter Class Reference
Inheritance diagram for BrawlLib.Internal.QuaternionStringConverter:

Public Member Functions

override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
 
override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 
override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
 
override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
 

Member Function Documentation

◆ CanConvertFrom()

override bool BrawlLib.Internal.QuaternionStringConverter.CanConvertFrom ( ITypeDescriptorContext  context,
Type  sourceType 
)
inline
376 {
377 return sourceType == typeof(string);
378 }

◆ CanConvertTo()

override bool BrawlLib.Internal.QuaternionStringConverter.CanConvertTo ( ITypeDescriptorContext  context,
Type  destinationType 
)
inline
365 {
366 return destinationType == typeof(Vector4);
367 }

◆ ConvertFrom()

override object BrawlLib.Internal.QuaternionStringConverter.ConvertFrom ( ITypeDescriptorContext  context,
CultureInfo  culture,
object  value 
)
inline
381 {
382 Vector4 q = new Vector4();
383
384 string s = value?.ToString() ?? "";
385 string[] arr = s.Split(LanguageCheck.DecimalDelimiters, StringSplitOptions.RemoveEmptyEntries);
386
387 if (arr.Length == 4)
388 {
389 float.TryParse(arr[0], out q._x);
390 float.TryParse(arr[1], out q._y);
391 float.TryParse(arr[2], out q._z);
392 float.TryParse(arr[3], out q._w);
393 }
394 else if (arr.Length == 1 && float.TryParse(arr[0], out float f))
395 {
396 q._x = f;
397 q._y = f;
398 q._z = f;
399 q._w = f;
400 }
401
402 return q;
403 }

◆ ConvertTo()

override object BrawlLib.Internal.QuaternionStringConverter.ConvertTo ( ITypeDescriptorContext  context,
CultureInfo  culture,
object  value,
Type  destinationType 
)
inline
371 {
372 return value?.ToString();
373 }

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