From 55cd9ebb06a956417cd3f51c78049cb4b9b9eb4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=C2=B7=C3=A6?= <279202647@qq.com> Date: Fri, 12 Nov 2021 16:01:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E7=A3=A8=E5=88=80=E7=9F=B3?= =?UTF-8?q?=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../齐越慧眼/齐越慧眼/MemoryHelper.cs | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/客户端/齐越慧眼/齐越慧眼/MemoryHelper.cs b/客户端/齐越慧眼/齐越慧眼/MemoryHelper.cs index fbdb479..567d477 100644 --- a/客户端/齐越慧眼/齐越慧眼/MemoryHelper.cs +++ b/客户端/齐越慧眼/齐越慧眼/MemoryHelper.cs @@ -7,13 +7,37 @@ namespace Utils { public class MemoryHelper { + public static string GetMemoryToken() + { + string memoryName = string.Empty; + string[] args = Environment.GetCommandLineArgs(); + foreach (var arg in args) + { + if (arg.StartsWith("uid:")) + { + memoryName = arg; + } + } + + var result = MemoryHelper.ReadMMF(memoryName); + + if (result.isOk) + { + return result.content; + } + else + { + System.Environment.Exit(0); + return string.Empty; + } + } /// /// 写入映射文件 /// /// /// - public static bool WriteMMF(string mapname, string content) + public static bool WriteMMF(string mapname, string content) { MemoryMappedFile mmf = MemoryMappedFile.CreateOrOpen(mapname, 1000, MemoryMappedFileAccess.ReadWrite); if (!string.IsNullOrEmpty(content))