tModLoader v0.11.8.9
A mod to make and play Terraria mods
Terraria.ModLoader.FrameworkVersion Class Reference
+ Collaboration diagram for Terraria.ModLoader.FrameworkVersion:

Static Public Attributes

static readonly Framework Framework
 
static readonly Version Version
 

Static Private Member Functions

static FrameworkVersion ()
 
static Version CheckFor45PlusVersion (int releaseKey)
 

Detailed Description

Definition at line 15 of file FrameworkVersion.cs.

Constructor & Destructor Documentation

◆ FrameworkVersion()

static Terraria.ModLoader.FrameworkVersion.FrameworkVersion ( )
staticprivate

Definition at line 20 of file FrameworkVersion.cs.

20 {
21 var monoRuntimeType = Type.GetType("Mono.Runtime");
22 if (monoRuntimeType != null) {
23 string displayName = (string)monoRuntimeType.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, null);
24 Framework = Framework.Mono;
25 Version = new Version(displayName.Substring(0, displayName.IndexOf(' ')));
26 return;
27 }
28
29 if (!Platform.IsWindows)
30 Framework = Framework.Unknown;
31
32 Framework = Framework.NetFramework;
33
34 const string subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\";
35 using (RegistryKey ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey))
36 if (ndpKey != null && ndpKey.GetValue("Release") is int releaseKey)
37 Version = CheckFor45PlusVersion(releaseKey);
38
39 if (Version == null)
40 Version = new Version(4, 0);
41 }
System.Version Version
Definition: ModLoader.cs:21
static Version CheckFor45PlusVersion(int releaseKey)
static readonly Framework Framework

References Terraria.ModLoader.FrameworkVersion.CheckFor45PlusVersion(), and Terraria.ModLoader.FrameworkVersion.Version.

+ Here is the call graph for this function:

Member Function Documentation

◆ CheckFor45PlusVersion()

static Version Terraria.ModLoader.FrameworkVersion.CheckFor45PlusVersion ( int  releaseKey)
staticprivate

Definition at line 44 of file FrameworkVersion.cs.

44 {
45 if (releaseKey >= 528040)
46 return new Version("4.8");
47 if (releaseKey >= 461808)
48 return new Version("4.7.2");
49 if (releaseKey >= 461308)
50 return new Version("4.7.1");
51 if (releaseKey >= 460798)
52 return new Version("4.7");
53 if (releaseKey >= 394802)
54 return new Version("4.6.2");
55 if (releaseKey >= 394254)
56 return new Version("4.6.1");
57 if (releaseKey >= 393295)
58 return new Version("4.6");
59 if (releaseKey >= 379893)
60 return new Version("4.5.2");
61 if (releaseKey >= 378675)
62 return new Version("4.5.1");
63 if (releaseKey >= 378389)
64 return new Version("4.5");
65
66 throw new Exception("No 4.5 or later version detected");
67 }

References Terraria.ModLoader.FrameworkVersion.Version.

Referenced by Terraria.ModLoader.FrameworkVersion.FrameworkVersion().

+ Here is the caller graph for this function:

Member Data Documentation

◆ Framework

◆ Version