So I'm writing a script for my airlocks, and I have a method for converting the % pressure from the vent's DetailedInfo into an int for status checking.
[SOLVED] Help with Exception handling - Vent Pressure snippet
Code:
public int VentPressure(IMyAirVent vent)
{
int vPressure;
string info = vent.DetailedInfo;
string[] infoSplit = info.Split('\n');
string[] pressureLine = infoSplit[2].Split(':');
string[] pressure = pressureLine[1].Trim().Split('%');
vPressure = (int)Convert.ToDouble(pressure[0]);
return vPressure;
}...