public static KSPSpecialAttrib Load(List <string[]> config) { KSPAdvancedSAS part = new KSPAdvancedSAS(); foreach (var line in config) { switch (line[0].Trim()) { case "Ki": try { part.Ki = Double.Parse(line[1].Trim()); } catch (Exception e) { throw new Exception(String.Format("Ki string '{0}' could not be parsed into a double value.", line[1].Trim()), e); } break; case "Kp": try { part.Kp = Double.Parse(line[1].Trim()); } catch (Exception e) { throw new Exception(String.Format("Kp string '{0}' could not be parsed into a double value.", line[1].Trim()), e); } break; case "Kd": try { part.Kd = Double.Parse(line[1].Trim()); } catch (Exception e) { throw new Exception(String.Format("Kd string '{0}' could not be parsed into a double value.", line[1].Trim()), e); } break; } } return(part); }
public static KSPSpecialAttrib Load(List<string[]> config) { KSPAdvancedSAS part = new KSPAdvancedSAS(); foreach (var line in config) { switch (line[0].Trim()) { case "Ki": try { part.Ki = Double.Parse(line[1].Trim()); } catch (Exception e) { throw new Exception(String.Format("Ki string '{0}' could not be parsed into a double value.", line[1].Trim()), e); } break; case "Kp": try { part.Kp = Double.Parse(line[1].Trim()); } catch (Exception e) { throw new Exception(String.Format("Kp string '{0}' could not be parsed into a double value.", line[1].Trim()), e); } break; case "Kd": try { part.Kd = Double.Parse(line[1].Trim()); } catch (Exception e) { throw new Exception(String.Format("Kd string '{0}' could not be parsed into a double value.", line[1].Trim()), e); } break; } } return part; }