/// <summary> /// Initializes a new instance of the <see cref="T:ByteDev.Io.FileSize" /> class. /// </summary> /// <param name="numberOfBytes">File size in bytes.</param> /// <param name="multiplier">Size multiplier type.</param> /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="numberOfBytes" /> must be zero or more.</exception> public FileSize(long numberOfBytes, MultiplierType multiplier = MultiplierType.BinaryMultiplier) { if (numberOfBytes < 0) { throw new ArgumentOutOfRangeException(nameof(numberOfBytes), "Number of bytes must be zero or more"); } TotalBytes = numberOfBytes; _multiplier = multiplier; }
public static float GetMultiplier(MultiplierType type) { switch (type) { case MultiplierType.MeleeDamage: return(ExtractNumber("MeleeDamage")); case MultiplierType.MeleeDurability: return(ExtractNumber("MeleeDurability")); case MultiplierType.MeleeLunge: return(ExtractNumber("MeleeLunge")); case MultiplierType.MeleeSpeed: return(ExtractNumber("MeleeSpeed")); case MultiplierType.ThrownDamage: return(ExtractNumber("ThrownDamage")); case MultiplierType.ThrownCount: return(ExtractNumber("ThrownCount")); case MultiplierType.ThrownDistance: return(ExtractNumber("ThrownDistance")); case MultiplierType.RangedDamage: return(ExtractNumber("RangedDamage")); case MultiplierType.RangedAmmo: return(ExtractNumber("RangedAmmo")); case MultiplierType.RangedFirerate: return(ExtractNumber("RangedFirerate")); case MultiplierType.RangedFullAuto: return(ExtractString("RangedFullAuto") != null ? 0f : 1f); case MultiplierType.ProjectileSpeed: return(ExtractNumber("ProjectileSpeed")); case MultiplierType.ProjectileType: string type2 = ExtractString("ProjectileType"); if (type2 == "Rocket") { return((int)ProjectileType.Rocket); } else if (type2 == "Random") { return((int)ProjectileType.Random); } else if (type2 == "RandomEffect") { return((int)ProjectileType.RandomEffect); } else { return((int)ProjectileType.Normal); } case MultiplierType.ExplosionDamage: return(ExtractNumber("ExplosionDamage")); case MultiplierType.ExplosionPower: return(ExtractNumber("ExplosionPower")); } return(1f); }
protected string FormatAxisTitle(MultiplierType unitMultiplierType, Parameters parameters) { var unit = GetUnit(unitMultiplierType, parameters); if (!unit.IsAllowNormalization || parameters.NormalizeBy == NormalizeBy.None) { return($"{unit.UnitName} ({unit.UnitAbbreviation})"); } var normilizedByTitle = parameters.NormalizeBy.GetType().GetField(Enum.GetName(typeof(NormalizeBy), parameters.NormalizeBy)).GetCustomAttribute <DescriptionAttribute>().Description; return($"{unit.UnitName} ({unit.UnitAbbreviation}/{normilizedByTitle})"); }
public void ChangeMultiplier(MultiplierType type) { if (type == MultiplierType.Wrong) { multiplierCount = 1; } else if (type != MultiplierType.Good) { if (multiplierCount + (int)type <= 10) { multiplierCount += (int)type; } else { multiplierCount = 10; } } _multiplierDisplayer.SetMultiplierText(multiplierCount); }
protected IUnitMeasurement GetUnit(MultiplierType unitMultiplierType, Parameters parameters) { var code = $"{unitMultiplierType.ToString().ToUpper()}_"; switch (unitMultiplierType) { case MultiplierType.Current: code += parameters.CurrentUoM.ToString(); break; case MultiplierType.Capacity: code += parameters.CapacityUoM.ToString(); break; case MultiplierType.Resistance: code += parameters.ResistanceUoM.ToString(); break; case MultiplierType.Voltage: code += parameters.VoltageUoM.ToString(); break; case MultiplierType.Time: code += parameters.TimeUoM.ToString(); break; case MultiplierType.Energy: code += parameters.EnergyUoM.ToString(); break; case MultiplierType.Power: code += parameters.PowerUoM.ToString(); break; case MultiplierType.Temperature: code += parameters.TemperatureUoM.ToString(); break; } return(UomProvider.Unit(code)); }
/// <summary> /// GWP name and value /// </summary> /// <param name="name">GWP name</param> /// <param name="value">GWP coefficient</param> /// <param name="type">GWP multiplier type, volume or weight</param> public GwpNameValue(string name, double value, MultiplierType type = MultiplierType.Volume) { Name = name; Value = value; GwpType = type; }
/// <summary> /// Initializes a new instance of the <see cref="T:ByteDev.Io.FileSize" /> class. /// </summary> /// <param name="fileInfo">File info.</param> /// <param name="multiplier">Size multiplier type.</param> public FileSize(FileInfo fileInfo, MultiplierType multiplier = MultiplierType.BinaryMultiplier) : this(fileInfo.Length, multiplier) { }
/// <summary> /// Initializes a new instance of the <see cref="T:ByteDev.Io.FileSize" /> class. /// </summary> /// <param name="filePath">File path.</param> /// <param name="multiplier">Size multiplier type.</param> public FileSize(string filePath, MultiplierType multiplier = MultiplierType.BinaryMultiplier) : this(new FileInfo(filePath), multiplier) { }
protected UnitMeasurementContext GetDataNormalizedContext(Project project, MultiplierType unitMultiplierType) { var unit = GetUnit(unitMultiplierType, ChartSettings); return(new UnitMeasurementContext(unit, GetNormalizeByDivider(project, ChartSettings))); }
public Multiplier(short value, MultiplierType type) { Type = type; Value = value; }