This commit is contained in:
lincube
2026-03-21 13:08:20 +08:00
parent 33baaa579d
commit 2a1c09ae39
23 changed files with 398 additions and 1436 deletions

View File

@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<NoWarn>$(NoWarn);NU5128</NoWarn>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<PackageId>LanMountainDesktop.PluginTemplate</PackageId>
<Version>1.0.0</Version>
<Authors>LanMountainDesktop</Authors>
<Description>Official dotnet new template package for LanMountainDesktop plugins.</Description>
<PackageTags>LanMountainDesktop;Plugin;Template;dotnet-new</PackageTags>
<PackageType>Template</PackageType>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/wwiinnddyy/LanMountainDesktop</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<IncludeBuildOutput>false</IncludeBuildOutput>
<IsPackable>true</IsPackable>
<NoDefaultExcludes>true</NoDefaultExcludes>
</PropertyGroup>
<ItemGroup>
<Compile Remove="content\**\*.cs" />
<None Include="README.md" Pack="true" PackagePath="\" />
<None Include="content\**\*" Pack="true" PackagePath="content\" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,17 @@
# LanMountainDesktop.PluginTemplate
Official `dotnet new` template package for LanMountainDesktop plugins.
## Install
```powershell
dotnet new install LanMountainDesktop.PluginTemplate
```
## Create a plugin
```powershell
dotnet new lmd-plugin -n YourPluginName
```
The generated project references `LanMountainDesktop.PluginSdk` and produces a `.laapp` package automatically when built.

View File

@@ -0,0 +1,55 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "LanMountainDesktop",
"classifications": [
"LanMountainDesktop",
"Plugin",
"Desktop"
],
"name": "LanMountainDesktop Plugin",
"identity": "LanMountainDesktop.PluginTemplate.CSharp",
"shortName": "lmd-plugin",
"sourceName": "LanMountainDesktop.PluginTemplate",
"preferNameDirectory": true,
"tags": {
"type": "project",
"language": "C#"
},
"symbols": {
"pluginId": {
"type": "parameter",
"datatype": "text",
"defaultValue": "LanMountainDesktop.PluginTemplate",
"description": "Plugin manifest id.",
"replaces": "__PLUGIN_ID__"
},
"pluginAuthor": {
"type": "parameter",
"datatype": "text",
"defaultValue": "Your Name",
"description": "Plugin author.",
"replaces": "__PLUGIN_AUTHOR__"
},
"pluginName": {
"type": "parameter",
"datatype": "text",
"defaultValue": "LanMountain Plugin Template",
"description": "Display name shown in plugin manifest.",
"replaces": "__PLUGIN_NAME__"
},
"pluginDescription": {
"type": "parameter",
"datatype": "text",
"defaultValue": "Plugin generated from the official LanMountainDesktop template.",
"description": "Plugin description shown in plugin manifest.",
"replaces": "__PLUGIN_DESCRIPTION__"
},
"pluginSdkVersion": {
"type": "parameter",
"datatype": "text",
"defaultValue": "4.0.0",
"description": "LanMountainDesktop.PluginSdk package version.",
"replaces": "__PLUGIN_SDK_VERSION__"
}
}
}

View File

@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>1.0.0</Version>
<EnableDynamicLoading>true</EnableDynamicLoading>
<LanMountainPluginPackageVersion>$(Version)</LanMountainPluginPackageVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="LanMountainDesktop.PluginSdk" Version="__PLUGIN_SDK_VERSION__" ExcludeAssets="runtime" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<None Update="plugin.json" CopyToOutputDirectory="PreserveNewest" />
<None Include="Localization\*.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,2 @@
{
}

View File

@@ -0,0 +1,2 @@
{
}

View File

@@ -0,0 +1,15 @@
using LanMountainDesktop.PluginSdk;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace LanMountainDesktop.PluginTemplate;
[PluginEntrance]
public sealed class Plugin : PluginBase
{
public override void Initialize(HostBuilderContext context, IServiceCollection services)
{
_ = context;
_ = services;
}
}

View File

@@ -0,0 +1,24 @@
# __PLUGIN_NAME__
Official-style plugin scaffold generated for LanMountainDesktop.
## Build
```powershell
dotnet build -c Release
```
`LanMountainDesktop.PluginSdk` build targets will generate:
- plugin output files under `bin/<Configuration>/<TFM>/`
- a `.laapp` package in the project root
## Manifest
Update `plugin.json` fields as needed before release:
- `id`
- `name`
- `description`
- `author`
- `version`

View File

@@ -0,0 +1,10 @@
{
"id": "__PLUGIN_ID__",
"name": "__PLUGIN_NAME__",
"description": "__PLUGIN_DESCRIPTION__",
"author": "__PLUGIN_AUTHOR__",
"version": "1.0.0",
"apiVersion": "4.0.0",
"entranceAssembly": "LanMountainDesktop.PluginTemplate.dll",
"sharedContracts": []
}