private void butProjectFolder_Click(object sender, EventArgs e) { // FolderBrowserDialog folderBrowser = new FolderBrowserDialog(); //folderBrowserDialog.SelectedPath = @"D:\"; // 设置打开目录选择对话框时默认的目录 //folderBrowserDialog.ShowNewFolderButton = true; // false; //是否显示新建文件夹按钮 //folderBrowserDialog.Description = "设置项目的目录"; //描述弹出框功能 //folderBrowserDialog.RootFolder = Environment.SpecialFolder.MyComputer; //.MyDocuments.MyDocuments; // 打开到我的文档 folderBrowserDialog.ShowDialog(); // 打开目录选择对话框 SystemConstants.StrProjectPath = folderBrowserDialog.SelectedPath; // 返回用户选择的目录地址 #region 复制减速器模版到项目目录 string[] fileProperties = new string[2]; fileProperties[0] = @"D:\zip\减速器.zip"; //待解压的文件 fileProperties[1] = SystemConstants.StrProjectPath + "\\"; // @"D:\unzipped\"; //解压后放置的目标目录 UnZipClass UnZc = new UnZipClass(); UnZc.UnZip(fileProperties); #endregion #region 把减速器基本参数写入 “减速器.xml” 文件 SystemConstants.XmlProject = XElement.Load(SystemConstants.StrProjectPath + @"\减速器.xml"); SystemConstants.XmlProject.Element("总体要求").Element("级数").Value = cmbGradeOfReducer.Text; SystemConstants.XmlProject.Element("总体要求").Element("结构形式").Value = cmbTypeOfReducer.Text; SystemConstants.XmlProject.Element("总体要求").Element("总功率").Value = txtP.Text; SystemConstants.XmlProject.Element("总体要求").Element("转速").Value = txtN.Text; SystemConstants.XmlProject.Element("总体要求").Element("总速比").Value = txtTotalRate.Text; SystemConstants.XmlProject.Save(SystemConstants.StrProjectPath + @"\减速器.xml"); #endregion //MessageBox.Show(strProjectPath); }
private void button3_Click(object sender, EventArgs e) { string[] FileProperties = new string[2]; FileProperties[0] = @"D:\zip\2.zip"; //待解压的文件 FileProperties[1] = @"D:\unzipped\"; //解压后放置的目标目录 UnZipClass UnZc = new UnZipClass(); UnZc.UnZip(FileProperties); }