Exemple #1
0
        private Tuple <string, string> GetMessageServiceUpdate(FileInfo changeFI)
        {
            try
            {
                WCFServiceSettings settings = WCFServiceSettings.Load(changeFI.FullName);

                if (settings == null)
                {
                    return(null);
                }

                return(new Tuple <string, string>
                       (
                           String.Format
                           (
                               "Service update for {0}",
                               settings.ServiceName
                           ),
                           String.Format
                           (
                               @"<html><head /><body><p>There is an update found for following Service</p><p>{0}{1}{2}{3}</p></body></html>",
                               !String.IsNullOrEmpty(settings.ServiceName) ? String.Format("Service name: {0}<br/>", settings.ServiceName) : String.Empty,
                               !String.IsNullOrEmpty(settings.Language) ? String.Format("Language: {0}<br/>", settings.Language) : String.Empty,
                               !String.IsNullOrEmpty(settings.Factory) ? String.Format("Factory: {0}<br/>", settings.Factory) : String.Empty,
                               String.IsNullOrEmpty(ServiceConfiguration.UriToWatchPath) ?
                               String.Format
                               (
                                   @"Update location: {0} on the BackOffice deploymentserver<br/>",
                                   changeFI.Directory.FullName
                               ) :
                               String.Format
                               (
                                   @"Update location: <a href=""{0}"">{0}</a><br/>",
                                   String.Concat
                                   (
                                       ServiceConfiguration.UriToWatchPath,
                                       changeFI.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);
            }
        }
        public static WCFServiceSettings Load(string service)
        {
            WCFServiceSettings newSettings = new WCFServiceSettings();

            newSettings.LoadServiceDetails(service);
            if (newSettings.ServiceName != null)
            {
                return(newSettings);
            }
            else
            {
                return(null);
            }
        }