diff --git a/.markdownlint.jsonc b/.markdownlint.jsonc new file mode 100644 index 0000000000..ba862ca768 --- /dev/null +++ b/.markdownlint.jsonc @@ -0,0 +1,16 @@ +{ + "default": true, + "line-length": false, + "no-inline-html": false, + "no-bare-urls": false, + "no-emphasis-as-heading": false, + "code-block-style": { + "style": "fenced" + }, + // Headers must start at the beginning of the line - false positive in some cases where it makes sense. + "MD023": false, + // First line in a file should be a top-level heading - false positive for include files. + "MD041": false, + // Link fragments should be valid - false positive for DocFx tabs + "MD051": false +} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 78070ef418..22d7954002 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,9 @@ # Contributing to Units.NET Guidelines for contributing to the repo. - + ## We want your help and we are friendly to first-time contributors! + Adding a new unit or a new quantity is easy! We have detailed the steps here and if you need any assistance we are happy to help! https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit @@ -11,20 +12,24 @@ We also want the person with the idea, suggestion or bug report to implement the This is to help grow the number of people that can contribute to the project and after someone new lands that first PR we often see more PRs from that person later. ## Coding Conventions + * Match the existing code style, we generally stick to "Visual Studio defaults" and [.NET Foundation Coding Guidelines](https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md) * If you use ReSharper there is a [settings file](https://github.com/angularsen/UnitsNet/blob/master/UnitsNet.sln.DotSettings) that will take effect automatically * There is an [.editorconfig](https://github.com/angularsen/UnitsNet/blob/master/.editorconfig) to help configure whitespace and C# syntax for your editor if it supports it * Add the file header to new files you create ### Test Code + * Test class: Use `Tests` suffix for the type you are testing, such as `UnitSystemTests` * Test method: `__` (`Parse_AmbiguousUnits_ThrowsException`) * If there are many tests for a single method, you can wrap those in an inner class named the same as the method and then you can skip that part of the test method names ## Unit definitions (.JSON) + For a fairly complete summary of the unit definition JSON schema, see [Meter of Length](https://github.com/angularsen/UnitsNet/blob/master/Common/UnitDefinitions/Length.json). It has prefix units and multiple cultures. ### Conversion functions + Converting from unit A to B is achieved by first converting from unit A to the base unit, then from the base unit to unit B. To achieve this, each unit defines two conversion functions. * Prefer multiplication for `FromUnitToBaseFunc` (`{x} * 2.54e-2` for `Inch` to `Meter`) @@ -34,6 +39,7 @@ Converting from unit A to B is achieved by first converting from unit A to the b * Prefer a calculation if the conversion factor is infinite (`({x} / 72.27)*2.54e-2` for `PrinterPoint`) ### Units + Generally we try to name the units as what is the most widely used. * Use prefix for country variants, such as `ImperialGallon` and `UsGallon` @@ -41,6 +47,7 @@ Generally we try to name the units as what is the most widely used. **Note:** We should really consider switching variant prefix to suffix, since that plays better with kilo, mega etc.. Currently we have units named `KilousGallon` and `KiloimperialGallon`, these would be better named `KilogallonUs` and `KilogallonImperial`. ### Unit abbreviations + A unit can have multiple abbreviations per culture/language, the first one is used by `ToString()` while all of them are used by `Parse()`. * Prefer the most widely used abbreviation in the domain, but try to adapt to our conventions diff --git a/Docs/top-dependencies.md b/Docs/top-dependencies.md index f6173603fb..2fad2c8d09 100644 --- a/Docs/top-dependencies.md +++ b/Docs/top-dependencies.md @@ -1,15 +1,20 @@ -| url | stars | +# Top Dependencies by GitHub Stars + +The following table lists the top public repositories using Units.NET, along with their GitHub star counts (as of May 2025): + +| Repo | Stars | |-----------------------------------------------------------------|---------| -| https://github.com/microsoft/PowerToys | 93K | -| https://github.com/dotnet/iot | 2.0K | -| https://github.com/angularsen/UnitsNet | 1.9K | -| https://github.com/genielabs/HomeGenie | 367 | -| https://github.com/raspberry-sharp/raspberry-sharp-io | 337 | +| https://github.com/microsoft/PowerToys | 120K | +| https://github.com/dotnet/iot | 2.3K | +| https://github.com/genielabs/HomeGenie | 410 | +| https://github.com/raspberry-sharp/raspberry-sharp-io | 340 | +| https://github.com/nanoframework/nanoFramework.IoT.Device | 258 | +| https://github.com/porrey/Virtual-ZPL-Printer | 240 | | https://github.com/chino-os/chino-os | 147 | -| https://github.com/BriefFiniteElementNet/BriefFiniteElement.Net | 128 | -| https://github.com/porrey/Virtual-ZPL-Printer | 95 | -| https://github.com/WhiteBlackGoose/UnitsOfMeasure | 56 | -| https://github.com/pi-top/pi-top-4-.NET-SDK | 47 | -found 451 repositories others repositories are private -found 154 repositories with more than zero star +| https://github.com/BriefFiniteElementNet/BriefFiniteElement.Net | 156 | +| https://github.com/WhiteBlackGoose/UnitsOfMeasure | 59 | +| https://github.com/pi-top/pi-top-4-.NET-SDK | 50 | + +_Total repositories listed: 10_ +_Star counts are based on the latest data in the main README and may change over time._ diff --git a/README.md b/README.md index 8cc3345836..17f692e492 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,8 @@ Add strongly typed quantities to your code and get merrily on with your life. No more magic constants found on Stack Overflow, no more second-guessing the unit of parameters and variables. ### Changes -ℹ️ The `master` branch now targets v6, but it is still in pre-release. + +ℹ️ The `master` branch now targets v6, but it is still in pre-release. New units will be backported to `maintenance/v5` until v6 becomes stable. [Upgrading from 5.x to 6.x](https://github.com/angularsen/UnitsNet/wiki/Upgrading-from-5.x-to-6.x)
@@ -36,13 +37,14 @@ New units will be backported to `maintenance/v5` until v6 becomes stable. ### Installing via NuGet -Add it via CLI +Add it via CLI: - dotnet add package UnitsNet +```bash +dotnet add package UnitsNet +``` or go to [NuGet Gallery | UnitsNet](https://www.nuget.org/packages/UnitsNet) for detailed instructions. - #### Build Targets * .NET Standard 2.0 @@ -95,6 +97,7 @@ The culture for abbreviations defaults to Thread.CurrentCulture and falls back t * GetAbbreviation() * Parse/TryParse() * ParseUnit/TryParseUnit() + ```C# var usEnglish = new CultureInfo("en-US"); var russian = new CultureInfo("ru-RU"); @@ -121,6 +124,7 @@ string kgAbbreviation = Mass.GetAbbreviation(MassUnit.Kilogram); // "kg" ``` #### Gotcha: AmbiguousUnitParseException + Some units of a quantity have the same abbreviation, which means `.Parse()` is not able to know what unit you wanted. Unfortunately there is no built-in way to avoid this, either you need to ensure you don't pass in input that cannot be parsed or you need to write your own parser that has more knowledge of preferred units or maybe only a subset of the units. @@ -128,15 +132,17 @@ Example: `Length.Parse("1 pt")` throws `AmbiguousUnitParseException` with message `Cannot parse "pt" since it could be either of these: DtpPoint, PrinterPoint`. ### Dynamically Parse Quantities and Convert to Units + Sometimes you need to work with quantities and units at runtime, such as parsing user input. There are a handful of classes to help with this: -- [Quantity](UnitsNet/CustomCode/Quantity.cs) for parsing and constructing quantities as well as looking up units, names and quantity information dynamically -- [UnitConverter](UnitsNet/UnitConverter.cs) for converting values to a different unit, with only strings or enum values -- [UnitParser](UnitsNet/CustomCode/UnitParser.cs) for parsing unit abbreviation strings, such as `"cm"` to `LengthUnit.Centimeter` +* [Quantity](UnitsNet/CustomCode/Quantity.cs) for parsing and constructing quantities as well as looking up units, names and quantity information dynamically +* [UnitConverter](UnitsNet/UnitConverter.cs) for converting values to a different unit, with only strings or enum values +* [UnitParser](UnitsNet/CustomCode/UnitParser.cs) for parsing unit abbreviation strings, such as `"cm"` to `LengthUnit.Centimeter` #### Quantity - Enumerate quantities and units at runtime + Use `Quantity` class for looking up `QuantityInfo` and `UnitInfo` at runtime. ```c# @@ -152,6 +158,7 @@ UnitInfo cmInfo = Quantity.GetUnitInfo(LengthUnit.Centimeter); ``` #### QuantityInfo - Information about a quantity + `QuantityInfo` makes it easy to get names, units, types and values for a quantity. This is useful for populating lists of quantities and units for the user to choose. @@ -172,6 +179,7 @@ lengthInfo.Zero; // Length.Zero ``` #### UnitInfo - Information about a unit + `UnitInfo` describes a unit, such as its enum value, names and its representation in SI base units. ```c# @@ -190,6 +198,7 @@ cm.BaseUnits; // {"Length": Centimeter, "Mass": null, "Time": null, ...} ``` #### Construct quantity + All you need is the value and the unit enum value. ```c# @@ -201,6 +210,7 @@ if (Quantity.TryFrom(3, LengthUnit.Centimeter, out IQuantity quantity2)) ``` You can also construct from strings, such as mapping between DTO types in an API: + ```c# IQuantity quantity = Quantity.From(value: 3, quantityName: "Length", unitName: "Centimeter"); @@ -210,6 +220,7 @@ if (Quantity.TryFrom(value: 3, quantityName: "Length", unitName: "Centimeter", o ``` Or create by just the unit abbreviation, as long as there is exactly one unit with this abbreviation. + ```c# // Length with unit LengthUnit.Centimeter IQuantity quantity = Quantity.FromUnitAbbreviation(3, "cm"); @@ -220,6 +231,7 @@ if (Quantity.TryFromUnitAbbreviation(3, "cm", out IQuantity? quantity2)) ``` #### Parse quantity + Parse any string to a quantity instance of the given the quantity type. ```c# @@ -231,6 +243,7 @@ if (Quantity.TryParse(typeof(Length), "3cm", out IQuantity quantity2) ``` #### Parse unit + [UnitParser](UnitsNet/CustomCode/UnitParser.cs) parses unit abbreviation strings to unit enum values. ```c# @@ -243,7 +256,9 @@ if (UnitsNetSetup.Default.UnitParser.TryParse("cm", typeof(LengthUnit), out Enum ``` #### Convert quantity to unit - IQuantity and Enum + Convert any `IQuantity` instance to a different unit by providing a target unit enum value. + ```c# // Assume these are passed in at runtime, we don't know their values or type Enum userSelectedUnit = LengthUnit.Millimeter; @@ -258,6 +273,7 @@ quantity.As(userSelectedUnit); // 30 ``` #### Convert quantity to unit - From/To Enums + Useful when populating lists with unit enum values for the user to choose. ```c# @@ -265,6 +281,7 @@ UnitConverter.Convert(1, LengthUnit.Centimeter, LengthUnit.Millimeter); // 10 mm ``` #### Convert quantity to unit - Names or abbreviation strings + Sometimes you only have strings to work with, that works too! ```c# @@ -279,6 +296,7 @@ Units.NET allows you to add your own units and quantities at runtime, to represe Read more at [Extending-with-Custom-Units](https://github.com/angularsen/UnitsNet/wiki/Extending-with-Custom-Units). #### Map between unit enum values and unit abbreviations + ```c# // Map unit enum values to unit abbreviations var unitAbbreviations = UnitsNetSetup.Default.UnitAbbreviations; @@ -289,6 +307,7 @@ UnitsNetSetup.Default.UnitParser.Parse("sm"); // HowMuchUnit.Some ``` #### Convert between units of custom quantity + ```c# var unitConverter = UnitsNetSetup.Default.UnitConverter; unitConverter.SetConversionFunction(HowMuchUnit.Lots, HowMuchUnit.Some, x => new HowMuch(x.Value * 2, HowMuchUnit.Some)); @@ -305,6 +324,7 @@ Console.WriteLine(Convert(HowMuchUnit.Tons)); // 10 tns ``` #### Parse custom quantity + [QuantityParser](UnitsNet/CustomCode/QuantityParser.cs) parses quantity strings to `IQuantity` by mapping custom units to unit abbreviations in `UnitAbbreviationsCache`. ```c# @@ -331,8 +351,8 @@ unitAbbreviationsCache.MapUnitToAbbreviation(HowMuchUnit.ATon, "tn"); var quantityParser = new QuantityParser(unitAbbreviationsCache); ``` - ### Example: Unit converter app + [Source code](https://github.com/angularsen/UnitsNet/tree/master/Samples/UnitConverter.Wpf) for `Samples/UnitConverter.Wpf`
[Download](https://github.com/angularsen/UnitsNet/releases/tag/UnitConverterWpf%2F2018-11-09) (release 2018-11-09 for Windows) @@ -342,6 +362,7 @@ This example shows how you can create a dynamic unit converter, where the user s The quantity list box contains quantity names, such as `"Length"`. The two unit list boxes contain `Enum` values, such as `LengthUnit.Meter`. #### Populate quantity selector + Use `Quantity` to enumerate all quantity names, such as `"Length"` and `"Mass"`. ```c# @@ -352,6 +373,7 @@ this.Quantities = Quantity.Infos.Select(i => i.Name).ToList(); ``` #### Update unit lists when selecting new quantity + So user can only choose from/to units compatible with the quantity type. ```c# @@ -365,6 +387,7 @@ foreach (Enum unitValue in quantityInfo.UnitInfos.Select(ui => ui.Value)) ``` #### Update calculation on unit selection changed + Using `UnitConverter` to convert by unit enum values as given by the list selection `"Length"` and unit names like `"Centimeter"` and `"Meter"`. ```c# @@ -378,7 +401,7 @@ double convertedValue = UnitConverter.Convert( Src: [Samples/MvvmSample.Wpf](https://github.com/angularsen/UnitsNet/tree/master/Samples/MvvmSample.Wpf) -![wpfmvvmsample_219w](https://user-images.githubusercontent.com/787816/34913417-094332e2-f8fd-11e7-9d8a-92db105fbbc9.png) +![WpfMvvmSample_219w](https://user-images.githubusercontent.com/787816/34913417-094332e2-f8fd-11e7-9d8a-92db105fbbc9.png) The purpose of this app is to show how to create an `IValueConverter` in order to bind XAML to quantities. @@ -388,7 +411,7 @@ A base unit is chosen for each unit class, represented by a double value (64-bit Units.NET was intended for convenience and ease of use, not highly accurate conversions, but I am open to suggestions for improvements. -The tests accept an error up to 1E-5 for most units added so far. Exceptions include units like Teaspoon, where the base unit cubic meter is a lot bigger. In many usecases this is sufficient, but for others this may be a showstopper and something you need to be aware of. +The tests accept an error up to 1E-5 for most units added so far. Exceptions include units like Teaspoon, where the base unit cubic meter is a lot bigger. In many use cases this is sufficient, but for others this may be a showstopper and something you need to be aware of. For more details, see [Precision](https://github.com/angularsen/UnitsNet/wiki/Precision). @@ -396,19 +419,18 @@ For more details, see [Precision](https://github.com/angularsen/UnitsNet/wiki/Pr Read the wiki on [Serializing to JSON, XML and more](https://github.com/angularsen/UnitsNet/wiki/Serializing-to-JSON,-XML-and-more). - ### Want To Contribute? -- [Adding a New Unit](https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit) is fairly easy to do and we are happy to help. -- Want a new feature or to report a bug? [Create an issue](https://github.com/angularsen/UnitsNet/issues/new/choose) or start a [discussion](https://github.com/angularsen/UnitsNet/discussions). +* [Adding a New Unit](https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit) is fairly easy to do and we are happy to help. +* Want a new feature or to report a bug? [Create an issue](https://github.com/angularsen/UnitsNet/issues/new/choose) or start a [discussion](https://github.com/angularsen/UnitsNet/discussions). ### Continuous Integration [Azure DevOps](https://dev.azure.com/unitsnet/Units.NET/) performs the following: + * Build and test all branches * Build and test pull requests, notifies on success or error -* Deploy nugets on master branch, if nuspec versions changed - +* Deploy NuGets on master branch, if nuspec versions changed ### Who are Using UnitsNet? @@ -417,6 +439,7 @@ It would be awesome to know who are using this library. If you would like your p ![Motion Catalyst logo](http://swingcatalyst.s3.amazonaws.com/images/logos/MotionCatalyst_greenblack_35p.png "Motion Catalyst logo") #### Swing Catalyst and Motion Catalyst, Norway + > Sports performance applications for Windows and iOS, that combine high-speed video with sensor data to bring facts into your training and visualize the invisible forces at work > > Units.NET started here in 2007 when reading strain gauge measurements from force plates and has been very useful in integrating a number of different sensor types into our software and presenting the data in the user's preferred culture and units. @@ -427,7 +450,9 @@ https://www.motioncatalyst.com (everything else) *- Andreas Gullberg Larsen, CTO (andreas@motioncatalyst.com)* ![PK Sound logo](https://cloud.githubusercontent.com/assets/17773454/19447800/5c6ec76c-945c-11e6-90f8-3f410e8157b9.jpg) + #### PK Sound, Canada + > Award-winning performers and composers put everything they’ve got into their music. PK Sound makes sure their fans will hear it all – brilliantly, precisely, consistently. > > PK Sound uses UnitsNet in Kontrol - the remote control counterpart to Trinity, the world's only robotic line array solution. @@ -439,12 +464,14 @@ http://www.pksound.ca/ (everything else) *- Jules LaPrairie, Kontrol software team member* #### Microsoft.IoT.Devices + > Microsoft.IoT.Devices extends Windows IoT Core and makes it easier to support devices like sensors and displays. It provides event-driven access for many digital and analog devices and even provides specialized wrappers for devices like joystick, rotary encoder and graphics display. http://aka.ms/iotdevices (home page including docs)
http://www.nuget.org/packages/Microsoft.IoT.Devices (NuGet package) #### Crawlspace + > Software for creating printable hex maps for use in pen and paper RPGs. Both > a user-friendly app and a high-level library for generating labelled hexmaps. @@ -455,6 +482,7 @@ https://bitbucket.org/MartinEden/Crawlspace ![ANSYS, Inc. Logo](https://www.ansys.com/-/media/ansys/global/brandings/logo-ansys.jpg "ANSYS, Inc. Logo") #### ANSYS, Inc. (ANSYS Discovery Live) + > ANSYS Discovery Live provides instantaneous 3D simulation, tightly coupled with direct geometry modeling, to enable interactive design exploration and rapid product innovation. It is an interactive experience in which you can manipulate geometry, material types or physics inputs, then instantaneously see changes in performance. https://www.ansys.com @@ -463,13 +491,15 @@ https://www.ansys.com/products/3d-design/ansys-discovery-live *- Tristan Milnthorp, Principal Software Architect (tristan.milnthorp@ansys.com)* #### Primoris Sigma Stargen + Stargen is a decades old software to create realistic planets and satellites from a given Star. It's based on work from various scientists and been used for years. Primoris Sigma Stargen is a C# port of the utility that makes it a Framework to extend it with new algorithms for planetary formation and physics equations. https://github.com/ebfortin/primoris.universe.stargen - +Harrington Hoists logo #### Harrington Hoists, Inc. (A Subsidiary of KITO Americas, Inc.) + > Harrington Hoists, Inc. is located in Manheim, PA, Elizabethtown, PA, South Holland, IL and Corona, CA. Harrington is a leading manufacturer of manual, electric and air chain hoists as well as wire rope hoists and crane products serving the North American material handling industry. Harrington uses UnitsNet in their internal software to perform many different calculations related to crane dimensioning, girder strength, electrical safety verification, etc. @@ -480,10 +510,11 @@ https://kito.com *- Luke Westfall, Design Automation Engineer* #### Structural Analysis Format - SDK project - + +Project logo > The Structural Analysis Format (SAF) has been created to allow structural engineering applications to exchange data using a straight forward and simple to understand format. -> While inspired by IFC, SAF has its benefits that it's **easily modifyable** by the end-user _(it's an xlsx file)_, **well documented** and **easy to understand**. +> While inspired by IFC, SAF has its benefits that it's **easily modifiable** by the end-user *(it's an xlsx file)*, **well documented** and **easy to understand**. > UnitsNet is used by the SDK provided by SCIA to facilitate import / export between metric & imperial systems https://www.saf.guide @@ -497,17 +528,16 @@ Produced with [ghtopdep](https://github.com/github-tooling/ghtopdep). | Repo | Stars | |-----------------------------------------------------------------|---------| -| https://github.com/microsoft/PowerToys | 105K | -| https://github.com/dotnet/iot | 2.1K | -| https://github.com/genielabs/HomeGenie | 388 | +| https://github.com/microsoft/PowerToys | 120K | +| https://github.com/dotnet/iot | 2.3K | +| https://github.com/genielabs/HomeGenie | 410 | | https://github.com/raspberry-sharp/raspberry-sharp-io | 340 | -| https://github.com/nanoframework/nanoFramework.IoT.Device | 202 | -| https://github.com/porrey/Virtual-ZPL-Printer | 166 | +| https://github.com/nanoframework/nanoFramework.IoT.Device | 258 | +| https://github.com/porrey/Virtual-ZPL-Printer | 240 | | https://github.com/chino-os/chino-os | 147 | -| https://github.com/BriefFiniteElementNet/BriefFiniteElement.Net | 143 | -| https://github.com/WhiteBlackGoose/UnitsOfMeasure | 57 | -| https://github.com/pi-top/pi-top-4-.NET-SDK | 48 | - +| https://github.com/BriefFiniteElementNet/BriefFiniteElement.Net | 156 | +| https://github.com/WhiteBlackGoose/UnitsOfMeasure | 59 | +| https://github.com/pi-top/pi-top-4-.NET-SDK | 50 | ### Units.NET on other platforms diff --git a/Samples/MvvmSample.Wpf/Readme.md b/Samples/MvvmSample.Wpf/Readme.md index 87ea6d5656..ba77dcaffb 100644 --- a/Samples/MvvmSample.Wpf/Readme.md +++ b/Samples/MvvmSample.Wpf/Readme.md @@ -1,13 +1,17 @@ ## WPF MVVM Sample + This is a simple sample showing how UnitsNet can be used to create a WPF MVVM application. I have used this strategy in a few simple engineering apps and thought I would share it as a sample to see if others might offer improvements. It performs a simple calculation allowing flexibility in the units for parameters and results. Default units for each are specified in the settings drop down. A key feature enabling this sample is the [UnitToStringConverter](https://github.com/dayewah/UnitsNet/blob/master/Samples/WpfMVVMSample/WpfMVVMSample/Converters/UnitToStringConverter.cs) class + - If a parameter is entered as a number the unit is assigned automatically - If a parameter is entered as a unit other than the default it is converted automatically - If a non-compatible unit is used a validation error is triggered +[!code-csharp[](./MvvmSample.Wpf/Converters/UnitToStringConverter.cs)] + The default unit for each parameter and the result can be changed from the settings pull down. -The number of significant digits displayed can also be changed from settings. \ No newline at end of file +The number of significant digits displayed can also be changed from settings. diff --git a/Samples/UnitConverter.Wpf/README.md b/Samples/UnitConverter.Wpf/README.md index 1c3e73e386..4f8fe8034a 100644 --- a/Samples/UnitConverter.Wpf/README.md +++ b/Samples/UnitConverter.Wpf/README.md @@ -10,4 +10,5 @@ The resulting value (`1530`) is computed instantly and reacts to whenever the nu This sample also highlights a limitation in the library that requires reflection in order to enumerate units for a selected quantity and to get the abbreviation for a unit, since the library does not provide a generic means to retrieve these without referencing types like `Length` and `LengthUnit` directly. There is definitely room for improvement in the library here. ### Dependencies -http://mahapps.com/ - UI toolkit for WPF \ No newline at end of file + +http://mahapps.com/ - UI toolkit for WPF diff --git a/cSpell.json b/cSpell.json new file mode 100644 index 0000000000..cb18f75d1a --- /dev/null +++ b/cSpell.json @@ -0,0 +1,51 @@ +{ + "version": "0.2", + "language": "en", + "words": [ + "AbbreviationsCache", + "DocFx", + "DTO", + "DtpPoint", + "HowMuchUnit", + "Kontrol", + "lts", + "Milnthorp", + "minstar", + "MVVM", + "MvvmSample", + "nanoFramework", + "Newton", + "NuGet", + "PrinterPoint", + "quantityParser", + "SCIA", + "sm", + "TimeSpan", + "tns", + "unitAbbreviationsCache", + "unitConverter", + "UnitsNet", + "Wpf" + ], + "ignoreWords": [ + "Westfall", + "Stargen", + "Schuermans", + "Manheim", + "pypi", + "Primoris", + "KITO", + "ghtopdep", + "Gullberg", + "haimkastner", + "hexmaps", + "Andreas" + ], + "ignorePaths": [ + "**/node_modules/**", + "**/bin/**", + "**/obj/**", + "**/.git/**", + "**/.vscode/**" + ] +} \ No newline at end of file