public static IValidator Create(UpdaterConfiguration configuration) { IValidator validator = null; #region Create the IValidator provider // use generic Factory to create instance of Validator with config type/asm info validator = (IValidator)GenericFactory.Create(configuration.Validator.Assembly, configuration.Validator.Type); try { validator.Init(configuration.Validator.Config); } catch (Exception e) { string error = ApplicationUpdateManager.TraceWrite(e, "[ValidatorFactory.Create]", "RES_ErrorInitializingValidator", configuration.Validator.Type, configuration.Validator.Assembly); ApplicationUpdaterException theException = new ApplicationUpdaterException(error, e); ExceptionManager.Publish(theException); throw theException; } #endregion return(validator); }
public static IDownloader Create(UpdaterConfiguration configuration) { IDownloader downloader = null; #region Create the IDownloader provider // use the GenericFactory to actually create the instance downloader = (IDownloader)GenericFactory.Create(configuration.Downloader.Assembly, configuration.Downloader.Type); try { downloader.Init(configuration.Downloader.Config); } catch (Exception e) { string error = ApplicationUpdateManager.TraceWrite(e, "[DownloaderFactory.Create]", "RES_ErrorInitializingDownloader", configuration.Downloader.Type, configuration.Downloader.Assembly); ApplicationUpdaterException theException = new ApplicationUpdaterException(error, e); ExceptionManager.Publish(theException); throw theException; } #endregion return(downloader); }
public static IDownloader Create( UpdaterConfiguration configuration ) { IDownloader downloader = null; #region Create the IDownloader provider // use the GenericFactory to actually create the instance downloader = (IDownloader)GenericFactory.Create( configuration.Downloader.Assembly, configuration.Downloader.Type ); try { downloader.Init( configuration.Downloader.Config ); } catch( Exception e ) { string error = ApplicationUpdateManager.TraceWrite( e, "[DownloaderFactory.Create]", "RES_ErrorInitializingDownloader", configuration.Downloader.Type, configuration.Downloader.Assembly ); ApplicationUpdaterException theException = new ApplicationUpdaterException( error, e ); ExceptionManager.Publish( theException ); throw theException; } #endregion return downloader; }
private static void Init() { #region Get the configuration instance try { if (null == _configuration) { _configuration = (UpdaterConfiguration)ConfigurationSettings.GetConfig("appUpdater"); } } catch (ApplicationUpdaterException aex) { string error = ApplicationUpdateManager.TraceWrite(aex, "[UpdaterConfiguration.cctor]", "RES_UnableToLoadConfiguration", AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); ApplicationUpdaterException theException = new ApplicationUpdaterException(error, aex); ExceptionManager.Publish(theException); throw theException; } catch (ConfigurationException configEx) { string error = ApplicationUpdateManager.TraceWrite(configEx, "[UpdaterConfiguration.cctor]", "RES_UnableToLoadConfiguration", AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); ConfigurationException plusConfEx = new ConfigurationException(error, configEx); ExceptionManager.Publish(plusConfEx); throw plusConfEx; } catch (Exception exception) { // for general exception, just publish and throw no more is reasonable to add ExceptionManager.Publish(exception); throw exception; } if (_configuration == null) { string error = ApplicationUpdateManager.TraceWrite("[UpdaterConfiguration.cctor]", "RES_UnableToLoadConfiguration", AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); ApplicationUpdaterException theException = new ApplicationUpdaterException(error); ExceptionManager.Publish(theException); throw theException; } #endregion }
public static IValidator Create( UpdaterConfiguration configuration ) { IValidator validator = null; #region Create the IValidator provider // use generic Factory to create instance of Validator with config type/asm info validator = (IValidator) GenericFactory.Create( configuration.Validator.Assembly, configuration.Validator.Type ); try { validator.Init( configuration.Validator.Config ); } catch( Exception e ) { string error = ApplicationUpdateManager.TraceWrite( e, "[ValidatorFactory.Create]", "RES_ErrorInitializingValidator", configuration.Validator.Type, configuration.Validator.Assembly ); ApplicationUpdaterException theException = new ApplicationUpdaterException( error, e ); ExceptionManager.Publish( theException ); throw theException; } #endregion return validator; }