static void Cleanup(DataClient client) { if (client == null) return; if (client.IsStarted) client.Stop(); client.Dispose(); }