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

◆ ValidateInternalRecursive()

static bool System.ComponentModel.LicenseManager.ValidateInternalRecursive ( LicenseContext context,
Type type,
object instance,
bool allowExceptions,
out License license,
out string licenseKey )
inlinestaticprivate

Definition at line 294 of file LicenseManager.cs.

295 {
296 LicenseProvider licenseProvider = GetCachedProvider(type);
297 if (licenseProvider == null && !GetCachedNoLicenseProvider(type))
298 {
299 LicenseProviderAttribute licenseProviderAttribute = (LicenseProviderAttribute)Attribute.GetCustomAttribute(type, typeof(LicenseProviderAttribute), inherit: false);
300 if (licenseProviderAttribute != null)
301 {
302 Type licenseProvider2 = licenseProviderAttribute.LicenseProvider;
303 licenseProvider = GetCachedProviderInstance(licenseProvider2) ?? ((LicenseProvider)Activator.CreateInstance(licenseProvider2));
304 }
305 CacheProvider(type, licenseProvider);
306 }
307 license = null;
308 bool flag = true;
309 licenseKey = null;
310 if (licenseProvider != null)
311 {
312 license = licenseProvider.GetLicense(context, type, instance, allowExceptions);
313 if (license == null)
314 {
315 flag = false;
316 }
317 else
318 {
319 licenseKey = license.LicenseKey;
320 }
321 }
322 if (flag && instance == null)
323 {
324 Type baseType = type.BaseType;
325 if (baseType != typeof(object) && baseType != null)
326 {
327 if (license != null)
328 {
329 license.Dispose();
330 license = null;
331 }
332 flag = ValidateInternalRecursive(context, baseType, null, allowExceptions, out license, out var _);
333 if (license != null)
334 {
335 license.Dispose();
336 license = null;
337 }
338 }
339 }
340 return flag;
341 }
static LicenseProvider GetCachedProviderInstance(Type providerType)
static bool ValidateInternalRecursive(LicenseContext context, Type type, object instance, bool allowExceptions, out License license, out string licenseKey)
static void CacheProvider(Type type, LicenseProvider provider)
static bool GetCachedNoLicenseProvider(Type type)
static LicenseProvider GetCachedProvider(Type type)

References System.Type.BaseType, System.ComponentModel.LicenseManager.CacheProvider(), System.Activator.CreateInstance(), System.ComponentModel.LicenseManager.GetCachedNoLicenseProvider(), System.ComponentModel.LicenseManager.GetCachedProvider(), System.ComponentModel.LicenseManager.GetCachedProviderInstance(), System.Attribute.GetCustomAttribute(), System.ComponentModel.LicenseProvider.GetLicense(), System.ComponentModel.LicenseProviderAttribute.LicenseProvider, System.type, and System.ComponentModel.LicenseManager.ValidateInternalRecursive().

Referenced by System.ComponentModel.LicenseManager.LicenseInteropHelper.ValidateAndRetrieveLicenseDetails(), System.ComponentModel.LicenseManager.ValidateInternal(), and System.ComponentModel.LicenseManager.ValidateInternalRecursive().