cms-tool - ScaleUtilities 2.0.0

A comprehensive .NET library for unit conversions across multiple scale types including Weight, Length, Volume, Temperature, Speed, Velocity, Angle, Voltage, Illuminance, and Concentration. Features formula-based conversions using NCalc, extensive unit support, and validation utilities.

PM> Install-Package ScaleUtilities -Version 2.0.0 -Source https://www.myget.org/F/cms-tool/api/v3/index.json

Copy to clipboard

> nuget.exe install ScaleUtilities -Version 2.0.0 -Source https://www.myget.org/F/cms-tool/api/v3/index.json

Copy to clipboard

> dotnet add package ScaleUtilities --version 2.0.0 --source https://www.myget.org/F/cms-tool/api/v3/index.json

Copy to clipboard
<PackageReference Include="ScaleUtilities" Version="2.0.0" />
Copy to clipboard
source https://www.myget.org/F/cms-tool/api/v3/index.json

nuget ScaleUtilities  ~> 2.0.0
Copy to clipboard

> choco install ScaleUtilities --version 2.0.0 --source https://www.myget.org/F/cms-tool/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "cms-tool" -SourceLocation "https://www.myget.org/F/cms-tool/api/v2"
Install-Module -Name "ScaleUtilities" -RequiredVersion "2.0.0" -Repository "cms-tool" 
Copy to clipboard

Version 2.0.0: MAJOR RELEASE - Breaking Changes and Symbol Display Enhancements

⚠️ BREAKING CHANGES - MAJOR VERSION UPDATE:

  • API Method Renamed: GetAvailableUnits() → GetAvailableUnitCodes() in all *ConversionTreeUtilities classes
    • Old method name is no longer available
    • GetAvailableUnitCodes() returns string[] (unit codes only)
    • New GetAvailableUnits() returns strongly-typed ScaleUnit arrays with metadata
  • Return Type Changed: GetAvailableUnits() now returns ScaleUnit-derived types instead of string[]
    • Migration required for existing code using GetAvailableUnits()
    • See Migration Guide below for step-by-step instructions

✨ NEW FEATURES:

  • Rich Unit Objects: New GetAvailableUnits() method returns strongly-typed unit classes:
    • WeightUnit[], LengthUnit[], VolumeUnit[], TemperatureUnit[]
    • SpeedUnit[], VelocityUnit[], AngleUnit[], VoltageUnit[]
    • IlluminanceUnit[], ConcentrationUnit[], WirelessSignalStrengthUnit[], ElectricalConductivityUnit[]
  • Enhanced Metadata: Each unit object includes Type, Code, and Symbol properties
  • Symbol Support: Added ScaleUnitDto.Symbol property for API responses with proper Unicode encoding
  • ConversionTree.Code Property: Added missing Code property for better API consistency

🐛 BUG FIXES - Unicode Symbol Display:

  • Fixed all Unicode character encoding issues across the library:
    • µ (micro): Microgram, Microvolt, Microwatt, Microsiemens, etc.
    • ℥ (apothecary ounce): Weight units
    • ℧ (mho): Electrical conductivity units
    • Ω (omega/ohm): Electrical conductivity units
    • ° (degree): Angle units
    • π (pi): Angle units (radians)
    • ∟ (right angle): Angle units (was showing as ?)
    • ² (superscript 2): Square units (m², ft², in²)
    • ³ (superscript 3): Cubic units (m³, ft³, in³)
  • Fixed missing symbols in IlluminanceUnitCodes: mlx, klx, lm/m², lm/ft², lm/in²
  • Fixed missing symbols in VelocityUnitCodes: cm/s, mm/s, in/s, yd/s, c, M
  • Fixed typo: Footcandle → FootCandle in IlluminanceUnitCodes
  • All source files re-saved with UTF-8 BOM encoding

🔧 IMPROVEMENTS:

  • Enhanced web application UTF-8 encoding in Program.cs and _Layout.cshtml
  • Added JavaScriptEncoder.UnsafeRelaxedJsonEscaping for proper JSON serialization
  • Comprehensive XML documentation for all GetSymbol() methods
  • Improved IntelliSense support with rich unit metadata
  • Better type safety throughout the library
  • Consistent API patterns across all conversion utilities

📖 MIGRATION GUIDE - Upgrading from 1.x to 2.0:

Before (1.x):

string[] units = WeightConversionTreeUtilities.GetAvailableUnits();
// Returns: ["KILOGRAM", "GRAM", "POUND", ...]

After (2.0):

// Option 1: Get unit codes (same as before)
string[] unitCodes = WeightConversionTreeUtilities.GetAvailableUnitCodes();
// Returns: ["KILOGRAM", "GRAM", "POUND", ...]

// Option 2: Get rich unit objects (NEW!)
WeightUnit[] units = WeightConversionTreeUtilities.GetAvailableUnits();
// Each unit has: Type (ScaleTypes.Weight), Code ("KILOGRAM"), Symbol ("kg")

// Access unit properties:
foreach (var unit in units)
{
    Console.WriteLine($"{unit.Code}: {unit.Symbol} ({unit.Type})");
}

Quick Migration Steps:

  1. Find all calls to GetAvailableUnits() in your code
  2. If you only need unit codes (strings), rename to GetAvailableUnitCodes()
  3. If you want unit metadata, keep GetAvailableUnits() and update variable types
  4. Recompile and test your application

Web Application Note:

  • Restart your application after updating
  • Clear browser cache (Ctrl+Shift+Delete) for proper symbol display
  • Unicode symbols (µ, ℥, ℧, Ω, °, ², ³, ∟) now display correctly

For detailed upgrade assistance, visit: https://gitlab.com/iot93/back-end/commons/uom

  • .NETFramework 9.0
    • NCalc.NetCore (>= 1.0.1)
  • .NETFramework 9.0: 9.0.0.0

Owners

Linh Nguyen

Authors

Scale Utilities Team

Project URL

https://gitlab.com/iot93/back-end/commons/uom

License

Unknown

Tags

unit-conversion measurement scale weight length volume temperature speed velocity angle voltage illuminance concentration ncalc conversion utilities

Info

21 total downloads
1 downloads for version 2.0.0
Download (46.7 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
2.0.4 52.8 KB Thu, 07 May 2026 03:20:11 GMT 3
2.0.3 50.27 KB Wed, 04 Mar 2026 04:11:33 GMT 1
2.0.2 47.64 KB Fri, 07 Nov 2025 03:29:40 GMT 2
2.0.1 47.01 KB Fri, 07 Nov 2025 03:29:39 GMT 1
2.0.0 46.7 KB Fri, 07 Nov 2025 03:29:40 GMT 1
1.0.2 44.11 KB Fri, 07 Nov 2025 03:29:41 GMT 2
1.0.1 41.11 KB Fri, 07 Nov 2025 03:29:39 GMT 8
1.0.0 22.26 KB Sat, 27 Sep 2025 17:20:57 GMT 3