StreamDeckToolkit 项目教程

StreamDeckToolkit 项目教程

StreamDeckToolkitA .NET Standard library, template, and tools for building extensions to the Elgato Stream Deck项目地址:https://gitcode.com/gh_mirrors/st/StreamDeckToolkit

1. 项目的目录结构及介绍

StreamDeckToolkit 项目的目录结构如下:

StreamDeckToolkit/
├── docs/
├── scripts/
├── src/
│   ├── StreamDeckToolkit/
│   └── StreamDeckPluginTemplate.CSharp/
├── test/
├── .editorconfig
├── .gitattributes
├── .gitignore
├── LICENSE
├── README.md
├── RESOURCES.md
└── StreamDeckToolkit.code-workspace

目录介绍

  • docs/: 包含项目的文档文件。
  • scripts/: 包含项目的脚本文件。
  • src/: 包含项目的源代码文件。
    • StreamDeckToolkit/: 包含 StreamDeckToolkit 的核心库代码。
    • StreamDeckPluginTemplate.CSharp/: 包含 C# 插件模板代码。
  • test/: 包含项目的测试文件。
  • .editorconfig: 编辑器配置文件。
  • .gitattributes: Git 属性配置文件。
  • .gitignore: Git 忽略配置文件。
  • LICENSE: 项目许可证文件。
  • README.md: 项目介绍和使用说明。
  • RESOURCES.md: 项目资源文件。
  • StreamDeckToolkit.code-workspace: Visual Studio Code 工作区配置文件。

2. 项目的启动文件介绍

项目的启动文件主要位于 src/StreamDeckPluginTemplate.CSharp/ 目录下。主要的启动文件是 Program.csMain.cs

Program.cs

Program.cs 文件包含了程序的入口点,负责初始化和启动插件。

using System;
using System.Threading.Tasks;
using StreamDeckToolkit;

namespace StreamDeckPluginTemplate.CSharp
{
    class Program
    {
        static async Task Main(string[] args)
        {
            var host = StreamDeckHostBuilder.CreateDefaultBuilder(args)
                .ConfigureStreamDeckApp<MyStreamDeckApp>()
                .Build();

            await host.RunAsync();
        }
    }
}

Main.cs

Main.cs 文件定义了插件的主要逻辑和行为。

using StreamDeckToolkit;

namespace StreamDeckPluginTemplate.CSharp
{
    public class MyStreamDeckApp : StreamDeckApp
    {
        public override void RegisterActions()
        {
            RegisterAction<MyStreamDeckAction>();
        }
    }
}

3. 项目的配置文件介绍

项目的配置文件主要包含在 src/StreamDeckPluginTemplate.CSharp/ 目录下,主要的配置文件是 manifest.json

manifest.json

manifest.json 文件是 Stream Deck 插件的配置文件,包含了插件的基本信息和动作定义。

{
  "Actions": [
    {
      "Name": "My Stream Deck Action",
      "UUID": "com.example.myaction",
      "Icon": "Images/action",
      "States": [
        {
          "Image": "Images/default",
          "TitleAlignment": "bottom",
          "FontSize": "12"
        }
      ],
      "SupportedInMultiActions": true,
      "Tooltip": "This is my custom action."
    }
  ],
  "Author": "Your Name",
  "Description": "A custom Stream Deck plugin.",
  "Name": "My Stream Deck Plugin",
  "Icon": "Images/plugin",
  "URL": "https://example.com",
  "Version": "1.0",
  "CodePath": "MyStreamDeckPlugin.exe",
  "SDKVersion": 2,
  "Software": {
    "MinimumVersion": "4.1"
  },
  "OS": [
    {
      "Platform": "windows",
      "MinimumVersion": "10"
    }
  ]
}

配置文件介绍

  • Actions: 定义插件的动作列表。
  • Author: 插件的作者。
  • Description: 插件的描述。
  • Name: 插件的名称。
  • **Icon

StreamDeckToolkitA .NET Standard library, template, and tools for building extensions to the Elgato Stream Deck项目地址:https://gitcode.com/gh_mirrors/st/StreamDeckToolkit

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

宁彦腾

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值