From 970d3465f4454d010721a3c074f2b0417f6da5e0 Mon Sep 17 00:00:00 2001
From: tian <11429339@qq.com>
Date: Sat, 11 Apr 2026 23:17:21 +0800
Subject: [PATCH] Add a custom ribbon tab for logistics tools
---
TransportPlugin.csproj | 13 ++++
deploy-plugin.bat | 31 ++++++++++
resources/TransportRibbon.xaml | 23 +++++++
resources/TransportRibbon_16.png | Bin 0 -> 614 bytes
resources/TransportRibbon_32.png | Bin 0 -> 1292 bytes
src/Commands/TransportRibbonHandler.cs | 79 +++++++++++++++++++++++++
6 files changed, 146 insertions(+)
create mode 100644 resources/TransportRibbon.xaml
create mode 100644 resources/TransportRibbon_16.png
create mode 100644 resources/TransportRibbon_32.png
create mode 100644 src/Commands/TransportRibbonHandler.cs
diff --git a/TransportPlugin.csproj b/TransportPlugin.csproj
index 4bbb6e9..a41f577 100644
--- a/TransportPlugin.csproj
+++ b/TransportPlugin.csproj
@@ -165,6 +165,7 @@
+
@@ -522,6 +523,18 @@
PreserveNewest
resources\TransportPlugin.name.txt
+
+ PreserveNewest
+ TransportRibbon.xaml
+
+
+ PreserveNewest
+ TransportRibbon_16.png
+
+
+ PreserveNewest
+ TransportRibbon_32.png
+
PreserveNewest
diff --git a/deploy-plugin.bat b/deploy-plugin.bat
index 0c5a3cd..789d687 100644
--- a/deploy-plugin.bat
+++ b/deploy-plugin.bat
@@ -16,6 +16,11 @@ powershell -NoProfile -ExecutionPolicy Bypass -Command ^
" 'System.Data.SQLite.dll'," ^
" 'Tomlyn.dll'" ^
");" ^
+ "$deployRootFiles = @(" ^
+ " 'TransportRibbon.xaml'," ^
+ " 'TransportRibbon_16.png'," ^
+ " 'TransportRibbon_32.png'" ^
+ ");" ^
"$stalePluginFiles = @(" ^
" 'Autodesk.Navisworks.Api.dll'," ^
" 'NavisworksTransport.UnitTests.dll'," ^
@@ -63,6 +68,17 @@ powershell -NoProfile -ExecutionPolicy Bypass -Command ^
" if (-not (Test-Path $sourceDll)) { throw ('Deployment source file missing: ' + $sourceDll) }" ^
" Copy-Item $sourceDll $targetDir -Force;" ^
"}" ^
+ "foreach ($rootFileName in $deployRootFiles) {" ^
+ " $sourceRootFile = Join-Path $buildDir $rootFileName;" ^
+ " if (Test-Path $sourceRootFile) {" ^
+ " Copy-Item $sourceRootFile $targetDir -Force;" ^
+ " foreach ($locale in @('en-US','zh-CN')) {" ^
+ " $localeDir = Join-Path $targetDir $locale;" ^
+ " New-Item -ItemType Directory -Force -Path $localeDir | Out-Null;" ^
+ " Copy-Item $sourceRootFile $localeDir -Force;" ^
+ " }" ^
+ " }" ^
+ "}" ^
"if (Test-Path (Join-Path $buildDir 'resources')) {" ^
" New-Item -ItemType Directory -Force -Path (Join-Path $targetDir 'resources') | Out-Null;" ^
" Copy-Item (Join-Path $buildDir 'resources\\*') (Join-Path $targetDir 'resources') -Recurse -Force;" ^
@@ -70,6 +86,10 @@ powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"" ^
"$sourceFiles = @();" ^
"foreach ($dllName in $deployDllNames) { $sourceFiles += Get-Item (Join-Path $buildDir $dllName) }" ^
+ "foreach ($rootFileName in $deployRootFiles) {" ^
+ " $sourceRootFile = Join-Path $buildDir $rootFileName;" ^
+ " if (Test-Path $sourceRootFile) { $sourceFiles += Get-Item $sourceRootFile }" ^
+ "}" ^
"if (Test-Path (Join-Path $buildDir 'resources')) {" ^
" $sourceFiles += Get-ChildItem (Join-Path $buildDir 'resources') -File;" ^
"}" ^
@@ -82,6 +102,17 @@ powershell -NoProfile -ExecutionPolicy Bypass -Command ^
" throw ('Deployment verification failed for ' + $sourceFile.Name + ': source=' + $sourceFile.LastWriteTime.ToString('yyyy-MM-dd HH:mm:ss.fff') + ' (' + $sourceFile.Length + '), target=' + $targetInfo.LastWriteTime.ToString('yyyy-MM-dd HH:mm:ss.fff') + ' (' + $targetInfo.Length + ')');" ^
" }" ^
" Write-Host ('Verified ' + $sourceFile.Name + ': ' + $targetInfo.LastWriteTime.ToString('yyyy-MM-dd HH:mm:ss.fff'));" ^
+ " if ($deployRootFiles -contains $sourceFile.Name) {" ^
+ " foreach ($locale in @('en-US','zh-CN')) {" ^
+ " $localeTargetFile = Join-Path (Join-Path $targetDir $locale) $sourceFile.Name;" ^
+ " if (-not (Test-Path $localeTargetFile)) { throw ('Deployment verification failed: missing locale target file ' + $localeTargetFile) }" ^
+ " $localeTargetInfo = Get-Item $localeTargetFile;" ^
+ " if ($sourceFile.Length -ne $localeTargetInfo.Length -or $sourceFile.LastWriteTime -ne $localeTargetInfo.LastWriteTime) {" ^
+ " throw ('Deployment verification failed for locale copy ' + $localeTargetFile);" ^
+ " }" ^
+ " Write-Host ('Verified ' + $locale + '\\' + $sourceFile.Name + ': ' + $localeTargetInfo.LastWriteTime.ToString('yyyy-MM-dd HH:mm:ss.fff'));" ^
+ " }" ^
+ " }" ^
"}" ^
"" ^
"Write-Host 'Plugin deployed successfully!';"
diff --git a/resources/TransportRibbon.xaml b/resources/TransportRibbon.xaml
new file mode 100644
index 0000000..d0188d7
--- /dev/null
+++ b/resources/TransportRibbon.xaml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/TransportRibbon_16.png b/resources/TransportRibbon_16.png
new file mode 100644
index 0000000000000000000000000000000000000000..7d75f301fdd84c1a188fdb9c0c7586c9147102ad
GIT binary patch
literal 614
zcmV-s0-61ZP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0sBcrK~y+T&5})M
zlR*%MbCRAsd-E!uyy#8DgCK$+SWv;gB4RuUIfTE4;%d-;N28xYbx
z4oFS=PJ!HrD82i4Z9}!avh$^vO%^Y-PnPA^N7uSr-u1pciwzXlA;Fo5q#Z(0V}$xT
z*G`)iwzhfhUDx(Ex^^yGF#~cm-a5V4RIXgU={J}JMR}0!!Px!ycRTKlN{`p|?D75s
zvzh9aTJ22uu4h2;EkK?TNGBE$T$X~7w7w|}l+fJ#w7Mx9uO&9mI=JmGbsoaaB
zfV3b`mq1O93&mR(8CW36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