------ #### SuperDesign V3.0.2412.2001 - *.[新增]新增程序更新日志设置和自动发布功能。 - *.[修复]修复Post数据格式不正确时双击文本框会导致软件闪退的BUG。
78 lines
2.4 KiB
C#
78 lines
2.4 KiB
C#
using ryCommon;
|
|
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;
|
|
using WeifenLuo.WinFormsUI.Docking;
|
|
|
|
namespace 开发辅助工具.Tools
|
|
{
|
|
public partial class FrmFileTime : DockContent
|
|
{
|
|
public FrmFileTime()
|
|
{
|
|
InitializeComponent();
|
|
RyFiles.AddDropDrag(TxtPath.Handle).ElevatedDragDrop += FrmImageToIcon_ElevatedDragDrop; ;
|
|
}
|
|
|
|
private void FrmImageToIcon_ElevatedDragDrop(object sender, ElevatedDragDropArgs e)
|
|
{
|
|
LoadFile(e.Files[0]);
|
|
}
|
|
|
|
private void LoadFile(string path)
|
|
{
|
|
var dt = RyFiles.GetFileDate(path);
|
|
dateTimePicker1.Value = dt.CreateTime;
|
|
dateTimePicker2.Value=dt.LastWriteTime;
|
|
TxtPath.Text = path;
|
|
BtnConvert.Text = "立即修改";
|
|
}
|
|
private void BtnBrowser_Click(object sender, EventArgs e)
|
|
{
|
|
if(openFileDialog1.ShowDialog()==DialogResult.OK)
|
|
{
|
|
LoadFile(openFileDialog1.FileName);
|
|
}
|
|
}
|
|
|
|
private void BtnConvert_Click(object sender, EventArgs e)
|
|
{
|
|
var path = TxtPath.Text;
|
|
if (!RyFiles.FileOrDirExist(path)) {
|
|
MessageBox.Show("文件不存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
BtnConvert.Enabled = false;
|
|
//superPictureBox1.Image = icon.ToBitmap();
|
|
BtnConvert.Text = "修改成功";
|
|
try
|
|
{
|
|
if(System.IO.File.Exists(path)) {
|
|
FileInfo fileInfo = new FileInfo(path);
|
|
fileInfo.CreationTime = dateTimePicker1.Value;
|
|
fileInfo.LastWriteTime = dateTimePicker2.Value;
|
|
}
|
|
else if(System.IO.Directory.Exists(path))
|
|
{
|
|
DirectoryInfo directoryInfo = new DirectoryInfo(path);
|
|
directoryInfo.CreationTime = dateTimePicker1.Value;
|
|
directoryInfo.LastWriteTime = dateTimePicker2.Value;
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
BtnConvert.Text = "修改失败";
|
|
}
|
|
LoadFile(path);
|
|
BtnConvert.Enabled = true;
|
|
}
|
|
}
|
|
}
|