|
|
@ -9,6 +9,8 @@ using System.Reflection; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using System.Windows; |
|
|
|
using PJZS.Models; |
|
|
|
using System.Linq; |
|
|
|
using System.IO.MemoryMappedFiles; |
|
|
|
|
|
|
|
namespace PJZS |
|
|
|
{ |
|
|
@ -83,5 +85,25 @@ namespace PJZS |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
} |
|
|
|
|
|
|
|
public (bool isOk, string content) ReadMMF(string mapname) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
using (MemoryMappedFile mmf = MemoryMappedFile.OpenExisting(mapname)) |
|
|
|
{ |
|
|
|
using (var mmfStream = mmf.CreateViewStream(0, 1000, MemoryMappedFileAccess.ReadWrite)) |
|
|
|
{ |
|
|
|
StreamReader reader = new StreamReader(mmfStream); |
|
|
|
string jwt = reader.ReadToEnd().Replace("\0", "").TrimEnd(); |
|
|
|
return (true, jwt); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
return (false, ex.Message); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|