Exemple #1
0
        private void copy_selected_to_file()
        {
            if (listViewResult.SelectedItems.Count == 0)
            {
                return;
            }

            FileStreamInfo sel_info = ((InternalListViewItem)listViewResult.SelectedItems[0]).InternalData;

            string source = internal_file_name + sel_info.Name;

            saveFileDialog1.AddExtension       = false;
            saveFileDialog1.AutoUpgradeEnabled = true;
            saveFileDialog1.CheckFileExists    = false;
            saveFileDialog1.CheckFileExists    = false;
            saveFileDialog1.OverwritePrompt    = true;
            saveFileDialog1.ValidateNames      = true;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string destinsation = saveFileDialog1.FileName;

                this.UseWaitCursor = true;

                try
                {
                    WinAPiFSwrapper.CopyFile
                        (source,
                        destinsation,
                        true,
                        null,
                        IntPtr.Zero,
                        131072);
                }
                catch (Exception ex)
                {
                    UseWaitCursor = false;
                    Messages.ShowException(ex);
                }

                UseWaitCursor = false;
            }
        }