完成附件打开功能
This commit is contained in:
parent
c0f2a1ab6e
commit
3ed9596abe
|
@ -402,7 +402,7 @@ namespace CalendarNotepad
|
||||||
}
|
}
|
||||||
var item = items[0];
|
var item = items[0];
|
||||||
var fk = item.SubItems[2].Text;
|
var fk = item.SubItems[2].Text;
|
||||||
var fileNam = item.Text;
|
var fileName = item.Text;
|
||||||
var qu = this.Db.Queryable<PlusFileUnit>()
|
var qu = this.Db.Queryable<PlusFileUnit>()
|
||||||
.Where(a => a.FileId == fk)
|
.Where(a => a.FileId == fk)
|
||||||
.Select(a => a.FileContent)
|
.Select(a => a.FileContent)
|
||||||
|
@ -413,13 +413,16 @@ namespace CalendarNotepad
|
||||||
}
|
}
|
||||||
var fc = qu.First();
|
var fc = qu.First();
|
||||||
var tempPath = Path.GetTempPath();
|
var tempPath = Path.GetTempPath();
|
||||||
var ran = new Random();
|
//var ran = new Random();
|
||||||
var fn = ran.NextInt64(10000,99999).ToString();
|
//var fn = ran.NextInt64(10000,99999).ToString();
|
||||||
var path = Path.Combine(tempPath,"CalendarNotepadFile");
|
var path = Path.Combine(tempPath,"CalendarNotepadFile");
|
||||||
if(!Directory.Exists(path)) {
|
if(!Directory.Exists(path)) {
|
||||||
Directory.CreateDirectory(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)) {
|
using(var fs = File.Create(fullPath,fc.Length)) {
|
||||||
fs.Write(fc,0,fc.Length);
|
fs.Write(fc,0,fc.Length);
|
||||||
fs.Close();
|
fs.Close();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user