Skip to content

Commit 00e6ce3

Browse files
committed
[Compability] Add Polyfill package for .Net compability
1 parent 6feed9c commit 00e6ce3

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

source/Nice3point.Revit.Extensions/ImperialExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Nice3point.Revit.Extensions;
1010
[PublicAPI]
1111
[Obsolete("Use UnitsNet package instead")]
1212
public static
13-
#if NETCOREAPP
13+
#if NET
1414
partial
1515
#endif
1616
class ImperialExtensions
@@ -20,7 +20,7 @@ class ImperialExtensions
2020
^\s*(?<sign>-)?\s*(((?<feet>[\d.]+)')?[\s-]*((?<inch>(\d+)?(\.)?\d+)?[\s-]*((?<numerator>\d+)/(?<denominator>\d+))?"?)?)\s*$
2121
""";
2222

23-
#if NETCOREAPP
23+
#if NET
2424
private static readonly Regex ImperialRegex = InvokeImperialRegexGenerator();
2525
[GeneratedRegex(ImperialExpression, RegexOptions.Compiled)] private static partial Regex InvokeImperialRegexGenerator();
2626
#else

source/Nice3point.Revit.Extensions/Nice3point.Revit.Extensions.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
<PackageReference Include="Nice3point.Revit.Api.RevitAPIUI" Version="$(RevitVersion).*" PrivateAssets="all"/>
7575
<PackageReference Include="Nice3point.Revit.Api.UIFramework" Version="$(RevitVersion).*" PrivateAssets="all"/>
7676
<PackageReference Include="Nice3point.Revit.Api.UIFrameworkServices" Version="$(RevitVersion).*" PrivateAssets="all"/>
77+
<PackageReference Include="Polyfill" Version="8.9.1" PrivateAssets="all"/>
7778
<PackageReference Include="JetBrains.Annotations" Version="2025.2.2"/>
7879
</ItemGroup>
7980

source/Nice3point.Revit.Extensions/UIFrameworkExtensions/RibbonExtensions.Helpers.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
using System.Reflection;
2-
using Autodesk.Revit.UI;
3-
using Autodesk.Windows;
4-
using UIFramework;
5-
using UIFrameworkServices;
62
using RibbonItem = Autodesk.Revit.UI.RibbonItem;
73
using RibbonPanel = Autodesk.Revit.UI.RibbonPanel;
84
#if REVIT2024_OR_GREATER
@@ -51,7 +47,7 @@ private static void AddButtonShortcuts(PushButton button, string representation)
5147
private static RibbonPanel CreatePanel(Autodesk.Windows.RibbonPanel panel, string tabId)
5248
{
5349
var type = typeof(RibbonPanel);
54-
#if NETCOREAPP
50+
#if NET
5551
var constructorInfo = type.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.DeclaredOnly,
5652
[typeof(Autodesk.Windows.RibbonPanel), typeof(string)])!;
5753
#else
@@ -197,7 +193,7 @@ private static bool TryGetThemedUri(string uri, out string result)
197193

198194
static string UpdateThemeUri(string source, string currentTheme, string newTheme, int themeIndex)
199195
{
200-
#if NETCOREAPP
196+
#if NET
201197
var sourceSpan = source.AsSpan();
202198
var before = sourceSpan[..themeIndex];
203199
var after = sourceSpan[(themeIndex + currentTheme.Length)..];

source/Nice3point.Revit.Extensions/UtilsExtensions/ParameterUtilsExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public bool IsBuiltInGroup()
4646
return ParameterUtils.IsBuiltInGroup(typeId);
4747
}
4848

49+
#if REVIT2024_OR_GREATER
4950
/// <summary>
5051
/// Retrieves settings associated with the given parameter from the Parameters Service.
5152
/// </summary>
@@ -77,7 +78,6 @@ public ParameterDownloadOptions DownloadParameterOptions()
7778
return ParameterUtils.DownloadParameterOptions(typeId);
7879
}
7980

80-
#if REVIT2024_OR_GREATER
8181
/// <summary>
8282
/// Downloads the name of the given parameter's owning account and records it in the given document. If the owning
8383
/// account's name is already recorded in the given document, this method returns the name without downloading it

0 commit comments

Comments
 (0)