Quantcast
Channel: Programming (In-game)
Viewing all articles
Browse latest Browse all 645

[SOLVED] Help with Exception handling - Vent Pressure snippet

$
0
0
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.

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;
}...
[SOLVED] Help with Exception handling - Vent Pressure snippet

Viewing all articles
Browse latest Browse all 645

Trending Articles