Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ConvertFrom() [1/2]

override? object System.ComponentModel.VersionConverter.ConvertFrom ( ITypeDescriptorContext? context,
CultureInfo? culture,
object value )
inlinevirtual

Reimplemented from System.ComponentModel.TypeConverter.

Definition at line 27 of file VersionConverter.cs.

28 {
29 if (value is string text)
30 {
31 try
32 {
33 return Version.Parse(text);
34 }
35 catch (Exception innerException)
36 {
37 throw new FormatException(System.SR.Format(System.SR.ConvertInvalidPrimitive, text, "Version"), innerException);
38 }
39 }
40 if (value is Version version)
41 {
42 return new Version(version.Major, version.Minor, version.Build, version.Revision);
43 }
44 return base.ConvertFrom(context, culture, value);
45 }
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string ConvertInvalidPrimitive
Definition SR.cs:20
Definition SR.cs:7

References System.SR.ConvertInvalidPrimitive, System.culture, System.SR.Format(), System.Version.Parse(), System.text, and System.value.