示例#1
0
        private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                string           path   = GetSelectedPath();
                List <string>    from   = new List <string>();
                StringCollection strcol = Clipboard.GetFileDropList();
                foreach (string file in strcol)
                {
                    if (Directory.Exists(file))
                    {
                        from.Add(file);
                    }
                    else if (File.Exists(file))
                    {
                        from.Add(file);
                    }
                }

                int byt = ((MemoryStream)Clipboard.GetData("Preferred DropEffect")).ReadByte();
                if (byt == 2) //cut
                {
                    LocalDirectory.MoveFilesOrFolders(from.ToArray(), path);
                }
                else if (byt == 5) //copy
                {
                    LocalDirectory.CopyFilesOrFolders(from.ToArray(), path);
                }

                Clipboard.Clear();
            }
            catch (Exception ex)
            {
                Logger.Add(ex.Message, "CodesBrowser|pasteToolStripMenuItem_Click");
            }
        }