此为资源整理价格,不提供任何技术支持,不包安装。新手不要买!
源码仅供研究学习代码使用,严禁用于非法和商业用途!如需商业用途请去购买官方正版源码!
只适用于老手和技术大神!发货后谢绝退款行为!
【源码截图】
【源码示例】
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using System.IO;
using System.Threading;
namespace ReNameFile
{
public partial class MainForm : Form
{
public readonly string SourePath = ConfigurationManager.AppSettings["SourePath"];
public readonly string TargetPath = ConfigurationManager.AppSettings["TargetPath"];
public readonly string Keyword = ConfigurationManager.AppSettings["Keyword"];
DataSet1.DataTable1DataTable dt = new DataSet1.DataTable1DataTable();
public MainForm()
{
InitializeComponent();
}
private void MainForm_Load(object sender, EventArgs e)
{
}
private void btn_add_Click(object sender, EventArgs e)
{
string partNo = txt_partno.Text.Trim();
if (string.IsNullOrEmpty(partNo))
{
MessageBox.Show("请输入料号名称!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_partno.Focus();
return;
}
string FilePath = SourePath.EndsWith(@"\") ? SourePath partNo : SourePath @"\" partNo;
if (!Directory.Exists(FilePath))
{
MessageBox.Show("输入的料号名称不正确,请重新输入!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_partno.Focus();
txt_partno.SelectAll();
return;
}
if (dt.Rows.Count >= 10)
{
MessageBox.Show("每次最多只能操作10个料号!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (dt.Select("partno='" partNo "'").Length > 0)
{
MessageBox.Show("已经存在" partNo "料号,请重新输入!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_partno.Focus();
txt_partno.SelectAll();
return;
}
DataSet1.DataTable1Row row = dt.NewDataTable1Row();
row.PartNo = partNo;
row.SourePath = FilePath @"\" Keyword @"\";
row.TargetPath = TargetPath @"\" partNo @"\";
dt.Rows.Add(row);
dataGridView1.DataSource = dt;
txt_partno.Text=string.Empty;
txt_partno.Focus();
// CopyDir(FilePath @"\film", TargetPath @"\" partNo @"\");
}
private static void CopyDir(string sourePath, string trgetPath)
{
if (!Directory.Exists(trgetPath))
{
Directory.CreateDirectory(trgetPath);
}
string[] files = Directory.GetFileSystemEntries(sourePath);
foreach (string file in files)
{
if (Directory.Exists(file))
{
CopyDir(file, trgetPath Path.GetFileName(file) Path.DirectorySeparatorChar);
}
else
{
File.Copy(file, trgetPath Path.GetFileName(file), true);
}
}
}
private void dataGridView1_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e)
{
e.Row.HeaderCell.Value = string.Format("{0}", e.Row.Index 1);
}
private void btn_change_Click(object sender, EventArgs e)
{
if (backgroundWorker1.IsBusy != true)
{
progressBar1.Value = 0;
progressBar1.Maximum = dt.Rows.Count;
backgroundWorker1.WorkerReportsProgress = true;
backgroundWorker1.RunWorkerAsync();
}
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
int count=0;
foreach (DataSet1.DataTable1Row row in dt.Rows)
{
count ;
CopyDir(row.SourePath, row.TargetPath);
backgroundWorker1.ReportProgress(count);
}
MessageBox.Show("");
}
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
progressBar1.Value=e.ProgressPercentage;
}
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
Thread.Sleep(100);
dt.Rows.Clear();
MessageBox.Show("工程资料传送完成!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
Spire v8.5.3 全家桶xx版,不是FreeSpire...
芋道源码【ruoyi-vue-pro】的完整文档...
画师AkiyamaRyo不知火舞原图无修4K动漫二次元mp4壁纸素材设...
C# Opencvsharp+OnnxRuntime+YOLOV5ne...
Spire.Doc.dll3.8xx版
朝夕教育进销存管理系统(数据库+winform源码)...
Spire.PDF_4.8xx版
基于php的智慧农场管理系统
串口调试助手代码(XCOM V2.0)
ZLG DBC_demo