From 3ed9596abe2a7e026ca54411f66009243fab1a34 Mon Sep 17 00:00:00 2001 From: Falcon <12919280+falconfly@user.noreply.gitee.com> Date: Fri, 2 Aug 2024 15:07:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E9=99=84=E4=BB=B6=E6=89=93?= =?UTF-8?q?=E5=BC=80=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CalendarNotepad/WorkMain.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CalendarNotepad/WorkMain.cs b/CalendarNotepad/WorkMain.cs index 0910663..b24fd8e 100644 --- a/CalendarNotepad/WorkMain.cs +++ b/CalendarNotepad/WorkMain.cs @@ -402,7 +402,7 @@ namespace CalendarNotepad } var item = items[0]; var fk = item.SubItems[2].Text; - var fileNam = item.Text; + var fileName = item.Text; var qu = this.Db.Queryable() .Where(a => a.FileId == fk) .Select(a => a.FileContent) @@ -413,13 +413,16 @@ namespace CalendarNotepad } var fc = qu.First(); var tempPath = Path.GetTempPath(); - var ran = new Random(); - var fn = ran.NextInt64(10000,99999).ToString(); + //var ran = new Random(); + //var fn = ran.NextInt64(10000,99999).ToString(); var path = Path.Combine(tempPath,"CalendarNotepadFile"); if(!Directory.Exists(path)) { Directory.CreateDirectory(path); } - var fullPath = Path.Combine(path,fn + ".txt"); + var fullPath = Path.Combine(path,fileName); + if(File.Exists(fullPath)) { + File.Delete(fullPath); + } using(var fs = File.Create(fullPath,fc.Length)) { fs.Write(fc,0,fc.Length); fs.Close();