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

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.Vector4StringConverter.CanConvertFrom ( ITypeDescriptorContext  context,
Type  sourceType 
)
inline
30 {
31 return sourceType == typeof(string);
32 }

◆ CanConvertTo()

override bool BrawlLib.Internal.Vector4StringConverter.CanConvertTo ( ITypeDescriptorContext  context,
Type  destinationType 
)
inline
19 {
20 return destinationType == typeof(Vector4);
21 }

◆ ConvertFrom()

override object BrawlLib.Internal.Vector4StringConverter.ConvertFrom ( ITypeDescriptorContext  context,
CultureInfo  culture,
object  value 
)
inline
35 {
36 Vector4 v = new Vector4();
37
38 string s = value?.ToString() ?? "";
39 string[] arr = s.Split(LanguageCheck.DecimalDelimiters, StringSplitOptions.RemoveEmptyEntries);
40
41 if (arr.Length == 4)
42 {
43 float.TryParse(arr[0], out v._x);
44 float.TryParse(arr[1], out v._y);
45 float.TryParse(arr[2], out v._z);
46 float.TryParse(arr[3], out v._w);
47 }
48 else if (arr.Length == 1 && float.TryParse(arr[0], out float i))
49 {
50 v._x = i;
51 v._y = i;
52 v._z = i;
53 v._w = i;
54 }
55
56 return v;
57 }

◆ ConvertTo()

override object BrawlLib.Internal.Vector4StringConverter.ConvertTo ( ITypeDescriptorContext  context,
CultureInfo  culture,
object  value,
Type  destinationType 
)
inline
25 {
26 return value?.ToString();
27 }

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