diff --git a/Build/build-pack-nano-nugets.psm1 b/Build/build-pack-nano-nugets.psm1 index 1b15f6f997..b2ed5c3e79 100644 --- a/Build/build-pack-nano-nugets.psm1 +++ b/Build/build-pack-nano-nugets.psm1 @@ -2,31 +2,13 @@ $nugetOutDir = "$root\Artifacts\NuGet" $toolsDir = "$root\.tools" $nuget = "$toolsDir\NuGet.exe" +$nugetsToProcess = (Get-ChildItem -Path "$root\UnitsNet.NanoFramework\GeneratedCode\" -Filter *.nuspec -r | % { echo $_.FullName }); function Invoke-BuildNanoNugets { - - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\Duration\UnitsNet.NanoFramework.Duration.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\ElectricCurrent\UnitsNet.NanoFramework.ElectricCurrent.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\ElectricPotential\UnitsNet.NanoFramework.ElectricPotential.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\ElectricResistance\UnitsNet.NanoFramework.ElectricResistance.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\Frequency\UnitsNet.NanoFramework.Frequency.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\Illuminance\UnitsNet.NanoFramework.Illuminance.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\Length\UnitsNet.NanoFramework.Length.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\Pressure\UnitsNet.NanoFramework.Pressure.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\Ratio\UnitsNet.NanoFramework.Ratio.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\RelativeHumidity\UnitsNet.NanoFramework.RelativeHumidity.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\Temperature\UnitsNet.NanoFramework.Temperature.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\VolumeConcentration\UnitsNet.NanoFramework.VolumeConcentration.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\Power\UnitsNet.NanoFramework.Power.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\Density\UnitsNet.NanoFramework.Density.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\Mass\UnitsNet.NanoFramework.Mass.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\Speed\UnitsNet.NanoFramework.Speed.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\MassConcentration\UnitsNet.NanoFramework.MassConcentration.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\Angle\UnitsNet.NanoFramework.Angle.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\MagneticField\UnitsNet.NanoFramework.MagneticField.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\Acceleration\UnitsNet.NanoFramework.Acceleration.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - & $nuget pack "$root\UnitsNet.NanoFramework\GeneratedCode\Level\UnitsNet.NanoFramework.Level.nuspec" -Verbosity detailed -OutputDirectory "$nugetOutDir" - +Foreach ($nuspecFile in $nugetsToProcess) + { + & $nuget pack "$nuspecFile" -Verbosity detailed -OutputDirectory "$nugetOutDir" + } } export-modulemember -function Invoke-BuildNanoNugets diff --git a/Common/UnitRelations.json b/Common/UnitRelations.json index bded89653c..2dea22c60a 100644 --- a/Common/UnitRelations.json +++ b/Common/UnitRelations.json @@ -13,8 +13,8 @@ "AreaMomentOfInertia.MeterToTheFourth = Volume.CubicMeter * Length.Meter", "double = SpecificEnergy.JoulePerKilogram * BrakeSpecificFuelConsumption.KilogramPerJoule", "DynamicViscosity.NewtonSecondPerMeterSquared = Density.KilogramPerCubicMeter * KinematicViscosity.SquareMeterPerSecond", - "ElectricCharge.AmpereHour = ElectricCurrent.Ampere * Duration.Hour", "ElectricCurrent.Ampere = ElectricCurrentGradient.AmperePerSecond * Duration.Second", + "ElectricCharge.AmpereHour = ElectricCurrent.Ampere * Duration.Hour", "ElectricPotential.Volt = ElectricCurrent.Ampere * ElectricResistance.Ohm", "Energy.Joule = ElectricPotential.Volt * ElectricCharge.Coulomb", "Energy.Joule = EnergyDensity.JoulePerCubicMeter * Volume.CubicMeter", @@ -73,8 +73,8 @@ "SpecificEnergy.JoulePerKilogram = Speed.MeterPerSecond * Speed.MeterPerSecond", "SpecificWeight.NewtonPerCubicMeter = Acceleration.MeterPerSecondSquared * Density.KilogramPerCubicMeter", "Speed.MeterPerSecond = Acceleration.MeterPerSecondSquared * Duration.Second", - "TemperatureDelta.DegreeCelsius = TemperatureChangeRate.DegreeCelsiusPerSecond * Duration.Second", "TemperatureDelta.DegreeCelsius = TemperatureGradient.DegreeCelsiusPerKilometer * Length.Kilometer", + "TemperatureDelta.DegreeCelsius = TemperatureChangeRate.DegreeCelsiusPerSecond * Duration.Second", "Torque.NewtonMeter = ForcePerLength.NewtonPerMeter * Area.SquareMeter", "Torque.NewtonMeter = Length.Meter * Force.Newton", "Torque.NewtonMeter = RotationalStiffness.NewtonMeterPerRadian * Angle.Radian", diff --git a/UnitsNet.NanoFramework/GeneratedCode/LapseRate/LapseRate.nfproj b/UnitsNet.NanoFramework/GeneratedCode/LapseRate/LapseRate.nfproj deleted file mode 100644 index 3850203729..0000000000 --- a/UnitsNet.NanoFramework/GeneratedCode/LapseRate/LapseRate.nfproj +++ /dev/null @@ -1,41 +0,0 @@ - - - - $(MSBuildExtensionsPath)\nanoFramework\v1.0\ - - - - Debug - AnyCPU - {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - {3f29cf67-7bd2-2cec-413f-5237833c48c6} - Library - Properties - 512 - UnitsNet - UnitsNet.LapseRate - v1.0 - bin\$(Configuration)\$(AssemblyName).xml - - - - - - - - - - - - - ..\packages\nanoFramework.CoreLibrary.1.15.5\lib\mscorlib.dll - True - - - - - - - - - \ No newline at end of file diff --git a/UnitsNet.NanoFramework/GeneratedCode/LapseRate/UnitsNet.NanoFramework.LapseRate.nuspec b/UnitsNet.NanoFramework/GeneratedCode/LapseRate/UnitsNet.NanoFramework.LapseRate.nuspec deleted file mode 100644 index 1196252d94..0000000000 --- a/UnitsNet.NanoFramework/GeneratedCode/LapseRate/UnitsNet.NanoFramework.LapseRate.nuspec +++ /dev/null @@ -1,26 +0,0 @@ - - - - UnitsNet.nanoFramework.LapseRate - 6.0.0-pre017 - Units.NET LapseRate - nanoFramework - Andreas Gullberg Larsen,nanoframework - UnitsNet - MIT-0 - https://github.com/angularsen/UnitsNet - false - Adds LapseRate units for Units.NET on .NET nanoFramework. For .NET or .NET Core, use UnitsNet instead. - https://raw.githubusercontent.com/angularsen/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png - - - Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). - en-US - nanoframework lapserate unit units quantity quantities measurement si metric imperial abbreviation abbreviations convert conversion parse immutable - - - - - - - - diff --git a/UnitsNet.NanoFramework/GeneratedCode/LapseRate/packages.config b/UnitsNet.NanoFramework/GeneratedCode/LapseRate/packages.config deleted file mode 100644 index e668a28c82..0000000000 --- a/UnitsNet.NanoFramework/GeneratedCode/LapseRate/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/LapseRate.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/LapseRate.g.cs deleted file mode 100644 index dc9b80b169..0000000000 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/LapseRate.g.cs +++ /dev/null @@ -1,159 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using System; -using UnitsNet.Units; - -namespace UnitsNet -{ - /// - /// - /// Lapse rate is the rate at which Earth's atmospheric temperature decreases with an increase in altitude, or increases with the decrease in altitude. - /// - public struct LapseRate - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly LapseRateUnit _unit; - - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - public LapseRateUnit Unit => _unit; - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to construct this quantity with. - /// The unit representation to construct this quantity with. - /// If value is NaN or Infinity. - public LapseRate(double value, LapseRateUnit unit) - { - _value = value; - _unit = unit; - } - - /// - /// The base unit of Duration, which is Second. All conversions go via this value. - /// - public static LapseRateUnit BaseUnit { get; } = LapseRateUnit.DegreeCelsiusPerKilometer; - - /// - /// Represents the largest possible value of Duration - /// - public static LapseRate MaxValue { get; } = new LapseRate(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Duration - /// - public static LapseRate MinValue { get; } = new LapseRate(double.MinValue, BaseUnit); - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Second. - /// - public static LapseRate Zero { get; } = new LapseRate(0, BaseUnit); - #region Conversion Properties - - /// - /// Gets a value of this quantity converted into - /// - public double DegreesCelciusPerKilometer => As(LapseRateUnit.DegreeCelsiusPerKilometer); - - #endregion - - #region Static Factory Methods - - /// - /// Creates a from . - /// - /// If value is NaN or Infinity. - public static LapseRate FromDegreesCelciusPerKilometer(double degreescelciusperkilometer) => new LapseRate(degreescelciusperkilometer, LapseRateUnit.DegreeCelsiusPerKilometer); - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// LapseRate unit value. - public static LapseRate From(double value, LapseRateUnit fromUnit) - { - return new LapseRate(value, fromUnit); - } - - #endregion - - #region Conversion Methods - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(LapseRateUnit unit) => GetValueAs(unit); - - /// - /// Converts this Duration to another Duration with the unit representation . - /// - /// A Duration with the specified unit. - public LapseRate ToUnit(LapseRateUnit unit) - { - var convertedValue = GetValueAs(unit); - return new LapseRate(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double GetValueInBaseUnit() - { - return Unit switch - { - LapseRateUnit.DegreeCelsiusPerKilometer => _value, - _ => throw new NotImplementedException($"Can not convert {Unit} to base units.") - }; - } - - private double GetValueAs(LapseRateUnit unit) - { - if (Unit == unit) - return _value; - - var baseUnitValue = GetValueInBaseUnit(); - - return unit switch - { - LapseRateUnit.DegreeCelsiusPerKilometer => baseUnitValue, - _ => throw new NotImplementedException($"Can not convert {Unit} to {unit}.") - }; - } - - #endregion - } -} - diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/TorquePerLength.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/TorquePerLength.g.cs deleted file mode 100644 index efda0c641c..0000000000 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/TorquePerLength.g.cs +++ /dev/null @@ -1,397 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using System; -using UnitsNet.Units; - -namespace UnitsNet -{ - /// - /// - /// The magnitude of torque per unit length. - /// - public struct TorquePerLength - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly TorquePerLengthUnit _unit; - - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - public TorquePerLengthUnit Unit => _unit; - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to construct this quantity with. - /// The unit representation to construct this quantity with. - public TorquePerLength(double value, TorquePerLengthUnit unit) - { - _value = value; - _unit = unit; - } - - /// - /// The base unit of TorquePerLength, which is Second. All conversions go via this value. - /// - public static TorquePerLengthUnit BaseUnit { get; } = TorquePerLengthUnit.NewtonMeterPerMeter; - - /// - /// Represents the largest possible value of TorquePerLength. - /// - public static TorquePerLength MaxValue { get; } = new TorquePerLength(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of TorquePerLength. - /// - public static TorquePerLength MinValue { get; } = new TorquePerLength(double.MinValue, BaseUnit); - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Second. - /// - public static TorquePerLength Zero { get; } = new TorquePerLength(0, BaseUnit); - #region Conversion Properties - - /// - /// Gets a value of this quantity converted into - /// - public double KilogramForceCentimetersPerMeter => As(TorquePerLengthUnit.KilogramForceCentimeterPerMeter); - - /// - /// Gets a value of this quantity converted into - /// - public double KilogramForceMetersPerMeter => As(TorquePerLengthUnit.KilogramForceMeterPerMeter); - - /// - /// Gets a value of this quantity converted into - /// - public double KilogramForceMillimetersPerMeter => As(TorquePerLengthUnit.KilogramForceMillimeterPerMeter); - - /// - /// Gets a value of this quantity converted into - /// - public double KilonewtonCentimetersPerMeter => As(TorquePerLengthUnit.KilonewtonCentimeterPerMeter); - - /// - /// Gets a value of this quantity converted into - /// - public double KilonewtonMetersPerMeter => As(TorquePerLengthUnit.KilonewtonMeterPerMeter); - - /// - /// Gets a value of this quantity converted into - /// - public double KilonewtonMillimetersPerMeter => As(TorquePerLengthUnit.KilonewtonMillimeterPerMeter); - - /// - /// Gets a value of this quantity converted into - /// - public double KilopoundForceFeetPerFoot => As(TorquePerLengthUnit.KilopoundForceFootPerFoot); - - /// - /// Gets a value of this quantity converted into - /// - public double KilopoundForceInchesPerFoot => As(TorquePerLengthUnit.KilopoundForceInchPerFoot); - - /// - /// Gets a value of this quantity converted into - /// - public double MeganewtonCentimetersPerMeter => As(TorquePerLengthUnit.MeganewtonCentimeterPerMeter); - - /// - /// Gets a value of this quantity converted into - /// - public double MeganewtonMetersPerMeter => As(TorquePerLengthUnit.MeganewtonMeterPerMeter); - - /// - /// Gets a value of this quantity converted into - /// - public double MeganewtonMillimetersPerMeter => As(TorquePerLengthUnit.MeganewtonMillimeterPerMeter); - - /// - /// Gets a value of this quantity converted into - /// - public double MegapoundForceFeetPerFoot => As(TorquePerLengthUnit.MegapoundForceFootPerFoot); - - /// - /// Gets a value of this quantity converted into - /// - public double MegapoundForceInchesPerFoot => As(TorquePerLengthUnit.MegapoundForceInchPerFoot); - - /// - /// Gets a value of this quantity converted into - /// - public double NewtonCentimetersPerMeter => As(TorquePerLengthUnit.NewtonCentimeterPerMeter); - - /// - /// Gets a value of this quantity converted into - /// - public double NewtonMetersPerMeter => As(TorquePerLengthUnit.NewtonMeterPerMeter); - - /// - /// Gets a value of this quantity converted into - /// - public double NewtonMillimetersPerMeter => As(TorquePerLengthUnit.NewtonMillimeterPerMeter); - - /// - /// Gets a value of this quantity converted into - /// - public double PoundForceFeetPerFoot => As(TorquePerLengthUnit.PoundForceFootPerFoot); - - /// - /// Gets a value of this quantity converted into - /// - public double PoundForceInchesPerFoot => As(TorquePerLengthUnit.PoundForceInchPerFoot); - - /// - /// Gets a value of this quantity converted into - /// - public double TonneForceCentimetersPerMeter => As(TorquePerLengthUnit.TonneForceCentimeterPerMeter); - - /// - /// Gets a value of this quantity converted into - /// - public double TonneForceMetersPerMeter => As(TorquePerLengthUnit.TonneForceMeterPerMeter); - - /// - /// Gets a value of this quantity converted into - /// - public double TonneForceMillimetersPerMeter => As(TorquePerLengthUnit.TonneForceMillimeterPerMeter); - - #endregion - - #region Static Factory Methods - - /// - /// Creates a from . - /// - public static TorquePerLength FromKilogramForceCentimetersPerMeter(double kilogramforcecentimeterspermeter) => new TorquePerLength(kilogramforcecentimeterspermeter, TorquePerLengthUnit.KilogramForceCentimeterPerMeter); - - /// - /// Creates a from . - /// - public static TorquePerLength FromKilogramForceMetersPerMeter(double kilogramforcemeterspermeter) => new TorquePerLength(kilogramforcemeterspermeter, TorquePerLengthUnit.KilogramForceMeterPerMeter); - - /// - /// Creates a from . - /// - public static TorquePerLength FromKilogramForceMillimetersPerMeter(double kilogramforcemillimeterspermeter) => new TorquePerLength(kilogramforcemillimeterspermeter, TorquePerLengthUnit.KilogramForceMillimeterPerMeter); - - /// - /// Creates a from . - /// - public static TorquePerLength FromKilonewtonCentimetersPerMeter(double kilonewtoncentimeterspermeter) => new TorquePerLength(kilonewtoncentimeterspermeter, TorquePerLengthUnit.KilonewtonCentimeterPerMeter); - - /// - /// Creates a from . - /// - public static TorquePerLength FromKilonewtonMetersPerMeter(double kilonewtonmeterspermeter) => new TorquePerLength(kilonewtonmeterspermeter, TorquePerLengthUnit.KilonewtonMeterPerMeter); - - /// - /// Creates a from . - /// - public static TorquePerLength FromKilonewtonMillimetersPerMeter(double kilonewtonmillimeterspermeter) => new TorquePerLength(kilonewtonmillimeterspermeter, TorquePerLengthUnit.KilonewtonMillimeterPerMeter); - - /// - /// Creates a from . - /// - public static TorquePerLength FromKilopoundForceFeetPerFoot(double kilopoundforcefeetperfoot) => new TorquePerLength(kilopoundforcefeetperfoot, TorquePerLengthUnit.KilopoundForceFootPerFoot); - - /// - /// Creates a from . - /// - public static TorquePerLength FromKilopoundForceInchesPerFoot(double kilopoundforceinchesperfoot) => new TorquePerLength(kilopoundforceinchesperfoot, TorquePerLengthUnit.KilopoundForceInchPerFoot); - - /// - /// Creates a from . - /// - public static TorquePerLength FromMeganewtonCentimetersPerMeter(double meganewtoncentimeterspermeter) => new TorquePerLength(meganewtoncentimeterspermeter, TorquePerLengthUnit.MeganewtonCentimeterPerMeter); - - /// - /// Creates a from . - /// - public static TorquePerLength FromMeganewtonMetersPerMeter(double meganewtonmeterspermeter) => new TorquePerLength(meganewtonmeterspermeter, TorquePerLengthUnit.MeganewtonMeterPerMeter); - - /// - /// Creates a from . - /// - public static TorquePerLength FromMeganewtonMillimetersPerMeter(double meganewtonmillimeterspermeter) => new TorquePerLength(meganewtonmillimeterspermeter, TorquePerLengthUnit.MeganewtonMillimeterPerMeter); - - /// - /// Creates a from . - /// - public static TorquePerLength FromMegapoundForceFeetPerFoot(double megapoundforcefeetperfoot) => new TorquePerLength(megapoundforcefeetperfoot, TorquePerLengthUnit.MegapoundForceFootPerFoot); - - /// - /// Creates a from . - /// - public static TorquePerLength FromMegapoundForceInchesPerFoot(double megapoundforceinchesperfoot) => new TorquePerLength(megapoundforceinchesperfoot, TorquePerLengthUnit.MegapoundForceInchPerFoot); - - /// - /// Creates a from . - /// - public static TorquePerLength FromNewtonCentimetersPerMeter(double newtoncentimeterspermeter) => new TorquePerLength(newtoncentimeterspermeter, TorquePerLengthUnit.NewtonCentimeterPerMeter); - - /// - /// Creates a from . - /// - public static TorquePerLength FromNewtonMetersPerMeter(double newtonmeterspermeter) => new TorquePerLength(newtonmeterspermeter, TorquePerLengthUnit.NewtonMeterPerMeter); - - /// - /// Creates a from . - /// - public static TorquePerLength FromNewtonMillimetersPerMeter(double newtonmillimeterspermeter) => new TorquePerLength(newtonmillimeterspermeter, TorquePerLengthUnit.NewtonMillimeterPerMeter); - - /// - /// Creates a from . - /// - public static TorquePerLength FromPoundForceFeetPerFoot(double poundforcefeetperfoot) => new TorquePerLength(poundforcefeetperfoot, TorquePerLengthUnit.PoundForceFootPerFoot); - - /// - /// Creates a from . - /// - public static TorquePerLength FromPoundForceInchesPerFoot(double poundforceinchesperfoot) => new TorquePerLength(poundforceinchesperfoot, TorquePerLengthUnit.PoundForceInchPerFoot); - - /// - /// Creates a from . - /// - public static TorquePerLength FromTonneForceCentimetersPerMeter(double tonneforcecentimeterspermeter) => new TorquePerLength(tonneforcecentimeterspermeter, TorquePerLengthUnit.TonneForceCentimeterPerMeter); - - /// - /// Creates a from . - /// - public static TorquePerLength FromTonneForceMetersPerMeter(double tonneforcemeterspermeter) => new TorquePerLength(tonneforcemeterspermeter, TorquePerLengthUnit.TonneForceMeterPerMeter); - - /// - /// Creates a from . - /// - public static TorquePerLength FromTonneForceMillimetersPerMeter(double tonneforcemillimeterspermeter) => new TorquePerLength(tonneforcemillimeterspermeter, TorquePerLengthUnit.TonneForceMillimeterPerMeter); - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// TorquePerLength unit value. - public static TorquePerLength From(double value, TorquePerLengthUnit fromUnit) - { - return new TorquePerLength(value, fromUnit); - } - - #endregion - - #region Conversion Methods - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(TorquePerLengthUnit unit) => GetValueAs(unit); - - /// - /// Converts this TorquePerLength to another TorquePerLength with the unit representation . - /// - /// A TorquePerLength with the specified unit. - public TorquePerLength ToUnit(TorquePerLengthUnit unit) - { - var convertedValue = GetValueAs(unit); - return new TorquePerLength(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double GetValueInBaseUnit() - { - return Unit switch - { - TorquePerLengthUnit.KilogramForceCentimeterPerMeter => _value * 0.0980665019960652, - TorquePerLengthUnit.KilogramForceMeterPerMeter => _value * 9.80665019960652, - TorquePerLengthUnit.KilogramForceMillimeterPerMeter => _value * 0.00980665019960652, - TorquePerLengthUnit.KilonewtonCentimeterPerMeter => (_value * 0.01) * 1e3d, - TorquePerLengthUnit.KilonewtonMeterPerMeter => (_value) * 1e3d, - TorquePerLengthUnit.KilonewtonMillimeterPerMeter => (_value * 0.001) * 1e3d, - TorquePerLengthUnit.KilopoundForceFootPerFoot => (_value * 4.44822161526) * 1e3d, - TorquePerLengthUnit.KilopoundForceInchPerFoot => (_value * 0.370685147638) * 1e3d, - TorquePerLengthUnit.MeganewtonCentimeterPerMeter => (_value * 0.01) * 1e6d, - TorquePerLengthUnit.MeganewtonMeterPerMeter => (_value) * 1e6d, - TorquePerLengthUnit.MeganewtonMillimeterPerMeter => (_value * 0.001) * 1e6d, - TorquePerLengthUnit.MegapoundForceFootPerFoot => (_value * 4.44822161526) * 1e6d, - TorquePerLengthUnit.MegapoundForceInchPerFoot => (_value * 0.370685147638) * 1e6d, - TorquePerLengthUnit.NewtonCentimeterPerMeter => _value * 0.01, - TorquePerLengthUnit.NewtonMeterPerMeter => _value, - TorquePerLengthUnit.NewtonMillimeterPerMeter => _value * 0.001, - TorquePerLengthUnit.PoundForceFootPerFoot => _value * 4.44822161526, - TorquePerLengthUnit.PoundForceInchPerFoot => _value * 0.370685147638, - TorquePerLengthUnit.TonneForceCentimeterPerMeter => _value * 98.0665019960652, - TorquePerLengthUnit.TonneForceMeterPerMeter => _value * 9806.65019960653, - TorquePerLengthUnit.TonneForceMillimeterPerMeter => _value * 9.80665019960652, - _ => throw new NotImplementedException($"Can not convert {Unit} to base units.") - }; - } - - private double GetValueAs(TorquePerLengthUnit unit) - { - if (Unit == unit) - return _value; - - var baseUnitValue = GetValueInBaseUnit(); - - return unit switch - { - TorquePerLengthUnit.KilogramForceCentimeterPerMeter => baseUnitValue * 10.1971619222242, - TorquePerLengthUnit.KilogramForceMeterPerMeter => baseUnitValue * 0.101971619222242, - TorquePerLengthUnit.KilogramForceMillimeterPerMeter => baseUnitValue * 101.971619222242, - TorquePerLengthUnit.KilonewtonCentimeterPerMeter => (baseUnitValue * 100) / 1e3d, - TorquePerLengthUnit.KilonewtonMeterPerMeter => (baseUnitValue) / 1e3d, - TorquePerLengthUnit.KilonewtonMillimeterPerMeter => (baseUnitValue * 1000) / 1e3d, - TorquePerLengthUnit.KilopoundForceFootPerFoot => (baseUnitValue / 4.44822161526) / 1e3d, - TorquePerLengthUnit.KilopoundForceInchPerFoot => (baseUnitValue / 0.370685147638) / 1e3d, - TorquePerLengthUnit.MeganewtonCentimeterPerMeter => (baseUnitValue * 100) / 1e6d, - TorquePerLengthUnit.MeganewtonMeterPerMeter => (baseUnitValue) / 1e6d, - TorquePerLengthUnit.MeganewtonMillimeterPerMeter => (baseUnitValue * 1000) / 1e6d, - TorquePerLengthUnit.MegapoundForceFootPerFoot => (baseUnitValue / 4.44822161526) / 1e6d, - TorquePerLengthUnit.MegapoundForceInchPerFoot => (baseUnitValue / 0.370685147638) / 1e6d, - TorquePerLengthUnit.NewtonCentimeterPerMeter => baseUnitValue * 100, - TorquePerLengthUnit.NewtonMeterPerMeter => baseUnitValue, - TorquePerLengthUnit.NewtonMillimeterPerMeter => baseUnitValue * 1000, - TorquePerLengthUnit.PoundForceFootPerFoot => baseUnitValue / 4.44822161526, - TorquePerLengthUnit.PoundForceInchPerFoot => baseUnitValue / 0.370685147638, - TorquePerLengthUnit.TonneForceCentimeterPerMeter => baseUnitValue * 0.0101971619222242, - TorquePerLengthUnit.TonneForceMeterPerMeter => baseUnitValue * 0.000101971619222242, - TorquePerLengthUnit.TonneForceMillimeterPerMeter => baseUnitValue * 0.101971619222242, - _ => throw new NotImplementedException($"Can not convert {Unit} to {unit}.") - }; - } - - #endregion - } -} - diff --git a/UnitsNet.NanoFramework/GeneratedCode/Units/LapseRateUnit.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Units/LapseRateUnit.g.cs deleted file mode 100644 index b6be109fd4..0000000000 --- a/UnitsNet.NanoFramework/GeneratedCode/Units/LapseRateUnit.g.cs +++ /dev/null @@ -1,32 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Units -{ - // Disable missing XML comment warnings for the generated unit enums. - #pragma warning disable 1591 - - public enum LapseRateUnit - { - DegreeCelsiusPerKilometer = 1, - } - - #pragma warning restore 1591 -} diff --git a/UnitsNet.NanoFramework/GeneratedCode/Units/TorquePerLengthUnit.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Units/TorquePerLengthUnit.g.cs deleted file mode 100644 index 4145084d80..0000000000 --- a/UnitsNet.NanoFramework/GeneratedCode/Units/TorquePerLengthUnit.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Units -{ - // Disable missing XML comment warnings for the generated unit enums. - #pragma warning disable 1591 - - public enum TorquePerLengthUnit - { - KilogramForceCentimeterPerMeter = 1, - KilogramForceMeterPerMeter = 2, - KilogramForceMillimeterPerMeter = 3, - KilonewtonCentimeterPerMeter = 4, - KilonewtonMeterPerMeter = 5, - KilonewtonMillimeterPerMeter = 6, - KilopoundForceFootPerFoot = 7, - KilopoundForceInchPerFoot = 8, - MeganewtonCentimeterPerMeter = 9, - MeganewtonMeterPerMeter = 10, - MeganewtonMillimeterPerMeter = 11, - MegapoundForceFootPerFoot = 12, - MegapoundForceInchPerFoot = 13, - NewtonCentimeterPerMeter = 14, - NewtonMeterPerMeter = 15, - NewtonMillimeterPerMeter = 16, - PoundForceFootPerFoot = 17, - PoundForceInchPerFoot = 18, - TonneForceCentimeterPerMeter = 19, - TonneForceMeterPerMeter = 20, - TonneForceMillimeterPerMeter = 21, - } - - #pragma warning restore 1591 -} diff --git a/UnitsNet/GeneratedCode/Resources/ReactiveEnergy.restext b/UnitsNet/GeneratedCode/Resources/ReactiveEnergy.restext deleted file mode 100644 index 1b5a2f86ac..0000000000 --- a/UnitsNet/GeneratedCode/Resources/ReactiveEnergy.restext +++ /dev/null @@ -1,3 +0,0 @@ -KilovoltampereReactiveHours=kvarh -MegavoltampereReactiveHours=Mvarh -VoltampereReactiveHours=varh diff --git a/UnitsNet/GeneratedCode/Resources/ReactivePower.restext b/UnitsNet/GeneratedCode/Resources/ReactivePower.restext deleted file mode 100644 index 713ea6becd..0000000000 --- a/UnitsNet/GeneratedCode/Resources/ReactivePower.restext +++ /dev/null @@ -1,4 +0,0 @@ -GigavoltamperesReactive=Gvar -KilovoltamperesReactive=kvar -MegavoltamperesReactive=Mvar -VoltamperesReactive=var diff --git a/UnitsNet/GeneratedCode/Resources/Volume.nb-NO.restext b/UnitsNet/GeneratedCode/Resources/Volume.nb-NO.restext deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/UnitsNet/GeneratedCode/Units/ReactiveEnergyUnit.g.cs b/UnitsNet/GeneratedCode/Units/ReactiveEnergyUnit.g.cs deleted file mode 100644 index d48f6482a1..0000000000 --- a/UnitsNet/GeneratedCode/Units/ReactiveEnergyUnit.g.cs +++ /dev/null @@ -1,34 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Units -{ - // Disable missing XML comment warnings for the generated unit enums. - #pragma warning disable 1591 - - public enum ReactiveEnergyUnit - { - KilovoltampereReactiveHour = 1, - MegavoltampereReactiveHour = 2, - VoltampereReactiveHour = 3, - } - - #pragma warning restore 1591 -} diff --git a/UnitsNet/GeneratedCode/Units/ReactivePowerUnit.g.cs b/UnitsNet/GeneratedCode/Units/ReactivePowerUnit.g.cs deleted file mode 100644 index 32e7a9ede9..0000000000 --- a/UnitsNet/GeneratedCode/Units/ReactivePowerUnit.g.cs +++ /dev/null @@ -1,35 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Units -{ - // Disable missing XML comment warnings for the generated unit enums. - #pragma warning disable 1591 - - public enum ReactivePowerUnit - { - GigavoltampereReactive = 1, - KilovoltampereReactive = 2, - MegavoltampereReactive = 3, - VoltampereReactive = 4, - } - - #pragma warning restore 1591 -}