Skip to content

Commit 9654905

Browse files
committed
Remove #if WINDOWS_UWP code
1 parent 98eb257 commit 9654905

Some content is hidden

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

56 files changed

+135
-806
lines changed

UnitsNet.Serialization.JsonNet/Internal/ReflectionHelper.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ internal static PropertyInfo GetProperty(this Type type, string name)
1919
#endif
2020
}
2121

22-
// Ambiguous method conflict with GetMethods() name WindowsRuntimeComponent, so use GetDeclaredMethods() instead
2322
internal static IEnumerable<MethodInfo> GetDeclaredMethods(this Type someType)
2423
{
2524
Type t = someType;

UnitsNet.Tests/BaseDimensionsTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ public void CheckBaseDimensionMultiplicationWithForceEqualsMassTimesAcceleration
410410
Assert.True(calculatedDimensions == Force.BaseDimensions);
411411
}
412412

413-
#if !WINDOWS_UWP
414413
[Fact]
415414
public void EqualityWorksAsExpectedWithOperatorOverloads()
416415
{
@@ -692,7 +691,6 @@ public void CheckBaseDimensionMultiplicationWithForceEqualsMassTimesAcceleration
692691
var calculatedDimensions = mass.Dimensions * acceleration.Dimensions;
693692
Assert.True(calculatedDimensions == Force.BaseDimensions);
694693
}
695-
#endif
696694

697695
[Fact]
698696
public void CheckToStringUsingMolarEntropy()

UnitsNet/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+
public class AmbiguousUnitParseException : UnitsNetException
3934
{
4035
/// <inheritdoc />
4136
public AmbiguousUnitParseException(string message) : base(message)

UnitsNet/BaseDimensions.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public bool IsDerivedQuantity()
6161
{
6262
return !IsBaseQuantity() && !IsDimensionless();
6363
}
64-
64+
6565
/// <summary>
6666
/// Checks if this base dimensions object represents a dimensionless quantity.
6767
/// </summary>
@@ -134,8 +134,6 @@ public BaseDimensions Divide(BaseDimensions right)
134134
LuminousIntensity - right.LuminousIntensity);
135135
}
136136

137-
#if !WINDOWS_UWP
138-
139137
/// <summary>
140138
/// Check if two dimensions are equal.
141139
/// </summary>
@@ -190,8 +188,6 @@ public BaseDimensions Divide(BaseDimensions right)
190188
return left.Divide(right);
191189
}
192190

193-
#endif
194-
195191
/// <inheritdoc />
196192
public override string ToString()
197193
{

UnitsNet/BaseUnits.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525

2626
namespace UnitsNet
2727
{
28-
#if !WINDOWS_UWP
2928
public sealed partial class BaseUnits : IEquatable<BaseUnits> { }
30-
#endif
3129

3230
/// <summary>
3331
/// Represents the base units for a quantity. All quantities, both base and derived, can be
@@ -72,9 +70,6 @@ public override bool Equals(object obj)
7270
/// </summary>
7371
/// <param name="other">The other instance to check if equal to.</param>
7472
/// <returns>True if equal, otherwise false.</returns>
75-
#if WINDOWS_UWP
76-
[Windows.Foundation.Metadata.DefaultOverload]
77-
#endif
7873
public bool Equals(BaseUnits other)
7974
{
8075
if(other is null)
@@ -95,8 +90,6 @@ public override int GetHashCode()
9590
return new {Length, Mass, Time, Current, Temperature, Amount, LuminousIntensity}.GetHashCode();
9691
}
9792

98-
#if !WINDOWS_UWP
99-
10093
/// <summary>
10194
/// Checks if this instance is equal to another.
10295
/// </summary>
@@ -121,8 +114,6 @@ public override int GetHashCode()
121114
return !(left == right);
122115
}
123116

124-
#endif
125-
126117
/// <inheritdoc />
127118
public override string ToString()
128119
{

UnitsNet/CustomCode/GlobalConfiguration.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ 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
35-
// 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;
34+
public static IFormatProvider DefaultCulture { get; set; } = CultureInfo.CurrentUICulture;
4135
}
4236
}

UnitsNet/CustomCode/Quantities/Acceleration.extra.cs

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

22-
// ReSharper disable once CheckNamespace
23-
24-
using System;
25-
using UnitsNet.Units;
26-
2722
namespace UnitsNet
2823
{
29-
// Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components
30-
// Public structures can't have any members other than public fields, and those fields must be value types or strings.
31-
// 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.
32-
#if WINDOWS_UWP
33-
public sealed partial class Acceleration
34-
#else
3524
public partial struct Acceleration
36-
#endif
3725
{
38-
// Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
39-
#if !WINDOWS_UWP
4026
/// <summary>
4127
/// Multiply <see cref="Acceleration"/> and <see cref="Density"/> to get <see cref="SpecificWeight"/>.
4228
/// </summary>
4329
public static SpecificWeight operator *(Acceleration acceleration, Density density)
4430
{
4531
return new SpecificWeight(acceleration.MetersPerSecondSquared * density.KilogramsPerCubicMeter, UnitsNet.Units.SpecificWeightUnit.NewtonPerCubicMeter);
4632
}
47-
#endif
4833
}
4934
}

UnitsNet/CustomCode/Quantities/AmplitudeRatio.extra.cs

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// Copyright (c) 2013 Andreas Gullberg Larsen ([email protected]).
22
// https://github.com/angularsen/UnitsNet
3-
//
3+
//
44
// Permission is hereby granted, free of charge, to any person obtaining a copy
55
// of this software and associated documentation files (the "Software"), to deal
66
// in the Software without restriction, including without limitation the rights
77
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
88
// copies of the Software, and to permit persons to whom the Software is
99
// furnished to do so, subject to the following conditions:
10-
//
10+
//
1111
// The above copyright notice and this permission notice shall be included in
1212
// all copies or substantial portions of the Software.
13-
//
13+
//
1414
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1515
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1616
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -22,17 +22,9 @@
2222
using System;
2323
using UnitsNet.Units;
2424

25-
// ReSharper disable once CheckNamespace
2625
namespace UnitsNet
2726
{
28-
// Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components
29-
// Public structures can't have any members other than public fields, and those fields must be value types or strings.
30-
// 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
32-
public sealed partial class AmplitudeRatio
33-
#else
3427
public partial struct AmplitudeRatio
35-
#endif
3628
{
3729
/// <summary>
3830
/// Initializes a new instance of the <see cref="AmplitudeRatio" /> struct from the specified electric potential
@@ -41,14 +33,7 @@ public partial struct AmplitudeRatio
4133
/// resistance.
4234
/// </summary>
4335
/// <param name="voltage">The electric potential referenced to one volt.</param>
44-
45-
// 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)
36+
public AmplitudeRatio(ElectricPotential voltage)
5237
: this()
5338
{
5439
if (voltage.Volts <= 0)
Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// Copyright (c) 2013 Andreas Gullberg Larsen ([email protected]).
22
// https://github.com/angularsen/UnitsNet
3-
//
3+
//
44
// Permission is hereby granted, free of charge, to any person obtaining a copy
55
// of this software and associated documentation files (the "Software"), to deal
66
// in the Software without restriction, including without limitation the rights
77
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
88
// copies of the Software, and to permit persons to whom the Software is
99
// furnished to do so, subject to the following conditions:
10-
//
10+
//
1111
// The above copyright notice and this permission notice shall be included in
1212
// all copies or substantial portions of the Software.
13-
//
13+
//
1414
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1515
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1616
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -21,20 +21,10 @@
2121

2222
using System;
2323

24-
// ReSharper disable once CheckNamespace
2524
namespace UnitsNet
2625
{
27-
// Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components
28-
// Public structures can't have any members other than public fields, and those fields must be value types or strings.
29-
// 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
31-
public sealed partial class Angle
32-
#else
3326
public partial struct Angle
34-
#endif
3527
{
36-
// Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
37-
#if !WINDOWS_UWP
3828
public static RotationalSpeed operator /(Angle angle, TimeSpan timeSpan)
3929
{
4030
return RotationalSpeed.FromRadiansPerSecond(angle.Radians / timeSpan.TotalSeconds);
@@ -44,6 +34,5 @@ public partial struct Angle
4434
{
4535
return RotationalSpeed.FromRadiansPerSecond(angle.Radians / duration.Seconds);
4636
}
47-
#endif
4837
}
4938
}

UnitsNet/CustomCode/Quantities/Area.extra.cs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// Copyright (c) 2013 Andreas Gullberg Larsen ([email protected]).
22
// https://github.com/angularsen/UnitsNet
3-
//
3+
//
44
// Permission is hereby granted, free of charge, to any person obtaining a copy
55
// of this software and associated documentation files (the "Software"), to deal
66
// in the Software without restriction, including without limitation the rights
77
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
88
// copies of the Software, and to permit persons to whom the Software is
99
// furnished to do so, subject to the following conditions:
10-
//
10+
//
1111
// The above copyright notice and this permission notice shall be included in
1212
// all copies or substantial portions of the Software.
13-
//
13+
//
1414
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1515
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1616
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -21,17 +21,9 @@
2121

2222
using System;
2323

24-
// ReSharper disable once CheckNamespace
2524
namespace UnitsNet
2625
{
27-
// Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components
28-
// Public structures can't have any members other than public fields, and those fields must be value types or strings.
29-
// 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
31-
public sealed partial class Area
32-
#else
3326
public partial struct Area
34-
#endif
3527
{
3628
#region Static Methods
3729

@@ -48,8 +40,6 @@ public static Area FromCircleRadius(Length radius)
4840

4941
#endregion
5042

51-
// Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
52-
#if !WINDOWS_UWP
5343
public static Length operator /(Area area, Length length)
5444
{
5545
return Length.FromMeters(area.SquareMeters / length.Meters);
@@ -64,6 +54,5 @@ public static Area FromCircleRadius(Length radius)
6454
{
6555
return VolumeFlow.FromCubicMetersPerSecond(area.SquareMeters * speed.MetersPerSecond);
6656
}
67-
#endif
6857
}
6958
}

0 commit comments

Comments
 (0)