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

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.Matrix43StringConverter.CanConvertFrom ( ITypeDescriptorContext  context,
Type  sourceType 
)
inline
248 {
249 return sourceType == typeof(string);
250 }

◆ CanConvertTo()

override bool BrawlLib.Internal.Matrix43StringConverter.CanConvertTo ( ITypeDescriptorContext  context,
Type  destinationType 
)
inline
237 {
238 return destinationType == typeof(Matrix34);
239 }

◆ ConvertFrom()

override object BrawlLib.Internal.Matrix43StringConverter.ConvertFrom ( ITypeDescriptorContext  context,
CultureInfo  culture,
object  value 
)
inline
253 {
254 Matrix34 m = new Matrix34();
255
256 string s = value?.ToString() ?? "";
257 string[] arr = s.Split(LanguageCheck.DecimalDelimiters, StringSplitOptions.RemoveEmptyEntries);
258
259 if (arr.Length == 12)
260 {
261 float.TryParse(arr[0], out m._data[0]);
262 float.TryParse(arr[1], out m._data[1]);
263 float.TryParse(arr[2], out m._data[2]);
264 float.TryParse(arr[3], out m._data[3]);
265 float.TryParse(arr[4], out m._data[4]);
266 float.TryParse(arr[5], out m._data[5]);
267 float.TryParse(arr[6], out m._data[6]);
268 float.TryParse(arr[7], out m._data[7]);
269 float.TryParse(arr[8], out m._data[8]);
270 float.TryParse(arr[9], out m._data[9]);
271 float.TryParse(arr[10], out m._data[10]);
272 float.TryParse(arr[11], out m._data[11]);
273 }
274 else if (arr.Length == 1 && float.TryParse(arr[0], out float f))
275 {
276 m._data[0] = f;
277 m._data[1] = f;
278 m._data[2] = f;
279 m._data[3] = f;
280 m._data[4] = f;
281 m._data[5] = f;
282 m._data[6] = f;
283 m._data[7] = f;
284 m._data[8] = f;
285 m._data[9] = f;
286 m._data[10] = f;
287 m._data[11] = f;
288 }
289
290 return m;
291 }

◆ ConvertTo()

override object BrawlLib.Internal.Matrix43StringConverter.ConvertTo ( ITypeDescriptorContext  context,
CultureInfo  culture,
object  value,
Type  destinationType 
)
inline
243 {
244 return value?.ToString();
245 }

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