|
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) |
|
◆ CanConvertFrom()
override bool BrawlLib.Internal.Vector3StringConverter.CanConvertFrom |
( |
ITypeDescriptorContext |
context, |
|
|
Type |
sourceType |
|
) |
| |
|
inline |
74 {
75 return sourceType == typeof(string);
76 }
◆ CanConvertTo()
override bool BrawlLib.Internal.Vector3StringConverter.CanConvertTo |
( |
ITypeDescriptorContext |
context, |
|
|
Type |
destinationType |
|
) |
| |
|
inline |
63 {
64 return destinationType == typeof(Vector3);
65 }
◆ ConvertFrom()
override object BrawlLib.Internal.Vector3StringConverter.ConvertFrom |
( |
ITypeDescriptorContext |
context, |
|
|
CultureInfo |
culture, |
|
|
object |
value |
|
) |
| |
|
inline |
79 {
80 Vector3 v = new Vector3();
81
82 string s = value?.ToString() ?? "";
83 string[] arr = s.Split(LanguageCheck.DecimalDelimiters, StringSplitOptions.RemoveEmptyEntries);
84
85 if (arr.Length == 3)
86 {
87 float.TryParse(arr[0], out v._x);
88 float.TryParse(arr[1], out v._y);
89 float.TryParse(arr[2], out v._z);
90 }
91 else if (arr.Length == 1 && float.TryParse(arr[0], out float i))
92 {
93 v._x = i;
94 v._y = i;
95 v._z = i;
96 }
97
98 return v;
99 }
◆ ConvertTo()
override object BrawlLib.Internal.Vector3StringConverter.ConvertTo |
( |
ITypeDescriptorContext |
context, |
|
|
CultureInfo |
culture, |
|
|
object |
value, |
|
|
Type |
destinationType |
|
) |
| |
|
inline |
69 {
70 return value?.ToString();
71 }
The documentation for this class was generated from the following file:
- BrawlLib/Internal/StringConverters.cs