Example #1
0
        private void pasteCmd()
        {
            bool success = false;

            if (fsctrl.BufferRestorePath != null) //вставка вырезанного
            {
                try
                {
                    fsctrl.writeHeader(fsctrl.CurrDir, fsctrl.BufferFH, true);
                    fsctrl.deleteHeader(fsctrl.BufferRestorePath, fsctrl.BufferFH, true);
                    success = true;
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    try
                    {
                        if (!(e is FileAlreadyExistException))
                        {
                            fsctrl.deleteHeader(fsctrl.CurrDir, fsctrl.BufferFH, false);
                        }
                        fsctrl.writeHeader(fsctrl.BufferRestorePath, fsctrl.BufferFH, false);
                    }
                    catch
                    {
                        //ignore
                    }
                }
            }
            else //вставка скопированного
            {
                try
                {
                    fsctrl.writeFromBuffer(fsctrl.CurrDir);
                    success = true;
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    if (e is RootdirOutOfSpaceException || e is DiskOutOfSpaceException)
                    {
                        try
                        {
                            fsctrl.deleteFile(fsctrl.CurrDir, fsctrl.BufferFH, false);
                        }
                        catch
                        {
                            //ignore
                        }
                    }
                }
            }

            if (success)
            {
                FileView fv = addFileView(fsctrl.BufferFH);
                if (fv != null)
                {
                    onFileViewMouseDown(fv, null);
                }
            }

            fsctrl.clearBuffer();
        }