public List <string> GetPressureRowLabels(int rangeTypeIndex, int classIndex) { List <string> row = new List <string>(); if (pressSystemInfo == null) { return(row); } RangeTypeEnum rangeType = RangeTypeFromLabel(RangeTypesLabels[rangeTypeIndex]); float precision = Convert.ToSingle(Classes[classIndex]); PressureRow pressureRow = new PressureRow(rangeType, pressSystemInfo, precision); List <int> pressRow = pressureRow.GetPressureRow(); if (pressRow != null) { foreach (int item in pressRow) { row.Add(GetPressLabel(item)); } } else { row.Add("-----"); } return(row); }
private void CreateDevRange(long pressure_Pa, RangeTypeEnum rangeType) { Pressure_Pa = pressure_Pa; RangeType = rangeType; AbsolutPressure = false; switch (rangeType) { case RangeTypeEnum.DIV: if (pressure_Pa > Math.Abs(VacuumPressure)) { Min_Pa = VacuumPressure; Max_Pa = pressure_Pa; } else { Min_Pa = (-1) * pressure_Pa; Max_Pa = pressure_Pa; } break; case RangeTypeEnum.DI: Min_Pa = 0; Max_Pa = pressure_Pa; break; case RangeTypeEnum.DD: Min_Pa = 0; Max_Pa = pressure_Pa; break; case RangeTypeEnum.DV: Min_Pa = 0; Max_Pa = (-1) * pressure_Pa; break; case RangeTypeEnum.DA: Min_Pa = 0; Max_Pa = pressure_Pa; AbsolutPressure = true; break; case RangeTypeEnum.DG: Min_Pa = 0; Max_Pa = pressure_Pa * 0.980665F; break; } Span = Math.Abs(Max_Pa - Min_Pa); SetUnits(); }
public DeviceRange(int pressure_Pa, RangeTypeEnum rangeType) { CreateDevRange(pressure_Pa, rangeType); }
public static string GetRangeTypeLabel(RangeTypeEnum rangeType) { return((rangeTypes.FirstOrDefault(item => item.Value == rangeType)).Key); }
public PressureRow(RangeTypeEnum rangeType, PressSystemInfo pressSystemInfo, float devicePrecision) { this.rangeType = rangeType; this.devicePrecision = devicePrecision; this.pressSystemInfo = pressSystemInfo; }
public void ApplyConfig(string config) { Match match; match = regexPos.Match(config); SetPosition( match.Success ? Utils.TryGetDouble(match.Groups[1].Value, defaultPosX) : defaultPosX, match.Success ? Utils.TryGetDouble(match.Groups[2].Value, defaultPosY) : defaultPosY ); match = regexScale.Match(config); SetScale( match.Success ? Utils.TryGetDouble(match.Groups[1].Value, defaultScale) : defaultScale ); match = regexColor.Match(config); SetColor(match.Success ? match.Groups[1].Value : defaultColor); if (config.IndexOf(monospaceFont, StringComparison.OrdinalIgnoreCase) != -1) { SetFont(monospaceFont); } else { SetFont(); } SetNoHideHud(config.IndexOf("nohide", StringComparison.OrdinalIgnoreCase) != -1); match = regexBackground.Match(config); if (match.Success) { SetBackground( true, match.Groups[1].Value, Utils.TryGetInt(match.Groups[2].Value, defaultBackgroundOpacity) ); } else { SetBackground(false); } match = regexRange.Match(config); if (match.Success) { switch (match.Groups[1].Value) { case "all": RangeType = RangeTypeEnum.All; break; case "faction": RangeType = RangeTypeEnum.Faction; break; default: RangeType = RangeTypeEnum.Player; break; } SetRange( true, Utils.TryGetInt(match.Groups[2].Value, defaultRange) ); } else { SetRange(false); } var matches = regexRestriction.Matches(config); if (matches.Count > 0 || HasRange) { RestrictionEnum NewRestrictions = RestrictionEnum.None; foreach (Match one in matches) { switch (one.Groups[1].Value) { case "first": NewRestrictions |= RestrictionEnum.First; break; case "third": NewRestrictions |= RestrictionEnum.Third; break; case "camera": NewRestrictions |= RestrictionEnum.Camera; break; case "anyview": NewRestrictions |= RestrictionEnum.Any; break; } } SetRestrictions(NewRestrictions); } else { SetRestrictions(); } }
public RangeAttribute(int min, int max) { RangeType = RangeTypeEnum.Float; MinInt = min; MaxInt = max; }
public RangeAttribute(float min, float max) { RangeType = RangeTypeEnum.Float; MinFloat = min; MaxFloat = max; }