12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
- {
- public partial class NewFileName : Form
- {
- string folderPath = "";
- string PathName = "";
- public string ChangePathName = "";
- public NewFileName(string a_Route,string a_PathName)
- {
- folderPath = a_Route;
- PathName = a_PathName;
- ChangePathName = a_PathName;
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- // 获取文件夹中的所有文件信息
- FileInfo[] files = new DirectoryInfo(folderPath).GetFiles("*.xml", SearchOption.AllDirectories);
- // 遍历文件信息数组并打印出文件名
- foreach (FileInfo file in files)
- {
- if (file.Name == textBox1.Text + ".xml")
- {
- MessageBox.Show("名称重复!");
- return;
- }
- }
- ChangePathName = textBox1.Text + ".xml";
- this.Close();
- }
- private void NewFileName_Load(object sender, EventArgs e)
- {
- }
- }
- }
|