Terraria ModLoader  0.11.4
A framework for 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

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  }
static readonly Framework Framework
static Version CheckFor45PlusVersion(int releaseKey)

Member Function Documentation

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

Definition at line 44 of file FrameworkVersion.cs.

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

Member Data Documentation

readonly Version Terraria.ModLoader.FrameworkVersion.Version
static