mirror of
https://github.com/snltty/linker.git
synced 2025-11-03 01:53:32 +08:00
适配跨平台,winform乱码
This commit is contained in:
@@ -57,7 +57,7 @@ namespace cmonitor.libs
|
||||
{
|
||||
if (OperatingSystem.IsWindows() && accessorGlobal == null)
|
||||
{
|
||||
accessorGlobal = ShareMemoryFactory.Create(key, length, itemSize);
|
||||
accessorGlobal = ShareMemoryFactory.Create($"Global\\{key}", length, itemSize);
|
||||
if (accessorGlobal.Init() == false)
|
||||
{
|
||||
accessorGlobal = null;
|
||||
@@ -168,11 +168,16 @@ namespace cmonitor.libs
|
||||
lock (lockObj)
|
||||
{
|
||||
accessorLocal.ReadArray(0, bytes, 0, bytes.Length);
|
||||
|
||||
for (int index = 0; index < length; index++)
|
||||
{
|
||||
//state
|
||||
bool _updated = ReadState(accessorLocal, index, ShareMemoryState.Updated);
|
||||
if (_updated == false) continue;
|
||||
if (_updated == false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
WriteState(accessorLocal, index, ShareMemoryState.Updated, false);
|
||||
updated |= _updated;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.ServiceProcess;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace cmonitor.sas.service
|
||||
{
|
||||
@@ -102,7 +101,7 @@ namespace cmonitor.sas.service
|
||||
}
|
||||
}, cancellationTokenSource, TaskCreationOptions.LongRunning);
|
||||
}
|
||||
|
||||
|
||||
private void WriteAllCloseState(bool state)
|
||||
{
|
||||
for (int i = 0; i < shareMLength; i++)
|
||||
@@ -110,7 +109,7 @@ namespace cmonitor.sas.service
|
||||
shareMemory.WriteClosed(i, state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Process proc;
|
||||
private void CheckMainProcess()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using cmonitor.libs;
|
||||
using common.libs.extends;
|
||||
using MemoryPack;
|
||||
|
||||
namespace cmonitor.server.client.reports.share
|
||||
@@ -47,7 +48,10 @@ namespace cmonitor.server.client.reports.share
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
if (shareMemory != null)
|
||||
{
|
||||
dic = shareMemory.GetItems(out updated);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
|
||||
Reference in New Issue
Block a user