mirror of
https://github.com/RRQM/TouchSocket.git
synced 2025-12-19 09:56:44 +08:00
feat(docs): 添加多个组件的导入和解析功能
在多个 `.mdx` 文件中添加对 `TouchSocketCoreDefinition`、`TouchSocketHttpDefinition`、`TouchSocketDmtpDefinition`、`TouchSocketModbusDefinition`、`TouchSocketProModbusDefinition`、`TouchSocketNamedPipeDefinition`、`TouchSocketWebApiDefinition`、`TouchSocketJsonRpcDefinition` 和 `TouchSocketXmlRpcDefinition` 的导入。增加解析和处理定义部分的 JavaScript 脚本,确保导入的有效性和一致性。新增功能包括精确匹配定义部分的正则表达式、解析定义内容的函数、生成定义组件的函数、递归查找 `.mdx` 文件的功能,以及验证导入的有效性
This commit is contained in:
@@ -4,11 +4,12 @@ title: 适配器消息构建器
|
||||
---
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ title: 介绍及使用
|
||||
---
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ title: 适配器纠错
|
||||
---
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@ id: appmessenger
|
||||
title: 应用信使
|
||||
---
|
||||
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
应用信使是在进程内的,行使注册和触发功能的组件。可**代替事件**,可**跨越程序集**,可**依赖倒置**。
|
||||
|
||||
@@ -4,11 +4,12 @@ title: 模板解析“大数据固定包头”数据适配器
|
||||
---
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ title: 内存池
|
||||
---
|
||||
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -3,10 +3,11 @@ id: consoleaction
|
||||
title: 控制台行为
|
||||
---
|
||||
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -3,10 +3,11 @@ id: cors
|
||||
title: 跨域资源共享
|
||||
---
|
||||
|
||||
import { TouchSocketHttpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Http <br/>
|
||||
程序集:[TouchSocket.Http.dll](https://www.nuget.org/packages/TouchSocket.Http)
|
||||
<TouchSocketHttpDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -6,11 +6,12 @@ title: 模板解析“区间数据”数据适配器
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ title: 模板解析“大数据不固定包头”数据适配器
|
||||
---
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -5,11 +5,12 @@ title: 模板解析“固定数量分隔符”数据适配器
|
||||
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ title: 用户自定义适配器
|
||||
---
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ title: 模板解析“固定包头”数据适配器
|
||||
---
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -5,11 +5,12 @@ title: 模板解析“Json”数据适配器
|
||||
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ title: 模板解析“非固定包头”数据适配器
|
||||
---
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ title: 适配器完整性、性能测试
|
||||
---
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ title: 原始适配器
|
||||
---
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -3,10 +3,11 @@ id: datasecurity
|
||||
title: 数据加密
|
||||
---
|
||||
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、3DES
|
||||
|
||||
@@ -2,33 +2,7 @@
|
||||
title: Definition组件完整测试
|
||||
---
|
||||
|
||||
import {
|
||||
TouchSocketDefinition,
|
||||
TouchSocketCoreDefinition,
|
||||
TouchSocketDmtpDefinition,
|
||||
TouchSocketHttpDefinition,
|
||||
TouchSocketNamedPipeDefinition,
|
||||
TouchSocketSerialPortsDefinition,
|
||||
TouchSocketRpcDefinition,
|
||||
TouchSocketJsonRpcDefinition,
|
||||
TouchSocketXmlRpcDefinition,
|
||||
TouchSocketWebApiDefinition,
|
||||
TouchSocketWebApiSwaggerDefinition,
|
||||
TouchSocketModbusDefinition,
|
||||
TouchSocketMqttDefinition,
|
||||
TouchSocketAspNetCoreDefinition,
|
||||
TouchSocketHostingDefinition,
|
||||
TouchSocketCoreDependencyInjectionDefinition,
|
||||
TouchSocketCoreAutofacDefinition,
|
||||
TouchSocketRpcRateLimitingDefinition,
|
||||
TouchSocketProDefinition,
|
||||
TouchSocketProDmtpDefinition,
|
||||
TouchSocketProAspNetCoreDefinition,
|
||||
TouchSocketProHostingDefinition,
|
||||
TouchSocketProModbusDefinition,
|
||||
TouchSocketProPlcBridgesDefinition,
|
||||
TouchSocketPipelinesDefinition
|
||||
} from '@site/src/components/Definition.js';
|
||||
import { TouchSocketDefinition, TouchSocketCoreDefinition, TouchSocketDmtpDefinition, TouchSocketHttpDefinition, TouchSocketNamedPipeDefinition, TouchSocketSerialPortsDefinition, TouchSocketRpcDefinition, TouchSocketJsonRpcDefinition, TouchSocketXmlRpcDefinition, TouchSocketWebApiDefinition, TouchSocketWebApiSwaggerDefinition, TouchSocketModbusDefinition, TouchSocketMqttDefinition, TouchSocketAspNetCoreDefinition, TouchSocketHostingDefinition, TouchSocketCoreDependencyInjectionDefinition, TouchSocketCoreAutofacDefinition, TouchSocketRpcRateLimitingDefinition, TouchSocketProDefinition, TouchSocketProDmtpDefinition, TouchSocketProAspNetCoreDefinition, TouchSocketProHostingDefinition, TouchSocketProModbusDefinition, TouchSocketProPlcBridgesDefinition, TouchSocketPipelinesDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
# Definition组件完整测试
|
||||
|
||||
|
||||
@@ -3,13 +3,10 @@ id: definition-test
|
||||
title: Definition 组件测试
|
||||
---
|
||||
|
||||
import Definition, {
|
||||
import {
|
||||
TouchSocketCoreDefinition,
|
||||
TouchSocketDmtpDefinition,
|
||||
TouchSocketHttpDefinition,
|
||||
TouchSocketRpcDefinition,
|
||||
TouchSocketMqttDefinition,
|
||||
TouchSocketModbusDefinition
|
||||
TouchSocketRpcDefinition
|
||||
} from '@site/src/components/Definition.js';
|
||||
|
||||
# Definition 组件测试
|
||||
|
||||
@@ -3,10 +3,11 @@ id: dependencyproperty
|
||||
title: 依赖属性
|
||||
---
|
||||
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -5,11 +5,12 @@ title: Dmtp基础功能
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
import { TouchSocketDmtpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Dmtp <br/>
|
||||
程序集:[TouchSocket.Dmtp.dll](https://www.nuget.org/packages/TouchSocket.Dmtp)
|
||||
<TouchSocketDmtpDefinition />
|
||||
|
||||
|
||||
## 一、连接
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@ title: 创建Dmtp客户端
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import Pro from "@site/src/components/Pro.js";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketProDmtpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Dmtp <br/>
|
||||
程序集:[TouchSocket.Dmtp.dll](https://www.nuget.org/packages/TouchSocket.Dmtp)<br/>
|
||||
程序集:[TouchSocketPro.Dmtp.dll](https://www.nuget.org/packages/TouchSocketPro.Dmtp) <Pro/>
|
||||
<TouchSocketProDmtpDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@ id: dmtpcustomactor
|
||||
title: 自定义DmtpActor
|
||||
---
|
||||
|
||||
import { TouchSocketDmtpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Dmtp <br/>
|
||||
程序集:[TouchSocket.Dmtp.dll](https://www.nuget.org/packages/TouchSocket.Dmtp)
|
||||
<TouchSocketDmtpDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ title: 产品及架构介绍
|
||||
---
|
||||
import Pro from "@site/src/components/Pro.js";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketDmtpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Dmtp <br/>
|
||||
程序集:[TouchSocket.Dmtp.dll](https://www.nuget.org/packages/TouchSocket.Dmtp)
|
||||
<TouchSocketDmtpDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -3,10 +3,12 @@ id: dmtpredis
|
||||
title: Redis缓存
|
||||
---
|
||||
|
||||
import { TouchSocketDmtpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Dmtp <br/>
|
||||
程序集:[TouchSocket.Dmtp.dll](https://www.nuget.org/packages/TouchSocket.Dmtp)
|
||||
<TouchSocketDmtpDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -5,12 +5,11 @@ title: b.远程流映射
|
||||
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import Pro from "@site/src/components/Pro.js";
|
||||
import { TouchSocketProDmtpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Dmtp <br/>
|
||||
程序集:[TouchSocketPro.Dmtp.dll](https://www.nuget.org/packages/TouchSocketPro.Dmtp)
|
||||
|
||||
<TouchSocketProDmtpDefinition />
|
||||
|
||||
|
||||
## 一、说明 <Pro/>
|
||||
|
||||
@@ -5,11 +5,12 @@ title: 路由包传输
|
||||
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import Pro from "@site/src/components/Pro.js";
|
||||
import { TouchSocketProDmtpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Dmtp <br/>
|
||||
程序集:[TouchSocketPro.Dmtp.dll](https://www.nuget.org/packages/TouchSocketPro.Dmtp)
|
||||
<TouchSocketProDmtpDefinition />
|
||||
|
||||
|
||||
## 一、说明 <Pro/>
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ title: Rpc功能
|
||||
---
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketDmtpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Dmtp.Rpc <br/>
|
||||
程序集:[TouchSocket.Dmtp.dll](https://www.nuget.org/packages/TouchSocket.Dmtp)
|
||||
<TouchSocketDmtpDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@ title: 创建Dmtp服务器
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import Pro from "@site/src/components/Pro.js";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketProDmtpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Dmtp <br/>
|
||||
程序集:[TouchSocket.Dmtp.dll](https://www.nuget.org/packages/TouchSocket.Dmtp)<br/>
|
||||
程序集:[TouchSocketPro.Dmtp.dll](https://www.nuget.org/packages/TouchSocketPro.Dmtp) <Pro/>
|
||||
<TouchSocketProDmtpDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@ import Tag from "@site/src/components/Tag.js";
|
||||
import Pro from "@site/src/components/Pro.js";
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import Definition from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Dmtp.FileTransfer <br/>
|
||||
程序集:[TouchSocket.Dmtp.dll](https://www.nuget.org/packages/TouchSocket.Dmtp)<br/>
|
||||
程序集:[TouchSocketPro.Dmtp.dll(多线程传输)](https://www.nuget.org/packages/TouchSocketPro.Dmtp)
|
||||
<Definition namespace="TouchSocket.Dmtp.FileTransfer <br/>" assemblies={["TouchSocket.Dmtp.dll","TouchSocketPro.Dmtp.dll(多线程传输)"]} />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,12 +4,13 @@ title: 动态方法调用(DynamicMethod)
|
||||
---
|
||||
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、核心概念
|
||||
|
||||
|
||||
@@ -3,10 +3,11 @@ id: fastbinaryformatter
|
||||
title: 高性能二进制序列化
|
||||
---
|
||||
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -3,10 +3,11 @@ id: filepool
|
||||
title: 文件流池
|
||||
---
|
||||
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -3,10 +3,11 @@ id: generateproxysourcegeneratordemo
|
||||
title: 源生成代理推荐写法
|
||||
---
|
||||
|
||||
import { TouchSocketRpcDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Rpc <br/>
|
||||
程序集:[TouchSocket.Rpc.dll](https://www.nuget.org/packages/TouchSocket.Rpc)
|
||||
<TouchSocketRpcDefinition />
|
||||
|
||||
|
||||
## 一、声明接口
|
||||
|
||||
@@ -6,12 +6,11 @@ title: 通用主机
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import Definition from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Hosting <br/>
|
||||
程序集:[TouchSocket.Hosting.dll](https://www.nuget.org/packages/TouchSocket.Hosting)<br/>
|
||||
程序集:[TouchSocketPro.Hosting.dll](https://www.nuget.org/packages/TouchSocketPro.Hosting)
|
||||
<Definition namespace="TouchSocket.Hosting <br/>" assemblies={["TouchSocket.Hosting.dll","TouchSocketPro.Hosting.dll"]} />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -5,11 +5,12 @@ title: 创建HttpClient
|
||||
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketHttpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Http <br/>
|
||||
程序集:[TouchSocket.Http.dll](https://www.nuget.org/packages/TouchSocket.Http)
|
||||
<TouchSocketHttpDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketHttpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Http <br/>
|
||||
程序集:[TouchSocket.Http.dll](https://www.nuget.org/packages/TouchSocket.Http)
|
||||
<TouchSocketHttpDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -3,10 +3,12 @@ id: httpstaticpageplugin
|
||||
title: 静态页面插件
|
||||
---
|
||||
|
||||
import { TouchSocketHttpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Http <br/>
|
||||
程序集:[TouchSocket.Http.dll](https://www.nuget.org/packages/TouchSocket.Http)
|
||||
<TouchSocketHttpDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@ id: ilog
|
||||
title: 日志记录器
|
||||
---
|
||||
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ title: 独立使用适配器
|
||||
---
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Sockets <br/>
|
||||
程序集:[TouchSocket.dll](https://www.nuget.org/packages/TouchSocket)
|
||||
<TouchSocketDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -3,10 +3,11 @@ id: ioc
|
||||
title: 依赖注入容器(IOC)
|
||||
---
|
||||
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -4,11 +4,11 @@ title: 包序列化模式
|
||||
---
|
||||
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -5,12 +5,13 @@ title: 产品及架构介绍
|
||||
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
import { TouchSocketJsonRpcDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.JsonRpc <br/>
|
||||
程序集:[TouchSocket.JsonRpc.dll](https://www.nuget.org/packages/TouchSocket.JsonRpc)
|
||||
<TouchSocketJsonRpcDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -3,10 +3,11 @@ id: jsonserialize
|
||||
title: Json序列化
|
||||
---
|
||||
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -5,11 +5,11 @@ title: Modbus主站(Master)
|
||||
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import Pro from "@site/src/components/Pro.js";
|
||||
import { TouchSocketModbusDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Modbus <br/>
|
||||
程序集:[TouchSocket.Modbus.dll](https://www.nuget.org/packages/TouchSocket.Modbus)
|
||||
<TouchSocketModbusDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -5,11 +5,11 @@ title: Modbus从站(Slave)
|
||||
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import Pro from "@site/src/components/Pro.js";
|
||||
import { TouchSocketProModbusDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocketPro.Modbus <br/>
|
||||
程序集:[TouchSocketPro.Modbus.dll](https://www.nuget.org/packages/TouchSocketPro.Modbus)
|
||||
<TouchSocketProModbusDefinition />
|
||||
|
||||
|
||||
## 一、说明 <Pro/>
|
||||
|
||||
@@ -4,11 +4,12 @@ title: Mqtt客户端使用
|
||||
---
|
||||
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import { TouchSocketMqttDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Mqtt <br/>
|
||||
程序集:[TouchSocket.Mqtt.dll](https://www.nuget.org/packages/TouchSocket.Mqtt)
|
||||
<TouchSocketMqttDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ title: Mqtt服务器
|
||||
---
|
||||
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import { TouchSocketMqttDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Mqtt <br/>
|
||||
程序集:[TouchSocket.Mqtt.dll](https://www.nuget.org/packages/TouchSocket.Mqtt)
|
||||
<TouchSocketMqttDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ title: 创建NamedPipeClient
|
||||
---
|
||||
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import { TouchSocketNamedPipeDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.NamedPipe <br/>
|
||||
程序集:[TouchSocket.NamedPipe.dll](https://www.nuget.org/packages/TouchSocket.NamedPipe)
|
||||
<TouchSocketNamedPipeDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -4,11 +4,12 @@ title: 创建命名管道服务器
|
||||
---
|
||||
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import { TouchSocketNamedPipeDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.NamedPipe <br/>
|
||||
程序集:[TouchSocket.NamedPipe.dll](https://www.nuget.org/packages/TouchSocket.NamedPipe)
|
||||
<TouchSocketNamedPipeDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -3,11 +3,12 @@ id: natservice
|
||||
title: Tcp端口转发
|
||||
---
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import { TouchSocketDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Sockets <br/>
|
||||
程序集:[TouchSocket.dll](https://www.nuget.org/packages/TouchSocket)
|
||||
<TouchSocketDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ id: othercore
|
||||
title: 其他相关功能类
|
||||
---
|
||||
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、Crc计算
|
||||
|
||||
@@ -5,11 +5,11 @@ title: 内置包适配器
|
||||
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -3,10 +3,12 @@ id: pipelinedatahandlingadapter
|
||||
title: Pipeline数据适配器
|
||||
---
|
||||
|
||||
import { TouchSocketDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Sockets <br/>
|
||||
程序集:[TouchSocket.dll](https://www.nuget.org/packages/TouchSocket)
|
||||
<TouchSocketDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -6,13 +6,11 @@ title: PlcBridge Modbus 集成指南
|
||||
import Pro from "@site/src/components/Pro.js";
|
||||
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
import Definition from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocketPro.PlcBridges <Pro/> <br/>
|
||||
命名空间:TouchSocketPro.Modbus <Pro/> <br/>
|
||||
程序集:[TouchSocketPro.PlcBridges.dll](https://www.nuget.org/packages/TouchSocketPro.PlcBridges)<br/>
|
||||
程序集:[TouchSocketPro.Modbus.dll](https://www.nuget.org/packages/TouchSocketPro.Modbus)
|
||||
<Definition namespace="TouchSocketPro.Modbus <Pro/> <br/>" assemblies={["TouchSocketPro.PlcBridges.dll","TouchSocketPro.Modbus.dll"]} />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -5,13 +5,12 @@ title: 历史更新
|
||||
|
||||
import Pro from "@site/src/components/Pro.js";
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
import { TouchSocketProPlcBridgesDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocketPro.PlcBridges <Pro/> <br/>
|
||||
程序集:[TouchSocketPro.PlcBridges.dll](https://www.nuget.org/packages/TouchSocketPro.PlcBridges)
|
||||
<TouchSocketProPlcBridgesDefinition />
|
||||
|
||||
# TouchSocketPro.PlcBridges 使用说明
|
||||
|
||||
## 一、说明 <Pro/>
|
||||
`TouchSocketPro.PlcBridges` 是一个高效、灵活的PLC数据桥接库,专为.NET开发者设计,用于简化与可编程逻辑控制器(PLC)的数据交互流程。该库提供了强大的数据读写管理能力,支持多种PLC协议和数据类型,使工业自动化开发更加便捷高效。
|
||||
|
||||
@@ -3,10 +3,11 @@ id: pluginsmanager
|
||||
title: 插件系统
|
||||
---
|
||||
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -4,11 +4,12 @@ title: 断线重连
|
||||
---
|
||||
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import { TouchSocketDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Sockets <br/>
|
||||
程序集:[TouchSocket.dll](https://www.nuget.org/packages/TouchSocket)
|
||||
<TouchSocketDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ title: 服务器重置id
|
||||
---
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Sockets <br/>
|
||||
程序集:[TouchSocket.dll](https://www.nuget.org/packages/TouchSocket)
|
||||
<TouchSocketDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -3,10 +3,11 @@ id: rpcactionfilter
|
||||
title: Rpc服务AOP
|
||||
---
|
||||
|
||||
import { TouchSocketRpcDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Rpc <br/>
|
||||
程序集:[TouchSocket.Rpc.dll](https://www.nuget.org/packages/TouchSocket.Rpc)
|
||||
<TouchSocketRpcDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -3,10 +3,11 @@ id: rpcallcontext
|
||||
title: 调用上下文
|
||||
---
|
||||
|
||||
import { TouchSocketRpcDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Rpc <br/>
|
||||
程序集:[TouchSocket.Rpc.dll](https://www.nuget.org/packages/TouchSocket.Rpc)
|
||||
<TouchSocketRpcDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -3,10 +3,12 @@ id: rpcgenerateproxy
|
||||
title: 生成、获取代理
|
||||
---
|
||||
|
||||
import { TouchSocketRpcDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Rpc <br/>
|
||||
程序集:[TouchSocket.Rpc.dll](https://www.nuget.org/packages/TouchSocket.Rpc)
|
||||
<TouchSocketRpcDefinition />
|
||||
|
||||
|
||||
## 一、为什么要生成代理
|
||||
|
||||
|
||||
@@ -3,10 +3,11 @@ id: rpcoption
|
||||
title: 调用配置
|
||||
---
|
||||
|
||||
import { TouchSocketRpcDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Rpc <br/>
|
||||
程序集:[TouchSocket.Rpc.dll](https://www.nuget.org/packages/TouchSocket.Rpc)
|
||||
<TouchSocketRpcDefinition />
|
||||
|
||||
|
||||
## 一、调用反馈类型
|
||||
|
||||
@@ -3,10 +3,11 @@ id: rpcratelimiting
|
||||
title: Rpc访问速率限制
|
||||
---
|
||||
|
||||
import { TouchSocketRpcRateLimitingDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Rpc.RateLimiting <br/>
|
||||
程序集:[TouchSocket.Rpc.RateLimiting.dll](https://www.nuget.org/packages/TouchSocket.Rpc.RateLimiting)
|
||||
<TouchSocketRpcRateLimitingDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -7,11 +7,11 @@ import Tag from "@site/src/components/Tag.js";
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketRpcDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Rpc <br/>
|
||||
程序集:[TouchSocket.Rpc.dll](https://www.nuget.org/packages/TouchSocket.Rpc)
|
||||
<TouchSocketRpcDefinition />
|
||||
|
||||
|
||||
## 一、直接注册
|
||||
|
||||
@@ -4,11 +4,11 @@ title: 串口客户端
|
||||
---
|
||||
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import { TouchSocketSerialPortsDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.SerialPorts <br/>
|
||||
程序集:[TouchSocket.SerialPorts.dll](https://www.nuget.org/packages/TouchSocket.SerialPorts)
|
||||
<TouchSocketSerialPortsDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -5,11 +5,11 @@ title: Swagger页面
|
||||
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketWebApiSwaggerDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.WebApi.Swagger <br/>
|
||||
程序集:[TouchSocket.WebApi.Swagger.dll](https://www.nuget.org/packages/TouchSocket.WebApi.Swagger)
|
||||
<TouchSocketWebApiSwaggerDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -7,11 +7,11 @@ import Tag from "@site/src/components/Tag.js";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
import { TouchSocketDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Sockets <br/>
|
||||
程序集:[TouchSocket.dll](https://www.nuget.org/packages/TouchSocket)
|
||||
<TouchSocketDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
@@ -3,10 +3,12 @@ id: tcpcommandlineplugin
|
||||
title: 命令行执行插件
|
||||
---
|
||||
|
||||
import { TouchSocketDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Sockets <br/>
|
||||
程序集:[TouchSocket.dll](https://www.nuget.org/packages/TouchSocket)
|
||||
<TouchSocketDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ title: 常用插件
|
||||
---
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Sockets <br/>
|
||||
程序集:[TouchSocket.dll](https://www.nuget.org/packages/TouchSocket)
|
||||
<TouchSocketDefinition />
|
||||
|
||||
|
||||
## 一、健康活性检验插件
|
||||
|
||||
|
||||
@@ -7,11 +7,12 @@ import Tag from "@site/src/components/Tag.js";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
import { TouchSocketDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Sockets <br/>
|
||||
程序集:[TouchSocket.dll](https://www.nuget.org/packages/TouchSocket)
|
||||
<TouchSocketDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@ id: tcpwaitingclient
|
||||
title: 同步请求
|
||||
---
|
||||
|
||||
import { TouchSocketDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Sockets <br/>
|
||||
程序集:[TouchSocket.dll](https://www.nuget.org/packages/TouchSocket)
|
||||
<TouchSocketDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ title: 三元组编码(TLV)适配器
|
||||
---
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import Pro from "@site/src/components/Pro.js";
|
||||
import { TouchSocketDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Sockets <br/>
|
||||
程序集:[TouchSocket.dll](https://www.nuget.org/packages/TouchSocket)
|
||||
<TouchSocketDefinition />
|
||||
|
||||
|
||||
## 一、说明 <Pro/>
|
||||
|
||||
|
||||
@@ -3,10 +3,11 @@ id: touchsocketbitconverter
|
||||
title: 大小端转换器
|
||||
---
|
||||
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、基本概念
|
||||
|
||||
@@ -3,10 +3,12 @@ id: udpbroadcast
|
||||
title: 组播、广播
|
||||
---
|
||||
|
||||
import { TouchSocketDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Sockets <br/>
|
||||
程序集:[TouchSocket.dll](https://www.nuget.org/packages/TouchSocket)
|
||||
<TouchSocketDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -5,10 +5,11 @@ title: 原始自定义适配器
|
||||
sidebar_label: a.原始自定义适配器
|
||||
---
|
||||
|
||||
import { TouchSocketDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Sockets <br/>
|
||||
程序集:[TouchSocket.dll](https://www.nuget.org/packages/TouchSocket)
|
||||
<TouchSocketDefinition />
|
||||
|
||||
|
||||
## 说明
|
||||
|
||||
@@ -5,11 +5,12 @@ title: 创建UdpSession
|
||||
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
import { TouchSocketDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Sockets <br/>
|
||||
程序集:[TouchSocket.dll](https://www.nuget.org/packages/TouchSocket)
|
||||
<TouchSocketDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@ id: udptransmitbigdata
|
||||
title: 传输大于64K的数据
|
||||
---
|
||||
|
||||
import { TouchSocketDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Sockets <br/>
|
||||
程序集:[TouchSocket.dll](https://www.nuget.org/packages/TouchSocket)
|
||||
<TouchSocketDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
UDP由于自身限制,每次发送的数据包最大约64K,但是在局域网内,有时候希望传输更大的数据。所以必须有策略发送。
|
||||
|
||||
@@ -3,10 +3,12 @@ id: udpwaitingclient
|
||||
title: Udp同步请求
|
||||
---
|
||||
|
||||
import { TouchSocketDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Sockets <br/>
|
||||
程序集:[TouchSocket.dll](https://www.nuget.org/packages/TouchSocket)
|
||||
<TouchSocketDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -6,11 +6,12 @@ title: 同步请求
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Sockets <br/>
|
||||
程序集:[TouchSocket.dll](https://www.nuget.org/packages/TouchSocket)
|
||||
<TouchSocketDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -5,11 +5,12 @@ title: 产品及架构介绍
|
||||
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketWebApiDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.WebApi <br/>
|
||||
程序集:[TouchSocket.WebApi.dll](https://www.nuget.org/packages/TouchSocket.WebApi)
|
||||
<TouchSocketWebApiDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -6,11 +6,12 @@ title: 创建WebSocket客户端
|
||||
import Tag from "@site/src/components/Tag.js";
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketHttpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Http.WebSockets <br/>
|
||||
程序集:[TouchSocket.Http.dll](https://www.nuget.org/packages/TouchSocket.Http)
|
||||
<TouchSocketHttpDefinition />
|
||||
|
||||
|
||||
## 一、可配置项
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ title: 产品及架构介绍
|
||||
---
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketHttpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Http.WebSockets <br/>
|
||||
程序集:[TouchSocket.Http.dll](https://www.nuget.org/packages/TouchSocket.Http)
|
||||
<TouchSocketHttpDefinition />
|
||||
|
||||
|
||||
## 产品介绍
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ title: Websocket心跳设置
|
||||
---
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketHttpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Http.WebSockets <br/>
|
||||
程序集:[TouchSocket.Http.dll](https://www.nuget.org/packages/TouchSocket.Http)
|
||||
<TouchSocketHttpDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -5,11 +5,12 @@ title: 创建WebSocket服务器
|
||||
|
||||
import CardLink from "@site/src/components/CardLink.js";
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketHttpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Http.WebSockets <br/>
|
||||
程序集:[TouchSocket.Http.dll](https://www.nuget.org/packages/TouchSocket.Http)
|
||||
<TouchSocketHttpDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ title: 快捷事务命令行
|
||||
---
|
||||
|
||||
import BilibiliCard from '@site/src/components/BilibiliCard.js';
|
||||
import { TouchSocketHttpDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Http.WebSockets <br/>
|
||||
程序集:[TouchSocket.Http.dll](https://www.nuget.org/packages/TouchSocket.Http)
|
||||
<TouchSocketHttpDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@ id: xmlrpc
|
||||
title: 产品及架构介绍
|
||||
---
|
||||
|
||||
import { TouchSocketXmlRpcDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.XmlRpc <br/>
|
||||
程序集:[TouchSocket.XmlRpc.dll](https://www.nuget.org/packages/TouchSocket.XmlRpc)
|
||||
<TouchSocketXmlRpcDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
46
handbook/scripts/debug-definition.js
Normal file
46
handbook/scripts/debug-definition.js
Normal file
@@ -0,0 +1,46 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// 精准匹配定义部分的正则表达式
|
||||
const definitionRegex = /### 定义\s*([\s\S]*?)(?=\n## |$)/;
|
||||
|
||||
// 解析定义部分内容
|
||||
function parseDefinition(definitionText) {
|
||||
const lines = definitionText.split('\n').map(line => line.trim()).filter(line => line);
|
||||
|
||||
let namespace = '';
|
||||
const assemblies = [];
|
||||
|
||||
for (const line of lines) {
|
||||
if (line.startsWith('命名空间:')) {
|
||||
namespace = line.replace('命名空间:', '').replace('<br/>', '').trim();
|
||||
} else if (line.startsWith('程序集:')) {
|
||||
// 解析程序集链接
|
||||
const assemblyMatch = line.match(/\[([^\]]+)\]/);
|
||||
if (assemblyMatch) {
|
||||
const assemblyName = assemblyMatch[1];
|
||||
const isPro = line.includes('<Pro/>');
|
||||
assemblies.push({ name: assemblyName, isPro });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return { namespace, assemblies };
|
||||
}
|
||||
|
||||
const filePath = 'd:/CodeOpen/TouchSocket/handbook/docs/dmtpclient.mdx';
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
|
||||
console.log('文件内容:');
|
||||
console.log(content.substring(0, 500));
|
||||
|
||||
const definitionMatch = content.match(definitionRegex);
|
||||
if (definitionMatch) {
|
||||
console.log('\n匹配到的定义部分:');
|
||||
console.log(definitionMatch[1]);
|
||||
|
||||
const result = parseDefinition(definitionMatch[1]);
|
||||
console.log('\n解析结果:', result);
|
||||
} else {
|
||||
console.log('\n未找到定义部分');
|
||||
}
|
||||
115
handbook/scripts/fix-definition-imports.js
Normal file
115
handbook/scripts/fix-definition-imports.js
Normal file
@@ -0,0 +1,115 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// 从 Definition.js 中提取预定义的程序集映射
|
||||
const definitionJsPath = path.join(__dirname, '..', 'src', 'components', 'Definition.js');
|
||||
const definitionJsContent = fs.readFileSync(definitionJsPath, 'utf8');
|
||||
|
||||
// 解析程序集到 type 的映射
|
||||
const assemblyToTypeMap = {};
|
||||
const typeDefRegex = /export const (\w+)Definition = \([^)]*\) =>\s*<Definition type="([^"]+)"/g;
|
||||
let match;
|
||||
while ((match = typeDefRegex.exec(definitionJsContent)) !== null) {
|
||||
const [, componentName, type] = match;
|
||||
assemblyToTypeMap[type] = componentName + 'Definition';
|
||||
}
|
||||
|
||||
// 递归查找所有 mdx 文件
|
||||
function findMdxFiles(dir) {
|
||||
const files = [];
|
||||
const items = fs.readdirSync(dir);
|
||||
|
||||
for (const item of items) {
|
||||
const fullPath = path.join(dir, item);
|
||||
const stat = fs.statSync(fullPath);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
files.push(...findMdxFiles(fullPath));
|
||||
} else if (item.endsWith('.mdx')) {
|
||||
files.push(fullPath);
|
||||
}
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
// 修复单个文件的导入
|
||||
function fixImportInFile(filePath) {
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
|
||||
// 查找文件中使用的 Definition 组件
|
||||
const usedComponents = new Set();
|
||||
const componentRegex = /<(\w+Definition)\s*\/>/g;
|
||||
let componentMatch;
|
||||
|
||||
while ((componentMatch = componentRegex.exec(content)) !== null) {
|
||||
usedComponents.add(componentMatch[1]);
|
||||
}
|
||||
|
||||
if (usedComponents.size === 0) {
|
||||
return { processed: false, reason: '没有使用Definition组件' };
|
||||
}
|
||||
|
||||
// 检查当前的导入语句
|
||||
const currentImportRegex = /import\s+(?:{\s*([^}]+)\s*}|(\w+))\s+from\s+["']@site\/src\/components\/Definition\.js["'];?/;
|
||||
const importMatch = content.match(currentImportRegex);
|
||||
|
||||
if (!importMatch) {
|
||||
return { processed: false, reason: '没有找到Definition导入语句' };
|
||||
}
|
||||
|
||||
const componentsArray = Array.from(usedComponents);
|
||||
const newImportStatement = `import { ${componentsArray.join(', ')} } from "@site/src/components/Definition.js";`;
|
||||
|
||||
// 替换导入语句
|
||||
const newContent = content.replace(currentImportRegex, newImportStatement);
|
||||
|
||||
// 写回文件
|
||||
fs.writeFileSync(filePath, newContent);
|
||||
|
||||
return {
|
||||
processed: true,
|
||||
components: componentsArray,
|
||||
oldImport: importMatch[0],
|
||||
newImport: newImportStatement
|
||||
};
|
||||
}
|
||||
|
||||
// 主函数
|
||||
function main() {
|
||||
const docsDir = path.join(__dirname, '..', 'docs');
|
||||
const versionedDocsDir = path.join(__dirname, '..', 'versioned_docs');
|
||||
|
||||
const allFiles = [
|
||||
...findMdxFiles(docsDir),
|
||||
...findMdxFiles(versionedDocsDir)
|
||||
];
|
||||
|
||||
console.log(`找到 ${allFiles.length} 个 mdx 文件`);
|
||||
|
||||
let processed = 0;
|
||||
let skipped = 0;
|
||||
|
||||
for (const file of allFiles) {
|
||||
const relativePath = path.relative(path.join(__dirname, '..'), file);
|
||||
const result = fixImportInFile(file);
|
||||
|
||||
if (result.processed) {
|
||||
processed++;
|
||||
console.log(`✓ ${relativePath}: ${result.components.join(', ')}`);
|
||||
} else {
|
||||
skipped++;
|
||||
// console.log(`- ${relativePath}: ${result.reason}`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`\n修复完成:`);
|
||||
console.log(`修复了 ${processed} 个文件`);
|
||||
console.log(`跳过了 ${skipped} 个文件`);
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
main();
|
||||
}
|
||||
|
||||
module.exports = { fixImportInFile };
|
||||
255
handbook/scripts/replace-definitions-precise.js
Normal file
255
handbook/scripts/replace-definitions-precise.js
Normal file
@@ -0,0 +1,255 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// 从 Definition.js 中提取预定义的程序集映射
|
||||
const definitionJsPath = path.join(__dirname, '..', 'src', 'components', 'Definition.js');
|
||||
const definitionJsContent = fs.readFileSync(definitionJsPath, 'utf8');
|
||||
|
||||
// 解析程序集到 type 的映射
|
||||
const assemblyToTypeMap = {};
|
||||
const typeDefRegex = /export const (\w+)Definition = \([^)]*\) =>\s*<Definition type="([^"]+)"/g;
|
||||
let match;
|
||||
while ((match = typeDefRegex.exec(definitionJsContent)) !== null) {
|
||||
const [, componentName, type] = match;
|
||||
assemblyToTypeMap[type] = componentName + 'Definition';
|
||||
}
|
||||
|
||||
console.log('解析到的程序集映射:', assemblyToTypeMap);
|
||||
|
||||
// 递归查找所有 mdx 文件
|
||||
function findMdxFiles(dir) {
|
||||
const files = [];
|
||||
const items = fs.readdirSync(dir);
|
||||
|
||||
for (const item of items) {
|
||||
const fullPath = path.join(dir, item);
|
||||
const stat = fs.statSync(fullPath);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
files.push(...findMdxFiles(fullPath));
|
||||
} else if (item.endsWith('.mdx')) {
|
||||
files.push(fullPath);
|
||||
}
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
// 精准匹配定义部分的正则表达式
|
||||
const definitionRegex = /### 定义\s*([\s\S]*?)(?=\n## |$)/;
|
||||
|
||||
// 解析定义部分内容
|
||||
function parseDefinition(definitionText) {
|
||||
const lines = definitionText.split('\n').map(line => line.trim()).filter(line => line);
|
||||
|
||||
let namespace = '';
|
||||
const assemblies = [];
|
||||
|
||||
for (const line of lines) {
|
||||
if (line.startsWith('命名空间:')) {
|
||||
namespace = line.replace('命名空间:', '').replace('<br/>', '').trim();
|
||||
} else if (line.startsWith('程序集:')) {
|
||||
// 解析程序集链接
|
||||
const assemblyMatch = line.match(/\[([^\]]+)\]/);
|
||||
if (assemblyMatch) {
|
||||
const assemblyName = assemblyMatch[1];
|
||||
const isPro = line.includes('<Pro/>');
|
||||
assemblies.push({ name: assemblyName, isPro });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return { namespace, assemblies };
|
||||
}
|
||||
|
||||
// 生成 Definition 组件
|
||||
function generateDefinitionComponent(namespace, assemblies) {
|
||||
// 将程序集名称转换为类型名称 (去掉.dll并转换格式)
|
||||
const assemblyTypes = assemblies.map(assembly => {
|
||||
const type = assembly.name.replace('.dll', '');
|
||||
// 去掉点,转换为驼峰式
|
||||
return type.replace(/\./g, '');
|
||||
});
|
||||
|
||||
// 检查是否有对应的预定义组件
|
||||
if (assemblies.length === 1) {
|
||||
// 单个程序集
|
||||
const type = assemblyTypes[0];
|
||||
if (assemblyToTypeMap[type]) {
|
||||
return `<${assemblyToTypeMap[type]} />`;
|
||||
}
|
||||
} else if (assemblies.length === 2) {
|
||||
// 双程序集组合,检查是否有 pro 版本的组合
|
||||
const regularAssembly = assemblies.find(a => !a.isPro);
|
||||
const proAssembly = assemblies.find(a => a.isPro);
|
||||
|
||||
if (regularAssembly && proAssembly) {
|
||||
const regularType = regularAssembly.name.replace('.dll', '').replace(/\./g, '');
|
||||
const proType = proAssembly.name.replace('.dll', '').replace(/\./g, '');
|
||||
|
||||
// 检查是否有 pro 版本的预定义组件
|
||||
if (assemblyToTypeMap[proType]) {
|
||||
return `<${assemblyToTypeMap[proType]} />`;
|
||||
}
|
||||
// 或者检查是否有常规版本的预定义组件
|
||||
else if (assemblyToTypeMap[regularType]) {
|
||||
return `<${assemblyToTypeMap[regularType]} />`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有找到预定义组件,使用自定义参数
|
||||
const props = [`namespace="${namespace}"`];
|
||||
|
||||
if (assemblies.length === 1) {
|
||||
props.push(`assembly="${assemblies[0].name}"`);
|
||||
if (assemblies[0].isPro) {
|
||||
props.push(`isPro={true}`);
|
||||
}
|
||||
} else {
|
||||
const assemblyNames = assemblies.map(a => a.name);
|
||||
props.push(`assemblies={${JSON.stringify(assemblyNames)}}`);
|
||||
|
||||
const proAssemblies = assemblies.filter(a => a.isPro).map(a => a.name);
|
||||
if (proAssemblies.length > 0) {
|
||||
props.push(`proAssemblies={${JSON.stringify(proAssemblies)}}`);
|
||||
}
|
||||
}
|
||||
|
||||
return `<Definition ${props.join(' ')} />`;
|
||||
}
|
||||
|
||||
// 处理单个文件
|
||||
function processFile(filePath) {
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
|
||||
// 检查是否包含定义部分
|
||||
const definitionMatch = content.match(definitionRegex);
|
||||
if (!definitionMatch) {
|
||||
return { processed: false, reason: '无定义部分' };
|
||||
}
|
||||
|
||||
const definitionText = definitionMatch[1];
|
||||
const { namespace, assemblies } = parseDefinition(definitionText);
|
||||
|
||||
if (!namespace || assemblies.length === 0) {
|
||||
return { processed: false, reason: '无法解析命名空间或程序集' };
|
||||
}
|
||||
|
||||
// 生成 Definition 组件
|
||||
const definitionComponent = generateDefinitionComponent(namespace, assemblies);
|
||||
|
||||
// 检查是否需要添加 import
|
||||
let newContent = content;
|
||||
|
||||
// 确定需要导入的组件名称
|
||||
const componentName = definitionComponent.match(/<(\w+)/)[1];
|
||||
const hasCorrectImport = content.includes(`import { ${componentName} }`) ||
|
||||
content.includes(`import {${componentName}}`) ||
|
||||
(content.includes(`import { `) && content.includes(`${componentName}`));
|
||||
|
||||
if (!hasCorrectImport) {
|
||||
// 检查是否已经有 Definition 相关的导入
|
||||
const existingImportRegex = /import\s+(?:{\s*([^}]+)\s*}|(\w+))\s+from\s+["']@site\/src\/components\/Definition\.js["'];?/;
|
||||
const existingImportMatch = content.match(existingImportRegex);
|
||||
|
||||
if (existingImportMatch) {
|
||||
// 替换现有的导入
|
||||
const newImportLine = `import { ${componentName} } from "@site/src/components/Definition.js";`;
|
||||
newContent = content.replace(existingImportRegex, newImportLine);
|
||||
} else {
|
||||
// 添加新的导入
|
||||
const importLine = `import { ${componentName} } from "@site/src/components/Definition.js";`;
|
||||
|
||||
// 查找现有的 import 语句
|
||||
const importMatches = content.match(/import .* from .*;/g) || [];
|
||||
|
||||
if (importMatches.length > 0) {
|
||||
// 找到最后一个 import 语句的位置
|
||||
const lastImport = importMatches[importMatches.length - 1];
|
||||
const lastImportIndex = content.indexOf(lastImport);
|
||||
const afterLastImport = lastImportIndex + lastImport.length;
|
||||
newContent = content.slice(0, afterLastImport) + '\n' + importLine + content.slice(afterLastImport);
|
||||
} else {
|
||||
// 在文件开头添加 import(在 frontmatter 之后)
|
||||
const frontmatterMatch = content.match(/^---[\s\S]*?---/);
|
||||
if (frontmatterMatch) {
|
||||
const frontmatterEnd = frontmatterMatch.index + frontmatterMatch[0].length;
|
||||
newContent = content.slice(0, frontmatterEnd) + '\n\n' + importLine + content.slice(frontmatterEnd);
|
||||
} else {
|
||||
newContent = importLine + '\n\n' + content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 替换定义部分
|
||||
const newDefinitionSection = `### 定义\n\n${definitionComponent}\n\n`;
|
||||
newContent = newContent.replace(definitionRegex, newDefinitionSection);
|
||||
|
||||
// 写回文件
|
||||
fs.writeFileSync(filePath, newContent);
|
||||
|
||||
return {
|
||||
processed: true,
|
||||
namespace,
|
||||
assemblies: assemblies.map(a => a.name),
|
||||
component: definitionComponent
|
||||
};
|
||||
}
|
||||
|
||||
// 主函数
|
||||
function main() {
|
||||
const docsDir = path.join(__dirname, '..', 'docs');
|
||||
const versionedDocsDir = path.join(__dirname, '..', 'versioned_docs');
|
||||
|
||||
const allFiles = [
|
||||
...findMdxFiles(docsDir),
|
||||
...findMdxFiles(versionedDocsDir)
|
||||
];
|
||||
|
||||
console.log(`找到 ${allFiles.length} 个 mdx 文件`);
|
||||
|
||||
let processed = 0;
|
||||
let skipped = 0;
|
||||
const results = [];
|
||||
|
||||
for (const file of allFiles) {
|
||||
const relativePath = path.relative(path.join(__dirname, '..'), file);
|
||||
const result = processFile(file);
|
||||
|
||||
if (result.processed) {
|
||||
processed++;
|
||||
console.log(`✓ ${relativePath}: ${result.component}`);
|
||||
results.push({ file: relativePath, ...result });
|
||||
} else {
|
||||
skipped++;
|
||||
console.log(`- ${relativePath}: ${result.reason}`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`\n处理完成:`);
|
||||
console.log(`处理了 ${processed} 个文件`);
|
||||
console.log(`跳过了 ${skipped} 个文件`);
|
||||
|
||||
// 输出统计信息
|
||||
const typeStats = {};
|
||||
results.forEach(result => {
|
||||
const key = result.assemblies.join(',');
|
||||
if (!typeStats[key]) {
|
||||
typeStats[key] = 0;
|
||||
}
|
||||
typeStats[key]++;
|
||||
});
|
||||
|
||||
console.log('\n程序集统计:');
|
||||
Object.entries(typeStats).forEach(([assemblies, count]) => {
|
||||
console.log(` ${assemblies}: ${count} 个文件`);
|
||||
});
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
main();
|
||||
}
|
||||
|
||||
module.exports = { processFile, parseDefinition, generateDefinitionComponent };
|
||||
62
handbook/scripts/test-precise-detailed.js
Normal file
62
handbook/scripts/test-precise-detailed.js
Normal file
@@ -0,0 +1,62 @@
|
||||
const { parseDefinition, generateDefinitionComponent } = require('./replace-definitions-precise.js');
|
||||
|
||||
// 测试不同的程序集组合
|
||||
const testCases = [
|
||||
{
|
||||
name: 'TouchSocket.Dmtp + TouchSocketPro.Dmtp',
|
||||
text: `
|
||||
命名空间:TouchSocket.Dmtp
|
||||
程序集:[TouchSocket.Dmtp.dll](https://www.nuget.org/packages/TouchSocket.Dmtp)
|
||||
程序集:[TouchSocketPro.Dmtp.dll](https://www.nuget.org/packages/TouchSocketPro.Dmtp) <Pro/>
|
||||
`
|
||||
},
|
||||
{
|
||||
name: '单个 TouchSocket.Dmtp',
|
||||
text: `
|
||||
命名空间:TouchSocket.Dmtp
|
||||
程序集:[TouchSocket.Dmtp.dll](https://www.nuget.org/packages/TouchSocket.Dmtp)
|
||||
`
|
||||
},
|
||||
{
|
||||
name: '单个 TouchSocketPro.Dmtp',
|
||||
text: `
|
||||
命名空间:TouchSocket.Dmtp
|
||||
程序集:[TouchSocketPro.Dmtp.dll](https://www.nuget.org/packages/TouchSocketPro.Dmtp) <Pro/>
|
||||
`
|
||||
}
|
||||
];
|
||||
|
||||
testCases.forEach(testCase => {
|
||||
console.log(`\n=== ${testCase.name} ===`);
|
||||
const result = parseDefinition(testCase.text);
|
||||
console.log('解析结果:', result);
|
||||
|
||||
const component = generateDefinitionComponent(result.namespace, result.assemblies);
|
||||
console.log('生成的组件:', component);
|
||||
|
||||
// 检查程序集类型
|
||||
const assemblyTypes = result.assemblies.map(a => a.name.replace('.dll', ''));
|
||||
console.log('程序集类型:', assemblyTypes);
|
||||
|
||||
// 检查是否有对应的预定义组件
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const definitionJsPath = path.join(__dirname, '..', 'src', 'components', 'Definition.js');
|
||||
const definitionJsContent = fs.readFileSync(definitionJsPath, 'utf8');
|
||||
|
||||
const assemblyToTypeMap = {};
|
||||
const typeDefRegex = /export const (\w+)Definition = \([^)]*\) =>\s*<Definition type="([^"]+)"/g;
|
||||
let match;
|
||||
while ((match = typeDefRegex.exec(definitionJsContent)) !== null) {
|
||||
const [, componentName, type] = match;
|
||||
assemblyToTypeMap[type] = componentName + 'Definition';
|
||||
}
|
||||
|
||||
assemblyTypes.forEach(type => {
|
||||
if (assemblyToTypeMap[type]) {
|
||||
console.log(` ${type} -> ${assemblyToTypeMap[type]}`);
|
||||
} else {
|
||||
console.log(` ${type} -> 无预定义组件`);
|
||||
}
|
||||
});
|
||||
});
|
||||
16
handbook/scripts/test-precise.js
Normal file
16
handbook/scripts/test-precise.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const { parseDefinition, generateDefinitionComponent } = require('./replace-definitions-precise.js');
|
||||
|
||||
const definitionText = `
|
||||
命名空间:TouchSocket.Dmtp
|
||||
程序集:[TouchSocket.Dmtp.dll](https://www.nuget.org/packages/TouchSocket.Dmtp)
|
||||
程序集:[TouchSocketPro.Dmtp.dll](https://www.nuget.org/packages/TouchSocketPro.Dmtp) <Pro/>
|
||||
`;
|
||||
|
||||
console.log('原始定义文本:');
|
||||
console.log(definitionText);
|
||||
|
||||
const result = parseDefinition(definitionText);
|
||||
console.log('\n解析结果:', result);
|
||||
|
||||
const component = generateDefinitionComponent(result.namespace, result.assemblies);
|
||||
console.log('\n生成的组件:', component);
|
||||
6
handbook/scripts/test-single-file.js
Normal file
6
handbook/scripts/test-single-file.js
Normal file
@@ -0,0 +1,6 @@
|
||||
const { processFile } = require('./replace-definitions-precise.js');
|
||||
|
||||
const filePath = 'd:/CodeOpen/TouchSocket/handbook/docs/dmtpclient.mdx';
|
||||
const result = processFile(filePath);
|
||||
|
||||
console.log('处理结果:', result);
|
||||
131
handbook/scripts/validate-imports.js
Normal file
131
handbook/scripts/validate-imports.js
Normal file
@@ -0,0 +1,131 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// 递归查找所有 mdx 文件
|
||||
function findMdxFiles(dir) {
|
||||
const files = [];
|
||||
const items = fs.readdirSync(dir);
|
||||
|
||||
for (const item of items) {
|
||||
const fullPath = path.join(dir, item);
|
||||
const stat = fs.statSync(fullPath);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
files.push(...findMdxFiles(fullPath));
|
||||
} else if (item.endsWith('.mdx')) {
|
||||
files.push(fullPath);
|
||||
}
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
// 验证单个文件的导入
|
||||
function validateFile(filePath) {
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
|
||||
// 查找文件中使用的 Definition 组件
|
||||
const usedComponents = new Set();
|
||||
const componentRegex = /<(\w+Definition)\s*\/>/g;
|
||||
let componentMatch;
|
||||
|
||||
while ((componentMatch = componentRegex.exec(content)) !== null) {
|
||||
usedComponents.add(componentMatch[1]);
|
||||
}
|
||||
|
||||
if (usedComponents.size === 0) {
|
||||
return { valid: true, reason: '没有使用Definition组件' };
|
||||
}
|
||||
|
||||
// 检查导入语句
|
||||
const importRegex = /import\s+{\s*([^}]+)\s*}\s+from\s+["']@site\/src\/components\/Definition\.js["'];?/;
|
||||
const importMatch = content.match(importRegex);
|
||||
|
||||
if (!importMatch) {
|
||||
return {
|
||||
valid: false,
|
||||
reason: '缺少Definition导入语句',
|
||||
usedComponents: Array.from(usedComponents)
|
||||
};
|
||||
}
|
||||
|
||||
// 解析导入的组件
|
||||
const importedComponents = importMatch[1].split(',').map(c => c.trim());
|
||||
const missingComponents = Array.from(usedComponents).filter(c => !importedComponents.includes(c));
|
||||
const unusedComponents = importedComponents.filter(c => !usedComponents.has(c));
|
||||
|
||||
if (missingComponents.length > 0 || unusedComponents.length > 0) {
|
||||
return {
|
||||
valid: false,
|
||||
reason: '导入和使用不匹配',
|
||||
missingComponents,
|
||||
unusedComponents,
|
||||
usedComponents: Array.from(usedComponents),
|
||||
importedComponents
|
||||
};
|
||||
}
|
||||
|
||||
return { valid: true, components: Array.from(usedComponents) };
|
||||
}
|
||||
|
||||
// 主函数
|
||||
function main() {
|
||||
const docsDir = path.join(__dirname, '..', 'docs');
|
||||
const versionedDocsDir = path.join(__dirname, '..', 'versioned_docs');
|
||||
|
||||
const allFiles = [
|
||||
...findMdxFiles(docsDir),
|
||||
...findMdxFiles(versionedDocsDir)
|
||||
];
|
||||
|
||||
console.log(`验证 ${allFiles.length} 个 mdx 文件`);
|
||||
|
||||
let validFiles = 0;
|
||||
let invalidFiles = 0;
|
||||
const errors = [];
|
||||
|
||||
for (const file of allFiles) {
|
||||
const relativePath = path.relative(path.join(__dirname, '..'), file);
|
||||
const result = validateFile(file);
|
||||
|
||||
if (result.valid) {
|
||||
validFiles++;
|
||||
if (result.components) {
|
||||
console.log(`✓ ${relativePath}: ${result.components.join(', ')}`);
|
||||
}
|
||||
} else {
|
||||
invalidFiles++;
|
||||
console.log(`✗ ${relativePath}: ${result.reason}`);
|
||||
if (result.missingComponents?.length > 0) {
|
||||
console.log(` 缺少导入: ${result.missingComponents.join(', ')}`);
|
||||
}
|
||||
if (result.unusedComponents?.length > 0) {
|
||||
console.log(` 多余导入: ${result.unusedComponents.join(', ')}`);
|
||||
}
|
||||
if (result.usedComponents?.length > 0) {
|
||||
console.log(` 使用的组件: ${result.usedComponents.join(', ')}`);
|
||||
}
|
||||
if (result.importedComponents?.length > 0) {
|
||||
console.log(` 导入的组件: ${result.importedComponents.join(', ')}`);
|
||||
}
|
||||
errors.push({ file: relativePath, ...result });
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`\n验证完成:`);
|
||||
console.log(`✓ 有效文件:${validFiles}`);
|
||||
console.log(`✗ 无效文件:${invalidFiles}`);
|
||||
|
||||
if (errors.length > 0) {
|
||||
console.log('\n错误详情:');
|
||||
errors.forEach(error => {
|
||||
console.log(`- ${error.file}: ${error.reason}`);
|
||||
});
|
||||
} else {
|
||||
console.log('\n🎉 所有文件的导入都正确!');
|
||||
}
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
main();
|
||||
}
|
||||
0
handbook/scripts/verify-definition-imports.js
Normal file
0
handbook/scripts/verify-definition-imports.js
Normal file
@@ -3,10 +3,12 @@ id: adapterbuilder
|
||||
title: 适配器消息构建器
|
||||
---
|
||||
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@ id: adapterdescription
|
||||
title: 介绍及使用
|
||||
---
|
||||
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@ id: adaptererrorcorrection
|
||||
title: 适配器纠错
|
||||
---
|
||||
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@ id: appmessenger
|
||||
title: 应用信使
|
||||
---
|
||||
|
||||
import { TouchSocketCoreDefinition } from "@site/src/components/Definition.js";
|
||||
|
||||
### 定义
|
||||
|
||||
命名空间:TouchSocket.Core <br/>
|
||||
程序集:[TouchSocket.Core.dll](https://www.nuget.org/packages/TouchSocket.Core)
|
||||
<TouchSocketCoreDefinition />
|
||||
|
||||
|
||||
## 一、说明
|
||||
应用信使是在进程内的,行使注册和触发功能的组件。可**代替事件**,可**跨越程序集**,可**依赖倒置**。
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user