|
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.Vector2StringConverter.CanConvertFrom |
( |
ITypeDescriptorContext |
context, |
|
|
Type |
sourceType |
|
) |
| |
|
inline |
116 {
117 return sourceType == typeof(string);
118 }
◆ CanConvertTo()
override bool BrawlLib.Internal.Vector2StringConverter.CanConvertTo |
( |
ITypeDescriptorContext |
context, |
|
|
Type |
destinationType |
|
) |
| |
|
inline |
105 {
106 return destinationType == typeof(Vector2);
107 }
◆ ConvertFrom()
override object BrawlLib.Internal.Vector2StringConverter.ConvertFrom |
( |
ITypeDescriptorContext |
context, |
|
|
CultureInfo |
culture, |
|
|
object |
value |
|
) |
| |
|
inline |
121 {
122 Vector2 v = new Vector2();
123
124 string s = value?.ToString() ?? "";
125 string[] arr = s.Split(LanguageCheck.DecimalDelimiters, StringSplitOptions.RemoveEmptyEntries);
126
127 if (arr.Length == 2)
128 {
129 float.TryParse(arr[0], out v._x);
130 float.TryParse(arr[1], out v._y);
131 }
132 else if (arr.Length == 1 && float.TryParse(arr[0], out float i))
133 {
134 v._x = i;
135 v._y = i;
136 }
137
138 return v;
139 }
◆ ConvertTo()
override object BrawlLib.Internal.Vector2StringConverter.ConvertTo |
( |
ITypeDescriptorContext |
context, |
|
|
CultureInfo |
culture, |
|
|
object |
value, |
|
|
Type |
destinationType |
|
) |
| |
|
inline |
111 {
112 return value?.ToString();
113 }
The documentation for this class was generated from the following file:
- BrawlLib/Internal/StringConverters.cs