Esempio n. 1
0
        private Tuple <string, string> GetMessageManifestUpdate(FileInfo changeFI)
        {
            try
            {
                DeploymentSettings settings = DeploymentSettings.Load(changeFI.FullName);
                if (settings == null)
                {
                    return(null);
                }

                return(new Tuple <string, string>
                       (
                           String.Format
                           (
                               !String.IsNullOrEmpty(settings.SuiteName) ? "Deployment update for {0} ({1})" : "Deployment update for {1}",
                               settings.SuiteName,
                               !String.IsNullOrEmpty(settings.ProductName) ? settings.ProductName : String.Empty
                           ),
                           String.Format
                           (
                               @"<html><head /><body><p>There is an update found for following deployment</p><p>{0}{1}{2}{3}</p></body></html>",
                               !String.IsNullOrEmpty(settings.SuiteName) ? String.Format("Suite name: {0}<br/>", settings.SuiteName) : String.Empty,
                               !String.IsNullOrEmpty(settings.ProductName) ? String.Format("Product name: {0}<br/>", settings.ProductName) : String.Empty,
                               !String.IsNullOrEmpty(settings.Version) ? String.Format("Version: {0}<br/>", settings.Version) : String.Empty,
                               String.IsNullOrEmpty(ServiceConfiguration.UriToWatchPath) ?
                               String.Format
                               (
                                   @"Update location: {0} on the BackOffice deploymentserver<br/>",
                                   settings.DeploymentManifestFile.Directory.FullName
                               ) :
                               String.Format
                               (
                                   @"Update location: <a href=""{0}"">{0}</a><br/>",
                                   String.Concat
                                   (
                                       ServiceConfiguration.UriToWatchPath,
                                       settings.DeploymentManifestFile.Directory.FullName.Replace
                                       (
                                           ServiceConfiguration.WatcherPath,
                                           ServiceConfiguration.WatcherPath.Substring(ServiceConfiguration.WatcherPath.Length - 1, 1) == @"\" ? @"\" : ""
                                       )
                                   )
                               )
                           )
                       ));
            }
            catch (Exception ex)
            {
                if (ErrorRegistered != null)
                {
                    ErrorRegistered(this, new UnhandledExceptionEventArgs(new Exception("Error while getting update information", ex), false));
                }
                return(null);
            }
        }