|
@@ -559,7 +559,8 @@ namespace OTSModelSharp
|
|
|
// file open dialog
|
|
|
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
|
|
saveFileDialog.FileName = m_strPathName.Split('\\')[m_strPathName.Split('\\').Length - 1];
|
|
|
- saveFileDialog.Filter = "Probject Files (*.prj)|*.prj|All files (*.*)|*.*";
|
|
|
+ saveFileDialog.Filter = "Directory (*.*)|*.*";
|
|
|
+ saveFileDialog.AddExtension=false;
|
|
|
if (saveFileDialog.ShowDialog() != DialogResult.OK)
|
|
|
{
|
|
|
return false;
|
|
@@ -568,13 +569,16 @@ namespace OTSModelSharp
|
|
|
// get file pathname
|
|
|
strPathName = saveFileDialog.FileName;
|
|
|
string DirectoryName = Path.GetDirectoryName(strPathName);
|
|
|
- DirectoryInfo Folder = new DirectoryInfo(DirectoryName);
|
|
|
- List<string> FolderNames = new List<string>();
|
|
|
- if (Folder.GetDirectories().Length != 0)
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory(strPathName);
|
|
|
+ }
|
|
|
+ catch
|
|
|
{
|
|
|
- MessageBox.Show("Save failed, a folder exists in the current location, delete or create a new one!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
|
+ MessageBox.Show("CreateDirectoryFailed!");
|
|
|
return false;
|
|
|
}
|
|
|
+ strPathName += "\\"+Path.GetFileNameWithoutExtension(strPathName) + ".prj";
|
|
|
//保存测量项目文件 .prj
|
|
|
XmlDocument doc = new XmlDocument();
|
|
|
//添加xml文件头申明
|