MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Get

Method Get

Source/Tools/Flax.Build/Build/Sdk.cs:80–108  ·  view source on GitHub ↗

Gets the specified SDK. The SDK name. The SDK instance or null if not supported.

(string name)

Source from the content-addressed store, hash-verified

78 /// <param name="name">The SDK name.</param>
79 /// <returns>The SDK instance or null if not supported.</returns>
80 public static Sdk Get(string name)
81 {
82 if (_sdks == null)
83 {
84 using (new ProfileEventScope("GetSdks"))
85 {
86 _sdks = new Dictionary<string, Sdk>();
87 var types = Builder.BuildTypes.Where(x => !x.IsAbstract && x.IsSubclassOf(typeof(Sdk)));
88 foreach (var type in types)
89 {
90 object instance = null;
91 var instanceField = type.GetField("Instance", BindingFlags.Public | BindingFlags.Static);
92 if (instanceField != null)
93 {
94 instance = instanceField.GetValue(null);
95 }
96 else if (type.GetConstructor(Type.EmptyTypes) != null)
97 {
98 instance = Activator.CreateInstance(type);
99 }
100 if (instance != null)
101 _sdks.Add(type.Name, (Sdk)instance);
102 }
103 }
104 }
105
106 _sdks.TryGetValue(name, out var result);
107 return result;
108 }
109
110 /// <summary>
111 /// Returns true if SDK is supported and is valid.

Callers 3

MainMethod · 0.45
BuildMethod · 0.45
BuildMethod · 0.45

Calls 7

WhereMethod · 0.80
IsSubclassOfMethod · 0.45
GetFieldMethod · 0.45
GetValueMethod · 0.45
CreateInstanceMethod · 0.45
AddMethod · 0.45
TryGetValueMethod · 0.45

Tested by

no test coverage detected