void RecordStatSample() { if (!setting.isEnableStatistics || !IsCoreRunning() || setting.IsScreenLocked() || setting.IsClosing() || !isRecording.Install()) { return; } try { var statsPort = coreStates.GetStatPort(); if (statsPort > 0) { var sample = v2rayCore.QueryStatsApi(statsPort); coreStates.AddStatSample(sample); } } catch { } isRecording.Remove(); }