Beispiel #1
0
        private static IServerComponentUpdater GetUpdater([NotNull] UpdateServerComponentOptions options)
        {
            Diagnostics.Debug.ArgumentNotNull(options, nameof(options));

            foreach (var updater in Updaters)
            {
                if (updater.CanUpdate(options))
                {
                    return(updater);
                }
            }

            return(null);
        }
        public bool Update(UpdateServerComponentOptions options)
        {
            Assert.ArgumentNotNull(options, nameof(options));

            var source = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty;

            var webServiceFolder = Path.Combine(options.WebSiteRootFolder, @"sitecore/shell/WebService");

            try
            {
                AppHost.Files.CreateDirectory(webServiceFolder);

                IO.File.CopyFile(webServiceFolder, Path.Combine(source, @"WebService\\Service2.asmx"));
                IO.File.CopyFile(webServiceFolder, Path.Combine(source, @"WebService\\Browse.aspx"));
                IO.File.CopyFile(webServiceFolder, Path.Combine(source, @"WebService\\Sitecore.Rocks.Validation.ashx"));
            }
            catch (UnauthorizedAccessException)
            {
                AppHost.MessageBox(string.Format(Resources.WebServiceUpdater_Update_, webServiceFolder), Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
            }

            return(false);
        }
        public bool CanUpdate(UpdateServerComponentOptions options)
        {
            Assert.ArgumentNotNull(options, nameof(options));

            return(options.PluginName == Constants.SitecoreRocksServer);
        }