完成附件打开功能

This commit is contained in:
Falcon 2024-08-02 15:07:05 +08:00
parent c0f2a1ab6e
commit 3ed9596abe

View File

@ -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<PlusFileUnit>()
.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();