Skip to content

Commit

Permalink
Добавьте файлы проекта.
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyNefyodov committed May 22, 2024
1 parent 0b10b85 commit cfdf6f7
Show file tree
Hide file tree
Showing 54 changed files with 1,601 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/Workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Workflow

on:
push:
branches:
- '**'
pull_request:
branches:
- '!main'

jobs:
windows:
name: windows-2022
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run Nuke build
run: ./.nuke/build.cmd Compile PublishGitHub --GitHubToken ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#IDE folders
*.idea/
*.vs/
*.vscode/

#Project-specific folders
*obj/
*bin/
*temp/

#Deprecated Nuget folder
/packages/

#Nuke output folder
/output/

#Project-specific files
*/build.schema.json

#User-specific files
*.user
1 change: 1 addition & 0 deletions .nuke/build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0Build.ps1" %*
69 changes: 69 additions & 0 deletions .nuke/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[CmdletBinding()]
Param(
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$BuildArguments
)

Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)"

Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 }

###########################################################################
# CONFIGURATION
###########################################################################

$SolutionDirectory = Split-Path $PSScriptRoot -Parent
$BuildProjectFile = "$SolutionDirectory\Build\Build.csproj"
$TempDirectory = "$SolutionDirectory\.nuke\temp"

$DotNetGlobalFile = "$SolutionDirectory\global.json"
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
$DotNetChannel = "Current"

$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
$env:DOTNET_MULTILEVEL_LOOKUP = 0

###########################################################################
# EXECUTION
###########################################################################

function ExecSafe([scriptblock] $cmd) {
& $cmd
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}

# If dotnet CLI is installed globally and it matches requested version, use for execution
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
$(dotnet --version) -and $LASTEXITCODE -eq 0) {
$env:DOTNET_EXE = (Get-Command "dotnet").Path
}
else {
# Download install script
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)

# If global.json exists, load expected version
if (Test-Path $DotNetGlobalFile) {
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
$DotNetVersion = $DotNetGlobal.sdk.version
}
}

# Install by channel or version
$DotNetDirectory = "$TempDirectory\dotnet-win"
if (!(Test-Path variable:DotNetVersion)) {
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
} else {
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
}
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
}

Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"

ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }
5 changes: 5 additions & 0 deletions .nuke/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "./build.schema.json",
"Solution": "ManyCommandsApplication.sln",
"Verbosity": "Normal"
}
25 changes: 25 additions & 0 deletions .run/Nuke Clean.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false"
name="Nuke Clean"
type="RunExe"
factoryName=".NET Executable">
<option name="EXE_PATH"
value="$USER_HOME$/.dotnet/tools/nuke.exe"/>
<option name="PROGRAM_PARAMETERS"
value="--Cleaning --skip Compile"/>
<option name="WORKING_DIRECTORY"
value="$PROJECT_DIR$/"/>
<option name="PASS_PARENT_ENVS"
value="1"/>
<option name="USE_EXTERNAL_CONSOLE"
value="0"/>
<option name="USE_MONO"
value="0"/>
<option name="RUNTIME_ARGUMENTS"
value=""/>
<method v="2">
<option name="CleanSolution"
enabled="true"/>
</method>
</configuration>
</component>
22 changes: 22 additions & 0 deletions .run/Nuke Plan.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false"
name="Nuke Plan"
type="RunExe"
factoryName=".NET Executable">
<option name="EXE_PATH"
value="$USER_HOME$/.dotnet/tools/nuke.exe"/>
<option name="PROGRAM_PARAMETERS"
value="--plan"/>
<option name="WORKING_DIRECTORY"
value="$PROJECT_DIR$/"/>
<option name="PASS_PARENT_ENVS"
value="1"/>
<option name="USE_EXTERNAL_CONSOLE"
value="0"/>
<option name="USE_MONO"
value="0"/>
<option name="RUNTIME_ARGUMENTS"
value=""/>
<method v="2"/>
</configuration>
</component>
22 changes: 22 additions & 0 deletions .run/Nuke.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false"
name="Nuke"
type="RunExe"
factoryName=".NET Executable">
<option name="EXE_PATH"
value="$USER_HOME$/.dotnet/tools/nuke.exe"/>
<option name="PROGRAM_PARAMETERS"
value=""/>
<option name="WORKING_DIRECTORY"
value="$PROJECT_DIR$/"/>
<option name="PASS_PARENT_ENVS"
value="1"/>
<option name="USE_EXTERNAL_CONSOLE"
value="0"/>
<option name="USE_MONO"
value="0"/>
<option name="RUNTIME_ARGUMENTS"
value=""/>
<method v="2"/>
</configuration>
</component>
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 1.0.0

Initial release. Enjoy!
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Autodesk.Revit.Attributes;
using Autodesk.Revit.UI;
using CommonProject.Core;
using ExtensibleStorageExample.ViewModels;
using ExtensibleStorageExample.Views;
using Nice3point.Revit.Toolkit.External;

namespace ExtensibleStorageExample.Commands
{
/// <summary>
/// External command entry point invoked from the Revit interface
/// </summary>
[UsedImplicitly]
[Transaction(TransactionMode.Manual)]
public class ExtensibleStorageExampleCommand : ExternalCommand
{
public override void Execute()
{
RevitShell.SayHello();
TaskDialog.Show("Info", $"{this.GetType().FullName} is executing");
//var viewModel = new ExtensibleStorageExampleViewModel();
//var view = new ExtensibleStorageExampleView(viewModel);
//view.ShowDialog();
}
}
}
54 changes: 54 additions & 0 deletions ExtensibleStorageExample/ExtensibleStorageExample.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<UseWPF>true</UseWPF>
<LangVersion>latest</LangVersion>
<PlatformTarget>x64</PlatformTarget>
<ImplicitUsings>true</ImplicitUsings>
<Configurations>Debug R20;Debug R21;Debug R22;Debug R23;Debug R24;Debug R25</Configurations>
<Configurations>$(Configurations);Release R20;Release R21;Release R22;Release R23;Release R24;Release R25</Configurations>
</PropertyGroup>

<PropertyGroup Condition="$(Configuration.Contains('R20'))">
<RevitVersion>2020</RevitVersion>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('R21'))">
<RevitVersion>2021</RevitVersion>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('R22'))">
<RevitVersion>2022</RevitVersion>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('R23'))">
<RevitVersion>2023</RevitVersion>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('R24'))">
<RevitVersion>2024</RevitVersion>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('R25'))">
<RevitVersion>2025</RevitVersion>
<TargetFramework>net8.0-windows</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nice3point.Revit.Build.Tasks" Version="1.*" />
<PackageReference Include="Nice3point.Revit.Toolkit" Version="$(RevitVersion).*" />
<PackageReference Include="Nice3point.Revit.Extensions" Version="$(RevitVersion).*" />
<PackageReference Include="Nice3point.Revit.Api.RevitAPI" Version="$(RevitVersion).*" />
<PackageReference Include="Nice3point.Revit.Api.RevitAPIUI" Version="$(RevitVersion).*" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.*" />
</ItemGroup>

<ItemGroup>
<Folder Include="Models" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\source\CommonProject\CommonProject.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace ExtensibleStorageExample.ViewModels
{
public sealed class ExtensibleStorageExampleViewModel : ObservableObject
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Globalization;
using System.Windows.Data;
using System.Windows.Markup;
using Visibility = System.Windows.Visibility;

namespace ExtensibleStorageExample.Views.Converters
{
public class BoolVisibilityConverter : MarkupExtension, IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool)value! ? Visibility.Visible : Visibility.Hidden;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return (Visibility)value! == Visibility.Visible;
}

public override object ProvideValue(IServiceProvider serviceProvider)
{
return this;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Globalization;
using System.Windows.Data;
using System.Windows.Markup;
using Visibility = System.Windows.Visibility;

namespace ExtensibleStorageExample.Views.Converters
{
public class EnumVisibilityConverter<TEnum> : MarkupExtension, IValueConverter where TEnum : Enum
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is not TEnum valueEnum)
{
throw new ArgumentException($"{nameof(value)} is not type: {typeof(TEnum)}");
}

if (parameter is not TEnum parameterEnum)
{
throw new ArgumentException($"{nameof(parameter)} is not type: {typeof(TEnum)}");
}

return EqualityComparer<TEnum>.Default.Equals(valueEnum, parameterEnum) ? Visibility.Visible : Visibility.Hidden;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}

public override object ProvideValue(IServiceProvider serviceProvider)
{
return this;
}
}
}
24 changes: 24 additions & 0 deletions ExtensibleStorageExample/Views/Converters/InverseBoolConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Globalization;
using System.Windows.Data;
using System.Windows.Markup;

namespace ExtensibleStorageExample.Views.Converters
{
public class InverseBoolConverter : MarkupExtension, IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return !(bool)value!;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return !(bool)value!;
}

public override object ProvideValue(IServiceProvider serviceProvider)
{
return this;
}
}
}
Loading

0 comments on commit cfdf6f7

Please sign in to comment.