Esempio n. 1
0
        public void InvokeCommand(IntPtr pici)
        {
            uint iCommand = (uint)Helper.GetCommandOffsetId(pici);

            if (!this.Command.ContainsKey(iCommand))
            {
                return;
            }

            string str = this.Command[iCommand];

            if (str == "Break")
            {
                FileOperations.BreakFolder(this.SelectedItems);
            }
            else if (str == "Build")
            {
                FileOperations.BuildFolder(this.SelectedItems);
            }
            else if (str == "Replace")
            {
                this.SelectedItems.ForEach(fi =>
                {
                    FileInfo fileInfo = new FileInfo(fi);
                    fileInfo.ReplaceFileName();
                });
            }
            else if (str == "UrlDecode")
            {
                this.SelectedItems.ForEach(fi =>
                {
                    FileInfo fileInfo = new FileInfo(fi);
                    fileInfo.DecodeFileNameUrl();
                });
            }
            else if (str == "HtmlDecode")
            {
                this.SelectedItems.ForEach(fi =>
                {
                    FileInfo fileInfo = new FileInfo(fi);
                    fileInfo.DecodeFileNameHtml();
                });
            }
            else if (str == "FileMoverMove")
            {
                FileMover.ExecuteListAction(this.SelectedItems[0]);
            }
            else if (str == "FileMoverAdd")
            {
                this.SelectedItems.ForEach(i => FileMover.AddPathToList(i));
            }
            else if (str == "FileMoverClear")
            {
                FileMover.ClearList();
            }
            else
            {
                var list = FileMover.GetList();
                if (list.Contains(str))
                {
                    FileMover.RemovePathFromList(str);
                }
                else
                {
                    Marshal.ThrowExceptionForHR(WinError.E_FAIL);
                }
            }
        }