ab56a9bcf7
SVN-Revision: r240
65 lines
2.2 KiB
C#
65 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Lserp_FileToDB
|
|
{
|
|
public partial class add : Form
|
|
{
|
|
IniFiles ini = new IniFiles(Application.StartupPath + @"\MyConfig.INI");
|
|
|
|
public add()
|
|
{
|
|
InitializeComponent();
|
|
if (ini.ExistINIFile())
|
|
{
|
|
txt_path.Text = ini.IniReadValue("文件检测", "Path");
|
|
txt_len.Text = ini.IniReadValue("文件检测", "Len");
|
|
txt_time.Text = ini.IniReadValue("文件检测", "Time");
|
|
}
|
|
}
|
|
private void btn_find_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
OpenFileDialog openDlg = new OpenFileDialog();
|
|
// 指定打开文本文件(后缀名为txt)
|
|
openDlg.InitialDirectory = "C:\\";//初始加载路径为C盘;
|
|
openDlg.Filter = "文本文件 (*.txt)|*.txt";//过滤你想设置的文本文件类型(这是txt型)
|
|
// openFileDialog1.Filter = "文本文件 (*.txt)|*.txt|All files (*.*)|*.*";(这是全部类型文件)
|
|
if (openDlg.ShowDialog() == DialogResult.OK)
|
|
{
|
|
txt_path.Text = openDlg.FileName;
|
|
}
|
|
}
|
|
|
|
private void btn_save_Click(object sender, EventArgs e)
|
|
{
|
|
ini.IniWriteValue(null, null, null);
|
|
if (string.IsNullOrEmpty(txt_path.Text) || string.IsNullOrEmpty(txt_len.Text) || string.IsNullOrEmpty(txt_time.Text))
|
|
{
|
|
MessageBox.Show("数据有空值请重新输入!");
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
ini.IniWriteValue("文件检测", "Path", txt_path.Text);
|
|
ini.IniWriteValue("文件检测", "Len", txt_len.Text);
|
|
ini.IniWriteValue("文件检测", "Time", txt_time.Text);
|
|
MessageBox.Show("保存成功!");
|
|
this.Close();
|
|
}
|
|
}
|
|
|
|
private void btn_out_Click(object sender, EventArgs e)
|
|
{
|
|
System.Environment.Exit(0);
|
|
}
|
|
}
|
|
}
|