Skip to content

Commit 2e55b7e

Browse files
committed
Remove WINDOWS_UWP regions and dead files
1 parent aca2a3d commit 2e55b7e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+76
-2548
lines changed

UnitsNet.WindowsRuntimeComponent/AmbiguousUnitParseException.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,7 @@ namespace UnitsNet
3030
/// <see cref="LengthUnit.DtpPoint" /> and
3131
/// <see cref="LengthUnit.PrinterPoint" /> have "pt" as their abbreviation.
3232
/// </summary>
33-
#if WINDOWS_UWP
34-
internal
35-
#else
36-
public
37-
#endif
38-
class AmbiguousUnitParseException : UnitsNetException
33+
internal class AmbiguousUnitParseException : UnitsNetException
3934
{
4035
/// <inheritdoc />
4136
public AmbiguousUnitParseException(string message) : base(message)

UnitsNet.WindowsRuntimeComponent/BaseDimensions.cs

Lines changed: 3 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public BaseDimensions(int length, int mass, int time, int current, int temperatu
4848
/// <returns>True if the dimensions represent a base quantity, otherwise false.</returns>
4949
public bool IsBaseQuantity()
5050
{
51-
var dimensionsArray = new int[]{Length, Mass, Time, Current, Temperature, Amount, LuminousIntensity};
51+
var dimensionsArray = new[]{Length, Mass, Time, Current, Temperature, Amount, LuminousIntensity};
5252
bool onlyOneEqualsOne = dimensionsArray.Where(dimension => dimension == 1).Take(2).Count() == 1;
5353
return onlyOneEqualsOne;
5454
}
@@ -68,13 +68,13 @@ public bool IsDerivedQuantity()
6868
/// <returns>True if this object represents a dimensionless quantity, otherwise false.</returns>
6969
public bool IsDimensionless()
7070
{
71-
return this == Dimensionless;
71+
return Equals(this, Dimensionless);
7272
}
7373

7474
/// <inheritdoc />
7575
public override bool Equals(object obj)
7676
{
77-
if(obj is null || !(obj is BaseDimensions))
77+
if(!(obj is BaseDimensions))
7878
return false;
7979

8080
var other = (BaseDimensions)obj;
@@ -134,64 +134,6 @@ public BaseDimensions Divide(BaseDimensions right)
134134
LuminousIntensity - right.LuminousIntensity);
135135
}
136136

137-
#if !WINDOWS_UWP
138-
139-
/// <summary>
140-
/// Check if two dimensions are equal.
141-
/// </summary>
142-
/// <param name="left">Left.</param>
143-
/// <param name="right">Right.</param>
144-
/// <returns>True if equal.</returns>
145-
public static bool operator ==(BaseDimensions left, BaseDimensions right)
146-
{
147-
return left is null ? right is null : left.Equals(right);
148-
}
149-
150-
/// <summary>
151-
/// Check if two dimensions are unequal.
152-
/// </summary>
153-
/// <param name="left">Left.</param>
154-
/// <param name="right">Right.</param>
155-
/// <returns>True if not equal.</returns>
156-
public static bool operator !=(BaseDimensions left, BaseDimensions right)
157-
{
158-
return !(left == right);
159-
}
160-
161-
/// <summary>
162-
/// Multiply two dimensions.
163-
/// </summary>
164-
/// <param name="left">Left.</param>
165-
/// <param name="right">Right.</param>
166-
/// <returns>Resulting dimensions.</returns>
167-
public static BaseDimensions operator *(BaseDimensions left, BaseDimensions right)
168-
{
169-
if(left is null)
170-
throw new ArgumentNullException(nameof(left));
171-
else if(right is null)
172-
throw new ArgumentNullException(nameof(right));
173-
174-
return left.Multiply(right);
175-
}
176-
177-
/// <summary>
178-
/// Divide two dimensions.
179-
/// </summary>
180-
/// <param name="left">Left.</param>
181-
/// <param name="right">Right.</param>
182-
/// <returns>Resulting dimensions.</returns>
183-
public static BaseDimensions operator /(BaseDimensions left, BaseDimensions right)
184-
{
185-
if(left is null)
186-
throw new ArgumentNullException(nameof(left));
187-
else if(right is null)
188-
throw new ArgumentNullException(nameof(right));
189-
190-
return left.Divide(right);
191-
}
192-
193-
#endif
194-
195137
/// <inheritdoc />
196138
public override string ToString()
197139
{

UnitsNet.WindowsRuntimeComponent/BaseUnits.cs

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,16 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2020
// THE SOFTWARE.
2121

22-
using System;
2322
using System.Text;
2423
using UnitsNet.Units;
2524

2625
namespace UnitsNet
2726
{
28-
#if !WINDOWS_UWP
29-
public sealed partial class BaseUnits : IEquatable<BaseUnits> { }
30-
#endif
31-
3227
/// <summary>
3328
/// Represents the base units for a quantity. All quantities, both base and derived, can be
3429
/// represented by a combination of these seven base units.
3530
/// </summary>
36-
public sealed partial class BaseUnits
31+
public sealed class BaseUnits
3732
{
3833
/// <summary>
3934
/// Creates an instance of if the base units class that represents the base units for a quantity.
@@ -72,9 +67,7 @@ public override bool Equals(object obj)
7267
/// </summary>
7368
/// <param name="other">The other instance to check if equal to.</param>
7469
/// <returns>True if equal, otherwise false.</returns>
75-
#if WINDOWS_UWP
7670
[Windows.Foundation.Metadata.DefaultOverload]
77-
#endif
7871
public bool Equals(BaseUnits other)
7972
{
8073
if(other is null)
@@ -95,34 +88,6 @@ public override int GetHashCode()
9588
return new {Length, Mass, Time, Current, Temperature, Amount, LuminousIntensity}.GetHashCode();
9689
}
9790

98-
#if !WINDOWS_UWP
99-
100-
/// <summary>
101-
/// Checks if this instance is equal to another.
102-
/// </summary>
103-
/// <param name="left">The left instance.</param>
104-
/// <param name="right">The right instance.</param>
105-
/// <returns>True if equal, otherwise false.</returns>
106-
/// <seealso cref="Equals(BaseUnits)"/>
107-
public static bool operator ==(BaseUnits left, BaseUnits right)
108-
{
109-
return left is null ? right is null : left.Equals(right);
110-
}
111-
112-
/// <summary>
113-
/// Checks if this instance is not equal to another.
114-
/// </summary>
115-
/// <param name="left">The left instance.</param>
116-
/// <param name="right">The right instance.</param>
117-
/// <returns>True if not equal, otherwise false.</returns>
118-
/// <seealso cref="Equals(BaseUnits)"/>
119-
public static bool operator !=(BaseUnits left, BaseUnits right)
120-
{
121-
return !(left == right);
122-
}
123-
124-
#endif
125-
12691
/// <inheritdoc />
12792
public override string ToString()
12893
{

UnitsNet.WindowsRuntimeComponent/CustomCode/GlobalConfiguration.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@ public sealed class GlobalConfiguration
3131
/// Defaults to <see cref="CultureInfo.CurrentUICulture" /> when creating an instance with no culture provided.
3232
/// Can be overridden, but note that this is static and will affect all subsequent usages.
3333
/// </summary>
34-
#if WINDOWS_UWP
3534
// Windows Runtime Component does not support exposing the IFormatProvider type in public API
36-
internal
37-
#else
38-
public
39-
#endif
40-
static IFormatProvider DefaultCulture { get; set; } = CultureInfo.CurrentUICulture;
35+
internal static IFormatProvider DefaultCulture { get; set; } = CultureInfo.CurrentUICulture;
4136
}
4237
}

UnitsNet.WindowsRuntimeComponent/CustomCode/Quantities/Acceleration.extra.cs

Lines changed: 0 additions & 49 deletions
This file was deleted.

UnitsNet.WindowsRuntimeComponent/CustomCode/Quantities/AmplitudeRatio.extra.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ namespace UnitsNet
2828
// Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components
2929
// Public structures can't have any members other than public fields, and those fields must be value types or strings.
3030
// Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic.
31-
#if WINDOWS_UWP
3231
public sealed partial class AmplitudeRatio
33-
#else
34-
public partial struct AmplitudeRatio
35-
#endif
3632
{
3733
/// <summary>
3834
/// Initializes a new instance of the <see cref="AmplitudeRatio" /> struct from the specified electric potential
@@ -43,12 +39,7 @@ public partial struct AmplitudeRatio
4339
/// <param name="voltage">The electric potential referenced to one volt.</param>
4440

4541
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
46-
#if WINDOWS_UWP
47-
internal
48-
#else
49-
public
50-
#endif
51-
AmplitudeRatio(ElectricPotential voltage)
42+
private AmplitudeRatio(ElectricPotential voltage)
5243
: this()
5344
{
5445
if (voltage.Volts <= 0)

UnitsNet.WindowsRuntimeComponent/CustomCode/Quantities/Angle.extra.cs

Lines changed: 0 additions & 49 deletions
This file was deleted.

UnitsNet.WindowsRuntimeComponent/CustomCode/Quantities/Area.extra.cs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,8 @@ namespace UnitsNet
2727
// Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components
2828
// Public structures can't have any members other than public fields, and those fields must be value types or strings.
2929
// Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic.
30-
#if WINDOWS_UWP
3130
public sealed partial class Area
32-
#else
33-
public partial struct Area
34-
#endif
3531
{
36-
#region Static Methods
37-
3832
public static Area FromCircleDiameter(Length diameter)
3933
{
4034
var radius = Length.FromMeters(diameter.Meters / 2d);
@@ -45,25 +39,5 @@ public static Area FromCircleRadius(Length radius)
4539
{
4640
return FromSquareMeters(Math.PI * radius.Meters * radius.Meters);
4741
}
48-
49-
#endregion
50-
51-
// Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
52-
#if !WINDOWS_UWP
53-
public static Length operator /(Area area, Length length)
54-
{
55-
return Length.FromMeters(area.SquareMeters / length.Meters);
56-
}
57-
58-
public static MassFlow operator *(Area area, MassFlux massFlux)
59-
{
60-
return MassFlow.FromGramsPerSecond(area.SquareMeters * massFlux.GramsPerSecondPerSquareMeter);
61-
}
62-
63-
public static VolumeFlow operator *(Area area, Speed speed)
64-
{
65-
return VolumeFlow.FromCubicMetersPerSecond(area.SquareMeters * speed.MetersPerSecond);
66-
}
67-
#endif
6842
}
6943
}

0 commit comments

Comments
 (0)