private void SaveAs(string side)
        {
            Cursor.Current = Cursors.WaitCursor;
            string fileName = GetFileName();

            fileName = PathUtil.GetFileName(fileName);

            using (var fileDialog = new SaveFileDialog
            {
                FileName = fileName,
                InitialDirectory = Module.WorkingDir + PathUtil.GetDirectoryName(GetFileName()),
                AddExtension = true
            })
            {
                fileDialog.DefaultExt = GitCommandHelpers.GetFileExtension(fileDialog.FileName);
                fileDialog.Filter     = string.Format(_currentFormatFilter.Text, GitCommandHelpers.GetFileExtension(fileDialog.FileName)) + "|*." +
                                        GitCommandHelpers.GetFileExtension(fileDialog.FileName) + "|" + _allFilesFilter.Text + "|*.*";

                if (fileDialog.ShowDialog(this) == DialogResult.OK)
                {
                    if (!Module.HandleConflictsSaveSide(GetFileName(), fileDialog.FileName, side))
                    {
                        MessageBox.Show(this, _failureWhileSaveFile.Text);
                    }
                }
            }
            Cursor.Current = Cursors.Default;
        }
        private void saveAsToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (DiffFiles.Revision == null || DiffFiles.SelectedItem == null)
            {
                return;
            }

            GitItemStatus item = DiffFiles.SelectedItem;

            var fullName = _fullPathResolver.Resolve(item.Name);

            using (var fileDialog =
                       new SaveFileDialog
            {
                InitialDirectory = Path.GetDirectoryName(fullName),
                FileName = Path.GetFileName(fullName),
                DefaultExt = GitCommandHelpers.GetFileExtension(fullName),
                AddExtension = true
            })
            {
                fileDialog.Filter =
                    _saveFileFilterCurrentFormat.Text + " (*." +
                    fileDialog.DefaultExt + ")|*." +
                    fileDialog.DefaultExt +
                    "|" + _saveFileFilterAllFiles.Text + " (*.*)|*.*";

                if (fileDialog.ShowDialog(this) == DialogResult.OK)
                {
                    Module.SaveBlobAs(fileDialog.FileName, string.Format("{0}:\"{1}\"", DiffFiles.Revision?.Guid, item.Name));
                }
            }
        }
        private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var selectedRows = FileChanges.GetSelectedRevisions();

            if (selectedRows.Count > 0)
            {
                string orgFileName = selectedRows[0].Name;

                if (string.IsNullOrEmpty(orgFileName))
                {
                    orgFileName = FileName;
                }

                string fullName = _fullPathResolver.Resolve(orgFileName.ToNativePath());

                using (var fileDialog = new SaveFileDialog
                {
                    InitialDirectory = Path.GetDirectoryName(fullName),
                    FileName = Path.GetFileName(fullName),
                    DefaultExt = GitCommandHelpers.GetFileExtension(fullName),
                    AddExtension = true
                })
                {
                    fileDialog.Filter =
                        "Current format (*." +
                        fileDialog.DefaultExt + ")|*." +
                        fileDialog.DefaultExt +
                        "|All files (*.*)|*.*";
                    if (fileDialog.ShowDialog(this) == DialogResult.OK)
                    {
                        Module.SaveBlobAs(fileDialog.FileName, selectedRows[0].Guid + ":\"" + orgFileName + "\"");
                    }
                }
            }
        }
        private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var gitItem = tvGitTree.SelectedNode?.Tag as GitItem;

            if (gitItem == null || gitItem.ObjectType != GitObjectType.Blob)
            {
                return;
            }

            var fullName = Path.Combine(Module.WorkingDir, gitItem.FileName);

            using (var fileDialog =
                       new SaveFileDialog
            {
                InitialDirectory = Path.GetDirectoryName(fullName),
                FileName = Path.GetFileName(fullName),
                DefaultExt = GitCommandHelpers.GetFileExtension(fullName),
                AddExtension = true
            })
            {
                var extension = GitCommandHelpers.GetFileExtension(fileDialog.FileName);

                fileDialog.Filter = $@"{_saveFileFilterCurrentFormat.Text}(*.{extension})|*.{extension }| {_saveFileFilterAllFiles.Text} (*.*)|*.*";
                if (fileDialog.ShowDialog(this) == DialogResult.OK)
                {
                    Module.SaveBlobAs(fileDialog.FileName, gitItem.Guid);
                }
            }
        }
Exemple #5
0
        private void SaveAs(string side)
        {
            Cursor.Current = Cursors.WaitCursor;
            string fileName = GetFileName();

            fileName = GetShortFileName(fileName);

            using (var fileDialog = new SaveFileDialog
            {
                FileName = fileName,
                InitialDirectory = GitModule.CurrentWorkingDir + GetDirectoryFromFileName(GetFileName()),
                AddExtension = true
            })
            {
                fileDialog.DefaultExt = GitCommandHelpers.GetFileExtension(fileDialog.FileName);
                fileDialog.Filter     = string.Format(_currentFormatFilter.Text, GitCommandHelpers.GetFileExtension(fileDialog.FileName)) + "|*." +
                                        GitCommandHelpers.GetFileExtension(fileDialog.FileName) + "|" + _allFilesFilter.Text + "|*.*";

                if (fileDialog.ShowDialog(this) == DialogResult.OK)
                {
                    GitModule.Current.HandleConflictsSaveSide(GetFileName(), fileDialog.FileName, side);
                }
            }
            Cursor.Current = Cursors.Default;
        }
        private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var selectedRows = FileChanges.GetSelectedRevisions();

            if (selectedRows.Count > 0)
            {
                string orgFileName = selectedRows[0].Name;

                if (string.IsNullOrEmpty(orgFileName))
                {
                    orgFileName = FileName;
                }

                string fileName = orgFileName.Replace(Settings.PathSeparatorWrong, Settings.PathSeparator);

                var fileDialog = new SaveFileDialog
                {
                    FileName     = Settings.WorkingDir + fileName,
                    AddExtension = true
                };
                fileDialog.DefaultExt = GitCommandHelpers.GetFileExtension(fileDialog.FileName);
                fileDialog.Filter     =
                    "Current format (*." +
                    GitCommandHelpers.GetFileExtension(fileDialog.FileName) + ")|*." +
                    GitCommandHelpers.GetFileExtension(fileDialog.FileName) +
                    "|All files (*.*)|*.*";
                if (fileDialog.ShowDialog(this) == DialogResult.OK)
                {
                    Settings.Module.SaveBlobAs(fileDialog.FileName, selectedRows[0].Guid + ":\"" + orgFileName + "\"");
                }
            }
        }
        private void SaveAs(string side)
        {
            using (WaitCursorScope.Enter())
            {
                var    conflictData = GetConflict();
                string fileName     = conflictData.Filename;
                fileName = PathUtil.GetFileName(fileName);

                using (var fileDialog = new SaveFileDialog
                {
                    FileName = fileName,
                    InitialDirectory = _fullPathResolver.Resolve(PathUtil.GetDirectoryName(conflictData.Filename)),
                    AddExtension = true
                })
                {
                    fileDialog.DefaultExt = GitCommandHelpers.GetFileExtension(fileDialog.FileName);
                    fileDialog.Filter     = string.Format(_currentFormatFilter.Text, GitCommandHelpers.GetFileExtension(fileDialog.FileName)) + "|*." +
                                            GitCommandHelpers.GetFileExtension(fileDialog.FileName) + "|" + _allFilesFilter.Text + "|*.*";

                    if (fileDialog.ShowDialog(this) == DialogResult.OK)
                    {
                        if (!Module.HandleConflictsSaveSide(conflictData.Filename, fileDialog.FileName, side))
                        {
                            MessageBox.Show(this, _failureWhileSaveFile.Text);
                        }
                    }
                }
            }
        }
        private void saveAsToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            IList <GitRevision> revisions = _revisionGrid.GetSelectedRevisions();

            if (revisions.Count == 0)
            {
                return;
            }

            if (DiffFiles.SelectedItem == null)
            {
                return;
            }

            GitItemStatus item = DiffFiles.SelectedItem;

            var fullName = Path.Combine(Module.WorkingDir, item.Name);

            using (var fileDialog =
                       new SaveFileDialog
            {
                InitialDirectory = Path.GetDirectoryName(fullName),
                FileName = Path.GetFileName(fullName),
                DefaultExt = GitCommandHelpers.GetFileExtension(fullName),
                AddExtension = true
            })
            {
                fileDialog.Filter =
                    _saveFileFilterCurrentFormat.Text + " (*." +
                    fileDialog.DefaultExt + ")|*." +
                    fileDialog.DefaultExt +
                    "|" + _saveFileFilterAllFiles.Text + " (*.*)|*.*";

                if (fileDialog.ShowDialog(this) == DialogResult.OK)
                {
                    Module.SaveBlobAs(fileDialog.FileName, string.Format("{0}:\"{1}\"", revisions[0].Guid, item.Name));
                }
            }
        }
Exemple #9
0
        private void SaveAs(string side)
        {
            Cursor.Current = Cursors.WaitCursor;
            string fileName = GetFileName();

            fileName = GetShortFileName(fileName);

            var fileDialog = new SaveFileDialog
            {
                FileName         = fileName,
                InitialDirectory = Settings.WorkingDir + GetDirectoryFromFileName(GetFileName()),
                AddExtension     = true
            };

            fileDialog.DefaultExt = GitCommandHelpers.GetFileExtension(fileDialog.FileName);
            fileDialog.Filter     = "Current format (*." + GitCommandHelpers.GetFileExtension(fileDialog.FileName) + ")|*." + GitCommandHelpers.GetFileExtension(fileDialog.FileName) + "|All files (*.*)|*.*";

            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                GitCommandHelpers.HandleConflictsSaveSide(GetFileName(), fileDialog.FileName, side);
            }
            Cursor.Current = Cursors.Default;
        }