private static void ReadBatteryVersion(RS232 paramcom, ValenceBattery paramBattery) { try { paramcom.Write(paramBattery.BatteryVersionRead()); if (paramcom.Read(51) == -1) { throw new Exception("Read Battery Version Error!"); } if (!paramBattery.BatteryVersionReturn(paramcom.InputStream)) { throw new Exception("Read Battery Version Error!"); } Console.WriteLine($"Version: {paramBattery.Version}"); Console.WriteLine($"Firmware Date: {paramBattery.BuildRevision}"); Console.WriteLine($"Revision: {paramBattery.Revision}"); } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } }