- private static List<int> GetActiveSpans(NetworkStream stream)
- {
- List<int> spans = new List<int>();
- string cmd = "Action: smscommand\r\ncommand: gsm show spans\r\n\r\n";
- SendCommand(stream, cmd);
- string response = ReadResponse(stream);
- string[] lines = response.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries);
- foreach (string line in lines)
- {
- if (line.Contains("GSM span") && line.Contains("Up, Active"))
- {
- string[] parts = line.Split();
- if (parts.Length >= 3 && int.TryParse(parts[2].TrimEnd(':'), out int span))
- {
- spans.Add(span);
- }
- }
- }
- LogMessage("Active Spans: " + string.Join(", ", spans), System.Diagnostics.EventLogEntryType.Information);
- return spans;
- }
Recent Pastes