private void DisposeMembers() { _LzmaLibData = null; _AuthenticatorData = null; _ComponentKey = null; _AuthenticatorKey = null; _ComponentEndPoint = null; _ServerEndPoint = null; _AuthenticatorHash = null; _LzmaLibHash = null; _PreferredMetadataEndPoint = null; _AlternateMetadataEndPoint = null; _LzmaLibType = null; _HttpClient = null; _DnsClient = null; _StrongNameVerifier = null; _ComponentAesDecryptor = null; _ComponentAesEncryptor = null; }
public void Initialize(string productId, BrokerSettings settings) { try { if (_Authenticator != null) { throw new Exception("Loader has already been initialized."); } if (settings == null) { throw new ArgumentNullException("settings"); } ThreadCulture threadCulture = NormalizeCulture(); if (settings.VerifyRuntimeIntegrity) { _StrongNameVerifier = new StrongNameVerifierLite(); CheckFrameworkStrongNames(); } InitializeWebHandling(); InitializeComponentTransform(); _ProductDirectory = GetProductDirectory(); string[] metadata = GetMetadata(); ParseMetadata(metadata); if (!Directory.Exists(_ProductDirectory)) { Directory.CreateDirectory(_ProductDirectory); } InitializeLzmaLib(); InitializeAuthenticator(); VerifyAuthenticator(); _AuthenticatorType = Assembly.Load(_AuthenticatorData).GetType("Controller"); _Authenticator = Activator.CreateInstance(_AuthenticatorType); MethodInfo method = _AuthenticatorType.GetMethod("UpdateValue"); method.Invoke(_Authenticator, new object[2] { "ProductId", productId }); method.Invoke(_Authenticator, new object[2] { "CatchUnhandledExceptions", settings.CatchUnhandledExceptions }); method.Invoke(_Authenticator, new object[2] { "DeferAutomaticUpdates", settings.DeferAutomaticUpdates }); method.Invoke(_Authenticator, new object[2] { "SilentAuthentication", settings.SilentAuthentication }); method.Invoke(_Authenticator, new object[2] { "DialogTheme", Convert.ToInt32(settings.DialogTheme) }); method.Invoke(_Authenticator, new object[2] { "LoaderVersion", _Version }); method.Invoke(_Authenticator, new object[2] { "ProductVersion", new Version(Application.ProductVersion) }); method.Invoke(_Authenticator, new object[2] { "Metadata", metadata }); method.Invoke(_Authenticator, new object[2] { "AuthorizedCallback", new CallbackDelegate(AuthorizedCallback) }); method.Invoke(_Authenticator, new object[2] { "RefreshedCallback", new CallbackDelegate(RefreshedCallback) }); method.Invoke(_Authenticator, new object[2] { "SuspendedCallback", new CallbackDelegate(SuspendedCallback) }); _AuthenticatorType.GetMethod("Initialize").Invoke(_Authenticator, null); DisposeMembers(); RestoreCulture(threadCulture); } catch (Exception ex) { HandleException(ex); } }