예제 #1
0
        public void DoMove(object Data)
        {
            DropData DataDrop = (DropData)Data;

            if (DataDrop.ItemsForDrop != null)
            {
                using (FileOperation fileOp = new FileOperation())
                {
                    foreach (ShellObject item in DataDrop.ItemsForDrop)
                    {

                        string New_Name = "";
                        if (Path.GetExtension(item.ParsingName) == "")
                        {

                            New_Name = item.GetDisplayName(DisplayNameType.Default);
                        }
                        else
                        {
                            New_Name = Path.GetFileName(item.ParsingName);
                        }
                        if (!File.Exists(DataDrop.PathForDrop))
                        {
                            fileOp.MoveItem(item.ParsingName, DataDrop.PathForDrop, New_Name);
                        }
                        else
                        {
                            fileOp.MoveItem(item.ParsingName, NavigationLog.CurrentLocation.ParsingName, New_Name);
                        }

                    }

                    fileOp.PerformOperations();
                } 
            }
            else if (DataDrop.DropList != null)
            {
                using (FileOperation fileOp = new FileOperation())
                {
                    foreach (string item in DataDrop.DropList)
                    {

                        string New_Name = "";
                        if (Path.GetExtension(item) == "")
                        {
                            ShellObject shi = ShellObject.FromParsingName(item);
                            New_Name = shi.GetDisplayName(DisplayNameType.Default);
                        }
                        else
                        {
                            New_Name = Path.GetFileName(item);
                        }
                        if (!File.Exists(DataDrop.PathForDrop))
                        {
                            fileOp.MoveItem(item, DataDrop.PathForDrop, New_Name);
                        }
                        else
                        {
                            fileOp.MoveItem(item, NavigationLog.CurrentLocation.ParsingName, New_Name);
                        }

                    }

                    fileOp.PerformOperations();
                }
            }
            else if (DataDrop.Shellobjects != null)
            {

                using (FileOperation fileOp = new FileOperation())
                {
                    foreach (ShellObject item in DataDrop.Shellobjects)
                    {

                        string New_Name = "";
                        if (Path.GetExtension(item.ParsingName) == "")
                        {
                            ShellObject shi = item;
                            New_Name = shi.GetDisplayName(DisplayNameType.Default);
                        }
                        else
                        {
                            New_Name = Path.GetFileName(item.ParsingName);
                        }
                        if (!File.Exists(DataDrop.PathForDrop))
                        {
                            fileOp.MoveItem(item.ParsingName, DataDrop.PathForDrop, New_Name);
                        }
                        else
                        {
                            fileOp.MoveItem(item.ParsingName, NavigationLog.CurrentLocation.ParsingName, New_Name);
                        }

                    }

                    fileOp.PerformOperations();
                }

            }
        }
예제 #2
0
        public void DoDelete(object Data)
        {
            ShellObjectCollection DataDelete = (ShellObjectCollection)Data;

            using (FileOperation fileOp = new FileOperation())
            {
                foreach (ShellObject item in DataDelete)
                {
                    fileOp.DeleteItem(item.ParsingName);
                }

                fileOp.PerformOperations();
            }
            
        }
예제 #3
0
        public void DoMove(object Data)
        {
            DropData DataDrop = (DropData)Data;

            using (FileOperation fileOp = new FileOperation())
            {
                foreach (ShellObject item in DataDrop.ItemsForDrop)
                {

                    string New_Name = "";
                    if (Path.GetExtension(item.ParsingName) == "")
                    {

                        New_Name = item.GetDisplayName(DisplayNameType.Default);
                    }
                    else
                    {
                        New_Name = Path.GetFileName(item.ParsingName);
                    }
                    if (!File.Exists(DataDrop.PathForDrop))
                    {
                        fileOp.MoveItem(item.ParsingName, DataDrop.PathForDrop, New_Name);
                    }

                }

                fileOp.PerformOperations();
            }
        }