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

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.MatrixStringConverter.CanConvertFrom ( ITypeDescriptorContext  context,
Type  sourceType 
)
inline
308 {
309 return sourceType == typeof(string);
310 }

◆ CanConvertTo()

override bool BrawlLib.Internal.MatrixStringConverter.CanConvertTo ( ITypeDescriptorContext  context,
Type  destinationType 
)
inline
297 {
298 return destinationType == typeof(Matrix);
299 }

◆ ConvertFrom()

override object BrawlLib.Internal.MatrixStringConverter.ConvertFrom ( ITypeDescriptorContext  context,
CultureInfo  culture,
object  value 
)
inline
313 {
314 Matrix m = new Matrix();
315
316 string s = value?.ToString() ?? "";
317 string[] arr = s.Split(LanguageCheck.DecimalDelimiters, StringSplitOptions.RemoveEmptyEntries);
318
319 if (arr.Length == 16)
320 {
321 float.TryParse(arr[0], out m.Data[0]);
322 float.TryParse(arr[1], out m.Data[1]);
323 float.TryParse(arr[2], out m.Data[2]);
324 float.TryParse(arr[3], out m.Data[3]);
325 float.TryParse(arr[4], out m.Data[4]);
326 float.TryParse(arr[5], out m.Data[5]);
327 float.TryParse(arr[6], out m.Data[6]);
328 float.TryParse(arr[7], out m.Data[7]);
329 float.TryParse(arr[8], out m.Data[8]);
330 float.TryParse(arr[9], out m.Data[9]);
331 float.TryParse(arr[10], out m.Data[10]);
332 float.TryParse(arr[11], out m.Data[11]);
333 float.TryParse(arr[12], out m.Data[12]);
334 float.TryParse(arr[13], out m.Data[13]);
335 float.TryParse(arr[14], out m.Data[14]);
336 float.TryParse(arr[15], out m.Data[15]);
337 }
338 else if (arr.Length == 1 && float.TryParse(arr[0], out float f))
339 {
340 m.Data[0] = f;
341 m.Data[1] = f;
342 m.Data[2] = f;
343 m.Data[3] = f;
344 m.Data[4] = f;
345 m.Data[5] = f;
346 m.Data[6] = f;
347 m.Data[7] = f;
348 m.Data[8] = f;
349 m.Data[9] = f;
350 m.Data[10] = f;
351 m.Data[11] = f;
352 m.Data[12] = f;
353 m.Data[13] = f;
354 m.Data[14] = f;
355 m.Data[15] = f;
356 }
357
358 return m;
359 }

◆ ConvertTo()

override object BrawlLib.Internal.MatrixStringConverter.ConvertTo ( ITypeDescriptorContext  context,
CultureInfo  culture,
object  value,
Type  destinationType 
)
inline
303 {
304 return value?.ToString();
305 }

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