Ejemplo n.º 1
0
        private bool GetTheAppCastInformation(string appCastUrl, IWebProxy proxy,
                                              ParseUpdateInfoHandler parseUpdateInfoHandler, out UpdateInfoEventArgs info)
        {
            info = null;
            var appCast = RetrieveTheAppCast(appCastUrl, proxy);

            Logger.Info(States.AppCastRetrievalDone, $"baseUri:[{appCast.BaseUri}]\nremoteData:{appCast.RemoteData}");

            try
            {
                if (parseUpdateInfoHandler != null)
                {
                    ExecuteUpdateCustomInfoParseEven(appCast, parseUpdateInfoHandler, out info);
                }
                else
                {
                    ExecuteUpdateXmlInfoParse(appCast, out info);
                }
            }
            catch (Exception e)
            {
                throw new UpdaterException(States.AppCastInvalidDataError, exception: e);
            }

            if (info.CurrentVersion == null || string.IsNullOrEmpty(info.DownloadURL))
            {
                throw new UpdaterException(States.AppCastInvalidDataError);
            }

            Logger.Info(States.AppCastDataValidationDone);

            info.DownloadURL  = GetURL(appCast.BaseUri, info.DownloadURL);
            info.ChangelogURL = GetURL(appCast.BaseUri, info.ChangelogURL);
            return(true);
        }
Ejemplo n.º 2
0
 private void ExecuteUpdateCustomInfoParseEven(AppCast appCast, ParseUpdateInfoHandler parseUpdateInfoHandler, out UpdateInfoEventArgs info)
 {
     info = null;
     try
     {
         var parseArgs = new ParseUpdateInfoEventArgs(appCast.RemoteData);
         CallSync(s => parseUpdateInfoHandler((ParseUpdateInfoEventArgs)s), parseArgs);
         info = parseArgs.UpdateInfo;
         Logger.Info(States.AppCastCustomInfoParseEventDone);
     }
     catch (Exception e)
     {
         throw new UpdaterException(States.AppCastCustomInfoParseEventError, exception: e);
     }
 }
 /// <summary>
 ///     An event that clients can use to be notified whenever the AppCast file needs parsing.
 /// </summary>
 public InitSettings SetAParseUpdateInfoEventHandler(ParseUpdateInfoHandler handler)
 {
     ParseUpdateInfoEvent = handler;
     return(this);
 }