Exemplo n.º 1
0
        protected virtual void Run(ClientPipelineArgs args)
        {
            ItemUri itemUri = ItemUri.Parse(args.Parameters["uri"]);
            Item    item    = Database.GetItem(itemUri);

            Error.AssertItemFound(item);
            bool   flag = true;
            string str1 = string.Concat(Settings.DataFolder.TrimStart(new char[] { '/' }), "\\", Settings.GetSetting("Sitecore.Scientist.MediaExportImport.ExportFolderName", "MediaExports"));

            if (!IsValidPath(str1))
            {
                str1 = HttpContext.Current.Server.MapPath("~/") + str1;
            }
            str1 = str1.Replace("/", "\\");
            FileUtil.CreateFolder(FileUtil.MapPath(str1));
            var innerfolders = item.Paths.FullPath.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var folder in innerfolders)
            {
                str1 = str1 + "\\" + folder;
                FileUtil.CreateFolder(FileUtil.MapPath(str1));
            }
            Log.Info(string.Concat("Starting export of media items to: ", string.Concat(Settings.DataFolder.TrimStart(new char[] { '/' }), "\\", Settings.GetSetting("Sitecore.Scientist.MediaExportImport.ExportFolderName", "MediaExports"))), this);
            ProgressBoxMethod progressBoxMethod = new ProgressBoxMethod(StartProcess);

            object[] objArray = new object[] { item, str1, flag };
            ProgressBox.Execute("Export Media Items...", "Export Media Items", progressBoxMethod, objArray);
        }
Exemplo n.º 2
0
 public ScriptRunner(ProgressBoxMethod method, object[] parameters,bool autoDispose)
 {
     Assert.ArgumentNotNull(method, "method");
     Assert.ArgumentNotNull(parameters, "parameters");
     this.method = method;
     this.parameters = parameters;
     this.autoDispose = autoDispose;
 }
Exemplo n.º 3
0
        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull(context, "context");

            var item = context.Items[0];

            Assert.IsNotNull(item, "context item cannot be null");

            var progressBoxMethod = new ProgressBoxMethod(Refresh);

            ProgressBox.Execute(
                string.Format("{0} ({1})", "Re-Index Elastic Tree.", item.Paths.ContentPath),
                "Re-indexing the current item and its descendants in Elastic",
                progressBoxMethod,
                new object[] { item });
        }
Exemplo n.º 4
0
        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull(context, "context");

            var item = context.Items[0];

            Assert.IsNotNull(item, "context item cannot be null");

            var progressBoxMethod = new ProgressBoxMethod(Recreate);

            ProgressBox.Execute(
                "Recreate Elastic Indexes.",
                "Recreating all Elastic indexes.",
                progressBoxMethod,
                new object[] { item });
        }
        protected virtual void Run(ClientPipelineArgs args)
        {
            ItemUri itemUri = ItemUri.Parse(args.Parameters["uri"]);
            Item    item    = Database.GetItem(itemUri);

            Error.AssertItemFound(item);
            bool   flag = true;
            string str1 = string.Concat(Settings.DataFolder.TrimStart(new char[] { '/' }), "\\", Settings.GetSetting("Sitecore.Scientist.MediaExportImport.ExportFolderName", "MediaExports")) + item.Paths.FullPath;

            if (!IsValidPath(str1))
            {
                str1 = HttpContext.Current.Server.MapPath("~/") + str1;
            }
            str1 = str1.Replace("/", "\\");
            if (FileUtil.FolderExists(FileUtil.MapPath(str1)))
            {
                Log.Info(string.Concat("Starting import media items from: ", string.Concat(Settings.DataFolder.TrimStart(new char[] { '/' }), "\\", Settings.GetSetting("Sitecore.Scientist.MediaExportImport.ExportFolderName", "MediaExports"))), this);
                ProgressBoxMethod progressBoxMethod = new ProgressBoxMethod(StartProcess);
                object[]          objArray          = new object[] { item, str1, flag };
                ProgressBox.Execute("Import Media Items...", "Import Media Items", progressBoxMethod, objArray);
            }
        }