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();