Skip to content

Commit

Permalink
Merge pull request #60 from shichuyibushishiwu/develop
Browse files Browse the repository at this point in the history
v19.1
  • Loading branch information
shichuyibushishiwu authored Dec 10, 2024
2 parents d4221cb + 43ece1f commit bcf6c8a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 8 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,43 @@ jobs:

- name: Publish NuGet
run: dotnet nuget push src\bin\${{ matrix.version }}\*.nupkg -k ${{secrets.NUGETKEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate

- name: Delete old packages
shell: pwsh
run: |
# 获取包名称
$packageId = "Tuna.Revit.Extension"
# 保留最新的N个版本
$versionsToKeep = 10
# 获取包的详细信息
$baseUrl = "https://api.nuget.org/v3/registration5-semver1/$packageId/index.json"
$response = Invoke-RestMethod -Uri $baseUrl
# 获取所有版本及其发布时间
$versionDetails = @()
foreach ($item in $response.items) {
foreach ($entry in $item.items) {
$versionDetails += @{
Version = $entry.catalogEntry.version
Published = [DateTime]::Parse($entry.catalogEntry.published)
}
}
}
# 按发布时间排序并选择要删除的版本
$versionsToDelete = $versionDetails |
Sort-Object Published -Descending |
Select-Object -Skip $versionsToKeep |
Select-Object -ExpandProperty Version
foreach ($version in $versionsToDelete) {
Write-Host "Deleting version $version of $packageId (Published: $($versionDetails | Where-Object Version -eq $version | Select-Object -ExpandProperty Published))"
# 删除包版本
Invoke-RestMethod -Uri "https://api.nuget.org/v3/packages/$packageId/$version" `
-Method Delete `
-Headers @{
'X-NuGet-ApiKey' = '${{secrets.NUGETKEY}}'
}
}
9 changes: 5 additions & 4 deletions src/Geometry/TransientElementExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,14 @@ public static void CleanTransientElements(this Document document)

document.NewTransaction(() =>
{
foreach (var elementId in _transientElementIds)
for (int i = _transientElementIds.Count - 1; i >= 0; i--)
{
Element element = document.GetElement(elementId);
ElementId currentId = _transientElementIds[i];
Element element = document.GetElement(currentId);
if (element != null)
{
document.Delete(elementId);
_transientElementIds.Remove(elementId);
document.Delete(currentId);
_transientElementIds.Remove(currentId);
}
}
});
Expand Down
6 changes: 3 additions & 3 deletions src/Selection/SelectionChangedEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ internal SelectionChangedEventArgs(Autodesk.Revit.UI.Events.SelectionChangedEven
/// <summary>
/// 发生选择变更的文档
/// </summary>
public Document Document { get; }
public Document? Document { get; }

/// <summary>
/// 被选择的图元 <see cref="Autodesk.Revit.DB.ElementId"/>
/// </summary>
public IEnumerable<ElementId> Elements { get; }
public IEnumerable<ElementId>? Elements { get; }

/// <summary>
/// 被选择的引用 <see cref="Autodesk.Revit.DB.Reference"/>
/// </summary>
public IEnumerable<Reference> References { get; }
public IEnumerable<Reference>? References { get; }
}
2 changes: 1 addition & 1 deletion src/Tuna.Revit.Extension.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
Rvt_24_Debug;Rvt_24_Release;
Rvt_25_Debug;Rvt_25_Release;
</Configurations>
<TunaVer>19</TunaVer>
<TunaVer>19.1</TunaVer>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
Expand Down

0 comments on commit bcf6c8a

Please sign in to comment.