/// <summary> /// プロセスの有効性をチェック /// </summary> private void checkProcessId() { try { if (Config.FollowFFXIVPlugin) { Process p = null; if (FFXIVPluginHelper.Instance != null) { p = FFXIVPluginHelper.GetFFXIVProcess; if (p == null || (_memory != null && _memory.process.Id != p.Id)) { _memory?.Dispose(); _memory = null; } } } if (_memory == null) { changeProcessId(0); } else if (_memory.validateProcess()) { // スキャン間隔をもどす if (timer.Interval != this.Config.ScanInterval) { timer.Interval = this.Config.ScanInterval; } if (suppress_log == true) { suppress_log = false; } } else { _memory?.Dispose(); _memory = null; } } catch (Exception ex) { LogError(ex.Message); } }
public void changeProcessId(int processId) { lock (_lock) { Process p = null; if (Config.FollowFFXIVPlugin) { if (FFXIVPluginHelper.Instance != null) { p = FFXIVPluginHelper.GetFFXIVProcess; } } else { p = FFXIVProcessHelper.GetFFXIVProcess(processId); } if ((_memory == null && p != null) || (_memory != null && p != null && p.Id != _memory.process.Id)) { try { _memory = new FFXIVMemory(this, p); } catch (Exception ex) { LogError(ex.Message); suppress_log = true; _memory = null; } } else if (_memory != null && p == null) { _memory.Dispose(); _memory = null; } } }