public static string SaveConfigurationFile(string fileFolder, string filePath, string entityName)
{
bool cont = true;
string newPath = "";
while (cont)
{
SaveFileDialog dlg = new SaveFileDialog();
dlg.InitialDirectory = fileFolder;
dlg.FileName = (string.IsNullOrEmpty(filePath) ? entityName + "." + Repository.SealConfigurationFileExtension : Path.GetFileName(filePath));
dlg.Filter = string.Format("Seal configuration files (*.{0})|*.{0}|All files (*.*)|*.*", Repository.SealConfigurationFileExtension);
if (dlg.ShowDialog() == DialogResult.OK)
{
if (fileFolder.ToLower() != Path.GetDirectoryName(dlg.FileName).ToLower())
{
MessageBox.Show("The configuration file must remain in the same repository folder.\r\n", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
newPath = dlg.FileName;
cont = false;
}
}
else return null;
}
return newPath;
}