添加项目
This commit is contained in:
7
RevitAddin/NuGet.config
Normal file
7
RevitAddin/NuGet.config
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
<add key="asmresolver-nightly" value="https://nuget.washi.dev/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
BIN
RevitAddin/Resources/Revit.ico
Normal file
BIN
RevitAddin/Resources/Revit.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 982 B |
30
RevitAddin/Revit/App.cs
Normal file
30
RevitAddin/Revit/App.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using ricaun.Revit.UI;
|
||||
|
||||
|
||||
namespace RevitAddin.Revit
|
||||
{
|
||||
[AppLoader]
|
||||
public class App : IExternalApplication
|
||||
{
|
||||
private RibbonPanel ribbonPanel;
|
||||
public Result OnStartup(UIControlledApplication application)
|
||||
{
|
||||
ribbonPanel = application.CreatePanel("RevitAddin");
|
||||
ribbonPanel.CreatePushButton<Commands.Command>()
|
||||
.SetLargeImage("Resources/Revit.ico");
|
||||
return Result.Succeeded;
|
||||
}
|
||||
|
||||
public Result OnShutdown(UIControlledApplication application)
|
||||
{
|
||||
ribbonPanel?.Remove();
|
||||
return Result.Succeeded;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
21
RevitAddin/Revit/Commands/Command.cs
Normal file
21
RevitAddin/Revit/Commands/Command.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
|
||||
namespace RevitAddin.Revit.Commands
|
||||
{
|
||||
[Transaction(TransactionMode.Manual)]
|
||||
public class Command : IExternalCommand
|
||||
{
|
||||
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
|
||||
{
|
||||
UIApplication uiapp = commandData.Application;
|
||||
|
||||
System.Windows.MessageBox.Show(uiapp.Application.VersionName);
|
||||
|
||||
return Result.Succeeded;
|
||||
}
|
||||
}
|
||||
}
|
||||
164
RevitAddin/RevitAddin.csproj
Normal file
164
RevitAddin/RevitAddin.csproj
Normal file
@@ -0,0 +1,164 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseWPF>true</UseWPF>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
|
||||
<Configurations>
|
||||
Debug 2020; 2020;
|
||||
Debug 2019; 2019;
|
||||
</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- RevitVersion -->
|
||||
<Choose>
|
||||
<When Condition="$(Configuration.Contains('2019'))">
|
||||
<PropertyGroup>
|
||||
<RevitVersion>2019</RevitVersion>
|
||||
<TargetFramework>net47</TargetFramework>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="$(Configuration.Contains('2020'))">
|
||||
<PropertyGroup>
|
||||
<RevitVersion>2020</RevitVersion>
|
||||
<TargetFramework>net47</TargetFramework>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="$(Configuration.Contains('2021'))">
|
||||
<PropertyGroup>
|
||||
<RevitVersion>2021</RevitVersion>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="$(Configuration.Contains('2022'))">
|
||||
<PropertyGroup>
|
||||
<RevitVersion>2022</RevitVersion>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="$(Configuration.Contains('2023'))">
|
||||
<PropertyGroup>
|
||||
<RevitVersion>2023</RevitVersion>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="$(Configuration.Contains('2024'))">
|
||||
<PropertyGroup>
|
||||
<RevitVersion>2024</RevitVersion>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="$(Configuration.Contains('2025'))">
|
||||
<PropertyGroup>
|
||||
<RevitVersion>2025</RevitVersion>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<PropertyGroup>
|
||||
<RevitVersion>2019</RevitVersion>
|
||||
<TargetFramework>net47</TargetFramework>
|
||||
</PropertyGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
|
||||
<!-- Net Core -->
|
||||
<PropertyGroup Condition="!$(TargetFramework.StartsWith('net4'))">
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<GenerateDependencyFile>false</GenerateDependencyFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Release -->
|
||||
<PropertyGroup Condition="!$(Configuration.Contains('Debug'))">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\$(RevitVersion)</OutputPath>
|
||||
<DefineConstants>$(DefineConstants);REVIT$(RevitVersion)</DefineConstants>
|
||||
<NoWarn>MSB3052</NoWarn>
|
||||
<DebugType>None</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Debug -->
|
||||
<PropertyGroup Condition="$(Configuration.Contains('Debug'))">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>$(DefineConstants);DEBUG;TRACE;REVIT$(RevitVersion)</DefineConstants>
|
||||
<DebugType>Full</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- DebugRevitVersion -->
|
||||
<PropertyGroup Condition="$(Configuration.Contains('Debug'))">
|
||||
<DebugRevitVersion>$(RevitVersion)</DebugRevitVersion>
|
||||
<StartAction>Program</StartAction>
|
||||
<StartProgram>C:\Program Files\Autodesk\Revit $(DebugRevitVersion)\Revit.exe</StartProgram>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<PackageId>SolutionTemplates</PackageId>
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<PackageAssemblyVersion></PackageAssemblyVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(Configuration.Contains('Debug'))">
|
||||
<IncludePackageReferencesDuringMarkupCompilation>false</IncludePackageReferencesDuringMarkupCompilation>
|
||||
<Revision>$([MSBuild]::Divide($([System.DateTime]::Now.TimeOfDay.TotalSeconds), 4).ToString('F0'))</Revision>
|
||||
<PackageAssemblyVersion>.Dev.$(Version).$(Revision)</PackageAssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Company>Company</Company>
|
||||
<Authors>Authors</Authors>
|
||||
<Description>Revit Plugin Description for $(PackageId).</Description>
|
||||
<CopyrightYears>$([System.DateTime]::Now.ToString('yyyy'))</CopyrightYears>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<AssemblyName>$(PackageId)$(PackageAssemblyVersion)</AssemblyName>
|
||||
<Product>$(PackageId)</Product>
|
||||
<Copyright>Copyright © $(CopyrightYears) $(Company)</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BitMono.Protections" Version="0.38.0" />
|
||||
<PackageReference Include="ricaun.Revit.UI" Version="*" />
|
||||
<PackageReference Include="ricaun.Revit.Mvvm" Version="*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="Revit\App.cs" />
|
||||
<None Include="Revit\Commands\Command.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Revit.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Fody -->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="3.*" IncludeAssets="build; compile" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<WeaverConfiguration>
|
||||
<Weavers>
|
||||
<PropertyChanged />
|
||||
</Weavers>
|
||||
</WeaverConfiguration>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*" IncludeAssets="build; compile" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="bitmono.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
9
RevitAddin/bitmono.json
Normal file
9
RevitAddin/bitmono.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"Protections": {
|
||||
"AntiDe4dot": { "Enabled": true },
|
||||
"StringsEncryption": { "Enabled": true }, // 保护敏感字符串
|
||||
"BitDotNet": { "Enabled": true }, // 防止简单的反编译
|
||||
"ControlFlow": { "Enabled": true }, // 打乱代码逻辑(重要)
|
||||
"FullRenaming": { "Enabled": false } // 关闭全局重命名,避免 Revit/WPF 崩溃
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user