'commit'
This commit is contained in:
@@ -1,4 +1,17 @@
|
||||
# coding=utf-8
|
||||
"""
|
||||
T2_Identify.py - 视觉识别系统测试 (Vision System Test)
|
||||
|
||||
【核心功能】
|
||||
- 静态分析:仅截图并分析,不进行任何点击操作。
|
||||
- 视觉验证:测试 OCR 识别准确率、发送者判定 (颜色/几何)、消息类型分类。
|
||||
- 调试工具:生成详细的检测日志和标记框图片 (T2_Identify_Debug.jpg)。
|
||||
|
||||
【使用场景】
|
||||
- 当发现机器人“看不见”某条消息时。
|
||||
- 当机器人把“对方”的消息误认为是“我”的消息时。
|
||||
- 调整 OCR 阈值或几何判定规则后的快速验证。
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
# coding=utf-8
|
||||
"""
|
||||
T3_Voice.py - 语音交互流程测试 (Voice Interaction Test)
|
||||
|
||||
【核心功能】
|
||||
- 动态交互:执行“截图 -> 识别语音 -> 点击转文字 -> 再次截图 -> 提取内容”的完整闭环。
|
||||
- 动作验证:测试长按操作、菜单识别、转文字等待逻辑。
|
||||
- 异步逻辑:验证异步 OCR 任务是否能正确捕获转文字后的内容。
|
||||
|
||||
【使用场景】
|
||||
- 验证微信版本更新后“转文字”按钮位置是否变化。
|
||||
- 调试语音消息“点不开”或“转完没内容”的问题。
|
||||
- 测试语音转文字的防死循环机制。
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
|
||||
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"ExpandedNodes": [
|
||||
""
|
||||
],
|
||||
"SelectedNode": "\\WordAddIn.sln",
|
||||
"PreviewInSolutionExplorer": false
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,85 +0,0 @@
|
||||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "D:\\dsWork\\aiData\\WordAddIn\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}|WordAddIn\\WordAddIn.csproj|d:\\dswork\\aidata\\wordaddin\\wordaddin\\outlineresultform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
|
||||
"RelativeMoniker": "D:0:0:{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}|WordAddIn\\WordAddIn.csproj|solutionrelative:wordaddin\\outlineresultform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}|WordAddIn\\WordAddIn.csproj|D:\\dsWork\\aiData\\WordAddIn\\wordaddin\\loginform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
|
||||
"RelativeMoniker": "D:0:0:{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}|WordAddIn\\WordAddIn.csproj|solutionrelative:wordaddin\\loginform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}|WordAddIn\\WordAddIn.csproj|D:\\dsWork\\aiData\\WordAddIn\\wordaddin\\imageoptionsform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
|
||||
"RelativeMoniker": "D:0:0:{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}|WordAddIn\\WordAddIn.csproj|solutionrelative:wordaddin\\imageoptionsform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}|WordAddIn\\WordAddIn.csproj|D:\\dsWork\\aiData\\WordAddIn\\wordaddin\\createoutlineform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
|
||||
"RelativeMoniker": "D:0:0:{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}|WordAddIn\\WordAddIn.csproj|solutionrelative:wordaddin\\createoutlineform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 1,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{3ae79031-e1bc-11d0-8f78-00a0c9110057}"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "OutlineResultForm.cs [\u8BBE\u8BA1]",
|
||||
"DocumentMoniker": "D:\\dsWork\\aiData\\WordAddIn\\WordAddIn\\OutlineResultForm.cs",
|
||||
"RelativeDocumentMoniker": "WordAddIn\\OutlineResultForm.cs",
|
||||
"ToolTip": "D:\\dsWork\\aiData\\WordAddIn\\WordAddIn\\OutlineResultForm.cs [\u8BBE\u8BA1]",
|
||||
"RelativeToolTip": "WordAddIn\\OutlineResultForm.cs [\u8BBE\u8BA1]",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2026-01-28T23:14:29.889Z",
|
||||
"EditorCaption": " [\u8BBE\u8BA1]"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "LoginForm.cs [\u8BBE\u8BA1]",
|
||||
"DocumentMoniker": "D:\\dsWork\\aiData\\WordAddIn\\WordAddIn\\LoginForm.cs",
|
||||
"RelativeDocumentMoniker": "WordAddIn\\LoginForm.cs",
|
||||
"ToolTip": "D:\\dsWork\\aiData\\WordAddIn\\WordAddIn\\LoginForm.cs [\u8BBE\u8BA1]",
|
||||
"RelativeToolTip": "WordAddIn\\LoginForm.cs [\u8BBE\u8BA1]",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2026-01-28T23:14:26.027Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "ImageOptionsForm.cs [\u8BBE\u8BA1]",
|
||||
"DocumentMoniker": "D:\\dsWork\\aiData\\WordAddIn\\WordAddIn\\ImageOptionsForm.cs",
|
||||
"RelativeDocumentMoniker": "WordAddIn\\ImageOptionsForm.cs",
|
||||
"ToolTip": "D:\\dsWork\\aiData\\WordAddIn\\WordAddIn\\ImageOptionsForm.cs [\u8BBE\u8BA1]",
|
||||
"RelativeToolTip": "WordAddIn\\ImageOptionsForm.cs [\u8BBE\u8BA1]",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2026-01-28T23:14:18.293Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"Title": "CreateOutlineForm.cs [\u8BBE\u8BA1]",
|
||||
"DocumentMoniker": "D:\\dsWork\\aiData\\WordAddIn\\WordAddIn\\CreateOutlineForm.cs",
|
||||
"RelativeDocumentMoniker": "WordAddIn\\CreateOutlineForm.cs",
|
||||
"ToolTip": "D:\\dsWork\\aiData\\WordAddIn\\WordAddIn\\CreateOutlineForm.cs [\u8BBE\u8BA1]",
|
||||
"RelativeToolTip": "WordAddIn\\CreateOutlineForm.cs [\u8BBE\u8BA1]",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2026-01-28T23:14:17.315Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "D:\\dsWork\\aiData\\WordAddIn\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}|WordAddIn\\WordAddIn.csproj|d:\\dswork\\aidata\\wordaddin\\wordaddin\\outlineresultform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
|
||||
"RelativeMoniker": "D:0:0:{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}|WordAddIn\\WordAddIn.csproj|solutionrelative:wordaddin\\outlineresultform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}|WordAddIn\\WordAddIn.csproj|D:\\dsWork\\aiData\\WordAddIn\\wordaddin\\loginform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
|
||||
"RelativeMoniker": "D:0:0:{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}|WordAddIn\\WordAddIn.csproj|solutionrelative:wordaddin\\loginform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}|WordAddIn\\WordAddIn.csproj|D:\\dsWork\\aiData\\WordAddIn\\wordaddin\\imageoptionsform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
|
||||
"RelativeMoniker": "D:0:0:{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}|WordAddIn\\WordAddIn.csproj|solutionrelative:wordaddin\\imageoptionsform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}|WordAddIn\\WordAddIn.csproj|D:\\dsWork\\aiData\\WordAddIn\\wordaddin\\createoutlineform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
|
||||
"RelativeMoniker": "D:0:0:{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}|WordAddIn\\WordAddIn.csproj|solutionrelative:wordaddin\\createoutlineform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 1,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{3ae79031-e1bc-11d0-8f78-00a0c9110057}"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "OutlineResultForm.cs [\u8BBE\u8BA1]",
|
||||
"DocumentMoniker": "D:\\dsWork\\aiData\\WordAddIn\\WordAddIn\\OutlineResultForm.cs",
|
||||
"RelativeDocumentMoniker": "WordAddIn\\OutlineResultForm.cs",
|
||||
"ToolTip": "D:\\dsWork\\aiData\\WordAddIn\\WordAddIn\\OutlineResultForm.cs [\u8BBE\u8BA1]",
|
||||
"RelativeToolTip": "WordAddIn\\OutlineResultForm.cs [\u8BBE\u8BA1]",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2026-01-28T23:14:29.889Z",
|
||||
"EditorCaption": " [\u8BBE\u8BA1]"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "LoginForm.cs [\u8BBE\u8BA1]",
|
||||
"DocumentMoniker": "D:\\dsWork\\aiData\\WordAddIn\\WordAddIn\\LoginForm.cs",
|
||||
"RelativeDocumentMoniker": "WordAddIn\\LoginForm.cs",
|
||||
"ToolTip": "D:\\dsWork\\aiData\\WordAddIn\\WordAddIn\\LoginForm.cs [\u8BBE\u8BA1]",
|
||||
"RelativeToolTip": "WordAddIn\\LoginForm.cs [\u8BBE\u8BA1]",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2026-01-28T23:14:26.027Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "ImageOptionsForm.cs [\u8BBE\u8BA1]",
|
||||
"DocumentMoniker": "D:\\dsWork\\aiData\\WordAddIn\\WordAddIn\\ImageOptionsForm.cs",
|
||||
"RelativeDocumentMoniker": "WordAddIn\\ImageOptionsForm.cs",
|
||||
"ToolTip": "D:\\dsWork\\aiData\\WordAddIn\\WordAddIn\\ImageOptionsForm.cs [\u8BBE\u8BA1]",
|
||||
"RelativeToolTip": "WordAddIn\\ImageOptionsForm.cs [\u8BBE\u8BA1]",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2026-01-28T23:14:18.293Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"Title": "CreateOutlineForm.cs [\u8BBE\u8BA1]",
|
||||
"DocumentMoniker": "D:\\dsWork\\aiData\\WordAddIn\\WordAddIn\\CreateOutlineForm.cs",
|
||||
"RelativeDocumentMoniker": "WordAddIn\\CreateOutlineForm.cs",
|
||||
"ToolTip": "D:\\dsWork\\aiData\\WordAddIn\\WordAddIn\\CreateOutlineForm.cs [\u8BBE\u8BA1]",
|
||||
"RelativeToolTip": "WordAddIn\\CreateOutlineForm.cs [\u8BBE\u8BA1]",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2026-01-28T23:14:17.315Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
@@ -1,78 +0,0 @@
|
||||
`Visual Studio 2022 Professional
|
||||
下载地址:`visualstudio.microsoft.com`
|
||||
安装器里务必勾选:
|
||||
|
||||
- 工作负载 → “.NET 桌面开发”
|
||||
- 工作负载 → “Office/SharePoint 开发”
|
||||
这两项会把 VSTO 项目模板、Office PIA(主互操作程序集)和调试工具一次装全
|
||||
|
||||
|
||||
|
||||
- Visual Studio 2022 Professional序列号:
|
||||
|
||||
```
|
||||
TD244-P4NB7-YQ6XK-Y8MMM-YWV2J
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
验证步骤
|
||||
|
||||
1. 新建项目 → 语言选 C# → 搜索“VSTO”,能看到“Word 外接程序 (.NET Framework)”模板即成功 。
|
||||
2. 直接 F5,Word 启动并在“加载项”页出现默认 Ribbon,说明调试环境就绪。
|
||||
|
||||
打包命令
|
||||
msbuild WordAddIn.csproj /t:Publish /p:Configuration=Release
|
||||
|
||||
|
||||
恭喜!既然程序已经开发完善,接下来就是激动人心的发布环节了。
|
||||
|
||||
要让其他人使用您的 Word 插件,最标准的方法是使用 Visual Studio 的**发布(Publish)**功能。这会生成一个安装程序( setup.exe ),用户只需双击即可自动配置环境并安装插件。
|
||||
|
||||
以下是详细的操作步骤:
|
||||
|
||||
### 第一步:准备发布信息
|
||||
建议先完善一下软件的“身份信息”,这样安装界面会显得更专业:
|
||||
|
||||
1. 在 Visual Studio 右侧的 解决方案资源管理器 中,右键点击项目 WordAddIn ,选择 属性 (Properties) 。
|
||||
2. 切换到 发布 (Publish) 选项卡。
|
||||
3. 点击 选项 (Options) 按钮。
|
||||
- 描述 (Description) :填写“发布者名称”(您的名字)和“产品名称”(如:AI 写作助手)。
|
||||
- Office 设置 :保持默认即可。
|
||||
4. 点击确定保存。
|
||||
### 第二步:执行发布
|
||||
1. 依然在 发布 (Publish) 选项卡页面。
|
||||
2. 发布位置 :默认会发布到项目目录下的 publish\ 文件夹,或者您可以点击“浏览”选择一个桌面上的文件夹(例如 D:\Desktop\AIWordAddIn_Setup\ ),方便查找。
|
||||
3. 点击页面底部的 立即发布 (Publish Now) 按钮。
|
||||
4. Visual Studio 会开始编译并打包,成功后会自动打开生成的文件夹。
|
||||
### 第三步:如何分享给他人
|
||||
打开发布生成的文件夹,您会看到以下文件:
|
||||
|
||||
- 📂 Application Files (文件夹)
|
||||
- 📄 setup.exe (安装程序)
|
||||
- 📄 WordAddIn.vsto (部署清单)
|
||||
分享方法 :
|
||||
请将这个 文件夹内的所有内容 (包括文件夹和两个文件)一起打包压缩(例如 AI助手安装包.zip ),发送给您的朋友或用户。
|
||||
|
||||
### 第四步:对方如何安装(关键!)
|
||||
由于我们使用的是开发用的“临时证书”(自签名证书),并没有购买昂贵的商业数字证书,所以对方在安装时,Windows 会提示“发布者不可信”并拦截安装。
|
||||
|
||||
请务必告诉您的朋友按以下步骤操作(只需做一次):
|
||||
|
||||
1. 解压 您发的压缩包。
|
||||
2. 安装证书 (解决信任问题):
|
||||
- 在文件夹中找到 WordAddIn.vsto 文件(或者是 WordAddIn_TemporaryKey.pfx ,如果在发布包里没包含 pfx,您可能需要单独发给他,或者指导他信任 setup.exe )。
|
||||
- 更简单的测试方法 :通常直接运行 setup.exe ,如果报错说“证书不受信任”,则需要手动将证书添加到信任列表。
|
||||
- 最稳妥的个人分发方式 :
|
||||
1. 在您的电脑上,右键点击项目中的 WordAddIn_TemporaryKey.pfx -> 安装 PFX 。
|
||||
2. 或者,让朋友在安装出错时,点击错误详情,选择“安装证书” -> 存储位置选 “受信任的根证书颁发机构” 。
|
||||
如果觉得证书麻烦: 如果只是发给非常信任的朋友,且不想折腾证书,可以让他们:
|
||||
|
||||
1. 运行 setup.exe 。
|
||||
2. 如果弹出红色警告,点击“详细信息”,查看是否允许“仍要运行”或“安装”。
|
||||
### 总结
|
||||
1. 右键项目 -> 发布 -> 立即发布 。
|
||||
2. 把生成的文件夹打包发给别人。
|
||||
3. 让对方运行 setup.exe 即可(注意解决证书信任警告)。
|
||||
快去试试打包,把您的作品分享给第一个用户吧!
|
||||
@@ -1,13 +0,0 @@
|
||||
@echo off
|
||||
echo ==========================================
|
||||
echo Switching to WPS Office Mode
|
||||
echo ==========================================
|
||||
echo.
|
||||
if exist "%~dp0WpsInstaller\bin\Debug\WpsInstaller.exe" (
|
||||
"%~dp0WpsInstaller\bin\Debug\WpsInstaller.exe" wps
|
||||
) else (
|
||||
echo Error: WpsInstaller.exe not found.
|
||||
echo Please build the solution first.
|
||||
)
|
||||
echo.
|
||||
pause
|
||||
@@ -1,13 +0,0 @@
|
||||
@echo off
|
||||
echo ==========================================
|
||||
echo Switching to MS Word Mode (VSTO)
|
||||
echo ==========================================
|
||||
echo.
|
||||
if exist "%~dp0WpsInstaller\bin\Debug\WpsInstaller.exe" (
|
||||
"%~dp0WpsInstaller\bin\Debug\WpsInstaller.exe" word
|
||||
) else (
|
||||
echo Error: WpsInstaller.exe not found.
|
||||
echo Please build the solution first.
|
||||
)
|
||||
echo.
|
||||
pause
|
||||
@@ -1,51 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36915.13
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WordAddIn", "WordAddIn\WordAddIn.csproj", "{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpsInstaller", "WpsInstaller\WpsInstaller.csproj", "{A1B2C3D4-E5F6-4789-0011-223344556677}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}.Release|x64.Build.0 = Release|Any CPU
|
||||
{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}.Release|x86.Build.0 = Release|Any CPU
|
||||
{A1B2C3D4-E5F6-4789-0011-223344556677}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A1B2C3D4-E5F6-4789-0011-223344556677}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A1B2C3D4-E5F6-4789-0011-223344556677}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{A1B2C3D4-E5F6-4789-0011-223344556677}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{A1B2C3D4-E5F6-4789-0011-223344556677}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{A1B2C3D4-E5F6-4789-0011-223344556677}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{A1B2C3D4-E5F6-4789-0011-223344556677}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A1B2C3D4-E5F6-4789-0011-223344556677}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A1B2C3D4-E5F6-4789-0011-223344556677}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{A1B2C3D4-E5F6-4789-0011-223344556677}.Release|x64.Build.0 = Release|Any CPU
|
||||
{A1B2C3D4-E5F6-4789-0011-223344556677}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{A1B2C3D4-E5F6-4789-0011-223344556677}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {AA8EFE82-D53C-4781-B63A-98CE9009C192}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
File diff suppressed because one or more lines are too long
@@ -1,49 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Word = Microsoft.Office.Interop.Word;
|
||||
|
||||
namespace WordAddIn
|
||||
{
|
||||
/// <summary>
|
||||
/// 全局上下文,用于存储当前 Word 应用程序实例。
|
||||
/// 兼容 VSTO (Office) 和 COM Add-in (WPS)。
|
||||
/// </summary>
|
||||
public static class AddInContext
|
||||
{
|
||||
private static Word.Application _application;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置当前的 Word 应用程序实例。
|
||||
/// </summary>
|
||||
public static Word.Application CurrentApplication
|
||||
{
|
||||
get
|
||||
{
|
||||
// 如果尚未设置(例如在非 VSTO 环境下且未初始化),尝试回退到 Globals(仅限 VSTO)
|
||||
if (_application == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 注意:如果不在 VSTO 环境下,访问 Globals.ThisAddIn 可能会抛出异常或返回 null
|
||||
if (Globals.ThisAddIn != null)
|
||||
{
|
||||
_application = Globals.ThisAddIn.Application;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 忽略异常,说明可能不是 VSTO 环境
|
||||
}
|
||||
}
|
||||
return _application;
|
||||
}
|
||||
set
|
||||
{
|
||||
_application = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,37 +0,0 @@
|
||||
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
|
||||
<ribbon>
|
||||
<tabs>
|
||||
<tab id="tabAiAssistant" label="AI助手">
|
||||
<group id="groupUser" label="用户">
|
||||
<button id="btnLogin" label="登录" size="large" onAction="OnLoginClick" imageMso="Lock" />
|
||||
</group>
|
||||
<group id="groupContent" label="内容创作">
|
||||
<button id="btnCreateOutline" label="创建大纲" size="large" onAction="OnCreateOutlineClick" getEnabled="GetControlEnabled" imageMso="ViewOutlineView" />
|
||||
<button id="btnReadFull" label="通读全文" size="large" onAction="OnReadFullClick" getEnabled="GetControlEnabled" imageMso="FindDialog" />
|
||||
<button id="btnSummarizeOutline" label="总结大纲" size="large" onAction="OnSummarizeOutlineClick" getEnabled="GetControlEnabled" imageMso="GroupSmartArtQuickStyles" />
|
||||
<button id="btnImportReference" label="补充背景" size="large" onAction="OnImportReferenceClick" getEnabled="GetControlEnabled" imageMso="ImportTextFile" />
|
||||
<button id="btnReferenceGenerate" label="素材写作" size="large" onAction="OnReferenceGenerateClick" getEnabled="GetControlEnabled" imageMso="ReviewCompareTwoVersions" />
|
||||
<button id="btnPolish" label="润色加工" size="large" onAction="OnPolishClick" getEnabled="GetControlEnabled" imageMso="Spelling" />
|
||||
<button id="btnElevate" label="深度升华" size="large" onAction="OnElevateClick" getEnabled="GetControlEnabled" imageMso="SmartArtInsert" />
|
||||
<button id="btnFormat" label="格式美化" imageMso="FontColorCycle" size="large" onAction="OnFormatClick" getEnabled="GetControlEnabled" />
|
||||
<button id="btnImage" label="生成配图" size="large" onAction="OnImageClick" getEnabled="GetControlEnabled" imageMso="PictureInsertFromFile" />
|
||||
</group>
|
||||
<group id="grpStyleWorkspace" label="样式工作区">
|
||||
<toggleButton id="tbtnStyleMainTitle" label="主标题" size="large" onAction="OnStyleBrushToggle" getPressed="GetStyleBrushPressed" getEnabled="GetControlEnabled" imageMso="ShapeStar" />
|
||||
<toggleButton id="tbtnStyleLevel1" label="一级样式" size="large" onAction="OnStyleBrushToggle" getPressed="GetStyleBrushPressed" getEnabled="GetControlEnabled" imageMso="ShapeIsoscelesTriangle" />
|
||||
<toggleButton id="tbtnStyleLevel2" label="二级样式" size="large" onAction="OnStyleBrushToggle" getPressed="GetStyleBrushPressed" getEnabled="GetControlEnabled" imageMso="ShapeOval" />
|
||||
<toggleButton id="tbtnStyleLevel3" label="三级样式" size="large" onAction="OnStyleBrushToggle" getPressed="GetStyleBrushPressed" getEnabled="GetControlEnabled" imageMso="ShapeRightArrow" />
|
||||
<toggleButton id="tbtnStyleBody" label="正文样式" size="large" onAction="OnStyleBrushToggle" getPressed="GetStyleBrushPressed" getEnabled="GetControlEnabled" imageMso="AlignLeft" />
|
||||
</group>
|
||||
<group id="groupConfig" label="设置">
|
||||
<labelControl id="lblCurrentModel" getLabel="GetCurrentModelLabel" getEnabled="GetControlEnabled" />
|
||||
<dropDown id="ddlModelSelect" label="模型选择" sizeString="WWWWWWWWWWWWWWW" onAction="OnModelSelection" getItemCount="GetModelCount" getItemLabel="GetModelLabel" getSelectedItemIndex="GetSelectedModelIndex" getEnabled="GetControlEnabled" imageMso="ServerConnection" />
|
||||
<button id="btnOutlineSettings" label="大纲配置" size="large" onAction="OnOutlineSettingClick" getEnabled="GetControlEnabled" imageMso="TextStylesGallery" />
|
||||
</group>
|
||||
<group id="groupHelp" label="帮助">
|
||||
<button id="btnAbout" label="关于" size="large" onAction="OnAboutClick" imageMso="Info" />
|
||||
</group>
|
||||
</tab>
|
||||
</tabs>
|
||||
</ribbon>
|
||||
</customUI>
|
||||
@@ -1,613 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using WordAddIn.Models;
|
||||
|
||||
namespace WordAddIn
|
||||
{
|
||||
/// <summary>
|
||||
/// AI 服务核心类。
|
||||
/// 职责:
|
||||
/// 1. 封装与后端大模型 API (如 Gemini, OpenAI) 的 HTTP 通信。
|
||||
/// 2. 构造 System Prompt 和 User Prompt,处理上下文注入。
|
||||
/// 3. 解析 API 返回的 JSON 数据,并处理异常。
|
||||
/// 4. 提供具体的业务接口:扩写、润色、升华、大纲生成、结构分析、配图生成。
|
||||
/// </summary>
|
||||
public class AiService
|
||||
{
|
||||
// 模型配置
|
||||
// TextModel 由 Settings.Default.SelectedModel 动态决定
|
||||
// ImageModel 目前使用默认的 Gemini 绘图模型,后续可扩展为可配置
|
||||
private const string ImageModel = "gemini-3-pro-image-preview";
|
||||
|
||||
private static readonly HttpClient _httpClient;
|
||||
|
||||
static AiService()
|
||||
{
|
||||
// 关键设置:必须强制启用 TLS 1.2,否则在 .NET Framework 4.7.2 下无法连接现代 HTTPS 站点
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
||||
|
||||
_httpClient = new HttpClient();
|
||||
_httpClient.Timeout = TimeSpan.FromSeconds(120); // 设置 120 秒超时,防止生图或长文本生成时连接断开
|
||||
// _httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {Config.TuZiApiKey}"); // Moved to per-request
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 润色加工:优化文本的语言表达,提升流畅度和专业性。
|
||||
/// </summary>
|
||||
/// <param name="originalText">原文</param>
|
||||
/// <param name="documentContext">文档全文上下文</param>
|
||||
/// <returns>润色后的文本</returns>
|
||||
public async Task<string> PolishText(string originalText, string documentContext = null, Action<string> onProgress = null)
|
||||
{
|
||||
string systemPrompt = "你是一个专业的文字编辑和润色专家。请对用户提供的文本进行深度润色和梳理。目标是:1. 提升语言的流畅度和专业性;2. 修正语法错误和用词不当;3. 优化逻辑结构,使表达更清晰;4. 保持原意不变。请直接输出润色后的内容,不要包含任何解释或客套话。请直接输出纯文本,不要使用任何Markdown标记。";
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(documentContext))
|
||||
{
|
||||
systemPrompt += $"\n\n【全文背景与排版规则】:你已通读全文,以下是文档的整体上下文信息和排版规则,请在润色时保持与全文主题和风格的一致性,并参考排版规则生成对应的层级结构:\n{documentContext}";
|
||||
}
|
||||
|
||||
var messages = new List<Message>
|
||||
{
|
||||
new Message { role = "system", content = systemPrompt },
|
||||
new Message { role = "user", content = $"请润色以下内容:\n\n{originalText}" }
|
||||
};
|
||||
|
||||
return await GetChatCompletion(messages, onProgress);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 深度升华:挖掘文本思想深度,提升价值和高度。
|
||||
/// </summary>
|
||||
/// <param name="originalText">原文</param>
|
||||
/// <param name="documentContext">文档全文上下文</param>
|
||||
/// <returns>升华后的文本</returns>
|
||||
public async Task<string> ElevateText(string originalText, string documentContext = null, Action<string> onProgress = null)
|
||||
{
|
||||
string systemPrompt = "你是一个资深的领域专家和思想家。用户提供了一段文本,请你根据自己的广博知识和深刻理解,对其进行深度升华。目标是:1. 挖掘深度:透过现象看本质,补充更有见地的分析;2. 拓展广度:引入相关的行业背景、前沿趋势或跨学科视角;3. 提升价值:将普通的描述提升为具有指导意义或启发性的洞见;4. 高于原文:不要局限于原文的字面意思,要大胆进行思想层面的拔高。请直接输出升华后的纯文本内容,保持逻辑连贯,不要使用任何Markdown标记。";
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(documentContext))
|
||||
{
|
||||
systemPrompt += $"\n\n【全文背景与排版规则】:你已通读全文,以下是文档的整体上下文信息和排版规则,请在升华时保持与全文主题和风格的一致性(但在思想深度上要超越它),并参考排版规则生成对应的层级结构:\n{documentContext}";
|
||||
}
|
||||
|
||||
var messages = new List<Message>
|
||||
{
|
||||
new Message { role = "system", content = systemPrompt },
|
||||
new Message { role = "user", content = $"请对以下内容进行深度升华和价值提升:\n\n{originalText}" }
|
||||
};
|
||||
|
||||
return await GetChatCompletion(messages, onProgress);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 素材写作:根据参考资料生成新的内容。
|
||||
/// </summary>
|
||||
/// <param name="originalText">目标文本/上下文</param>
|
||||
/// <param name="referenceContent">参考资料内容</param>
|
||||
/// <param name="wordLimit">字数限制</param>
|
||||
/// <param name="documentContext">文档全文上下文</param>
|
||||
/// <returns>生成的内容</returns>
|
||||
public async Task<string> GenerateWithReference(string originalText, string referenceContent, int wordLimit, string documentContext = null, Action<string> onProgress = null)
|
||||
{
|
||||
string systemPrompt = "你是一个专业的文档写作助手。请根据提供的参考资料,撰写或重写目标文本。请直接输出纯文本内容,不要使用任何Markdown标记。";
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(documentContext))
|
||||
{
|
||||
systemPrompt += $"\n\n【全文背景与排版规则】:你已通读全文,以下是文档的整体上下文信息和排版规则,请在生成时保持与全文主题和风格的一致性,并参考排版规则生成对应的层级结构:\n{documentContext}";
|
||||
}
|
||||
|
||||
StringBuilder userPrompt = new StringBuilder();
|
||||
userPrompt.AppendLine("请根据以下信息生成内容:");
|
||||
userPrompt.AppendLine();
|
||||
userPrompt.AppendLine($"【字数要求】:{wordLimit}字左右");
|
||||
userPrompt.AppendLine();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(referenceContent))
|
||||
{
|
||||
userPrompt.AppendLine("【参考资料】:");
|
||||
userPrompt.AppendLine(referenceContent);
|
||||
userPrompt.AppendLine();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(originalText))
|
||||
{
|
||||
userPrompt.AppendLine("【目标文本/上下文】:");
|
||||
userPrompt.AppendLine(originalText);
|
||||
userPrompt.AppendLine();
|
||||
}
|
||||
|
||||
userPrompt.AppendLine("请开始生成:");
|
||||
|
||||
var messages = new List<Message>
|
||||
{
|
||||
new Message { role = "system", content = systemPrompt },
|
||||
new Message { role = "user", content = userPrompt.ToString() }
|
||||
};
|
||||
|
||||
return await GetChatCompletion(messages, onProgress);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 总结大纲:将文本总结为层级分明的大纲文本。
|
||||
/// </summary>
|
||||
/// <param name="originalText">原文</param>
|
||||
/// <returns>大纲文本</returns>
|
||||
public async Task<string> SummarizeToOutline(string originalText, Action<string> onProgress = null)
|
||||
{
|
||||
string systemPrompt = "你是一个专业的文档总结助手。请将用户提供的长文本总结为一个层级分明的大纲。要求:1. 结构清晰,使用缩进或序号表示层级;2. 语言精练,概括重点;3. 适合用于制作PPT或架构图。请直接输出大纲文本,不要包含Markdown代码块标记。";
|
||||
|
||||
var messages = new List<Message>
|
||||
{
|
||||
new Message { role = "system", content = systemPrompt },
|
||||
new Message { role = "user", content = $"请将以下内容总结为大纲:\n\n{originalText}" }
|
||||
};
|
||||
|
||||
return await GetChatCompletion(messages, onProgress);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成大纲:根据主题生成结构化的 JSON 大纲。
|
||||
/// 功能描述:
|
||||
/// 1. 构造 Prompt,要求 AI 返回 Markdown 格式的大纲。
|
||||
/// 2. 调用 AI 接口。
|
||||
/// 3. 解析 Markdown 为对象列表。
|
||||
/// </summary>
|
||||
/// <param name="topic">大纲主题或简要描述</param>
|
||||
/// <returns>大纲项列表 (包含标题和层级)</returns>
|
||||
public async Task<List<OutlineItem>> GenerateOutline(string topic, Action<string> onProgress = null)
|
||||
{
|
||||
string systemPrompt = @"你是一个专业的文档大纲生成助手。请根据用户提供的主题或描述,生成一个结构化的文档大纲。
|
||||
请直接输出 Markdown 格式的大纲,不要包含任何前言、后语或 Markdown 代码块标记(如 ```markdown)。
|
||||
格式要求:
|
||||
- 主标题使用 # (一级标题)
|
||||
- 一级目录使用 ## (二级标题)
|
||||
- 二级目录使用 ### (三级标题)
|
||||
- 三级目录使用 #### (四级标题)
|
||||
|
||||
例如:
|
||||
# 关于人工智能的发展报告
|
||||
## 第一章 绪论
|
||||
### 1.1 研究背景
|
||||
";
|
||||
|
||||
var messages = new List<Message>
|
||||
{
|
||||
new Message { role = "system", content = systemPrompt },
|
||||
new Message { role = "user", content = topic }
|
||||
};
|
||||
|
||||
string markdownResponse = await GetChatCompletion(messages, onProgress);
|
||||
|
||||
// 记录原始响应以便调试
|
||||
try { System.IO.File.AppendAllText(@"C:\Users\Public\WordAddInLog.txt", $"{DateTime.Now} GenerateOutline Markdown Raw: {markdownResponse}\n"); } catch { }
|
||||
|
||||
// 清理可能存在的 Markdown 代码块标记
|
||||
markdownResponse = markdownResponse.Replace("```markdown", "").Replace("```", "").Trim();
|
||||
|
||||
var result = new List<OutlineItem>();
|
||||
try
|
||||
{
|
||||
var lines = markdownResponse.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (var line in lines)
|
||||
{
|
||||
var trimmed = line.Trim();
|
||||
if (string.IsNullOrWhiteSpace(trimmed)) continue;
|
||||
|
||||
int level = -1;
|
||||
string title = trimmed;
|
||||
|
||||
// 解析 Markdown 标题层级
|
||||
if (trimmed.StartsWith("####"))
|
||||
{
|
||||
level = 3;
|
||||
title = trimmed.Substring(4).Trim();
|
||||
}
|
||||
else if (trimmed.StartsWith("###"))
|
||||
{
|
||||
level = 2;
|
||||
title = trimmed.Substring(3).Trim();
|
||||
}
|
||||
else if (trimmed.StartsWith("##"))
|
||||
{
|
||||
level = 1;
|
||||
title = trimmed.Substring(2).Trim();
|
||||
}
|
||||
else if (trimmed.StartsWith("#"))
|
||||
{
|
||||
level = 0;
|
||||
title = trimmed.Substring(1).Trim();
|
||||
}
|
||||
|
||||
// 如果识别到有效标题,则加入列表
|
||||
if (level >= 0)
|
||||
{
|
||||
result.Add(new OutlineItem { Title = title, Level = level });
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
try { System.IO.File.AppendAllText(@"C:\Users\Public\WordAddInLog.txt", $"{DateTime.Now} Markdown Parse Error: {ex.Message}\n"); } catch { }
|
||||
Console.WriteLine("Markdown Parsing Failed: " + ex.Message);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 结构分析:分析文档文本,提取标题及其层级结构。
|
||||
/// 功能描述:
|
||||
/// 1. 发送文档内容给 AI。
|
||||
/// 2. AI 识别出所有的标题行及其层级 (1-5)。
|
||||
/// 3. 返回 JSON 格式的标题列表,供格式美化功能使用。
|
||||
/// </summary>
|
||||
/// <param name="text">文档全文内容 (或截断后的部分内容)</param>
|
||||
/// <returns>标题信息列表 (包含标题文本和层级)</returns>
|
||||
public async Task<List<HeadingInfo>> AnalyzeStructure(string text, Action<string> onProgress = null)
|
||||
{
|
||||
string systemPrompt = @"你是一个文档格式专家。请分析用户提供的文档内容,识别出所有的标题及其对应的层级(1级、2级、3级...)。
|
||||
请只返回一个JSON数组,数组中的每个元素包含 'text' (标题所在行的完整纯文本内容,包含序号) 和 'level' (整数层级)。
|
||||
忽略正文内容,只提取标题。
|
||||
例如:[{""text"": ""第一章 绪论"", ""level"": 1}, {""text"": ""1.1 研究背景"", ""level"": 2}]
|
||||
请确保返回的是合法的JSON格式,不包含Markdown标记。";
|
||||
|
||||
var messages = new List<Message>
|
||||
{
|
||||
new Message { role = "system", content = systemPrompt },
|
||||
new Message { role = "user", content = text }
|
||||
};
|
||||
|
||||
string jsonResponse = await GetChatCompletion(messages, onProgress);
|
||||
|
||||
// 清理可能存在的 Markdown 代码块标记
|
||||
jsonResponse = jsonResponse.Replace("```json", "").Replace("```", "").Trim();
|
||||
|
||||
try
|
||||
{
|
||||
return JsonConvert.DeserializeObject<List<HeadingInfo>>(jsonResponse);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("JSON Parsing Failed: " + ex.Message);
|
||||
return new List<HeadingInfo>();
|
||||
}
|
||||
}
|
||||
|
||||
public class HeadingInfo
|
||||
{
|
||||
public string text { get; set; }
|
||||
public int level { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通读全文:分析文档全文,生成摘要和风格画像。
|
||||
/// </summary>
|
||||
/// <param name="fullText">全文内容</param>
|
||||
/// <returns>文档画像描述</returns>
|
||||
public async Task<string> AnalyzeDocument(string fullText, Action<string> onProgress = null)
|
||||
{
|
||||
var messages = new List<Message>
|
||||
{
|
||||
new Message { role = "system", content = "你是一个文档分析专家。请阅读提供的文档全文,并提取关键的上下文信息,包括:1. 核心主题摘要;2. 写作风格与语调;3. 关键术语或背景设定。请生成一段简明扼要的“文档画像”,用于在后续写作任务中作为System Prompt的一部分,帮助AI保持上下文一致性。请直接输出这段描述性文字,不要包含其他客套话。" },
|
||||
new Message { role = "user", content = $"请分析以下文档全文:\n\n{fullText}" }
|
||||
};
|
||||
|
||||
return await GetChatCompletion(messages, onProgress);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 格式化文本(保留接口,目前逻辑主要在 AnalyzeStructure 中实现)。
|
||||
/// </summary>
|
||||
public async Task<string> FormatText(string originalText, Action<string> onProgress = null)
|
||||
{
|
||||
var messages = new List<Message>
|
||||
{
|
||||
new Message { role = "system", content = "你是一个文档排版专家。请直接输出处理后的纯文本,严禁使用Markdown格式,不要包含任何解释性文字。" },
|
||||
new Message { role = "user", content = $"请对以下文本进行格式化和润色:修正错别字、规范标点符号、优化分段,使其看起来更专业:\n\n{originalText}" }
|
||||
};
|
||||
|
||||
return await GetChatCompletion(messages, onProgress);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成图片 URL。
|
||||
/// 流程:
|
||||
/// 1. 优化提示词:将用户简单的中文描述转换为详细的英文绘图 Prompt。
|
||||
/// 2. 调用生图 API (如 DALL-E 3 或 Gemini Image)。
|
||||
/// 3. 解析 API 响应,提取图片 URL。
|
||||
/// </summary>
|
||||
/// <param name="prompt">用户的原始描述</param>
|
||||
/// <param name="style">图片风格 (如"水墨画", "赛博朋克"等)</param>
|
||||
/// <param name="shouldOptimize">是否需要 AI 优化提示词(默认为 true)</param>
|
||||
/// <returns>生成的图片 URL (有效期通常较短)</returns>
|
||||
public async Task<string> GenerateImageUrl(string prompt, string style = null, bool shouldOptimize = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 1. 优化 Prompt:根据 flag 决定是否调用 LLM 进行翻译和优化
|
||||
string optimizedPrompt = prompt;
|
||||
if (shouldOptimize)
|
||||
{
|
||||
optimizedPrompt = await OptimizePromptForImage(prompt, style);
|
||||
}
|
||||
|
||||
// 检查登录状态
|
||||
if (string.IsNullOrEmpty(AiRibbon.AccessToken))
|
||||
{
|
||||
throw new Exception("未登录,请先点击功能区的【登录】按钮获取权限。");
|
||||
}
|
||||
|
||||
// 指向本地 FastAPI 后端代理
|
||||
string requestUrl = $"{Config.BackendBaseUrl}/api/image";
|
||||
|
||||
// 使用匿名对象构造请求体,以获得最大灵活性
|
||||
var requestBody = new
|
||||
{
|
||||
prompt = optimizedPrompt,
|
||||
model = ImageModel,
|
||||
size = "1024x1024", // 标准分辨率
|
||||
response_format = "url" // 显式请求 URL 格式
|
||||
};
|
||||
|
||||
var json = JsonConvert.SerializeObject(requestBody);
|
||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
||||
// 创建请求并添加 Token
|
||||
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUrl))
|
||||
{
|
||||
request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", AiRibbon.AccessToken);
|
||||
request.Content = content;
|
||||
|
||||
using (var response = await _httpClient.SendAsync(request))
|
||||
{
|
||||
var responseString = await response.Content.ReadAsStringAsync();
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
|
||||
{
|
||||
throw new Exception("认证失效,请重新登录。");
|
||||
}
|
||||
throw new Exception($"后端服务错误 ({response.StatusCode}): {responseString}");
|
||||
}
|
||||
|
||||
// 使用 JObject 动态解析响应,以兼容不同厂商的 API 格式差异
|
||||
var jsonResponse = JObject.Parse(responseString);
|
||||
|
||||
// 1. 尝试解析 OpenAI 标准格式: data[0].url
|
||||
var data = jsonResponse["data"];
|
||||
if (data != null)
|
||||
{
|
||||
if (data.Type == JTokenType.Array && data.HasValues)
|
||||
{
|
||||
var firstItem = data[0];
|
||||
// Gemini 3 image preview 可能会返回 revised_prompt 和 url
|
||||
if (firstItem["url"] != null) return firstItem["url"].ToString();
|
||||
|
||||
// 有时它会返回 NO_IMAGE,这可能是模型拒绝了,或者格式不对
|
||||
if (firstItem["revised_prompt"] != null && firstItem["revised_prompt"].ToString() == "NO_IMAGE")
|
||||
{
|
||||
// 尝试从其他字段找,或者这就是个错误
|
||||
}
|
||||
|
||||
// 某些 API 可能直接在数组里放 URL 字符串
|
||||
if (firstItem.Type == JTokenType.String) return firstItem.ToString();
|
||||
}
|
||||
// 2. 尝试解析 data 为直接字符串的情况
|
||||
else if (data.Type == JTokenType.String)
|
||||
{
|
||||
return data.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 尝试解析根节点 url (部分非标准 API)
|
||||
if (jsonResponse["url"] != null)
|
||||
{
|
||||
return jsonResponse["url"].ToString();
|
||||
}
|
||||
|
||||
throw new Exception($"无法从响应中解析图片 URL。原始响应: {responseString}");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception($"生图请求失败: {ex.Message}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 优化图片生成提示词。
|
||||
/// 将用户的中文描述翻译成英文,并加入风格指令。
|
||||
/// </summary>
|
||||
private async Task<string> OptimizePromptForImage(string originalPrompt, string style = null)
|
||||
{
|
||||
// 注意:架构图的特殊模板处理已移动到 UI 层 (ImageOptionsForm),
|
||||
// 这里主要处理需要 AI 翻译和润色的艺术风格。
|
||||
|
||||
string styleInstruction = string.IsNullOrEmpty(style) ? "" : $"6. 图片风格必须严格遵循:{style}。";
|
||||
|
||||
var messages = new List<Message>
|
||||
{
|
||||
new Message { role = "system", content = $"你是一个专业的AI绘图提示词专家。你的任务是将用户的输入转化为一段高质量的、英文的DALL-E 3绘图提示词。请遵循以下规则:\n1. 描述画面的部分必须翻译成英文。\n2. 提炼核心意象,去除无关的修饰语或敏感词。\n3. 增加艺术风格、光影、构图等细节描述。\n4. 直接输出最终的英文Prompt,不要包含任何解释或前言后语。\n5. 确保内容安全,符合通用内容审核标准。\n{styleInstruction}\n7. 【重要约束】如果画面中需要包含任何文字(Text/Label/Title),必须严格保留中文(Simplified Chinese),并明确指示 'text in Chinese',绝对禁止在画面中生成英文文字。" },
|
||||
new Message { role = "user", content = $"请根据以下描述生成一段绘图Prompt:\n{originalPrompt}" }
|
||||
};
|
||||
|
||||
return await GetChatCompletion(messages);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通用聊天补全请求方法。
|
||||
/// 改为通过本地 Python FastAPI 后端代理请求。
|
||||
/// </summary>
|
||||
private async Task<string> GetChatCompletion(List<Message> messages, Action<string> onProgress = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 检查登录状态
|
||||
if (string.IsNullOrEmpty(AiRibbon.AccessToken))
|
||||
{
|
||||
throw new Exception("未登录,请先点击功能区的【登录】按钮获取权限。");
|
||||
}
|
||||
|
||||
// 获取当前选择的模型
|
||||
string selectedModelId = Properties.Settings.Default.SelectedModel;
|
||||
if (string.IsNullOrEmpty(selectedModelId)) selectedModelId = "qwen-plus";
|
||||
|
||||
var modelInfo = ModelConfig.GetModel(selectedModelId);
|
||||
|
||||
// 指向本地 FastAPI 后端代理
|
||||
string requestUrl = "http://127.0.0.1:8000/api/chat";
|
||||
string accessToken = AiRibbon.AccessToken;
|
||||
string jsonContent = "";
|
||||
|
||||
// 统一构造 OpenAI 兼容格式请求体发送给后端
|
||||
// 后端负责根据模型类型转发给 DashScope 或其他服务
|
||||
var requestDict = new Dictionary<string, object>
|
||||
{
|
||||
{ "model", modelInfo.Id },
|
||||
{ "messages", messages },
|
||||
{ "temperature", 0.7 }
|
||||
};
|
||||
|
||||
// 注意:目前后端 Mock 暂时只支持非流式,但协议上保留 stream 字段
|
||||
if (onProgress != null)
|
||||
{
|
||||
requestDict["stream"] = true;
|
||||
}
|
||||
|
||||
// 针对 glm-4.7 开启思考模式 (透传给后端)
|
||||
if (modelInfo.Id == "glm-4.7")
|
||||
{
|
||||
requestDict["enable_thinking"] = true;
|
||||
}
|
||||
|
||||
jsonContent = JsonConvert.SerializeObject(requestDict);
|
||||
|
||||
var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
|
||||
|
||||
// 创建新的 HttpRequestMessage
|
||||
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUrl))
|
||||
{
|
||||
// 使用登录获取的 Access Token
|
||||
request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", accessToken);
|
||||
request.Content = content;
|
||||
|
||||
var completionOption = onProgress != null ? HttpCompletionOption.ResponseHeadersRead : HttpCompletionOption.ResponseContentRead;
|
||||
|
||||
using (var response = await _httpClient.SendAsync(request, completionOption))
|
||||
{
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
|
||||
{
|
||||
throw new Exception("认证失效,请重新登录。");
|
||||
}
|
||||
var errorString = await response.Content.ReadAsStringAsync();
|
||||
throw new Exception($"后端服务错误 ({response.StatusCode}): {errorString}");
|
||||
}
|
||||
|
||||
// ... 后续处理保持不变,后端返回格式应兼容 OpenAI ...
|
||||
|
||||
|
||||
if (onProgress != null)
|
||||
{
|
||||
// 处理流式响应
|
||||
using (var stream = await response.Content.ReadAsStreamAsync())
|
||||
using (var reader = new System.IO.StreamReader(stream))
|
||||
{
|
||||
string line;
|
||||
StringBuilder fullContent = new StringBuilder();
|
||||
int lineCount = 0;
|
||||
|
||||
while ((line = await reader.ReadLineAsync()) != null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(line)) continue;
|
||||
|
||||
// Debug logging: Log first 5 lines
|
||||
if (lineCount < 5)
|
||||
{
|
||||
try { System.IO.File.AppendAllText(@"C:\Users\Public\WordAddInLog.txt", $"{DateTime.Now} Stream Line {lineCount}: {line}\n"); } catch { }
|
||||
lineCount++;
|
||||
}
|
||||
|
||||
string dataStr = null;
|
||||
if (line.StartsWith("data:"))
|
||||
{
|
||||
dataStr = line.Substring(5).Trim();
|
||||
}
|
||||
else if (line.Trim().StartsWith("{") && line.Trim().EndsWith("}"))
|
||||
{
|
||||
// Fallback: If not SSE but standard JSON (maybe incremental_output ignored)
|
||||
dataStr = line.Trim();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(dataStr))
|
||||
{
|
||||
if (dataStr == "[DONE]") break;
|
||||
|
||||
try
|
||||
{
|
||||
var json = JObject.Parse(dataStr);
|
||||
string contentDelta = "";
|
||||
|
||||
// 统一处理:假设后端代理返回 OpenAI 兼容格式
|
||||
// 优先尝试获取 delta (流式)
|
||||
contentDelta = json["choices"]?[0]?["delta"]?["content"]?.ToString();
|
||||
|
||||
// 如果没有 delta,尝试获取 message (非流式/完整包)
|
||||
if (string.IsNullOrEmpty(contentDelta))
|
||||
{
|
||||
contentDelta = json["choices"]?[0]?["message"]?["content"]?.ToString();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(contentDelta))
|
||||
{
|
||||
onProgress(contentDelta);
|
||||
fullContent.Append(contentDelta);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore parse errors
|
||||
}
|
||||
}
|
||||
}
|
||||
return fullContent.ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 非流式处理
|
||||
var responseString = await response.Content.ReadAsStringAsync();
|
||||
|
||||
// 统一按照 OpenAI 兼容格式解析
|
||||
try
|
||||
{
|
||||
var result = JsonConvert.DeserializeObject<ChatCompletionResponse>(responseString);
|
||||
return result?.choices?.FirstOrDefault()?.message?.content ?? responseString;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return responseString;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 抛出更详细的错误
|
||||
throw new Exception($"AI 请求失败: {ex.Message}", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WordAddIn
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建大纲输入窗体。
|
||||
/// 功能描述:
|
||||
/// 1. 提供一个文本框,让用户输入大纲的主题、关键词或详细描述。
|
||||
/// 2. 作为生成大纲的前置步骤,获取用户的初始意图。
|
||||
/// </summary>
|
||||
public class CreateOutlineForm : Form
|
||||
{
|
||||
private TextBox txtTopic;
|
||||
private Button btnGenerate;
|
||||
private Button btnCancel;
|
||||
private Label lblTopic;
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户输入的主题内容。
|
||||
/// </summary>
|
||||
public string Topic { get; private set; }
|
||||
|
||||
public CreateOutlineForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化窗体组件。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.lblTopic = new System.Windows.Forms.Label();
|
||||
this.txtTopic = new System.Windows.Forms.TextBox();
|
||||
this.btnGenerate = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lblTopic
|
||||
//
|
||||
this.lblTopic.AutoSize = true;
|
||||
this.lblTopic.Location = new System.Drawing.Point(20, 20);
|
||||
this.lblTopic.Name = "lblTopic";
|
||||
this.lblTopic.Size = new System.Drawing.Size(191, 12);
|
||||
this.lblTopic.TabIndex = 0;
|
||||
this.lblTopic.Text = "请输入文档主题或描述 (支持多行):";
|
||||
//
|
||||
// txtTopic
|
||||
//
|
||||
this.txtTopic.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtTopic.Location = new System.Drawing.Point(20, 50);
|
||||
this.txtTopic.Multiline = true;
|
||||
this.txtTopic.Name = "txtTopic";
|
||||
this.txtTopic.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.txtTopic.Size = new System.Drawing.Size(460, 240);
|
||||
this.txtTopic.TabIndex = 1;
|
||||
//
|
||||
// btnGenerate
|
||||
//
|
||||
this.btnGenerate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnGenerate.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.btnGenerate.Location = new System.Drawing.Point(260, 310);
|
||||
this.btnGenerate.Name = "btnGenerate";
|
||||
this.btnGenerate.Size = new System.Drawing.Size(100, 35);
|
||||
this.btnGenerate.TabIndex = 2;
|
||||
this.btnGenerate.Text = "生成大纲";
|
||||
this.btnGenerate.UseVisualStyleBackColor = true;
|
||||
this.btnGenerate.Click += new System.EventHandler(this.BtnGenerate_Click);
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCancel.Location = new System.Drawing.Point(380, 310);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(100, 35);
|
||||
this.btnCancel.TabIndex = 3;
|
||||
this.btnCancel.Text = "取消";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CreateOutlineForm
|
||||
//
|
||||
// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.Font = new System.Drawing.Font("Microsoft YaHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.CancelButton = this.btnCancel;
|
||||
this.ClientSize = new System.Drawing.Size(500, 370);
|
||||
this.MinimumSize = new System.Drawing.Size(400, 300);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.btnGenerate);
|
||||
this.Controls.Add(this.txtTopic);
|
||||
this.Controls.Add(this.lblTopic);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
|
||||
this.MaximizeBox = true;
|
||||
this.MinimizeBox = true;
|
||||
this.Name = "CreateOutlineForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "创建大纲 - AI助手";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成按钮点击事件。
|
||||
/// 验证输入是否为空,若通过则设置 Topic 属性并关闭窗体。
|
||||
/// </summary>
|
||||
private void BtnGenerate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Topic = txtTopic.Text.Trim();
|
||||
if (string.IsNullOrWhiteSpace(Topic))
|
||||
{
|
||||
MessageBox.Show("请输入主题或描述内容。");
|
||||
this.DialogResult = DialogResult.None;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,319 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using WordAddIn.Properties;
|
||||
|
||||
namespace WordAddIn
|
||||
{
|
||||
/// <summary>
|
||||
/// 生成配图设置窗体。
|
||||
/// 功能描述:
|
||||
/// 1. 允许用户选择图片风格(包括多种架构图)。
|
||||
/// 2. 自动根据选择的风格生成提示词模板。
|
||||
/// 3. 允许用户直接编辑最终发送给 AI 的提示词。
|
||||
/// </summary>
|
||||
public class ImageOptionsForm : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// 最终生成的提示词(用户编辑后的版本)。
|
||||
/// </summary>
|
||||
public string FinalPrompt { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否需要 AI 进一步优化提示词(翻译/润色)。
|
||||
/// 对于架构图通常为 false(直接使用模板),对于艺术画通常为 true。
|
||||
/// </summary>
|
||||
public bool ShouldOptimize { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 源文本(从 Word 选区或剪贴板获取)。
|
||||
/// </summary>
|
||||
public string SourceText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户选择的风格名称(用于后续可能的引用,虽然后端逻辑已主要依赖 FinalPrompt)
|
||||
/// </summary>
|
||||
public string SelectedStyle { get; private set; }
|
||||
|
||||
private ComboBox cmbStyles;
|
||||
private RadioButton rbClipboard;
|
||||
private RadioButton rbInput;
|
||||
private TextBox txtInput;
|
||||
private TextBox txtFinalPrompt;
|
||||
private CheckBox chkOptimize;
|
||||
private Button btnOk;
|
||||
private Button btnCancel;
|
||||
private Label lblStyle;
|
||||
private Label lblSource;
|
||||
private Label lblPrompt;
|
||||
|
||||
private readonly Dictionary<string, string> _styleTemplates = new Dictionary<string, string>();
|
||||
|
||||
public ImageOptionsForm()
|
||||
{
|
||||
InitializeTemplates();
|
||||
InitializeComponent();
|
||||
|
||||
foreach (var key in _styleTemplates.Keys)
|
||||
{
|
||||
this.cmbStyles.Items.Add(key);
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeTemplates()
|
||||
{
|
||||
// 基础模板:用于架构图系列
|
||||
// 注意:{0} 是图表类型,{1} 是内容占位符
|
||||
string archTemplate =
|
||||
"帮我绘制{0},必须文字合使用中文,中文一定要清晰可见,不能字体模糊或者创造不存在的汉字!\n" +
|
||||
"同时要美观,大方。\n\n" +
|
||||
"内容如下:\n{1}\n\n" +
|
||||
"根据如下内容创建一个整体上的{0},美观,细节处理仔细,特别需要注意的是文字的准确性,中文不要出现错字或不可识别的乱码!!!" +
|
||||
"同时,字体除标题使用黑体外,其它一概使用宋体,这样不容易出现字体不完整的情况!!!!";
|
||||
|
||||
// 注册所有支持的风格及其处理逻辑
|
||||
// 架构图类
|
||||
_styleTemplates.Add("逻辑架构图 (Logical Architecture)", string.Format(archTemplate, "逻辑架构图", "{0}"));
|
||||
_styleTemplates.Add("业务架构图 (Business Architecture)", string.Format(archTemplate, "业务架构图", "{0}"));
|
||||
_styleTemplates.Add("应用架构图 (Application Architecture)", string.Format(archTemplate, "应用架构图", "{0}"));
|
||||
_styleTemplates.Add("数据架构图 (Data Architecture)", string.Format(archTemplate, "数据架构图", "{0}"));
|
||||
_styleTemplates.Add("技术架构图 (Technical Architecture)", string.Format(archTemplate, "技术架构图", "{0}"));
|
||||
_styleTemplates.Add("部署架构图 (Deployment Architecture)", string.Format(archTemplate, "部署架构图", "{0}"));
|
||||
_styleTemplates.Add("思维导图 (Mind Map)", string.Format(archTemplate, "思维导图", "{0}"));
|
||||
_styleTemplates.Add("流程图 (Flow Chart)", string.Format(archTemplate, "流程图", "{0}"));
|
||||
_styleTemplates.Add("时序图 (Sequence Diagram)", string.Format(archTemplate, "时序交互图", "{0}"));
|
||||
_styleTemplates.Add("实施保障图 (Implementation & Safeguard Diagram)", string.Format(archTemplate, "实施保障图", "{0}"));
|
||||
_styleTemplates.Add("逐步进化路线图 (Evolutionary Roadmap)", string.Format(archTemplate, "逐步进化路线图", "{0}"));
|
||||
|
||||
// 艺术风格类 (Value 为 null 表示使用默认 AI 优化逻辑)
|
||||
_styleTemplates.Add("写实摄影 (Photorealistic)", null);
|
||||
_styleTemplates.Add("卡通插画 (Cartoon)", null);
|
||||
_styleTemplates.Add("手绘草图 (Sketch)", null);
|
||||
_styleTemplates.Add("3D 渲染 (3D Render)", null);
|
||||
_styleTemplates.Add("水彩画 (Watercolor)", null);
|
||||
_styleTemplates.Add("赛博朋克 (Cyberpunk)", null);
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.Text = "生成配图设置";
|
||||
this.Size = new Size(500, 650);
|
||||
this.MinimumSize = new Size(400, 500);
|
||||
this.StartPosition = FormStartPosition.CenterParent;
|
||||
this.AutoScaleMode = AutoScaleMode.Dpi;
|
||||
this.Font = new System.Drawing.Font("Microsoft YaHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.FormBorderStyle = FormBorderStyle.Sizable;
|
||||
this.MaximizeBox = true;
|
||||
this.MinimizeBox = true;
|
||||
|
||||
this.lblStyle = new Label();
|
||||
this.cmbStyles = new ComboBox();
|
||||
this.lblSource = new Label();
|
||||
this.rbClipboard = new RadioButton();
|
||||
this.rbInput = new RadioButton();
|
||||
this.txtInput = new TextBox();
|
||||
this.lblPrompt = new Label();
|
||||
this.txtFinalPrompt = new TextBox();
|
||||
this.chkOptimize = new CheckBox();
|
||||
this.btnOk = new Button();
|
||||
this.btnCancel = new Button();
|
||||
|
||||
this.SuspendLayout();
|
||||
|
||||
// lblStyle
|
||||
this.lblStyle.AutoSize = true;
|
||||
this.lblStyle.Location = new Point(20, 20);
|
||||
this.lblStyle.Text = "1. 图片风格:";
|
||||
|
||||
// cmbStyles
|
||||
this.cmbStyles.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
this.cmbStyles.Location = new Point(20, 45);
|
||||
this.cmbStyles.Size = new Size(440, 25);
|
||||
this.cmbStyles.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
this.cmbStyles.SelectedIndexChanged += CmbStyles_SelectedIndexChanged;
|
||||
|
||||
// lblSource
|
||||
this.lblSource.AutoSize = true;
|
||||
this.lblSource.Location = new Point(20, 85);
|
||||
this.lblSource.Text = "2. 内容来源:";
|
||||
|
||||
// rbClipboard
|
||||
this.rbClipboard.AutoSize = true;
|
||||
this.rbClipboard.Location = new Point(40, 110);
|
||||
this.rbClipboard.Text = "使用剪贴板内容";
|
||||
this.rbClipboard.CheckedChanged += RbSource_CheckedChanged;
|
||||
|
||||
// rbInput
|
||||
this.rbInput.AutoSize = true;
|
||||
this.rbInput.Location = new Point(200, 110);
|
||||
this.rbInput.Text = "手动录入/编辑";
|
||||
this.rbInput.CheckedChanged += RbSource_CheckedChanged;
|
||||
|
||||
// txtInput
|
||||
this.txtInput.Location = new Point(40, 140);
|
||||
this.txtInput.Multiline = true;
|
||||
this.txtInput.ScrollBars = ScrollBars.Vertical;
|
||||
this.txtInput.Size = new Size(420, 100);
|
||||
this.txtInput.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
this.txtInput.TextChanged += TxtInput_TextChanged;
|
||||
|
||||
// lblPrompt
|
||||
this.lblPrompt.AutoSize = true;
|
||||
this.lblPrompt.Location = new Point(20, 255);
|
||||
this.lblPrompt.Text = "3. 最终提示词预览 (可直接修改):";
|
||||
|
||||
// txtFinalPrompt
|
||||
this.txtFinalPrompt.Location = new Point(20, 280);
|
||||
this.txtFinalPrompt.Multiline = true;
|
||||
this.txtFinalPrompt.ScrollBars = ScrollBars.Vertical;
|
||||
this.txtFinalPrompt.Size = new Size(440, 220);
|
||||
this.txtFinalPrompt.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
|
||||
// chkOptimize
|
||||
this.chkOptimize.AutoSize = true;
|
||||
this.chkOptimize.Location = new Point(20, 520);
|
||||
this.chkOptimize.Size = new Size(400, 24);
|
||||
this.chkOptimize.Text = "使用 AI 优化提示词 (自动翻译成英文并丰富细节)";
|
||||
this.chkOptimize.Checked = true;
|
||||
this.chkOptimize.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
|
||||
// btnOk
|
||||
this.btnOk.Text = "开始生成";
|
||||
this.btnOk.DialogResult = DialogResult.OK;
|
||||
this.btnOk.Location = new Point(260, 560);
|
||||
this.btnOk.Size = new Size(100, 35);
|
||||
this.btnOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
this.btnOk.Click += BtnOk_Click;
|
||||
|
||||
// btnCancel
|
||||
this.btnCancel.Text = "取消";
|
||||
this.btnCancel.DialogResult = DialogResult.Cancel;
|
||||
this.btnCancel.Location = new Point(380, 560);
|
||||
this.btnCancel.Size = new Size(80, 35);
|
||||
this.btnCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
|
||||
this.Controls.Add(this.lblStyle);
|
||||
this.Controls.Add(this.cmbStyles);
|
||||
this.Controls.Add(this.lblSource);
|
||||
this.Controls.Add(this.rbClipboard);
|
||||
this.Controls.Add(this.rbInput);
|
||||
this.Controls.Add(this.txtInput);
|
||||
this.Controls.Add(this.lblPrompt);
|
||||
this.Controls.Add(this.txtFinalPrompt);
|
||||
this.Controls.Add(this.chkOptimize);
|
||||
this.Controls.Add(this.btnOk);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
|
||||
// Initialize Source Logic
|
||||
// If SourceText is provided (from Selection), populate txtInput and select rbInput
|
||||
if (!string.IsNullOrWhiteSpace(this.SourceText))
|
||||
{
|
||||
this.txtInput.Text = this.SourceText;
|
||||
this.rbInput.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No selection, check clipboard
|
||||
this.rbClipboard.Checked = true;
|
||||
// Trigger logic to load clipboard if possible
|
||||
RbSource_CheckedChanged(this.rbClipboard, EventArgs.Empty);
|
||||
}
|
||||
|
||||
// Default Style Selection
|
||||
if (this.cmbStyles.Items.Count > 0)
|
||||
{
|
||||
int index = this.cmbStyles.FindString("逻辑架构图");
|
||||
this.cmbStyles.SelectedIndex = index >= 0 ? index : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdatePrompt();
|
||||
}
|
||||
}
|
||||
|
||||
private void RbSource_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (rbClipboard.Checked)
|
||||
{
|
||||
this.txtInput.Enabled = false;
|
||||
try
|
||||
{
|
||||
if (Clipboard.ContainsText())
|
||||
{
|
||||
this.SourceText = Clipboard.GetText().Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SourceText = "";
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
this.SourceText = "";
|
||||
}
|
||||
}
|
||||
else if (rbInput.Checked)
|
||||
{
|
||||
this.txtInput.Enabled = true;
|
||||
this.SourceText = this.txtInput.Text;
|
||||
}
|
||||
UpdatePrompt();
|
||||
}
|
||||
|
||||
private void TxtInput_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (rbInput.Checked)
|
||||
{
|
||||
this.SourceText = this.txtInput.Text;
|
||||
UpdatePrompt();
|
||||
}
|
||||
}
|
||||
|
||||
private void CmbStyles_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdatePrompt();
|
||||
}
|
||||
|
||||
private void UpdatePrompt()
|
||||
{
|
||||
if (cmbStyles.SelectedItem == null) return;
|
||||
|
||||
string styleKey = cmbStyles.SelectedItem.ToString();
|
||||
string template = _styleTemplates.ContainsKey(styleKey) ? _styleTemplates[styleKey] : null;
|
||||
|
||||
// 只有当文本框为空,或者文本框内容是上一个模板生成的内容时,才自动覆盖
|
||||
// 但为了简单起见,这里策略是:只要切换风格,就重置提示词。用户如果修改了,切换风格会丢失修改。
|
||||
// 这是一个权衡。为了体验更好,可以加个判断,但现在先强制刷新。
|
||||
|
||||
if (template != null)
|
||||
{
|
||||
// 是架构图类:使用模板
|
||||
this.txtFinalPrompt.Text = template.Replace("{0}", this.SourceText ?? "");
|
||||
// 用户要求默认选中 AI 优化
|
||||
this.chkOptimize.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 是艺术风格类:直接显示原文本,开启 AI 优化
|
||||
this.txtFinalPrompt.Text = this.SourceText ?? "";
|
||||
this.chkOptimize.Checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.FinalPrompt = this.txtFinalPrompt.Text;
|
||||
this.ShouldOptimize = this.chkOptimize.Checked;
|
||||
this.SelectedStyle = this.cmbStyles.SelectedItem?.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,220 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WordAddIn
|
||||
{
|
||||
/// <summary>
|
||||
/// 加载动画窗体。
|
||||
/// 功能描述:
|
||||
/// 1. 在执行耗时操作(如 AI 生成)时显示,阻断用户界面。
|
||||
/// 2. 使用 GDI+ 自定义绘制旋转动画 (Spinner)。
|
||||
/// 3. 支持跨线程安全关闭。
|
||||
/// </summary>
|
||||
public class LoadingForm : Form
|
||||
{
|
||||
private System.Windows.Forms.Label lblMessage;
|
||||
private System.Windows.Forms.RichTextBox txtProgress;
|
||||
private System.Windows.Forms.Timer animationTimer;
|
||||
private System.ComponentModel.IContainer components;
|
||||
private int _spinnerAngle = 0;
|
||||
private const int SPINNER_SIZE = 60;
|
||||
|
||||
// 现代化配色
|
||||
private readonly Color _primaryColor = Color.FromArgb(43, 87, 154); // Word Blue
|
||||
private readonly Color _backgroundColor = Color.White;
|
||||
private readonly Color _borderColor = Color.FromArgb(100, 100, 100);
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数。
|
||||
/// </summary>
|
||||
/// <param name="message">加载时显示的提示文字</param>
|
||||
public LoadingForm(string message = "AI 正在思考中...")
|
||||
{
|
||||
InitializeComponent();
|
||||
lblMessage.Text = message;
|
||||
|
||||
// 开启双缓冲以减少闪烁
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);
|
||||
this.UpdateStyles();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化窗体组件。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.lblMessage = new System.Windows.Forms.Label();
|
||||
this.txtProgress = new System.Windows.Forms.RichTextBox();
|
||||
this.animationTimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lblMessage
|
||||
//
|
||||
this.lblMessage.BackColor = System.Drawing.Color.Transparent;
|
||||
this.lblMessage.Dock = System.Windows.Forms.DockStyle.None;
|
||||
this.lblMessage.Font = new System.Drawing.Font("Microsoft YaHei UI", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblMessage.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.lblMessage.Location = new System.Drawing.Point(0, 150);
|
||||
this.lblMessage.Name = "lblMessage";
|
||||
this.lblMessage.Size = new System.Drawing.Size(500, 30);
|
||||
this.lblMessage.TabIndex = 0;
|
||||
this.lblMessage.Text = "AI 正在思考中...";
|
||||
this.lblMessage.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
//
|
||||
// txtProgress
|
||||
//
|
||||
this.txtProgress.BackColor = System.Drawing.Color.White;
|
||||
this.txtProgress.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtProgress.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.txtProgress.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.txtProgress.Location = new System.Drawing.Point(40, 190);
|
||||
this.txtProgress.Name = "txtProgress";
|
||||
this.txtProgress.ReadOnly = true;
|
||||
this.txtProgress.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
|
||||
this.txtProgress.Size = new System.Drawing.Size(420, 190);
|
||||
this.txtProgress.TabIndex = 1;
|
||||
this.txtProgress.Text = "";
|
||||
//
|
||||
// animationTimer
|
||||
//
|
||||
this.animationTimer.Enabled = true;
|
||||
this.animationTimer.Interval = 30;
|
||||
this.animationTimer.Tick += new System.EventHandler(this.AnimationTimer_Tick);
|
||||
//
|
||||
// LoadingForm
|
||||
//
|
||||
// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.ClientSize = new System.Drawing.Size(500, 400);
|
||||
this.Controls.Add(this.txtProgress);
|
||||
this.Controls.Add(this.lblMessage);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Name = "LoadingForm";
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "AI助手";
|
||||
this.TopMost = true;
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 动画定时器触发事件。更新旋转角度并重绘。
|
||||
/// </summary>
|
||||
private void AnimationTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
_spinnerAngle = (_spinnerAngle + 10) % 360;
|
||||
this.Invalidate(); // 触发重绘
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写绘制事件,自定义绘制加载动画。
|
||||
/// </summary>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
Graphics g = e.Graphics;
|
||||
g.SmoothingMode = SmoothingMode.HighQuality;
|
||||
|
||||
// 1. 绘制边框
|
||||
using (Pen borderPen = new Pen(_borderColor, 2))
|
||||
{
|
||||
g.DrawRectangle(borderPen, 0, 0, this.Width - 1, this.Height - 1);
|
||||
}
|
||||
|
||||
// 2. 绘制 Spinner (中心位置)
|
||||
int centerX = this.Width / 2;
|
||||
int centerY = 100; // 居中
|
||||
|
||||
g.TranslateTransform(centerX, centerY);
|
||||
g.RotateTransform(_spinnerAngle);
|
||||
|
||||
// 绘制一个渐变的圆环或一串圆点
|
||||
// 这里我们画 8 个圆点,透明度渐变
|
||||
int dotCount = 10;
|
||||
int radius = SPINNER_SIZE / 2;
|
||||
int dotSize = 6;
|
||||
|
||||
for (int i = 0; i < dotCount; i++)
|
||||
{
|
||||
// 计算每个点的透明度 (0-255)
|
||||
// 使得看起来像是有拖尾
|
||||
int alpha = 255 * (i + 1) / dotCount;
|
||||
using (Brush brush = new SolidBrush(Color.FromArgb(alpha, _primaryColor)))
|
||||
{
|
||||
// 保存当前状态
|
||||
var state = g.Save();
|
||||
|
||||
// 旋转到对应角度
|
||||
float angle = 360f / dotCount * i;
|
||||
g.RotateTransform(angle);
|
||||
|
||||
// 在半径处画圆点
|
||||
g.FillEllipse(brush, radius - dotSize, -dotSize / 2, dotSize, dotSize);
|
||||
|
||||
// 恢复状态
|
||||
g.Restore(state);
|
||||
}
|
||||
}
|
||||
|
||||
g.ResetTransform();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 线程安全的关闭方法。
|
||||
/// 允许从非 UI 线程调用。
|
||||
/// </summary>
|
||||
public void UpdateProgress(string content)
|
||||
{
|
||||
if (this.IsDisposed) return;
|
||||
if (this.InvokeRequired)
|
||||
{
|
||||
this.Invoke(new Action<string>(UpdateProgress), content);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.txtProgress.AppendText(content);
|
||||
this.txtProgress.ScrollToCaret();
|
||||
}
|
||||
}
|
||||
|
||||
public void CloseSafe()
|
||||
{
|
||||
if (this.IsDisposed) return;
|
||||
|
||||
if (this.InvokeRequired)
|
||||
{
|
||||
this.Invoke(new Action(CloseSafe));
|
||||
}
|
||||
else
|
||||
{
|
||||
animationTimer.Stop();
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 支持鼠标拖动无边框窗体。
|
||||
/// </summary>
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
ReleaseCapture();
|
||||
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
|
||||
}
|
||||
}
|
||||
|
||||
[System.Runtime.InteropServices.DllImport("user32.dll")]
|
||||
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
|
||||
[System.Runtime.InteropServices.DllImport("user32.dll")]
|
||||
public static extern bool ReleaseCapture();
|
||||
public const int WM_NCLBUTTONDOWN = 0xA1;
|
||||
public const int HT_CAPTION = 0x2;
|
||||
}
|
||||
}
|
||||
@@ -1,220 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WordAddIn
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户登录窗体。
|
||||
/// 功能描述:
|
||||
/// 1. 模拟用户登录验证过程。
|
||||
/// 2. 提供用户名和密码输入框。
|
||||
/// 3. 目前使用硬编码的凭证 (huanghai / 12345678) 进行验证,实际生产中应连接认证服务。
|
||||
/// </summary>
|
||||
public class LoginForm : Form
|
||||
{
|
||||
private TextBox txtUsername;
|
||||
private TextBox txtPassword;
|
||||
private Button btnLogin;
|
||||
private Button btnCancel;
|
||||
private Label lblTitle;
|
||||
private Label lblUser;
|
||||
private Label lblPass;
|
||||
|
||||
public LoginForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化窗体组件。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.lblTitle = new System.Windows.Forms.Label();
|
||||
this.lblUser = new System.Windows.Forms.Label();
|
||||
this.txtUsername = new System.Windows.Forms.TextBox();
|
||||
this.lblPass = new System.Windows.Forms.Label();
|
||||
this.txtPassword = new System.Windows.Forms.TextBox();
|
||||
this.btnLogin = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lblTitle
|
||||
//
|
||||
this.lblTitle.AutoSize = false;
|
||||
this.lblTitle.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Bold);
|
||||
this.lblTitle.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(43)))), ((int)(((byte)(87)))), ((int)(((byte)(154)))));
|
||||
this.lblTitle.Location = new System.Drawing.Point(0, 25);
|
||||
this.lblTitle.Name = "lblTitle";
|
||||
this.lblTitle.Size = new System.Drawing.Size(500, 40);
|
||||
this.lblTitle.TabIndex = 0;
|
||||
this.lblTitle.Text = "AI助手";
|
||||
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lblUser
|
||||
//
|
||||
this.lblUser.AutoSize = true;
|
||||
this.lblUser.Font = new System.Drawing.Font("微软雅黑", 13F);
|
||||
this.lblUser.Location = new System.Drawing.Point(80, 85);
|
||||
this.lblUser.Name = "lblUser";
|
||||
this.lblUser.Size = new System.Drawing.Size(63, 20);
|
||||
this.lblUser.TabIndex = 1;
|
||||
this.lblUser.Text = "用户名:";
|
||||
//
|
||||
// txtUsername
|
||||
//
|
||||
this.txtUsername.Font = new System.Drawing.Font("微软雅黑", 13F);
|
||||
this.txtUsername.Location = new System.Drawing.Point(160, 80);
|
||||
this.txtUsername.Name = "txtUsername";
|
||||
this.txtUsername.Size = new System.Drawing.Size(220, 27);
|
||||
this.txtUsername.TabIndex = 2;
|
||||
this.txtUsername.Text = "huanghai";
|
||||
//
|
||||
// lblPass
|
||||
//
|
||||
this.lblPass.AutoSize = true;
|
||||
this.lblPass.Font = new System.Drawing.Font("微软雅黑", 13F);
|
||||
this.lblPass.Location = new System.Drawing.Point(80, 145);
|
||||
this.lblPass.Name = "lblPass";
|
||||
this.lblPass.Size = new System.Drawing.Size(58, 20);
|
||||
this.lblPass.TabIndex = 3;
|
||||
this.lblPass.Text = "密 码:";
|
||||
//
|
||||
// txtPassword
|
||||
//
|
||||
this.txtPassword.Font = new System.Drawing.Font("微软雅黑", 13F);
|
||||
this.txtPassword.Location = new System.Drawing.Point(160, 140);
|
||||
this.txtPassword.Name = "txtPassword";
|
||||
this.txtPassword.PasswordChar = '●';
|
||||
this.txtPassword.Size = new System.Drawing.Size(220, 27);
|
||||
this.txtPassword.TabIndex = 4;
|
||||
this.txtPassword.Text = "12345678";
|
||||
//
|
||||
// btnLogin
|
||||
//
|
||||
this.btnLogin.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(43)))), ((int)(((byte)(87)))), ((int)(((byte)(154)))));
|
||||
this.btnLogin.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnLogin.FlatAppearance.BorderSize = 0;
|
||||
this.btnLogin.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnLogin.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold);
|
||||
this.btnLogin.ForeColor = System.Drawing.Color.White;
|
||||
this.btnLogin.Location = new System.Drawing.Point(110, 220);
|
||||
this.btnLogin.Name = "btnLogin";
|
||||
this.btnLogin.Size = new System.Drawing.Size(120, 40);
|
||||
this.btnLogin.TabIndex = 5;
|
||||
this.btnLogin.Text = "立即登录";
|
||||
this.btnLogin.UseVisualStyleBackColor = false;
|
||||
this.btnLogin.Click += new System.EventHandler(this.BtnLogin_Click);
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnCancel.Location = new System.Drawing.Point(250, 220);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(120, 40);
|
||||
this.btnCancel.TabIndex = 6;
|
||||
this.btnCancel.Text = "取消";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// LoginForm
|
||||
//
|
||||
this.AcceptButton = this.btnLogin;
|
||||
// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.Font = new System.Drawing.Font("Microsoft YaHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.CancelButton = this.btnCancel;
|
||||
this.ClientSize = new System.Drawing.Size(500, 320);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.btnLogin);
|
||||
this.Controls.Add(this.txtPassword);
|
||||
this.Controls.Add(this.lblPass);
|
||||
this.Controls.Add(this.txtUsername);
|
||||
this.Controls.Add(this.lblUser);
|
||||
this.Controls.Add(this.lblTitle);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "LoginForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "AI助手 - 用户登录";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录按钮点击事件。
|
||||
/// 验证用户名和密码。
|
||||
/// </summary>
|
||||
private async void BtnLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
string user = txtUsername.Text.Trim();
|
||||
string pass = txtPassword.Text.Trim();
|
||||
|
||||
if (string.IsNullOrEmpty(user) || string.IsNullOrEmpty(pass))
|
||||
{
|
||||
MessageBox.Show("请输入用户名和密码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
btnLogin.Enabled = false;
|
||||
btnLogin.Text = "登录中...";
|
||||
|
||||
try
|
||||
{
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
// 指向本地 FastAPI 后端
|
||||
string url = $"{Config.BackendBaseUrl}/token";
|
||||
|
||||
var content = new FormUrlEncodedContent(new[]
|
||||
{
|
||||
new KeyValuePair<string, string>("username", user),
|
||||
new KeyValuePair<string, string>("password", pass),
|
||||
new KeyValuePair<string, string>("grant_type", "password")
|
||||
});
|
||||
|
||||
var response = await client.PostAsync(url, content);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string jsonResponse = await response.Content.ReadAsStringAsync();
|
||||
var json = JObject.Parse(jsonResponse);
|
||||
this.Token = json["access_token"]?.ToString();
|
||||
|
||||
if (!string.IsNullOrEmpty(this.Token))
|
||||
{
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("登录失败:未能获取有效的 Token。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errorDetail = await response.Content.ReadAsStringAsync();
|
||||
MessageBox.Show($"登录失败:{response.ReasonPhrase}\n{errorDetail}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"连接服务器失败:{ex.Message}\n请确保后端服务已启动 (http://127.0.0.1:8000)", "网络错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (!this.IsDisposed)
|
||||
{
|
||||
btnLogin.Enabled = true;
|
||||
btnLogin.Text = "立即登录";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,219 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WordAddIn.Models
|
||||
{
|
||||
// ==========================================
|
||||
// Chat Completion API 模型定义
|
||||
// 用于与 OpenAI / Gemini 兼容的聊天接口交互
|
||||
// ==========================================
|
||||
|
||||
/// <summary>
|
||||
/// 聊天补全请求对象
|
||||
/// </summary>
|
||||
public class ChatCompletionRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 模型名称 (e.g., "gpt-3.5-turbo", "gemini-3-flash")
|
||||
/// </summary>
|
||||
public string model { get; set; } = "gpt-3.5-turbo";
|
||||
|
||||
/// <summary>
|
||||
/// 消息列表,包含 system, user, assistant 等角色的消息
|
||||
/// </summary>
|
||||
public List<Message> messages { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 温度参数,控制生成的随机性 (0.0 - 1.0)
|
||||
/// 较高值使输出更随机,较低值使输出更确定
|
||||
/// </summary>
|
||||
public double temperature { get; set; } = 0.7;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 聊天消息对象
|
||||
/// </summary>
|
||||
public class Message
|
||||
{
|
||||
/// <summary>
|
||||
/// 角色: system, user, assistant
|
||||
/// </summary>
|
||||
public string role { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消息内容
|
||||
/// </summary>
|
||||
public string content { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 聊天补全响应对象
|
||||
/// </summary>
|
||||
public class ChatCompletionResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 响应 ID
|
||||
/// </summary>
|
||||
public string id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生成的选择列表 (通常只取第一个)
|
||||
/// </summary>
|
||||
public List<Choice> choices { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成结果选项
|
||||
/// </summary>
|
||||
public class Choice
|
||||
{
|
||||
/// <summary>
|
||||
/// 生成的消息内容
|
||||
/// </summary>
|
||||
public Message message { get; set; }
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// Image Generation API 模型定义
|
||||
// 用于与 DALL-E / Gemini Image 接口交互
|
||||
// ==========================================
|
||||
|
||||
/// <summary>
|
||||
/// 图片生成请求对象
|
||||
/// </summary>
|
||||
public class ImageGenerationRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 模型名称
|
||||
/// </summary>
|
||||
public string model { get; set; } = "dall-e-3";
|
||||
|
||||
/// <summary>
|
||||
/// 绘图提示词
|
||||
/// </summary>
|
||||
public string prompt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生成数量 (DALL-E 3 通常限制为 1)
|
||||
/// </summary>
|
||||
public int n { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 图片尺寸 (e.g., "1024x1024")
|
||||
/// </summary>
|
||||
public string size { get; set; } = "1024x1024";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图片生成响应对象
|
||||
/// </summary>
|
||||
public class ImageGenerationResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 生成的数据列表
|
||||
/// </summary>
|
||||
public List<ImageItem> data { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图片数据项
|
||||
/// </summary>
|
||||
public class ImageItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 图片 URL
|
||||
/// </summary>
|
||||
public string url { get; set; }
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// 业务逻辑模型定义
|
||||
// 用于大纲生成和样式配置
|
||||
// ==========================================
|
||||
|
||||
/// <summary>
|
||||
/// 大纲条目
|
||||
/// 用于接收 AI 生成的结构化大纲数据
|
||||
/// </summary>
|
||||
public class OutlineItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 标题文本
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标题层级
|
||||
/// 0: 主标题
|
||||
/// 1: 一级标题
|
||||
/// 2: 二级标题
|
||||
/// 3: 三级标题
|
||||
/// </summary>
|
||||
public int Level { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 大纲样式配置集合
|
||||
/// 存储各级标题的样式设置
|
||||
/// </summary>
|
||||
public class OutlineStyleConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// 主标题样式
|
||||
/// </summary>
|
||||
public TextStyle MainTitle { get; set; } = new TextStyle { FontSize = 22, IsBold = true, FontName = "微软雅黑", Alignment = 1 }; // 默认为居中
|
||||
|
||||
/// <summary>
|
||||
/// 一级标题样式
|
||||
/// </summary>
|
||||
public TextStyle Heading1 { get; set; } = new TextStyle { FontSize = 16, IsBold = true, FontName = "黑体" };
|
||||
|
||||
/// <summary>
|
||||
/// 二级标题样式
|
||||
/// </summary>
|
||||
public TextStyle Heading2 { get; set; } = new TextStyle { FontSize = 14, IsBold = true, FontName = "黑体" };
|
||||
|
||||
/// <summary>
|
||||
/// 三级标题样式
|
||||
/// </summary>
|
||||
public TextStyle Heading3 { get; set; } = new TextStyle { FontSize = 12, IsBold = true, FontName = "宋体" };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 文本样式定义
|
||||
/// </summary>
|
||||
public class TextStyle
|
||||
{
|
||||
/// <summary>
|
||||
/// 字体名称
|
||||
/// </summary>
|
||||
public string FontName { get; set; } = "宋体";
|
||||
|
||||
/// <summary>
|
||||
/// 字号 (磅值)
|
||||
/// </summary>
|
||||
public float FontSize { get; set; } = 12;
|
||||
|
||||
/// <summary>
|
||||
/// 是否加粗
|
||||
/// </summary>
|
||||
public bool IsBold { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 对齐方式
|
||||
/// 0: 左对齐
|
||||
/// 1: 居中
|
||||
/// 2: 右对齐
|
||||
/// </summary>
|
||||
public int Alignment { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 字体颜色 (Word WdColor 枚举值)
|
||||
/// 默认值为黑色 (wdColorBlack = -16777216, but usually 0 or auto)
|
||||
/// 在 Word Interop 中,wdColorBlack = 0 (0x000000)
|
||||
/// wdColorAutomatic = -16777216 (0xFF000000)
|
||||
/// 我们存储 int 值。
|
||||
/// </summary>
|
||||
public int Color { get; set; } = 0; // 0 = Black
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WordAddIn
|
||||
{
|
||||
/// <summary>
|
||||
/// 大纲总结结果展示窗体。
|
||||
/// 功能描述:
|
||||
/// 1. 展示 AI 生成的大纲总结内容。
|
||||
/// 2. 提供一键复制到剪贴板功能,方便后续生成架构图使用。
|
||||
/// </summary>
|
||||
public class OutlineResultForm : Form
|
||||
{
|
||||
public string ResultText { get; private set; }
|
||||
|
||||
private TextBox txtResult;
|
||||
private Button btnCopy;
|
||||
private Button btnClose;
|
||||
private Label lblHint;
|
||||
|
||||
public OutlineResultForm(string text)
|
||||
{
|
||||
ResultText = text;
|
||||
InitializeComponent();
|
||||
txtResult.Text = text;
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.lblHint = new System.Windows.Forms.Label();
|
||||
this.txtResult = new System.Windows.Forms.TextBox();
|
||||
this.btnCopy = new System.Windows.Forms.Button();
|
||||
this.btnClose = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lblHint
|
||||
//
|
||||
this.lblHint.AutoSize = true;
|
||||
this.lblHint.Location = new System.Drawing.Point(20, 15);
|
||||
this.lblHint.Name = "lblHint";
|
||||
this.lblHint.Size = new System.Drawing.Size(400, 12);
|
||||
this.lblHint.TabIndex = 0;
|
||||
this.lblHint.Text = "AI 已将内容总结为以下大纲。请点击“复制”按钮,以便后续生成架构图。";
|
||||
//
|
||||
// txtResult
|
||||
//
|
||||
this.txtResult.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtResult.Location = new System.Drawing.Point(20, 40);
|
||||
this.txtResult.Multiline = true;
|
||||
this.txtResult.Name = "txtResult";
|
||||
this.txtResult.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.txtResult.Size = new System.Drawing.Size(540, 350);
|
||||
this.txtResult.TabIndex = 1;
|
||||
//
|
||||
// btnCopy
|
||||
//
|
||||
this.btnCopy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnCopy.Location = new System.Drawing.Point(360, 410);
|
||||
this.btnCopy.Name = "btnCopy";
|
||||
this.btnCopy.Size = new System.Drawing.Size(100, 30);
|
||||
this.btnCopy.TabIndex = 2;
|
||||
this.btnCopy.Text = "复制到剪贴板";
|
||||
this.btnCopy.UseVisualStyleBackColor = true;
|
||||
this.btnCopy.Click += new System.EventHandler(this.btnCopy_Click);
|
||||
//
|
||||
// btnClose
|
||||
//
|
||||
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnClose.Location = new System.Drawing.Point(480, 410);
|
||||
this.btnClose.Name = "btnClose";
|
||||
this.btnClose.Size = new System.Drawing.Size(80, 30);
|
||||
this.btnClose.TabIndex = 3;
|
||||
this.btnClose.Text = "关闭";
|
||||
this.btnClose.UseVisualStyleBackColor = true;
|
||||
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
|
||||
//
|
||||
// OutlineResultForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.Font = new System.Drawing.Font("Microsoft YaHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.ClientSize = new System.Drawing.Size(584, 461);
|
||||
this.Controls.Add(this.btnClose);
|
||||
this.Controls.Add(this.btnCopy);
|
||||
this.Controls.Add(this.txtResult);
|
||||
this.Controls.Add(this.lblHint);
|
||||
this.Name = "OutlineResultForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "大纲总结结果";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
}
|
||||
|
||||
private void btnCopy_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(txtResult.Text))
|
||||
{
|
||||
Clipboard.SetText(txtResult.Text);
|
||||
MessageBox.Show("大纲内容已复制到剪贴板!\n现在您可以去使用“生成配图”功能,选择“逻辑架构图”风格来生成架构图了。", "复制成功");
|
||||
}
|
||||
}
|
||||
|
||||
private void btnClose_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,184 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using WordAddIn.Models;
|
||||
using WordAddIn.Properties;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace WordAddIn
|
||||
{
|
||||
/// <summary>
|
||||
/// 大纲样式配置窗体。
|
||||
/// 功能描述:
|
||||
/// 1. 允许用户为大纲的不同层级(主标题、一级目录、二级目录、三级目录)配置样式。
|
||||
/// 2. 使用 TabControl 组织不同层级的样式编辑器(StyleEditorControl)。
|
||||
/// 3. 支持保存配置到本地设置(Settings.Default.OutlineStyles)和加载已有配置。
|
||||
/// </summary>
|
||||
public class OutlineSettingsForm : Form
|
||||
{
|
||||
private TabControl tabControl;
|
||||
private Button btnSave;
|
||||
private Button btnCancel;
|
||||
|
||||
private StyleEditorControl mainTitleEditor;
|
||||
private StyleEditorControl h1Editor;
|
||||
private StyleEditorControl h2Editor;
|
||||
private StyleEditorControl h3Editor;
|
||||
|
||||
public OutlineSettingsForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeCustomControls();
|
||||
LoadSettings();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化基本窗体组件。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tabControl = new System.Windows.Forms.TabControl();
|
||||
this.btnSave = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tabControl
|
||||
//
|
||||
this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tabControl.Location = new System.Drawing.Point(12, 12);
|
||||
this.tabControl.Name = "tabControl";
|
||||
this.tabControl.SelectedIndex = 0;
|
||||
this.tabControl.Size = new System.Drawing.Size(410, 280);
|
||||
this.tabControl.TabIndex = 0;
|
||||
//
|
||||
// btnSave
|
||||
//
|
||||
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnSave.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.btnSave.Location = new System.Drawing.Point(210, 310);
|
||||
this.btnSave.Name = "btnSave";
|
||||
this.btnSave.Size = new System.Drawing.Size(100, 35);
|
||||
this.btnSave.TabIndex = 1;
|
||||
this.btnSave.Text = "保存配置";
|
||||
this.btnSave.UseVisualStyleBackColor = true;
|
||||
this.btnSave.Click += new System.EventHandler(this.BtnSave_Click);
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCancel.Location = new System.Drawing.Point(320, 310);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(100, 35);
|
||||
this.btnCancel.TabIndex = 2;
|
||||
this.btnCancel.Text = "取消";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// OutlineSettingsForm
|
||||
//
|
||||
this.AcceptButton = this.btnSave;
|
||||
// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.Font = new System.Drawing.Font("Microsoft YaHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.CancelButton = this.btnCancel;
|
||||
this.ClientSize = new System.Drawing.Size(450, 360);
|
||||
this.MinimumSize = new System.Drawing.Size(350, 300);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.btnSave);
|
||||
this.Controls.Add(this.tabControl);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
|
||||
this.MaximizeBox = true;
|
||||
this.MinimizeBox = true;
|
||||
this.Name = "OutlineSettingsForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "大纲样式配置";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化自定义样式编辑器控件,并添加到 Tab 页中。
|
||||
/// </summary>
|
||||
private void InitializeCustomControls()
|
||||
{
|
||||
mainTitleEditor = new StyleEditorControl("主标题", true);
|
||||
h1Editor = new StyleEditorControl("一级目录", false);
|
||||
h2Editor = new StyleEditorControl("二级目录", false);
|
||||
h3Editor = new StyleEditorControl("三级目录", false);
|
||||
|
||||
AddTab("主标题", mainTitleEditor);
|
||||
AddTab("一级目录", h1Editor);
|
||||
AddTab("二级目录", h2Editor);
|
||||
AddTab("三级目录", h3Editor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 辅助方法:添加一个新的 Tab 页。
|
||||
/// </summary>
|
||||
private void AddTab(string title, Control content)
|
||||
{
|
||||
TabPage page = new TabPage(title);
|
||||
content.Dock = DockStyle.Fill;
|
||||
page.Controls.Add(content);
|
||||
tabControl.TabPages.Add(page);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从 Settings 中加载保存的样式配置。
|
||||
/// </summary>
|
||||
private void LoadSettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
string json = Settings.Default.OutlineStyles;
|
||||
OutlineStyleConfig config = null;
|
||||
|
||||
if (!string.IsNullOrEmpty(json))
|
||||
{
|
||||
config = JsonConvert.DeserializeObject<OutlineStyleConfig>(json);
|
||||
}
|
||||
|
||||
if (config == null)
|
||||
{
|
||||
config = new OutlineStyleConfig(); // Use defaults
|
||||
}
|
||||
|
||||
mainTitleEditor.SetStyle(config.MainTitle);
|
||||
h1Editor.SetStyle(config.Heading1);
|
||||
h2Editor.SetStyle(config.Heading2);
|
||||
h3Editor.SetStyle(config.Heading3);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("加载配置失败: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存按钮点击事件。
|
||||
/// 将当前配置序列化为 JSON 并保存到 Settings。
|
||||
/// </summary>
|
||||
private void BtnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
OutlineStyleConfig config = new OutlineStyleConfig();
|
||||
config.MainTitle = mainTitleEditor.GetStyle();
|
||||
config.Heading1 = h1Editor.GetStyle();
|
||||
config.Heading2 = h2Editor.GetStyle();
|
||||
config.Heading3 = h3Editor.GetStyle();
|
||||
|
||||
string json = JsonConvert.SerializeObject(config);
|
||||
Settings.Default.OutlineStyles = json;
|
||||
Settings.Default.Save();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("保存配置失败: " + ex.Message);
|
||||
this.DialogResult = DialogResult.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("WordAddIn")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("WordAddIn")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2026")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//将 ComVisible 设置为 false 将使此程序集中的类型
|
||||
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("9113a477-5db3-40e1-bcb5-536bba10d35d")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”: :
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
62
WordAddIn/WordAddIn/Properties/Resources.Designer.cs
generated
62
WordAddIn/WordAddIn/Properties/Resources.Designer.cs
generated
@@ -1,62 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WordAddIn.Properties {
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WordAddIn.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
98
WordAddIn/WordAddIn/Properties/Settings.Designer.cs
generated
98
WordAddIn/WordAddIn/Properties/Settings.Designer.cs
generated
@@ -1,98 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WordAddIn.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("微软雅黑")]
|
||||
public string FormatFontName {
|
||||
get {
|
||||
return ((string)(this["FormatFontName"]));
|
||||
}
|
||||
set {
|
||||
this["FormatFontName"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("12")]
|
||||
public float FormatFontSize {
|
||||
get {
|
||||
return ((float)(this["FormatFontSize"]));
|
||||
}
|
||||
set {
|
||||
this["FormatFontSize"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("1.5")]
|
||||
public float FormatLineSpacing {
|
||||
get {
|
||||
return ((float)(this["FormatLineSpacing"]));
|
||||
}
|
||||
set {
|
||||
this["FormatLineSpacing"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("写实摄影 (Photorealistic)")]
|
||||
public string LastImageStyle {
|
||||
get {
|
||||
return ((string)(this["LastImageStyle"]));
|
||||
}
|
||||
set {
|
||||
this["LastImageStyle"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string OutlineStyles {
|
||||
get {
|
||||
return ((string)(this["OutlineStyles"]));
|
||||
}
|
||||
set {
|
||||
this["OutlineStyles"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("qwen-plus")]
|
||||
public string SelectedModel {
|
||||
get {
|
||||
return ((string)(this["SelectedModel"]));
|
||||
}
|
||||
set {
|
||||
this["SelectedModel"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="WordAddIn.Properties" GeneratedClassName="Settings">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings>
|
||||
<Setting Name="FormatFontName" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">微软雅黑</Value>
|
||||
</Setting>
|
||||
<Setting Name="FormatFontSize" Type="System.Single" Scope="User">
|
||||
<Value Profile="(Default)">12</Value>
|
||||
</Setting>
|
||||
<Setting Name="FormatLineSpacing" Type="System.Single" Scope="User">
|
||||
<Value Profile="(Default)">1.5</Value>
|
||||
</Setting>
|
||||
<Setting Name="LastImageStyle" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">写实摄影 (Photorealistic)</Value>
|
||||
</Setting>
|
||||
<Setting Name="OutlineStyles" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="SelectedModel" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">qwen-plus</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@@ -1,328 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
||||
namespace WordAddIn
|
||||
{
|
||||
/// <summary>
|
||||
/// 素材写作(参考生成)配置窗体。
|
||||
/// 功能描述:
|
||||
/// 1. 允许用户提供参考素材,用于辅助 AI 生成内容。
|
||||
/// 2. 支持两种输入模式:上传文件 (Word/Txt) 或 直接输入文本。
|
||||
/// 3. 允许用户设置生成内容的字数上限。
|
||||
/// </summary>
|
||||
public class ReferenceGeneratorForm : Form
|
||||
{
|
||||
private TabControl tabControl;
|
||||
private TabPage tabText;
|
||||
private TabPage tabFile;
|
||||
private RichTextBox txtReferenceInput;
|
||||
private TextBox txtFilePath;
|
||||
private Button btnBrowse;
|
||||
private NumericUpDown numWordCount;
|
||||
private Button btnGenerate;
|
||||
private Button btnCancel;
|
||||
private Label lblFileTip;
|
||||
private Label lblWordCount;
|
||||
private Label lblWordUnit;
|
||||
|
||||
/// <summary>
|
||||
/// 获取直接输入的参考文本内容。
|
||||
/// </summary>
|
||||
public string ReferenceContent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户设置的字数上限。
|
||||
/// </summary>
|
||||
public int WordLimit { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 指示是否选择了文件模式。
|
||||
/// </summary>
|
||||
public bool IsFileMode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户选择的文件路径。
|
||||
/// </summary>
|
||||
public string SelectedFilePath { get; private set; }
|
||||
|
||||
public ReferenceGeneratorForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化窗体组件。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tabControl = new System.Windows.Forms.TabControl();
|
||||
this.tabFile = new System.Windows.Forms.TabPage();
|
||||
this.lblFileTip = new System.Windows.Forms.Label();
|
||||
this.txtFilePath = new System.Windows.Forms.TextBox();
|
||||
this.btnBrowse = new System.Windows.Forms.Button();
|
||||
this.tabText = new System.Windows.Forms.TabPage();
|
||||
this.txtReferenceInput = new System.Windows.Forms.RichTextBox();
|
||||
this.lblWordCount = new System.Windows.Forms.Label();
|
||||
this.numWordCount = new System.Windows.Forms.NumericUpDown();
|
||||
this.lblWordUnit = new System.Windows.Forms.Label();
|
||||
this.btnGenerate = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.tabControl.SuspendLayout();
|
||||
this.tabFile.SuspendLayout();
|
||||
this.tabText.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numWordCount)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tabControl
|
||||
//
|
||||
this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tabControl.Controls.Add(this.tabFile);
|
||||
this.tabControl.Controls.Add(this.tabText);
|
||||
this.tabControl.Font = new System.Drawing.Font("微软雅黑", 13F);
|
||||
this.tabControl.Location = new System.Drawing.Point(25, 25);
|
||||
this.tabControl.Name = "tabControl";
|
||||
this.tabControl.SelectedIndex = 0;
|
||||
this.tabControl.Size = new System.Drawing.Size(585, 300);
|
||||
this.tabControl.TabIndex = 0;
|
||||
//
|
||||
// tabFile
|
||||
//
|
||||
this.tabFile.BackColor = System.Drawing.Color.White;
|
||||
this.tabFile.Controls.Add(this.lblFileTip);
|
||||
this.tabFile.Controls.Add(this.txtFilePath);
|
||||
this.tabFile.Controls.Add(this.btnBrowse);
|
||||
this.tabFile.Location = new System.Drawing.Point(4, 29);
|
||||
this.tabFile.Name = "tabFile";
|
||||
this.tabFile.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabFile.Size = new System.Drawing.Size(577, 267);
|
||||
this.tabFile.TabIndex = 0;
|
||||
this.tabFile.Text = "上传文档";
|
||||
//
|
||||
// lblFileTip
|
||||
//
|
||||
this.lblFileTip.AutoSize = true;
|
||||
this.lblFileTip.Font = new System.Drawing.Font("微软雅黑", 14F);
|
||||
this.lblFileTip.Location = new System.Drawing.Point(30, 60);
|
||||
this.lblFileTip.Name = "lblFileTip";
|
||||
this.lblFileTip.Size = new System.Drawing.Size(255, 21);
|
||||
this.lblFileTip.TabIndex = 0;
|
||||
this.lblFileTip.Text = "请选择参考文档 (支持 Word/Txt):";
|
||||
//
|
||||
// txtFilePath
|
||||
//
|
||||
this.txtFilePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtFilePath.Font = new System.Drawing.Font("微软雅黑", 13F);
|
||||
this.txtFilePath.Location = new System.Drawing.Point(30, 100);
|
||||
this.txtFilePath.Name = "txtFilePath";
|
||||
this.txtFilePath.ReadOnly = true;
|
||||
this.txtFilePath.Size = new System.Drawing.Size(400, 27);
|
||||
this.txtFilePath.TabIndex = 1;
|
||||
//
|
||||
// btnBrowse
|
||||
//
|
||||
this.btnBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnBrowse.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnBrowse.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnBrowse.Location = new System.Drawing.Point(440, 98);
|
||||
this.btnBrowse.Name = "btnBrowse";
|
||||
this.btnBrowse.Size = new System.Drawing.Size(100, 35);
|
||||
this.btnBrowse.TabIndex = 2;
|
||||
this.btnBrowse.Text = "浏览...";
|
||||
this.btnBrowse.UseVisualStyleBackColor = true;
|
||||
this.btnBrowse.Click += new System.EventHandler(this.BtnBrowse_Click);
|
||||
//
|
||||
// tabText
|
||||
//
|
||||
this.tabText.BackColor = System.Drawing.Color.White;
|
||||
this.tabText.Controls.Add(this.txtReferenceInput);
|
||||
this.tabText.Location = new System.Drawing.Point(4, 29);
|
||||
this.tabText.Name = "tabText";
|
||||
this.tabText.Padding = new System.Windows.Forms.Padding(10);
|
||||
this.tabText.Size = new System.Drawing.Size(577, 267);
|
||||
this.tabText.TabIndex = 1;
|
||||
this.tabText.Text = "直接输入";
|
||||
//
|
||||
// txtReferenceInput
|
||||
//
|
||||
this.txtReferenceInput.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.txtReferenceInput.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtReferenceInput.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.txtReferenceInput.Font = new System.Drawing.Font("微软雅黑", 13F);
|
||||
this.txtReferenceInput.Location = new System.Drawing.Point(10, 10);
|
||||
this.txtReferenceInput.Name = "txtReferenceInput";
|
||||
this.txtReferenceInput.Size = new System.Drawing.Size(557, 247);
|
||||
this.txtReferenceInput.TabIndex = 0;
|
||||
this.txtReferenceInput.Text = "";
|
||||
//
|
||||
// lblWordCount
|
||||
//
|
||||
this.lblWordCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lblWordCount.AutoSize = true;
|
||||
this.lblWordCount.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Bold);
|
||||
this.lblWordCount.Location = new System.Drawing.Point(30, 355);
|
||||
this.lblWordCount.Name = "lblWordCount";
|
||||
this.lblWordCount.Size = new System.Drawing.Size(117, 22);
|
||||
this.lblWordCount.TabIndex = 1;
|
||||
this.lblWordCount.Text = "生成字数上限:";
|
||||
//
|
||||
// numWordCount
|
||||
//
|
||||
this.numWordCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.numWordCount.Font = new System.Drawing.Font("微软雅黑", 16F);
|
||||
this.numWordCount.Increment = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numWordCount.Location = new System.Drawing.Point(200, 350);
|
||||
this.numWordCount.Maximum = new decimal(new int[] {
|
||||
10000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numWordCount.Minimum = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numWordCount.Name = "numWordCount";
|
||||
this.numWordCount.Size = new System.Drawing.Size(120, 32);
|
||||
this.numWordCount.TabIndex = 2;
|
||||
this.numWordCount.Value = new decimal(new int[] {
|
||||
500,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// lblWordUnit
|
||||
//
|
||||
this.lblWordUnit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lblWordUnit.AutoSize = true;
|
||||
this.lblWordUnit.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.lblWordUnit.Location = new System.Drawing.Point(330, 355);
|
||||
this.lblWordUnit.Name = "lblWordUnit";
|
||||
this.lblWordUnit.Size = new System.Drawing.Size(26, 21);
|
||||
this.lblWordUnit.TabIndex = 3;
|
||||
this.lblWordUnit.Text = "字";
|
||||
//
|
||||
// btnGenerate
|
||||
//
|
||||
this.btnGenerate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnGenerate.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(43)))), ((int)(((byte)(87)))), ((int)(((byte)(154)))));
|
||||
this.btnGenerate.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnGenerate.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.btnGenerate.FlatAppearance.BorderSize = 0;
|
||||
this.btnGenerate.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnGenerate.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold);
|
||||
this.btnGenerate.ForeColor = System.Drawing.Color.White;
|
||||
this.btnGenerate.Location = new System.Drawing.Point(160, 410);
|
||||
this.btnGenerate.Name = "btnGenerate";
|
||||
this.btnGenerate.Size = new System.Drawing.Size(140, 45);
|
||||
this.btnGenerate.TabIndex = 4;
|
||||
this.btnGenerate.Text = "开始生成";
|
||||
this.btnGenerate.UseVisualStyleBackColor = false;
|
||||
this.btnGenerate.Click += new System.EventHandler(this.BtnGenerate_Click);
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnCancel.Location = new System.Drawing.Point(320, 410);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(140, 45);
|
||||
this.btnCancel.TabIndex = 5;
|
||||
this.btnCancel.Text = "取消";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// ReferenceGeneratorForm
|
||||
//
|
||||
this.AcceptButton = this.btnGenerate;
|
||||
// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.Font = new System.Drawing.Font("Microsoft YaHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.CancelButton = this.btnCancel;
|
||||
this.ClientSize = new System.Drawing.Size(650, 520);
|
||||
this.MinimumSize = new System.Drawing.Size(500, 400);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.btnGenerate);
|
||||
this.Controls.Add(this.lblWordUnit);
|
||||
this.Controls.Add(this.numWordCount);
|
||||
this.Controls.Add(this.lblWordCount);
|
||||
this.Controls.Add(this.tabControl);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
|
||||
this.MaximizeBox = true;
|
||||
this.MinimizeBox = true;
|
||||
this.Name = "ReferenceGeneratorForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "素材写作 - AI助手";
|
||||
this.tabControl.ResumeLayout(false);
|
||||
this.tabFile.ResumeLayout(false);
|
||||
this.tabFile.PerformLayout();
|
||||
this.tabText.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.numWordCount)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 浏览按钮点击事件。
|
||||
/// 打开文件选择对话框,选择参考文档。
|
||||
/// </summary>
|
||||
private void BtnBrowse_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (OpenFileDialog ofd = new OpenFileDialog())
|
||||
{
|
||||
ofd.Filter = "Word 文档 (*.docx;*.doc)|*.docx;*.doc|文本文件 (*.txt)|*.txt|所有文件 (*.*)|*.*";
|
||||
ofd.Title = "选择参考文档";
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
txtFilePath.Text = ofd.FileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成按钮点击事件。
|
||||
/// 验证输入有效性,并保存用户的选择。
|
||||
/// </summary>
|
||||
private void BtnGenerate_Click(object sender, EventArgs e)
|
||||
{
|
||||
WordLimit = (int)numWordCount.Value;
|
||||
|
||||
if (tabControl.SelectedTab == tabFile)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(txtFilePath.Text) || !File.Exists(txtFilePath.Text))
|
||||
{
|
||||
MessageBox.Show("请选择有效的参考文档。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
IsFileMode = true;
|
||||
SelectedFilePath = txtFilePath.Text;
|
||||
ReferenceContent = null; // 由调用方读取
|
||||
}
|
||||
else
|
||||
{
|
||||
string text = txtReferenceInput.Text.Trim();
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
MessageBox.Show("请输入参考文本内容。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
IsFileMode = false;
|
||||
ReferenceContent = text;
|
||||
}
|
||||
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using WordAddIn.Models;
|
||||
|
||||
namespace WordAddIn
|
||||
{
|
||||
/// <summary>
|
||||
/// 样式编辑器控件。
|
||||
/// 功能描述:
|
||||
/// 1. 提供可复用的用户界面,用于配置文本样式(字体、字号、加粗、对齐方式)。
|
||||
/// 2. 封装了 WinForms 控件(ComboBox, NumericUpDown, CheckBox),简化样式设置。
|
||||
/// 3. 支持数据绑定:SetStyle() 设置界面状态,GetStyle() 获取用户配置。
|
||||
/// </summary>
|
||||
public class StyleEditorControl : UserControl
|
||||
{
|
||||
private ComboBox cmbFont;
|
||||
private NumericUpDown numSize;
|
||||
private CheckBox chkBold;
|
||||
private ComboBox cmbAlign;
|
||||
private Button btnColor; // 颜色选择按钮
|
||||
private Panel pnlColorPreview; // 颜色预览面板
|
||||
private int _selectedColor = 0; // 存储选中的颜色值 (Word WdColor)
|
||||
|
||||
private bool _showAlign;
|
||||
|
||||
/// <summary>
|
||||
/// 默认构造函数 (设计器支持)。
|
||||
/// </summary>
|
||||
public StyleEditorControl()
|
||||
{
|
||||
// Default constructor for designer support
|
||||
_showAlign = false;
|
||||
Initialize("样式");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 带参数的构造函数。
|
||||
/// </summary>
|
||||
/// <param name="labelText">分组标题文本 (如 "一级目录")</param>
|
||||
/// <param name="showAlign">是否显示对齐方式选项</param>
|
||||
public StyleEditorControl(string labelText, bool showAlign)
|
||||
{
|
||||
_showAlign = showAlign;
|
||||
Initialize(labelText);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化控件界面。
|
||||
/// </summary>
|
||||
/// <param name="labelText">分组标题</param>
|
||||
private void Initialize(string labelText)
|
||||
{
|
||||
this.Padding = new Padding(20);
|
||||
this.Size = new Size(380, 200); // Set a default size
|
||||
|
||||
// 字体选择
|
||||
Label lblFont = new Label { Text = "字体:", Location = new Point(20, 30), AutoSize = true };
|
||||
cmbFont = new ComboBox { Location = new Point(80, 27), Width = 150, DropDownStyle = ComboBoxStyle.DropDownList };
|
||||
// Add common Chinese fonts
|
||||
cmbFont.Items.AddRange(new object[] { "宋体", "黑体", "微软雅黑", "楷体", "仿宋", "Arial", "Times New Roman" });
|
||||
cmbFont.SelectedIndex = 0;
|
||||
|
||||
// 字号选择
|
||||
Label lblSize = new Label { Text = "字号:", Location = new Point(20, 70), AutoSize = true };
|
||||
numSize = new NumericUpDown { Location = new Point(80, 67), Width = 80, Minimum = 5, Maximum = 72, DecimalPlaces = 1 };
|
||||
|
||||
// 加粗选项
|
||||
chkBold = new CheckBox { Text = "加粗", Location = new Point(80, 110), AutoSize = true };
|
||||
|
||||
this.Controls.Add(lblFont);
|
||||
this.Controls.Add(cmbFont);
|
||||
this.Controls.Add(lblSize);
|
||||
this.Controls.Add(numSize);
|
||||
this.Controls.Add(chkBold);
|
||||
|
||||
// 颜色选择
|
||||
Label lblColor = new Label { Text = "颜色:", Location = new Point(180, 67), AutoSize = true };
|
||||
btnColor = new Button { Text = "选择...", Location = new Point(220, 63), Width = 60, Height = 25 };
|
||||
pnlColorPreview = new Panel { Location = new Point(290, 65), Width = 20, Height = 20, BorderStyle = BorderStyle.FixedSingle, BackColor = Color.Black };
|
||||
|
||||
btnColor.Click += BtnColor_Click;
|
||||
|
||||
this.Controls.Add(lblColor);
|
||||
this.Controls.Add(btnColor);
|
||||
this.Controls.Add(pnlColorPreview);
|
||||
|
||||
// 对齐方式 (可选)
|
||||
if (_showAlign)
|
||||
{
|
||||
Label lblAlign = new Label { Text = "对齐:", Location = new Point(20, 150), AutoSize = true };
|
||||
cmbAlign = new ComboBox { Location = new Point(80, 147), Width = 100, DropDownStyle = ComboBoxStyle.DropDownList };
|
||||
cmbAlign.Items.AddRange(new object[] { "左对齐", "居中", "右对齐" });
|
||||
cmbAlign.SelectedIndex = 0;
|
||||
|
||||
this.Controls.Add(lblAlign);
|
||||
this.Controls.Add(cmbAlign);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnColor_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (ColorDialog colorDialog = new ColorDialog())
|
||||
{
|
||||
// Set initial color based on current selection
|
||||
colorDialog.Color = pnlColorPreview.BackColor;
|
||||
|
||||
if (colorDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
pnlColorPreview.BackColor = colorDialog.Color;
|
||||
|
||||
// Convert .NET Color to Word WdColor (int)
|
||||
// Word stores colors as BGR (0xBBGGRR) in lower 24 bits
|
||||
// But .NET Color.ToArgb() returns ARGB (0xAARRGGBB)
|
||||
// WdColor is weird.
|
||||
// wdColorBlack = 0
|
||||
// wdColorRed = 255 (0x0000FF)
|
||||
// It seems to be standard RGB or BGR integer value.
|
||||
// Let's use ColorTranslator or manual conversion.
|
||||
// Word Interop usually expects BGR int for some properties, or standard OLE color.
|
||||
// Actually, WdColor enum has values like wdColorRed = 0xFF.
|
||||
// The safest way is to cast the RGB value.
|
||||
// However, ColorTranslator.ToOle(c) returns BGR, which is what Office usually expects.
|
||||
|
||||
_selectedColor = ColorTranslator.ToOle(colorDialog.Color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将 TextStyle 对象应用到界面控件。
|
||||
/// </summary>
|
||||
/// <param name="style">要显示的样式对象</param>
|
||||
public void SetStyle(TextStyle style)
|
||||
{
|
||||
if (style == null) return;
|
||||
|
||||
if (cmbFont.Items.Contains(style.FontName))
|
||||
cmbFont.SelectedItem = style.FontName;
|
||||
else
|
||||
cmbFont.Text = style.FontName; // Fallback
|
||||
|
||||
numSize.Value = (decimal)style.FontSize;
|
||||
chkBold.Checked = style.IsBold;
|
||||
|
||||
_selectedColor = style.Color;
|
||||
// Convert OLE Color back to .NET Color for preview
|
||||
try
|
||||
{
|
||||
pnlColorPreview.BackColor = ColorTranslator.FromOle(_selectedColor);
|
||||
}
|
||||
catch
|
||||
{
|
||||
pnlColorPreview.BackColor = Color.Black;
|
||||
}
|
||||
|
||||
if (_showAlign && cmbAlign != null)
|
||||
{
|
||||
if (style.Alignment >= 0 && style.Alignment < cmbAlign.Items.Count)
|
||||
cmbAlign.SelectedIndex = style.Alignment;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从界面控件获取当前的 TextStyle 配置。
|
||||
/// </summary>
|
||||
/// <returns>包含用户配置的样式对象</returns>
|
||||
public TextStyle GetStyle()
|
||||
{
|
||||
TextStyle style = new TextStyle();
|
||||
style.FontName = cmbFont.Text;
|
||||
style.FontSize = (float)numSize.Value;
|
||||
style.IsBold = chkBold.Checked;
|
||||
style.Color = _selectedColor;
|
||||
|
||||
if (_showAlign && cmbAlign != null)
|
||||
{
|
||||
style.Alignment = cmbAlign.SelectedIndex;
|
||||
}
|
||||
return style;
|
||||
}
|
||||
}
|
||||
}
|
||||
237
WordAddIn/WordAddIn/ThisAddIn.Designer.cs
generated
237
WordAddIn/WordAddIn/ThisAddIn.Designer.cs
generated
@@ -1,237 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#pragma warning disable 414
|
||||
namespace WordAddIn {
|
||||
|
||||
|
||||
///
|
||||
[Microsoft.VisualStudio.Tools.Applications.Runtime.StartupObjectAttribute(0)]
|
||||
[global::System.Security.Permissions.PermissionSetAttribute(global::System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
|
||||
public sealed partial class ThisAddIn : Microsoft.Office.Tools.AddInBase {
|
||||
|
||||
internal Microsoft.Office.Tools.CustomTaskPaneCollection CustomTaskPanes;
|
||||
|
||||
internal Microsoft.Office.Tools.SmartTagCollection VstoSmartTags;
|
||||
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
|
||||
private global::System.Object missing = global::System.Type.Missing;
|
||||
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
|
||||
internal Microsoft.Office.Interop.Word.Application Application;
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public ThisAddIn(global::Microsoft.Office.Tools.Word.ApplicationFactory factory, global::System.IServiceProvider serviceProvider) :
|
||||
base(factory, serviceProvider, "AddIn", "ThisAddIn") {
|
||||
Globals.Factory = factory;
|
||||
}
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||
protected override void Initialize() {
|
||||
base.Initialize();
|
||||
this.Application = this.GetHostItem<Microsoft.Office.Interop.Word.Application>(typeof(Microsoft.Office.Interop.Word.Application), "Application");
|
||||
Globals.ThisAddIn = this;
|
||||
global::System.Windows.Forms.Application.EnableVisualStyles();
|
||||
this.InitializeCachedData();
|
||||
this.InitializeControls();
|
||||
this.InitializeComponents();
|
||||
this.InitializeData();
|
||||
}
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||
protected override void FinishInitialization() {
|
||||
this.InternalStartup();
|
||||
this.OnStartup();
|
||||
}
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||
protected override void InitializeDataBindings() {
|
||||
this.BeginInitialization();
|
||||
this.BindToData();
|
||||
this.EndInitialization();
|
||||
}
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||
private void InitializeCachedData() {
|
||||
if ((this.DataHost == null)) {
|
||||
return;
|
||||
}
|
||||
if (this.DataHost.IsCacheInitialized) {
|
||||
this.DataHost.FillCachedData(this);
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||
private void InitializeData() {
|
||||
}
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||
private void BindToData() {
|
||||
}
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
private void StartCaching(string MemberName) {
|
||||
this.DataHost.StartCaching(this, MemberName);
|
||||
}
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
private void StopCaching(string MemberName) {
|
||||
this.DataHost.StopCaching(this, MemberName);
|
||||
}
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
private bool IsCached(string MemberName) {
|
||||
return this.DataHost.IsCached(this, MemberName);
|
||||
}
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||
private void BeginInitialization() {
|
||||
this.BeginInit();
|
||||
this.CustomTaskPanes.BeginInit();
|
||||
this.VstoSmartTags.BeginInit();
|
||||
}
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||
private void EndInitialization() {
|
||||
this.VstoSmartTags.EndInit();
|
||||
this.CustomTaskPanes.EndInit();
|
||||
this.EndInit();
|
||||
}
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||
private void InitializeControls() {
|
||||
this.CustomTaskPanes = Globals.Factory.CreateCustomTaskPaneCollection(null, null, "CustomTaskPanes", "CustomTaskPanes", this);
|
||||
this.VstoSmartTags = Globals.Factory.CreateSmartTagCollection(null, null, "VstoSmartTags", "VstoSmartTags", this);
|
||||
}
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||
private void InitializeComponents() {
|
||||
}
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
private bool NeedsFill(string MemberName) {
|
||||
return this.DataHost.NeedsFill(this, MemberName);
|
||||
}
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||
protected override void OnShutdown() {
|
||||
this.VstoSmartTags.Dispose();
|
||||
this.CustomTaskPanes.Dispose();
|
||||
base.OnShutdown();
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
|
||||
internal sealed partial class Globals {
|
||||
|
||||
///
|
||||
private Globals() {
|
||||
}
|
||||
|
||||
private static ThisAddIn _ThisAddIn;
|
||||
|
||||
private static global::Microsoft.Office.Tools.Word.ApplicationFactory _factory;
|
||||
|
||||
private static ThisRibbonCollection _ThisRibbonCollection;
|
||||
|
||||
internal static ThisAddIn ThisAddIn {
|
||||
get {
|
||||
return _ThisAddIn;
|
||||
}
|
||||
set {
|
||||
if ((_ThisAddIn == null)) {
|
||||
_ThisAddIn = value;
|
||||
}
|
||||
else {
|
||||
throw new System.NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static global::Microsoft.Office.Tools.Word.ApplicationFactory Factory {
|
||||
get {
|
||||
return _factory;
|
||||
}
|
||||
set {
|
||||
if ((_factory == null)) {
|
||||
_factory = value;
|
||||
}
|
||||
else {
|
||||
throw new System.NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static ThisRibbonCollection Ribbons {
|
||||
get {
|
||||
if ((_ThisRibbonCollection == null)) {
|
||||
_ThisRibbonCollection = new ThisRibbonCollection(_factory.GetRibbonFactory());
|
||||
}
|
||||
return _ThisRibbonCollection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
|
||||
internal sealed partial class ThisRibbonCollection : Microsoft.Office.Tools.Ribbon.RibbonCollectionBase {
|
||||
|
||||
///
|
||||
internal ThisRibbonCollection(global::Microsoft.Office.Tools.Ribbon.RibbonFactory factory) :
|
||||
base(factory) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
<hostitem:hostItem hostitem:baseType="Microsoft.Office.Tools.AddInBase" hostitem:namespace="WordAddIn" hostitem:className="ThisAddIn" hostitem:identifier="ThisAddIn" hostitem:primaryCookie="AddIn" hostitem:master="true" hostitem:factoryType="Microsoft.Office.Tools.Word.ApplicationFactory" hostitem:startupIndex="0" xmlns:hostitem="http://schemas.microsoft.com/2004/VisualStudio/Tools/Applications/HostItem.xsd">
|
||||
<hostitem:hostObject hostitem:name="Application" hostitem:identifier="Application" hostitem:type="Microsoft.Office.Interop.Word.Application" hostitem:cookie="Application" hostitem:modifier="Internal" />
|
||||
<hostitem:hostControl hostitem:name="CustomTaskPanes" hostitem:identifier="CustomTaskPanes" hostitem:type="Microsoft.Office.Tools.CustomTaskPaneCollection" hostitem:primaryCookie="CustomTaskPanes" hostitem:modifier="Internal" />
|
||||
<hostitem:hostControl hostitem:name="VstoSmartTags" hostitem:identifier="VstoSmartTags" hostitem:type="Microsoft.Office.Tools.SmartTagCollection" hostitem:primaryCookie="VstoSmartTags" hostitem:modifier="Internal" />
|
||||
</hostitem:hostItem>
|
||||
@@ -1,74 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
using Word = Microsoft.Office.Interop.Word;
|
||||
using Office = Microsoft.Office.Core;
|
||||
using Microsoft.Office.Tools.Word;
|
||||
using System.IO;
|
||||
|
||||
namespace WordAddIn
|
||||
{
|
||||
public partial class ThisAddIn
|
||||
{
|
||||
/// <summary>
|
||||
/// 覆盖 CreateRibbonExtensibilityObject 方法。
|
||||
/// 返回我们自定义的 Ribbon 实例 (AiRibbon)。
|
||||
/// VSTO 在加载时会调用此方法来获取 Ribbon XML 和回调处理程序。
|
||||
/// </summary>
|
||||
/// <returns>IRibbonExtensibility 接口实现</returns>
|
||||
protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 尝试写入日志,如果失败则忽略,避免因为日志权限问题导致崩溃
|
||||
try { File.AppendAllText(@"C:\Users\Public\WordAddInLog.txt", DateTime.Now + " CreateRibbonExtensibilityObject called.\n"); } catch {}
|
||||
|
||||
return new AiRibbon();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("创建 Ribbon 界面失败: " + ex.ToString());
|
||||
// 记录详细错误到日志
|
||||
try { File.AppendAllText(@"C:\Users\Public\WordAddInLog.txt", DateTime.Now + " ERROR: " + ex.ToString() + "\n"); } catch {}
|
||||
throw; // 重新抛出异常,让 VSTO 知道初始化失败
|
||||
}
|
||||
}
|
||||
|
||||
private void ThisAddIn_Startup(object sender, System.EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
try { File.AppendAllText(@"C:\Users\Public\WordAddInLog.txt", DateTime.Now + " ThisAddIn_Startup called.\n"); } catch {}
|
||||
|
||||
// 初始化全局上下文,供 AiRibbon 等使用
|
||||
AddInContext.CurrentApplication = this.Application;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("插件启动初始化失败: " + ex.ToString());
|
||||
try { File.AppendAllText(@"C:\Users\Public\WordAddInLog.txt", DateTime.Now + " STARTUP ERROR: " + ex.ToString() + "\n"); } catch {}
|
||||
}
|
||||
}
|
||||
|
||||
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
|
||||
{
|
||||
// 在此添加清理代码
|
||||
}
|
||||
|
||||
#region VSTO 生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InternalStartup()
|
||||
{
|
||||
this.Startup += new System.EventHandler(ThisAddIn_Startup);
|
||||
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,341 +0,0 @@
|
||||
<Project ToolsVersion="17.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<!--
|
||||
This section defines project-level properties.
|
||||
|
||||
AssemblyName
|
||||
Name of the output assembly.
|
||||
Configuration
|
||||
Specifies a default value for debug.
|
||||
OutputType
|
||||
Must be "Library" for VSTO.
|
||||
Platform
|
||||
Specifies what CPU the output of this project can run on.
|
||||
NoStandardLibraries
|
||||
Set to "false" for VSTO.
|
||||
RootNamespace
|
||||
In C#, this specifies the namespace given to new files. In VB, all objects are
|
||||
wrapped in this namespace at runtime.
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<ProjectTypeGuids>{BAA0C2D2-18E2-41B9-852F-F413020CAA33};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{EC0A80FA-FCBD-4239-945A-627B20CCCBAA}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<NoStandardLibraries>false</NoStandardLibraries>
|
||||
<RootNamespace>WordAddIn</RootNamespace>
|
||||
<AssemblyName>WordAddIn</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<DefineConstants>VSTO40;UseOfficeInterop</DefineConstants>
|
||||
<ResolveComReferenceSilent>true</ResolveComReferenceSilent>
|
||||
<IsWebBootstrapper>False</IsWebBootstrapper>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<PublishUrl>D:\办公\</PublishUrl>
|
||||
<InstallUrl />
|
||||
<TargetCulture>zh-chs</TargetCulture>
|
||||
<ApplicationVersion>1.0.0.5</ApplicationVersion>
|
||||
<AutoIncrementApplicationRevision>true</AutoIncrementApplicationRevision>
|
||||
<UpdateEnabled>true</UpdateEnabled>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>days</UpdateIntervalUnits>
|
||||
<ProductName>WordAddIn</ProductName>
|
||||
<PublisherName />
|
||||
<SupportUrl />
|
||||
<FriendlyName>WordAddIn</FriendlyName>
|
||||
<OfficeApplicationDescription />
|
||||
<LoadBehavior>3</LoadBehavior>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 和 x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.VSTORuntime.4.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft Visual Studio 2010 Tools for Office Runtime %28x86 和 x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<!--
|
||||
OfficeApplication
|
||||
Add-in host application
|
||||
-->
|
||||
<OfficeApplication>Word</OfficeApplication>
|
||||
</PropertyGroup>
|
||||
<!--
|
||||
This section defines properties that are set when the "Debug" configuration is selected.
|
||||
|
||||
DebugSymbols
|
||||
If "true", create symbols (.pdb). If "false", do not create symbols.
|
||||
DefineConstants
|
||||
Constants defined for the preprocessor.
|
||||
EnableUnmanagedDebugging
|
||||
If "true", starting the debugger will attach both managed and unmanaged debuggers.
|
||||
Optimize
|
||||
If "true", optimize the build output. If "false", do not optimize.
|
||||
OutputPath
|
||||
Output path of project relative to the project file.
|
||||
WarningLevel
|
||||
Warning level for the compiler.
|
||||
-->
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
<DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<StartAction>Program</StartAction>
|
||||
<StartProgram>C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE</StartProgram>
|
||||
</PropertyGroup>
|
||||
<!--
|
||||
This section defines properties that are set when the "Release" configuration is selected.
|
||||
|
||||
DebugSymbols
|
||||
If "true", create symbols (.pdb). If "false", do not create symbols.
|
||||
DefineConstants
|
||||
Constants defined for the preprocessor.
|
||||
EnableUnmanagedDebugging
|
||||
If "true", starting the debugger will attach both managed and unmanaged debuggers.
|
||||
Optimize
|
||||
If "true", optimize the build output. If "false", do not optimize.
|
||||
OutputPath
|
||||
Output path of project relative to the project file.
|
||||
WarningLevel
|
||||
Warning level for the compiler.
|
||||
-->
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<StartAction>Program</StartAction>
|
||||
<StartProgram>C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE</StartProgram>
|
||||
</PropertyGroup>
|
||||
<!--
|
||||
This section specifies references for the project.
|
||||
-->
|
||||
<ItemGroup>
|
||||
<Reference Include="Accessibility" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Office.Tools.v4.0.Framework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.Tools.Applications.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Office.Tools, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Office.Tools.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Office.Tools.Word, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Office.Tools.Common.v4.0.Utilities, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="$([System.String]::Copy(";$(DefineConstants);").ToLower().Contains(';useofficeinterop;')) or $([System.String]::Copy(",$(DefineConstants),").ToLower().Contains(',useofficeinterop,'))">
|
||||
<ItemGroup>
|
||||
<Reference Include="Office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
|
||||
<Private>False</Private>
|
||||
<EmbedInteropTypes>true</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
|
||||
<Private>False</Private>
|
||||
<EmbedInteropTypes>true</EmbedInteropTypes>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<ItemGroup>
|
||||
<COMReference Include="Microsoft.Office.Core">
|
||||
<Guid>{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}</Guid>
|
||||
<VersionMajor>2</VersionMajor>
|
||||
<VersionMinor>7</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>true</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
<COMReference Include="Microsoft.Office.Interop.Word">
|
||||
<Guid>{00020905-0000-0000-C000-000000000046}</Guid>
|
||||
<VersionMajor>8</VersionMajor>
|
||||
<VersionMinor>6</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>true</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
<COMReference Include="Extensibility">
|
||||
<Guid>{AC0714F2-3D04-11D1-C2E4-00600893B433}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Reference Include="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Extensibility, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<!--
|
||||
This section defines the user source files that are part of the project.
|
||||
|
||||
A "Compile" element specifies a source file to compile.
|
||||
An "EmbeddedResource" element specifies an .resx file for embedded resources.
|
||||
A "None" element specifies a file that is not to be passed to the compiler (for instance,
|
||||
a text file or XML file).
|
||||
The "AppDesigner" element specifies the directory where the application properties files
|
||||
can be found.
|
||||
-->
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Config.cs" />
|
||||
<Compile Include="ThisAddIn.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="AiRibbon.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Models.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ModelDefinitions.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ImageOptionsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ReferenceGeneratorForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="LoginForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="LoadingForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="AiService.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CreateOutlineForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="OutlineResultForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="OutlineSettingsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="StyleEditorControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="AboutForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="AiRibbon.xml" />
|
||||
<None Include="ThisAddIn.Designer.xml">
|
||||
<DependentUpon>ThisAddIn.cs</DependentUpon>
|
||||
</None>
|
||||
<Compile Include="AddInContext.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="WpsAddIn.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ThisAddIn.Designer.cs">
|
||||
<DependentUpon>ThisAddIn.Designer.xml</DependentUpon>
|
||||
</Compile>
|
||||
<AppDesigner Include="Properties\" />
|
||||
<None Include="WordAddIn_TemporaryKey.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Test\" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>true</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestKeyFile>WordAddIn_TemporaryKey.pfx</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestCertificateThumbprint>1B8D8AB21D9D321D59A4C13B926DAB7BD3677944</ManifestCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<!-- Include the build rules for a C# project. -->
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- Include additional build rules for an Office application add-in. -->
|
||||
<Import Project="$(VSToolsPath)\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
<!-- This section defines VSTO properties that describe the host-changeable project properties. -->
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{BAA0C2D2-18E2-41B9-852F-F413020CAA33}">
|
||||
<ProjectProperties HostName="Word" HostPackage="{29A7B9D7-A7F1-4328-8EF0-6B2D1A56B2C1}" OfficeVersion="15.0" VstxVersion="4.0" ApplicationType="Word" Language="cs" TemplatesPath="" DebugInfoExeName="#Software\Microsoft\Office\16.0\Word\InstallRoot\Path#WINWORD.EXE" DebugInfoCommandLine="/x" AddItemTemplatesGuid="{51063C3A-E220-4D12-8922-BDA915ACD783}" />
|
||||
<Host Name="Word" GeneratedCodeNamespace="WordAddIn" PublishedHash="69C324AB27932AA2FBF2B7EA72250886FF164DE6" IconIndex="0">
|
||||
<HostItem Name="ThisAddIn" Code="ThisAddIn.cs" CanonicalName="AddIn" PublishedHash="8166DE8D98B62268329D9D6125CF7DE54A2E1945" CanActivate="false" IconIndex="1" Blueprint="ThisAddIn.Designer.xml" GeneratedCode="ThisAddIn.Designer.cs" />
|
||||
</Host>
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<PublishUrlHistory>D:\办公\</PublishUrlHistory>
|
||||
<InstallUrlHistory />
|
||||
<SupportUrlHistory />
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Binary file not shown.
@@ -1,120 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Extensibility;
|
||||
using Microsoft.Office.Core;
|
||||
using Word = Microsoft.Office.Interop.Word;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WordAddIn
|
||||
{
|
||||
/// <summary>
|
||||
/// WPS Office 兼容入口类。
|
||||
/// 实现标准的 COM Add-in 接口 (IDTExtensibility2),以便 WPS 可以加载此插件。
|
||||
/// 同时继承自 AiRibbon,复用 Ribbon UI 和业务逻辑。
|
||||
/// </summary>
|
||||
[ComVisible(true)]
|
||||
[Guid("D8E52004-9D68-4509-8A11-66774D4F0523")] // 固定的 COM GUID
|
||||
[ProgId("WordAddIn.WpsAddIn")] // 注册表中的 ProgID
|
||||
public class WpsAddIn : AiRibbon, IDTExtensibility2, IRibbonExtensibility
|
||||
{
|
||||
private Word.Application _application;
|
||||
private object _addInInstance;
|
||||
|
||||
private void Log(string message)
|
||||
{
|
||||
try
|
||||
{
|
||||
string logPath = @"C:\Temp\WpsAddIn.log";
|
||||
string dir = System.IO.Path.GetDirectoryName(logPath);
|
||||
if (!System.IO.Directory.Exists(dir))
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(dir);
|
||||
}
|
||||
System.IO.File.AppendAllText(logPath, $"{DateTime.Now}: {message}{Environment.NewLine}");
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
#region IDTExtensibility2 成员
|
||||
|
||||
/// <summary>
|
||||
/// 插件加载时调用
|
||||
/// </summary>
|
||||
public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
|
||||
{
|
||||
Log("OnConnection called");
|
||||
try
|
||||
{
|
||||
_application = Application as Word.Application;
|
||||
_addInInstance = AddInInst;
|
||||
|
||||
if (_application == null)
|
||||
{
|
||||
Log("Application is null in OnConnection");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("Application obtained successfully");
|
||||
}
|
||||
|
||||
// 初始化全局上下文,确保 AiRibbon 中的功能可以正常获取 Application 对象
|
||||
AddInContext.CurrentApplication = _application;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"Error in OnConnection: {ex.Message}");
|
||||
MessageBox.Show("WPS 插件加载失败: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 插件卸载时调用
|
||||
/// </summary>
|
||||
public void OnDisconnection(ext_DisconnectMode RemoveMode, ref Array custom)
|
||||
{
|
||||
Log("OnDisconnection called");
|
||||
_application = null;
|
||||
_addInInstance = null;
|
||||
// 清理上下文
|
||||
if (AddInContext.CurrentApplication == _application)
|
||||
{
|
||||
AddInContext.CurrentApplication = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnAddInsUpdate(ref Array custom)
|
||||
{
|
||||
Log("OnAddInsUpdate called");
|
||||
}
|
||||
|
||||
public void OnStartupComplete(ref Array custom)
|
||||
{
|
||||
Log("OnStartupComplete called");
|
||||
}
|
||||
|
||||
public void OnBeginShutdown(ref Array custom)
|
||||
{
|
||||
Log("OnBeginShutdown called");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// 显式实现 IRibbonExtensibility,虽然基类实现了,但为了确保 COM 可见性和调试,这里显式重写/覆盖
|
||||
public new string GetCustomUI(string RibbonID)
|
||||
{
|
||||
Log($"GetCustomUI called for RibbonID: {RibbonID}");
|
||||
try
|
||||
{
|
||||
// 调用基类的方法获取 XML
|
||||
string xml = base.GetCustomUI(RibbonID);
|
||||
Log("GetCustomUI XML retrieved successfully");
|
||||
return xml;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"Error in GetCustomUI: {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1,203 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
|
||||
<asmv1:assemblyIdentity name="WordAddIn.dll" version="1.0.0.5" publicKeyToken="06a92c46db516926" language="neutral" processorArchitecture="msil" type="win32" />
|
||||
<description xmlns="urn:schemas-microsoft-com:asm.v1">WordAddIn</description>
|
||||
<application />
|
||||
<entryPoint>
|
||||
<co.v1:customHostSpecified />
|
||||
</entryPoint>
|
||||
<trustInfo>
|
||||
<security>
|
||||
<applicationRequestMinimum>
|
||||
<PermissionSet Unrestricted="true" ID="Custom" SameSite="site" />
|
||||
<defaultAssemblyRequest permissionSetReference="Custom" />
|
||||
</applicationRequestMinimum>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!--
|
||||
UAC 清单选项
|
||||
如果要更改 Windows 用户帐户控制级别,请用以下节点之一替换
|
||||
requestedExecutionLevel 节点。
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
如果要利用文件和注册表虚拟化提供
|
||||
向后兼容性,请删除 requestedExecutionLevel 节点。
|
||||
-->
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<dependency>
|
||||
<dependentOS>
|
||||
<osVersionInfo>
|
||||
<os majorVersion="5" minorVersion="1" buildNumber="2600" servicePackMajor="0" />
|
||||
</osVersionInfo>
|
||||
</dependentOS>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="Microsoft.Windows.CommonLanguageRuntime" version="4.0.30319.0" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="Accessibility" version="4.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="Microsoft.CSharp" version="4.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="Microsoft.Office.Tools" version="10.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="Microsoft.Office.Tools.Common" version="10.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="Microsoft.Office.Tools.v4.0.Framework" version="10.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="Microsoft.Office.Tools.Word" version="10.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="Microsoft.VisualStudio.Tools.Applications.Runtime" version="10.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="mscorlib" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="stdole" version="7.0.3300.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Core" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Data" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Data.DataSetExtensions" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Drawing" version="4.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Net.Http" version="4.2.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Numerics" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Runtime.Serialization" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Windows.Forms" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Xml" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Xml.Linq" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Microsoft.Office.Tools.Common.v4.0.Utilities.dll" size="32664">
|
||||
<assemblyIdentity name="Microsoft.Office.Tools.Common.v4.0.Utilities" version="10.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
|
||||
<hash>
|
||||
<dsig:Transforms>
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>jLCTF8Mm6bD4PDN+rnzN6q0+ReXaNgPh68kMWgatFwI=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Newtonsoft.Json.dll" size="721320">
|
||||
<assemblyIdentity name="Newtonsoft.Json" version="13.0.0.0" publicKeyToken="30AD4FE6B2A6AEED" language="neutral" processorArchitecture="msil" />
|
||||
<hash>
|
||||
<dsig:Transforms>
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>8MB68OhNTdTaS9eCO6RTW8BIGzv2I+1Atlm2gUemu3U=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="WordAddIn.dll" size="122368">
|
||||
<assemblyIdentity name="WordAddIn" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
|
||||
<hash>
|
||||
<dsig:Transforms>
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>Sv+qgHZFDhjy9IFwv7kNOHU+fY7HZYjsKfxAAPn7OKk=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<vstav3:addIn xmlns:vstav3="urn:schemas-microsoft-com:vsta.v3">
|
||||
<vstav3:entryPointsCollection>
|
||||
<vstav3:entryPoints>
|
||||
<vstav3:entryPoint class="WordAddIn.ThisAddIn">
|
||||
<assemblyIdentity name="WordAddIn" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
|
||||
</vstav3:entryPoint>
|
||||
</vstav3:entryPoints>
|
||||
</vstav3:entryPointsCollection>
|
||||
<vstav3:update enabled="true">
|
||||
<vstav3:expiration maximumAge="7" unit="days" />
|
||||
</vstav3:update>
|
||||
<vstav3:application>
|
||||
<vstov4:customizations xmlns:vstov4="urn:schemas-microsoft-com:vsto.v4">
|
||||
<vstov4:customization>
|
||||
<vstov4:appAddIn application="Word" loadBehavior="3" keyName="WordAddIn">
|
||||
<vstov4:friendlyName>WordAddIn</vstov4:friendlyName>
|
||||
<vstov4:description>WordAddIn</vstov4:description>
|
||||
<vstov4.1:ribbonTypes xmlns:vstov4.1="urn:schemas-microsoft-com:vsto.v4.1" />
|
||||
</vstov4:appAddIn>
|
||||
</vstov4:customization>
|
||||
</vstov4:customizations>
|
||||
</vstav3:application>
|
||||
</vstav3:addIn>
|
||||
<publisherIdentity name="CN=DESKTOP-Q6H7B6L\Administrator" issuerKeyHash="42606c52715d5764c2f9dab5bee6dcd76cc7a67d" /><Signature Id="StrongNameSignature" xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha256" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /><DigestValue>ZOkNjAKYNyMSBNhvZ8gVr+wBPStzS85tNEApEJeuU10=</DigestValue></Reference></SignedInfo><SignatureValue>m54F1LbgqoSzKzsz7VyEaU5L5VPSErBFaVB+4TDGDHYawHVbgmm+xC3AcJZeVCYlrEobHTKRQrug9hgt0u3q6pK+tYcye6oXQEkxZPWvSR+HCMd642w1HnEXe0OYgQrgr3BCfGgCbbqjGgSCyI3JsakstMSgAudffFmbmK9rbLI=</SignatureValue><KeyInfo Id="StrongNameKeyInfo"><KeyValue><RSAKeyValue><Modulus>23ghUI75yy8GcLhPT5yA+v2ssRfSW+chNqMI+pq5OAr7RXQJOt/+bHdoT9NoS9GQkvblc7ekoUNShIcN601ZZOPgAxkXaQS+La14Wp8GOwnM1qHNJwgla4VAIYjmCj3CUMXLsxspOFVZKRnB6/idYku4Gzhc7NjRBAwe8qWBXaE=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><msrel:RelData xmlns:msrel="http://schemas.microsoft.com/windows/rel/2005/reldata"><r:license xmlns:r="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:as="http://schemas.microsoft.com/windows/pki/2005/Authenticode"><r:grant><as:ManifestInformation Hash="5d53ae97102940346dce4b732b3d01ecaf15c8676fd80412233798028c0de964" Description="" Url=""><as:assemblyIdentity name="WordAddIn.dll" version="1.0.0.5" publicKeyToken="06a92c46db516926" language="neutral" processorArchitecture="msil" type="win32" /></as:ManifestInformation><as:SignedBy /><as:AuthenticodePublisher><as:X509SubjectName>CN=DESKTOP-Q6H7B6L\Administrator</as:X509SubjectName></as:AuthenticodePublisher></r:grant><r:issuer><Signature Id="AuthenticodeSignature" xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha256" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /><DigestValue>t0BRfVoNqhoaPOc2UKbHbTHoevSy5xe2FpaMu7/cbao=</DigestValue></Reference></SignedInfo><SignatureValue>yhN59Dtne4w1PdCUP45PNv5AM8RCDXSK1L/BP2VtKtHrZuR58L+mJcST1vBX4HkDilbegq8WX2Ox7Hf+kqLSuS6LMP4teKrzuzF9ROH0TFnLKUOPuWrJjtBoZAmInun8Vfqxq2fCpOCDd/wRrDqRjm2YQHn/qHwHQkXNzlzfjuA=</SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>23ghUI75yy8GcLhPT5yA+v2ssRfSW+chNqMI+pq5OAr7RXQJOt/+bHdoT9NoS9GQkvblc7ekoUNShIcN601ZZOPgAxkXaQS+La14Wp8GOwnM1qHNJwgla4VAIYjmCj3CUMXLsxspOFVZKRnB6/idYku4Gzhc7NjRBAwe8qWBXaE=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><X509Data><X509Certificate>MIICDTCCAXagAwIBAgIQJpSlsxfGbpRNgyjD5Q/yDjANBgkqhkiG9w0BAQsFADBFMUMwQQYDVQQDHjoARABFAFMASwBUAE8AUAAtAFEANgBIADcAQgA2AEwAXABBAGQAbQBpAG4AaQBzAHQAcgBhAHQAbwByMB4XDTI2MDEyNDAwMzYxNVoXDTI3MDEyNDA2MzYxNVowRTFDMEEGA1UEAx46AEQARQBTAEsAVABPAFAALQBRADYASAA3AEIANgBMAFwAQQBkAG0AaQBuAGkAcwB0AHIAYQB0AG8AcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA23ghUI75yy8GcLhPT5yA+v2ssRfSW+chNqMI+pq5OAr7RXQJOt/+bHdoT9NoS9GQkvblc7ekoUNShIcN601ZZOPgAxkXaQS+La14Wp8GOwnM1qHNJwgla4VAIYjmCj3CUMXLsxspOFVZKRnB6/idYku4Gzhc7NjRBAwe8qWBXaECAwEAATANBgkqhkiG9w0BAQsFAAOBgQC3GjWMhEFFrn9PGYrQVGNAaibG1sR/eRX3ZWNRjYLhiqbsdeHvm4CX/W0EWd9yZlbaej87XyeUbX+mC3q3yMFVPCRn/W65WYyBPbWTWmSfU9VLKKULAH6WqjS7CqEU3cQSuKcU6nYG4AJu2/FkQJaA82tr3pvcQD28HmOlDeNh0Q==</X509Certificate></X509Data></KeyInfo></Signature></r:issuer></r:license></msrel:RelData></KeyInfo></Signature></asmv1:assembly>
|
||||
Binary file not shown.
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xrml="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
|
||||
<assemblyIdentity name="WordAddIn.vsto" version="1.0.0.5" publicKeyToken="06a92c46db516926" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" />
|
||||
<description asmv2:publisher="WordAddIn" asmv2:product="WordAddIn" xmlns="urn:schemas-microsoft-com:asm.v1" />
|
||||
<deployment install="false" />
|
||||
<compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
|
||||
<framework targetVersion="4.7.2" profile="Full" supportedRuntime="4.0.30319" />
|
||||
</compatibleFrameworks>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="install" codebase="WordAddIn.dll.manifest" size="14627">
|
||||
<assemblyIdentity name="WordAddIn.dll" version="1.0.0.5" publicKeyToken="06a92c46db516926" language="neutral" processorArchitecture="msil" type="win32" />
|
||||
<hash>
|
||||
<dsig:Transforms>
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>9reCGw0n5BNGpv4nRAlMEl+9KA74gqf2Bi31YDIuVSE=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<publisherIdentity name="CN=DESKTOP-Q6H7B6L\Administrator" issuerKeyHash="42606c52715d5764c2f9dab5bee6dcd76cc7a67d" /><Signature Id="StrongNameSignature" xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha256" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /><DigestValue>SUC6Yjv6NvxmVHgsXQGLba0wVDBY01J0NUXy81ARtjM=</DigestValue></Reference></SignedInfo><SignatureValue>rJF3Cswyo7dSJZ0ZBkoYjEc/BDekJOQ+kDoxvMOf7UWBYec+2EOUBXb+XZwVF7uVLXOJsDTJncnHBf9hcrcwnq8fF7HWuDw9lOMkzvDs5kPvkp9aTIFvPuu8BotBAYV3sn1jHnrtOAf2mkmD/1LU2hyhiH5ymyyI0w17Rwi+f0k=</SignatureValue><KeyInfo Id="StrongNameKeyInfo"><KeyValue><RSAKeyValue><Modulus>23ghUI75yy8GcLhPT5yA+v2ssRfSW+chNqMI+pq5OAr7RXQJOt/+bHdoT9NoS9GQkvblc7ekoUNShIcN601ZZOPgAxkXaQS+La14Wp8GOwnM1qHNJwgla4VAIYjmCj3CUMXLsxspOFVZKRnB6/idYku4Gzhc7NjRBAwe8qWBXaE=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><msrel:RelData xmlns:msrel="http://schemas.microsoft.com/windows/rel/2005/reldata"><r:license xmlns:r="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:as="http://schemas.microsoft.com/windows/pki/2005/Authenticode"><r:grant><as:ManifestInformation Hash="33b61150f3f245357452d358305430ad6d8b015d2c785466fc36fa3b62ba4049" Description="" Url=""><as:assemblyIdentity name="WordAddIn.vsto" version="1.0.0.5" publicKeyToken="06a92c46db516926" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" /></as:ManifestInformation><as:SignedBy /><as:AuthenticodePublisher><as:X509SubjectName>CN=DESKTOP-Q6H7B6L\Administrator</as:X509SubjectName></as:AuthenticodePublisher></r:grant><r:issuer><Signature Id="AuthenticodeSignature" xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha256" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /><DigestValue>BmlXdT7EP/tEd4mBeMHh2OJ8nURtQ9BfdX3rIi01DPA=</DigestValue></Reference></SignedInfo><SignatureValue>eRIoPFOTfeko5ygKR1m63sb+yJ8qFp9CZniS9T8sMW1WmMAZozZJXiMH+bYIHO1P6Z+47rJHoSfmvUSESLpHIzk0s+WYSd/w4NK/aGE+vIwFA/SeHCWeqfhqC65ZjS0hVbQJ7ScoJfiBTLjNBEPmD/tQhQM/m8/jLv6cRZ8ToQA=</SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>23ghUI75yy8GcLhPT5yA+v2ssRfSW+chNqMI+pq5OAr7RXQJOt/+bHdoT9NoS9GQkvblc7ekoUNShIcN601ZZOPgAxkXaQS+La14Wp8GOwnM1qHNJwgla4VAIYjmCj3CUMXLsxspOFVZKRnB6/idYku4Gzhc7NjRBAwe8qWBXaE=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><X509Data><X509Certificate>MIICDTCCAXagAwIBAgIQJpSlsxfGbpRNgyjD5Q/yDjANBgkqhkiG9w0BAQsFADBFMUMwQQYDVQQDHjoARABFAFMASwBUAE8AUAAtAFEANgBIADcAQgA2AEwAXABBAGQAbQBpAG4AaQBzAHQAcgBhAHQAbwByMB4XDTI2MDEyNDAwMzYxNVoXDTI3MDEyNDA2MzYxNVowRTFDMEEGA1UEAx46AEQARQBTAEsAVABPAFAALQBRADYASAA3AEIANgBMAFwAQQBkAG0AaQBuAGkAcwB0AHIAYQB0AG8AcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA23ghUI75yy8GcLhPT5yA+v2ssRfSW+chNqMI+pq5OAr7RXQJOt/+bHdoT9NoS9GQkvblc7ekoUNShIcN601ZZOPgAxkXaQS+La14Wp8GOwnM1qHNJwgla4VAIYjmCj3CUMXLsxspOFVZKRnB6/idYku4Gzhc7NjRBAwe8qWBXaECAwEAATANBgkqhkiG9w0BAQsFAAOBgQC3GjWMhEFFrn9PGYrQVGNAaibG1sR/eRX3ZWNRjYLhiqbsdeHvm4CX/W0EWd9yZlbaej87XyeUbX+mC3q3yMFVPCRn/W65WYyBPbWTWmSfU9VLKKULAH6WqjS7CqEU3cQSuKcU6nYG4AJu2/FkQJaA82tr3pvcQD28HmOlDeNh0Q==</X509Certificate></X509Data></KeyInfo></Signature></r:issuer></r:license></msrel:RelData></KeyInfo></Signature></asmv1:assembly>
|
||||
@@ -1,4 +0,0 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,28 +0,0 @@
|
||||
D:\dsWork\aiData\addOne\WordAddIn\WordAddIn\bin\Debug\WordAddIn.dll
|
||||
D:\dsWork\aiData\addOne\WordAddIn\WordAddIn\bin\Debug\WordAddIn.pdb
|
||||
D:\dsWork\aiData\addOne\WordAddIn\WordAddIn\bin\Debug\WordAddIn.dll.manifest
|
||||
D:\dsWork\aiData\addOne\WordAddIn\WordAddIn\bin\Debug\WordAddIn.vsto
|
||||
D:\dsWork\aiData\addOne\WordAddIn\WordAddIn\bin\Debug\Microsoft.Office.Tools.Common.v4.0.Utilities.dll
|
||||
D:\dsWork\aiData\addOne\WordAddIn\WordAddIn\bin\Debug\Newtonsoft.Json.dll
|
||||
D:\dsWork\aiData\addOne\WordAddIn\WordAddIn\bin\Debug\Newtonsoft.Json.xml
|
||||
D:\dsWork\aiData\addOne\WordAddIn\WordAddIn\obj\Debug\WordAddIn.csproj.AssemblyReference.cache
|
||||
D:\dsWork\aiData\addOne\WordAddIn\WordAddIn\obj\Debug\WordAddIn.Properties.Resources.resources
|
||||
D:\dsWork\aiData\addOne\WordAddIn\WordAddIn\obj\Debug\WordAddIn.csproj.GenerateResource.cache
|
||||
D:\dsWork\aiData\addOne\WordAddIn\WordAddIn\obj\Debug\WordAddIn.csproj.CoreCompileInputs.cache
|
||||
D:\dsWork\aiData\addOne\WordAddIn\WordAddIn\obj\Debug\WordAddIn.csproj.Up2Date
|
||||
D:\dsWork\aiData\addOne\WordAddIn\WordAddIn\obj\Debug\WordAddIn.dll
|
||||
D:\dsWork\aiData\addOne\WordAddIn\WordAddIn\obj\Debug\WordAddIn.pdb
|
||||
d:\dsWork\aiData\WordAddIn\WordAddIn\bin\Debug\WordAddIn.dll
|
||||
d:\dsWork\aiData\WordAddIn\WordAddIn\bin\Debug\WordAddIn.pdb
|
||||
d:\dsWork\aiData\WordAddIn\WordAddIn\bin\Debug\WordAddIn.dll.manifest
|
||||
d:\dsWork\aiData\WordAddIn\WordAddIn\bin\Debug\WordAddIn.vsto
|
||||
d:\dsWork\aiData\WordAddIn\WordAddIn\bin\Debug\Microsoft.Office.Tools.Common.v4.0.Utilities.dll
|
||||
d:\dsWork\aiData\WordAddIn\WordAddIn\bin\Debug\Newtonsoft.Json.dll
|
||||
d:\dsWork\aiData\WordAddIn\WordAddIn\bin\Debug\Newtonsoft.Json.xml
|
||||
d:\dsWork\aiData\WordAddIn\WordAddIn\obj\Debug\WordAddIn.csproj.AssemblyReference.cache
|
||||
d:\dsWork\aiData\WordAddIn\WordAddIn\obj\Debug\WordAddIn.Properties.Resources.resources
|
||||
d:\dsWork\aiData\WordAddIn\WordAddIn\obj\Debug\WordAddIn.csproj.GenerateResource.cache
|
||||
d:\dsWork\aiData\WordAddIn\WordAddIn\obj\Debug\WordAddIn.csproj.CoreCompileInputs.cache
|
||||
d:\dsWork\aiData\WordAddIn\WordAddIn\obj\Debug\WordAddIn.csproj.Up2Date
|
||||
d:\dsWork\aiData\WordAddIn\WordAddIn\obj\Debug\WordAddIn.dll
|
||||
d:\dsWork\aiData\WordAddIn\WordAddIn\obj\Debug\WordAddIn.pdb
|
||||
@@ -1,4 +0,0 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
a8dbfbd53c9d2d6a82eb262741605b35dd6e229dda7031b84eeac3678ff78031
|
||||
@@ -1,14 +0,0 @@
|
||||
D:\dsWork\aiData\WordAddIn\WordAddIn\bin\Release\WordAddIn.dll
|
||||
D:\dsWork\aiData\WordAddIn\WordAddIn\bin\Release\WordAddIn.pdb
|
||||
D:\dsWork\aiData\WordAddIn\WordAddIn\bin\Release\WordAddIn.dll.manifest
|
||||
D:\dsWork\aiData\WordAddIn\WordAddIn\bin\Release\WordAddIn.vsto
|
||||
D:\dsWork\aiData\WordAddIn\WordAddIn\bin\Release\Microsoft.Office.Tools.Common.v4.0.Utilities.dll
|
||||
D:\dsWork\aiData\WordAddIn\WordAddIn\bin\Release\Newtonsoft.Json.dll
|
||||
D:\dsWork\aiData\WordAddIn\WordAddIn\bin\Release\Newtonsoft.Json.xml
|
||||
D:\dsWork\aiData\WordAddIn\WordAddIn\obj\Release\WordAddIn.csproj.AssemblyReference.cache
|
||||
D:\dsWork\aiData\WordAddIn\WordAddIn\obj\Release\WordAddIn.Properties.Resources.resources
|
||||
D:\dsWork\aiData\WordAddIn\WordAddIn\obj\Release\WordAddIn.csproj.GenerateResource.cache
|
||||
D:\dsWork\aiData\WordAddIn\WordAddIn\obj\Release\WordAddIn.csproj.CoreCompileInputs.cache
|
||||
D:\dsWork\aiData\WordAddIn\WordAddIn\obj\Release\WordAddIn.csproj.Up2Date
|
||||
D:\dsWork\aiData\WordAddIn\WordAddIn\obj\Release\WordAddIn.dll
|
||||
D:\dsWork\aiData\WordAddIn\WordAddIn\obj\Release\WordAddIn.pdb
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net472" />
|
||||
</packages>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,203 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
|
||||
<asmv1:assemblyIdentity name="WordAddIn.dll" version="1.0.0.0" publicKeyToken="06a92c46db516926" language="neutral" processorArchitecture="msil" type="win32" />
|
||||
<description xmlns="urn:schemas-microsoft-com:asm.v1">WordAddIn</description>
|
||||
<application />
|
||||
<entryPoint>
|
||||
<co.v1:customHostSpecified />
|
||||
</entryPoint>
|
||||
<trustInfo>
|
||||
<security>
|
||||
<applicationRequestMinimum>
|
||||
<PermissionSet Unrestricted="true" ID="Custom" SameSite="site" />
|
||||
<defaultAssemblyRequest permissionSetReference="Custom" />
|
||||
</applicationRequestMinimum>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!--
|
||||
UAC 清单选项
|
||||
如果要更改 Windows 用户帐户控制级别,请用以下节点之一替换
|
||||
requestedExecutionLevel 节点。
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
如果要利用文件和注册表虚拟化提供
|
||||
向后兼容性,请删除 requestedExecutionLevel 节点。
|
||||
-->
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<dependency>
|
||||
<dependentOS>
|
||||
<osVersionInfo>
|
||||
<os majorVersion="5" minorVersion="1" buildNumber="2600" servicePackMajor="0" />
|
||||
</osVersionInfo>
|
||||
</dependentOS>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="Microsoft.Windows.CommonLanguageRuntime" version="4.0.30319.0" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="Accessibility" version="4.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="Microsoft.CSharp" version="4.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="Microsoft.Office.Tools" version="10.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="Microsoft.Office.Tools.Common" version="10.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="Microsoft.Office.Tools.v4.0.Framework" version="10.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="Microsoft.Office.Tools.Word" version="10.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="Microsoft.VisualStudio.Tools.Applications.Runtime" version="10.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="mscorlib" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="stdole" version="7.0.3300.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Core" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Data" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Data.DataSetExtensions" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Drawing" version="4.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Net.Http" version="4.2.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Numerics" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Runtime.Serialization" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Windows.Forms" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Xml" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
|
||||
<assemblyIdentity name="System.Xml.Linq" version="4.0.0.0" publicKeyToken="B77A5C561934E089" language="neutral" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Microsoft.Office.Tools.Common.v4.0.Utilities.dll" size="32664">
|
||||
<assemblyIdentity name="Microsoft.Office.Tools.Common.v4.0.Utilities" version="10.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
|
||||
<hash>
|
||||
<dsig:Transforms>
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>jLCTF8Mm6bD4PDN+rnzN6q0+ReXaNgPh68kMWgatFwI=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Newtonsoft.Json.dll" size="721320">
|
||||
<assemblyIdentity name="Newtonsoft.Json" version="13.0.0.0" publicKeyToken="30AD4FE6B2A6AEED" language="neutral" processorArchitecture="msil" />
|
||||
<hash>
|
||||
<dsig:Transforms>
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>8MB68OhNTdTaS9eCO6RTW8BIGzv2I+1Atlm2gUemu3U=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="WordAddIn.dll" size="92672">
|
||||
<assemblyIdentity name="WordAddIn" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
|
||||
<hash>
|
||||
<dsig:Transforms>
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>y4xivocoIp8Py1pQadRda9HJK1lJPDi2e/MIWHzz8V4=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<vstav3:addIn xmlns:vstav3="urn:schemas-microsoft-com:vsta.v3">
|
||||
<vstav3:entryPointsCollection>
|
||||
<vstav3:entryPoints>
|
||||
<vstav3:entryPoint class="WordAddIn.ThisAddIn">
|
||||
<assemblyIdentity name="WordAddIn" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
|
||||
</vstav3:entryPoint>
|
||||
</vstav3:entryPoints>
|
||||
</vstav3:entryPointsCollection>
|
||||
<vstav3:update enabled="true">
|
||||
<vstav3:expiration maximumAge="7" unit="days" />
|
||||
</vstav3:update>
|
||||
<vstav3:application>
|
||||
<vstov4:customizations xmlns:vstov4="urn:schemas-microsoft-com:vsto.v4">
|
||||
<vstov4:customization>
|
||||
<vstov4:appAddIn application="Word" loadBehavior="3" keyName="WordAddIn">
|
||||
<vstov4:friendlyName>WordAddIn</vstov4:friendlyName>
|
||||
<vstov4:description>WordAddIn</vstov4:description>
|
||||
<vstov4.1:ribbonTypes xmlns:vstov4.1="urn:schemas-microsoft-com:vsto.v4.1" />
|
||||
</vstov4:appAddIn>
|
||||
</vstov4:customization>
|
||||
</vstov4:customizations>
|
||||
</vstav3:application>
|
||||
</vstav3:addIn>
|
||||
<publisherIdentity name="CN=DESKTOP-Q6H7B6L\Administrator" issuerKeyHash="42606c52715d5764c2f9dab5bee6dcd76cc7a67d" /><Signature Id="StrongNameSignature" xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha256" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /><DigestValue>nzFmuqGMTufidijFdHzd5EGSf5WOKf7c2AjATAY/QXQ=</DigestValue></Reference></SignedInfo><SignatureValue>kec11gHTkSnlIv0W9zVym1S7bKdmUlth8lply4yAThpZy4vYVECTxPs+WnqUb2jfF2GZ0S5HnDirRBDuabJWZ6hzWxH0qZhiwVS4gqQz64IHo6xn+WZ7Jewbq6HRgUNl+JYFoe4MfmT9BsyOaSjjqcSttZHJocW2TMZvSC2CDuY=</SignatureValue><KeyInfo Id="StrongNameKeyInfo"><KeyValue><RSAKeyValue><Modulus>23ghUI75yy8GcLhPT5yA+v2ssRfSW+chNqMI+pq5OAr7RXQJOt/+bHdoT9NoS9GQkvblc7ekoUNShIcN601ZZOPgAxkXaQS+La14Wp8GOwnM1qHNJwgla4VAIYjmCj3CUMXLsxspOFVZKRnB6/idYku4Gzhc7NjRBAwe8qWBXaE=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><msrel:RelData xmlns:msrel="http://schemas.microsoft.com/windows/rel/2005/reldata"><r:license xmlns:r="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:as="http://schemas.microsoft.com/windows/pki/2005/Authenticode"><r:grant><as:ManifestInformation Hash="74413f064cc008d8dcfe298e957f9241e4dd7c74c52876e2e74e8ca1ba66319f" Description="" Url=""><as:assemblyIdentity name="WordAddIn.dll" version="1.0.0.0" publicKeyToken="06a92c46db516926" language="neutral" processorArchitecture="msil" type="win32" /></as:ManifestInformation><as:SignedBy /><as:AuthenticodePublisher><as:X509SubjectName>CN=DESKTOP-Q6H7B6L\Administrator</as:X509SubjectName></as:AuthenticodePublisher></r:grant><r:issuer><Signature Id="AuthenticodeSignature" xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha256" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /><DigestValue>lkht93KCRD6xvp4ITwaBZBfKJqkHiRlwzLkUqlOxs2o=</DigestValue></Reference></SignedInfo><SignatureValue>B+FiLgSCXupEf1Nhejue8+299l1qYdgURdD7C2LLB2VbzFLLk9sR8wmGoQhBa3fIFUBAtCJxIMlYOlebZChMrXiiSiol05gBWxrMYk3wprnNUMUOQrJQ+SvHyOWYXiuFgWJMLW3z/VzeNZmelF2HMuyUPOqz3Sd3rnphDvmiu9k=</SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>23ghUI75yy8GcLhPT5yA+v2ssRfSW+chNqMI+pq5OAr7RXQJOt/+bHdoT9NoS9GQkvblc7ekoUNShIcN601ZZOPgAxkXaQS+La14Wp8GOwnM1qHNJwgla4VAIYjmCj3CUMXLsxspOFVZKRnB6/idYku4Gzhc7NjRBAwe8qWBXaE=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><X509Data><X509Certificate>MIICDTCCAXagAwIBAgIQJpSlsxfGbpRNgyjD5Q/yDjANBgkqhkiG9w0BAQsFADBFMUMwQQYDVQQDHjoARABFAFMASwBUAE8AUAAtAFEANgBIADcAQgA2AEwAXABBAGQAbQBpAG4AaQBzAHQAcgBhAHQAbwByMB4XDTI2MDEyNDAwMzYxNVoXDTI3MDEyNDA2MzYxNVowRTFDMEEGA1UEAx46AEQARQBTAEsAVABPAFAALQBRADYASAA3AEIANgBMAFwAQQBkAG0AaQBuAGkAcwB0AHIAYQB0AG8AcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA23ghUI75yy8GcLhPT5yA+v2ssRfSW+chNqMI+pq5OAr7RXQJOt/+bHdoT9NoS9GQkvblc7ekoUNShIcN601ZZOPgAxkXaQS+La14Wp8GOwnM1qHNJwgla4VAIYjmCj3CUMXLsxspOFVZKRnB6/idYku4Gzhc7NjRBAwe8qWBXaECAwEAATANBgkqhkiG9w0BAQsFAAOBgQC3GjWMhEFFrn9PGYrQVGNAaibG1sR/eRX3ZWNRjYLhiqbsdeHvm4CX/W0EWd9yZlbaej87XyeUbX+mC3q3yMFVPCRn/W65WYyBPbWTWmSfU9VLKKULAH6WqjS7CqEU3cQSuKcU6nYG4AJu2/FkQJaA82tr3pvcQD28HmOlDeNh0Q==</X509Certificate></X509Data></KeyInfo></Signature></r:issuer></r:license></msrel:RelData></KeyInfo></Signature></asmv1:assembly>
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xrml="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
|
||||
<assemblyIdentity name="WordAddIn.vsto" version="1.0.0.0" publicKeyToken="06a92c46db516926" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" />
|
||||
<description asmv2:publisher="WordAddIn" asmv2:product="WordAddIn" xmlns="urn:schemas-microsoft-com:asm.v1" />
|
||||
<deployment install="false" mapFileExtensions="true" />
|
||||
<compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
|
||||
<framework targetVersion="4.7.2" profile="Full" supportedRuntime="4.0.30319" />
|
||||
</compatibleFrameworks>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="install" codebase="Application Files\WordAddIn_1_0_0_0\WordAddIn.dll.manifest" size="14626">
|
||||
<assemblyIdentity name="WordAddIn.dll" version="1.0.0.0" publicKeyToken="06a92c46db516926" language="neutral" processorArchitecture="msil" type="win32" />
|
||||
<hash>
|
||||
<dsig:Transforms>
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>l0YIXWniJAOVvXIuq2gcsxgh6HiLzzq3Qbzl/vvdGcU=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<publisherIdentity name="CN=DESKTOP-Q6H7B6L\Administrator" issuerKeyHash="42606c52715d5764c2f9dab5bee6dcd76cc7a67d" /><Signature Id="StrongNameSignature" xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha256" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /><DigestValue>XIAhjSP9NMvto3hNCon8XWja0spk/WAz/YRgsaC9NAo=</DigestValue></Reference></SignedInfo><SignatureValue>ZEub2vJdHkXv+rnwN2Rfq6vBnN+mUYuOr4/X76AcTre2N9HNv36HIeuufOaCwSIm9I37R09oAa0YKgWsr0K/CCgSF7wqaVqBe6fJcvepI/Gtaolrmta1FwKCh1C53YDt7PNakBpydLsreZW0P0aBY68U2MJAfTNWUs2NmeqXVG4=</SignatureValue><KeyInfo Id="StrongNameKeyInfo"><KeyValue><RSAKeyValue><Modulus>23ghUI75yy8GcLhPT5yA+v2ssRfSW+chNqMI+pq5OAr7RXQJOt/+bHdoT9NoS9GQkvblc7ekoUNShIcN601ZZOPgAxkXaQS+La14Wp8GOwnM1qHNJwgla4VAIYjmCj3CUMXLsxspOFVZKRnB6/idYku4Gzhc7NjRBAwe8qWBXaE=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><msrel:RelData xmlns:msrel="http://schemas.microsoft.com/windows/rel/2005/reldata"><r:license xmlns:r="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:as="http://schemas.microsoft.com/windows/pki/2005/Authenticode"><r:grant><as:ManifestInformation Hash="0a34bda0b16084fd3360fd64cad2da685dfc890a4d78a3edcb34fd238d21805c" Description="" Url=""><as:assemblyIdentity name="WordAddIn.vsto" version="1.0.0.0" publicKeyToken="06a92c46db516926" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" /></as:ManifestInformation><as:SignedBy /><as:AuthenticodePublisher><as:X509SubjectName>CN=DESKTOP-Q6H7B6L\Administrator</as:X509SubjectName></as:AuthenticodePublisher></r:grant><r:issuer><Signature Id="AuthenticodeSignature" xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha256" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /><DigestValue>cV57IfAuq85wNkKjrzi3jhRZNc7Cf6ZvKM70ci4T5wQ=</DigestValue></Reference></SignedInfo><SignatureValue>AzHMNpKdtaXkn+WGDS5auR1B95LwvsxcHO+9+9oxPZqVD9RSQ+E/LmN9xteIZF2ugOZn2LwMDUW7Kc2fOkvwoKycCxJE9avHhK284WaQR+94tOjrlBpm7Tiw8GsWz2Ts/sqhI4n5v07hPY9nGJVcJgGLJEBKrMMdGTFJwbOE7Ps=</SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>23ghUI75yy8GcLhPT5yA+v2ssRfSW+chNqMI+pq5OAr7RXQJOt/+bHdoT9NoS9GQkvblc7ekoUNShIcN601ZZOPgAxkXaQS+La14Wp8GOwnM1qHNJwgla4VAIYjmCj3CUMXLsxspOFVZKRnB6/idYku4Gzhc7NjRBAwe8qWBXaE=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><X509Data><X509Certificate>MIICDTCCAXagAwIBAgIQJpSlsxfGbpRNgyjD5Q/yDjANBgkqhkiG9w0BAQsFADBFMUMwQQYDVQQDHjoARABFAFMASwBUAE8AUAAtAFEANgBIADcAQgA2AEwAXABBAGQAbQBpAG4AaQBzAHQAcgBhAHQAbwByMB4XDTI2MDEyNDAwMzYxNVoXDTI3MDEyNDA2MzYxNVowRTFDMEEGA1UEAx46AEQARQBTAEsAVABPAFAALQBRADYASAA3AEIANgBMAFwAQQBkAG0AaQBuAGkAcwB0AHIAYQB0AG8AcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA23ghUI75yy8GcLhPT5yA+v2ssRfSW+chNqMI+pq5OAr7RXQJOt/+bHdoT9NoS9GQkvblc7ekoUNShIcN601ZZOPgAxkXaQS+La14Wp8GOwnM1qHNJwgla4VAIYjmCj3CUMXLsxspOFVZKRnB6/idYku4Gzhc7NjRBAwe8qWBXaECAwEAATANBgkqhkiG9w0BAQsFAAOBgQC3GjWMhEFFrn9PGYrQVGNAaibG1sR/eRX3ZWNRjYLhiqbsdeHvm4CX/W0EWd9yZlbaej87XyeUbX+mC3q3yMFVPCRn/W65WYyBPbWTWmSfU9VLKKULAH6WqjS7CqEU3cQSuKcU6nYG4AJu2/FkQJaA82tr3pvcQD28HmOlDeNh0Q==</X509Certificate></X509Data></KeyInfo></Signature></r:issuer></r:license></msrel:RelData></KeyInfo></Signature></asmv1:assembly>
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xrml="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
|
||||
<assemblyIdentity name="WordAddIn.vsto" version="1.0.0.0" publicKeyToken="06a92c46db516926" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" />
|
||||
<description asmv2:publisher="WordAddIn" asmv2:product="WordAddIn" xmlns="urn:schemas-microsoft-com:asm.v1" />
|
||||
<deployment install="false" mapFileExtensions="true" />
|
||||
<compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
|
||||
<framework targetVersion="4.7.2" profile="Full" supportedRuntime="4.0.30319" />
|
||||
</compatibleFrameworks>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="install" codebase="Application Files\WordAddIn_1_0_0_0\WordAddIn.dll.manifest" size="14626">
|
||||
<assemblyIdentity name="WordAddIn.dll" version="1.0.0.0" publicKeyToken="06a92c46db516926" language="neutral" processorArchitecture="msil" type="win32" />
|
||||
<hash>
|
||||
<dsig:Transforms>
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>l0YIXWniJAOVvXIuq2gcsxgh6HiLzzq3Qbzl/vvdGcU=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<publisherIdentity name="CN=DESKTOP-Q6H7B6L\Administrator" issuerKeyHash="42606c52715d5764c2f9dab5bee6dcd76cc7a67d" /><Signature Id="StrongNameSignature" xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha256" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /><DigestValue>XIAhjSP9NMvto3hNCon8XWja0spk/WAz/YRgsaC9NAo=</DigestValue></Reference></SignedInfo><SignatureValue>ZEub2vJdHkXv+rnwN2Rfq6vBnN+mUYuOr4/X76AcTre2N9HNv36HIeuufOaCwSIm9I37R09oAa0YKgWsr0K/CCgSF7wqaVqBe6fJcvepI/Gtaolrmta1FwKCh1C53YDt7PNakBpydLsreZW0P0aBY68U2MJAfTNWUs2NmeqXVG4=</SignatureValue><KeyInfo Id="StrongNameKeyInfo"><KeyValue><RSAKeyValue><Modulus>23ghUI75yy8GcLhPT5yA+v2ssRfSW+chNqMI+pq5OAr7RXQJOt/+bHdoT9NoS9GQkvblc7ekoUNShIcN601ZZOPgAxkXaQS+La14Wp8GOwnM1qHNJwgla4VAIYjmCj3CUMXLsxspOFVZKRnB6/idYku4Gzhc7NjRBAwe8qWBXaE=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><msrel:RelData xmlns:msrel="http://schemas.microsoft.com/windows/rel/2005/reldata"><r:license xmlns:r="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:as="http://schemas.microsoft.com/windows/pki/2005/Authenticode"><r:grant><as:ManifestInformation Hash="0a34bda0b16084fd3360fd64cad2da685dfc890a4d78a3edcb34fd238d21805c" Description="" Url=""><as:assemblyIdentity name="WordAddIn.vsto" version="1.0.0.0" publicKeyToken="06a92c46db516926" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" /></as:ManifestInformation><as:SignedBy /><as:AuthenticodePublisher><as:X509SubjectName>CN=DESKTOP-Q6H7B6L\Administrator</as:X509SubjectName></as:AuthenticodePublisher></r:grant><r:issuer><Signature Id="AuthenticodeSignature" xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha256" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /><DigestValue>cV57IfAuq85wNkKjrzi3jhRZNc7Cf6ZvKM70ci4T5wQ=</DigestValue></Reference></SignedInfo><SignatureValue>AzHMNpKdtaXkn+WGDS5auR1B95LwvsxcHO+9+9oxPZqVD9RSQ+E/LmN9xteIZF2ugOZn2LwMDUW7Kc2fOkvwoKycCxJE9avHhK284WaQR+94tOjrlBpm7Tiw8GsWz2Ts/sqhI4n5v07hPY9nGJVcJgGLJEBKrMMdGTFJwbOE7Ps=</SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>23ghUI75yy8GcLhPT5yA+v2ssRfSW+chNqMI+pq5OAr7RXQJOt/+bHdoT9NoS9GQkvblc7ekoUNShIcN601ZZOPgAxkXaQS+La14Wp8GOwnM1qHNJwgla4VAIYjmCj3CUMXLsxspOFVZKRnB6/idYku4Gzhc7NjRBAwe8qWBXaE=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><X509Data><X509Certificate>MIICDTCCAXagAwIBAgIQJpSlsxfGbpRNgyjD5Q/yDjANBgkqhkiG9w0BAQsFADBFMUMwQQYDVQQDHjoARABFAFMASwBUAE8AUAAtAFEANgBIADcAQgA2AEwAXABBAGQAbQBpAG4AaQBzAHQAcgBhAHQAbwByMB4XDTI2MDEyNDAwMzYxNVoXDTI3MDEyNDA2MzYxNVowRTFDMEEGA1UEAx46AEQARQBTAEsAVABPAFAALQBRADYASAA3AEIANgBMAFwAQQBkAG0AaQBuAGkAcwB0AHIAYQB0AG8AcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA23ghUI75yy8GcLhPT5yA+v2ssRfSW+chNqMI+pq5OAr7RXQJOt/+bHdoT9NoS9GQkvblc7ekoUNShIcN601ZZOPgAxkXaQS+La14Wp8GOwnM1qHNJwgla4VAIYjmCj3CUMXLsxspOFVZKRnB6/idYku4Gzhc7NjRBAwe8qWBXaECAwEAATANBgkqhkiG9w0BAQsFAAOBgQC3GjWMhEFFrn9PGYrQVGNAaibG1sR/eRX3ZWNRjYLhiqbsdeHvm4CX/W0EWd9yZlbaej87XyeUbX+mC3q3yMFVPCRn/W65WYyBPbWTWmSfU9VLKKULAH6WqjS7CqEU3cQSuKcU6nYG4AJu2/FkQJaA82tr3pvcQD28HmOlDeNh0Q==</X509Certificate></X509Data></KeyInfo></Signature></r:issuer></r:license></msrel:RelData></KeyInfo></Signature></asmv1:assembly>
|
||||
Binary file not shown.
@@ -1,440 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Win32;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
|
||||
namespace WpsInstaller
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("========================================");
|
||||
Console.WriteLine(" WPS Add-in Installer Tool");
|
||||
Console.WriteLine("========================================");
|
||||
Console.WriteLine();
|
||||
|
||||
string mode = "wps"; // default
|
||||
if (args.Length > 0)
|
||||
{
|
||||
mode = args[0].ToLower();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// 1. Locate WordAddIn.dll and WordAddIn.vsto
|
||||
string currentDir = AppDomain.CurrentDomain.BaseDirectory;
|
||||
string dllPath = Path.Combine(currentDir, "WordAddIn.dll");
|
||||
string vstoPath = Path.Combine(currentDir, "WordAddIn.vsto");
|
||||
|
||||
if (!File.Exists(dllPath))
|
||||
{
|
||||
// Fallback for Dev scenario
|
||||
string devPathDll = Path.GetFullPath(Path.Combine(currentDir, @"..\..\..\WordAddIn\bin\Debug\WordAddIn.dll"));
|
||||
if (!File.Exists(devPathDll))
|
||||
{
|
||||
devPathDll = Path.GetFullPath(Path.Combine(currentDir, @"..\..\..\WordAddIn\bin\Release\WordAddIn.dll"));
|
||||
}
|
||||
|
||||
if (File.Exists(devPathDll))
|
||||
{
|
||||
dllPath = devPathDll;
|
||||
vstoPath = Path.ChangeExtension(dllPath, ".vsto");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Error: Could not find WordAddIn.dll.");
|
||||
Pause();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine("Found DLL: " + dllPath);
|
||||
|
||||
if (mode == "word")
|
||||
{
|
||||
Console.WriteLine("Mode: Switch to MS Word (VSTO)");
|
||||
// 1. Clean WPS Keys
|
||||
CleanupWpsKeys();
|
||||
|
||||
// 1.5 Clear ClickOnce cache to avoid upgrade conflicts
|
||||
Console.WriteLine("Clearing ClickOnce cache to avoid upgrade conflicts...");
|
||||
ClearClickOnceCache();
|
||||
|
||||
// 2. Register VSTO
|
||||
if (RegisterVsto(vstoPath))
|
||||
{
|
||||
Console.WriteLine(" [OK] VSTO registered successfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(" [FAIL] Failed to register VSTO.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Mode: Switch to WPS Office");
|
||||
// 1. Register Assembly (COM Registration)
|
||||
Console.WriteLine("Registering Assembly for COM Interop...");
|
||||
if (RegisterAssembly(dllPath))
|
||||
{
|
||||
Console.WriteLine(" [OK] Assembly registered successfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(" [FAIL] Failed to register assembly.");
|
||||
Pause();
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. Register for WPS (Registry Keys)
|
||||
Console.WriteLine("Configuring WPS Registry Keys...");
|
||||
if (RegisterForWPS())
|
||||
{
|
||||
Console.WriteLine(" [OK] WPS Registry keys configured successfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(" [FAIL] Failed to configure WPS registry keys.");
|
||||
Pause();
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. Cleanup conflicting VSTO registration
|
||||
Console.WriteLine("Checking for conflicting VSTO registrations...");
|
||||
CleanupVstoKeys();
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("========================================");
|
||||
Console.WriteLine(" Operation Completed Successfully!");
|
||||
Console.WriteLine("========================================");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("An unexpected error occurred: " + ex.Message);
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
}
|
||||
|
||||
Pause();
|
||||
}
|
||||
|
||||
static void UninstallOldVersions()
|
||||
{
|
||||
Console.WriteLine("Checking for existing versions to uninstall...");
|
||||
|
||||
// 1. Cleanup VSTO Keys
|
||||
CleanupVstoKeys();
|
||||
|
||||
// 2. Cleanup WPS Keys
|
||||
CleanupWpsKeys();
|
||||
|
||||
// 3. Cleanup COM Registration (WPS)
|
||||
UnregisterCom("{D8E52004-9D68-4509-8A11-66774D4F0523}", "WordAddIn.WpsAddIn");
|
||||
}
|
||||
|
||||
static void UnregisterCom(string guid, string progId)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Try to find CodeBase from HKCR\CLSID\{GUID}\InprocServer32
|
||||
string clsidKeyPath = @"CLSID\" + guid;
|
||||
string inprocKeyPath = clsidKeyPath + @"\InprocServer32";
|
||||
string oldDllPath = null;
|
||||
|
||||
using (RegistryKey key = Registry.ClassesRoot.OpenSubKey(inprocKeyPath))
|
||||
{
|
||||
if (key != null)
|
||||
{
|
||||
oldDllPath = key.GetValue("CodeBase") as string;
|
||||
if (string.IsNullOrEmpty(oldDllPath))
|
||||
{
|
||||
oldDllPath = key.GetValue("") as string; // Default value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(oldDllPath))
|
||||
{
|
||||
// Fix file:/// prefix if present
|
||||
if (oldDllPath.StartsWith("file:///", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
oldDllPath = oldDllPath.Substring(8).Replace('/', '\\');
|
||||
}
|
||||
|
||||
if (File.Exists(oldDllPath))
|
||||
{
|
||||
Console.WriteLine(" Found old COM registration pointing to: " + oldDllPath);
|
||||
Console.WriteLine(" Unregistering assembly...");
|
||||
|
||||
string regAsmPath = GetRegAsmPath();
|
||||
if (!string.IsNullOrEmpty(regAsmPath))
|
||||
{
|
||||
string args = string.Format("\"{0}\" /u /tlb", oldDllPath);
|
||||
ProcessStartInfo psi = new ProcessStartInfo(regAsmPath, args);
|
||||
psi.UseShellExecute = false;
|
||||
psi.RedirectStandardOutput = true;
|
||||
psi.CreateNoWindow = true;
|
||||
|
||||
using (Process p = Process.Start(psi))
|
||||
{
|
||||
string output = p.StandardOutput.ReadToEnd();
|
||||
p.WaitForExit();
|
||||
// Console.WriteLine(output); // Optional: show output
|
||||
}
|
||||
Console.WriteLine(" [OK] RegAsm /u completed.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(" Old COM DLL not found at: " + oldDllPath + ". Skipping RegAsm /u.");
|
||||
}
|
||||
}
|
||||
|
||||
// Force delete registry keys to be sure
|
||||
try
|
||||
{
|
||||
Registry.ClassesRoot.DeleteSubKeyTree(clsidKeyPath, false);
|
||||
Console.WriteLine(" [OK] Deleted HKCR\\" + clsidKeyPath);
|
||||
}
|
||||
catch {}
|
||||
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(progId))
|
||||
{
|
||||
Registry.ClassesRoot.DeleteSubKeyTree(progId, false);
|
||||
Console.WriteLine(" [OK] Deleted HKCR\\" + progId);
|
||||
}
|
||||
}
|
||||
catch {}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(" Warning during COM unregistration: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
static void Pause()
|
||||
{
|
||||
Console.WriteLine("\nPress any key to exit...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
static void ClearClickOnceCache()
|
||||
{
|
||||
try
|
||||
{
|
||||
string localApp = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
string cachePath = System.IO.Path.Combine(localApp, "Apps", "2.0");
|
||||
if (Directory.Exists(cachePath))
|
||||
{
|
||||
Directory.Delete(cachePath, true);
|
||||
Console.WriteLine(" [OK] Cleared ClickOnce cache at " + cachePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(" ClickOnce cache not found, skipping.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(" Warning: Failed to clear ClickOnce cache: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
static bool RegisterVsto(string vstoPath)
|
||||
{
|
||||
if (!File.Exists(vstoPath))
|
||||
{
|
||||
Console.WriteLine(" Error: .vsto file not found at " + vstoPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Register via Registry for Development/Local use
|
||||
// HKCU\Software\Microsoft\Office\Word\Addins\WordAddIn
|
||||
string keyPath = @"Software\Microsoft\Office\Word\Addins\WordAddIn";
|
||||
using (RegistryKey key = Registry.CurrentUser.CreateSubKey(keyPath))
|
||||
{
|
||||
if (key == null) return false;
|
||||
|
||||
key.SetValue("Description", "WordAddIn", RegistryValueKind.String);
|
||||
key.SetValue("FriendlyName", "WordAddIn", RegistryValueKind.String);
|
||||
key.SetValue("LoadBehavior", 3, RegistryValueKind.DWord);
|
||||
// Point to vsto file with |vstolocal to indicate local file
|
||||
key.SetValue("Manifest", vstoPath + "|vstolocal", RegistryValueKind.String);
|
||||
|
||||
Console.WriteLine(" Created Key: HKCU\\" + keyPath);
|
||||
Console.WriteLine(" Manifest: " + vstoPath + "|vstolocal");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(" Error registering VSTO: " + ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static void CleanupWpsKeys()
|
||||
{
|
||||
try
|
||||
{
|
||||
string keyPath = @"Software\Kingsoft\Office\Word\Addins\WordAddIn.WpsAddIn";
|
||||
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyPath, true))
|
||||
{
|
||||
if (key != null)
|
||||
{
|
||||
Console.WriteLine(" Found WPS key. Deleting...");
|
||||
Registry.CurrentUser.DeleteSubKeyTree(keyPath);
|
||||
Console.WriteLine(" [OK] WPS key deleted.");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(" Warning: Failed to cleanup WPS keys: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
static bool RegisterAssembly(string assemblyPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Use RegistrationServices to register the assembly
|
||||
// This is equivalent to regasm /codebase
|
||||
// Note: This requires the assembly to be strong-named if registered in GAC,
|
||||
// but for simple codebase registration, it might work if run as Admin.
|
||||
|
||||
// However, standard RegistrationServices doesn't easily support /codebase option programmatically
|
||||
// without some caveats.
|
||||
// The most robust way for a utility is often to shell out to RegAsm.exe if available,
|
||||
// OR use RegistrationServices.RegisterAssembly.
|
||||
|
||||
// Let's try RegistrationServices first.
|
||||
RegistrationServices regService = new RegistrationServices();
|
||||
Assembly asm = Assembly.LoadFrom(assemblyPath);
|
||||
|
||||
// RegisterAssembly adds entries to HKCR\CLSID\{GUID}
|
||||
// We need to set the CodeBase registry key manually if not in GAC,
|
||||
// or ensure RegistrationServices does it.
|
||||
// Actually, RegistrationServices.RegisterAssembly does NOT set the CodeBase by default.
|
||||
// It works like RegAsm without /codebase.
|
||||
|
||||
// So calling RegAsm.exe via process is safer to ensure /codebase behavior.
|
||||
string regAsmPath = GetRegAsmPath();
|
||||
if (string.IsNullOrEmpty(regAsmPath))
|
||||
{
|
||||
Console.WriteLine(" Warning: Could not find RegAsm.exe. Attempting manual registration...");
|
||||
return ManualRegister(asm, assemblyPath);
|
||||
}
|
||||
|
||||
string args = string.Format("\"{0}\" /codebase /tlb", assemblyPath);
|
||||
ProcessStartInfo psi = new ProcessStartInfo(regAsmPath, args);
|
||||
psi.UseShellExecute = false;
|
||||
psi.RedirectStandardOutput = true;
|
||||
psi.CreateNoWindow = true;
|
||||
|
||||
Console.WriteLine(string.Format(" Executing: {0} {1}", psi.FileName, psi.Arguments));
|
||||
|
||||
using (Process p = Process.Start(psi))
|
||||
{
|
||||
string output = p.StandardOutput.ReadToEnd();
|
||||
p.WaitForExit();
|
||||
Console.WriteLine(output);
|
||||
return p.ExitCode == 0;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(" Error registering assembly: " + ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static bool ManualRegister(Assembly asm, string assemblyPath)
|
||||
{
|
||||
// Fallback: This is complex to do fully manually for all COM types.
|
||||
// If RegAsm is missing, we might be in trouble.
|
||||
// But usually on a machine with .NET Framework (needed to run this app), RegAsm is present.
|
||||
return false;
|
||||
}
|
||||
|
||||
static string GetRegAsmPath()
|
||||
{
|
||||
// Usually in C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe
|
||||
// or Framework64
|
||||
string windir = Environment.GetEnvironmentVariable("windir");
|
||||
string fxDir = Path.Combine(windir, @"Microsoft.NET\Framework\v4.0.30319");
|
||||
// Check for 64 bit OS and prefer Framework64 if this process is 64 bit,
|
||||
// BUT WordAddIn is likely AnyCPU.
|
||||
// If Word/WPS is 32-bit, we need 32-bit RegAsm. If 64-bit, we need 64-bit RegAsm.
|
||||
// Ideally register both.
|
||||
|
||||
// For safety, let's try to find the one matching the current process architecture,
|
||||
// or just use the 32-bit one as it is most common for Office.
|
||||
|
||||
string regAsm = Path.Combine(fxDir, "RegAsm.exe");
|
||||
if (File.Exists(regAsm)) return regAsm;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static bool RegisterForWPS()
|
||||
{
|
||||
try
|
||||
{
|
||||
string keyPath = @"Software\Kingsoft\Office\Word\Addins\WordAddIn.WpsAddIn";
|
||||
using (RegistryKey key = Registry.CurrentUser.CreateSubKey(keyPath))
|
||||
{
|
||||
if (key == null)
|
||||
{
|
||||
Console.WriteLine(" Error: Could not create registry key HKCU\\" + keyPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
key.SetValue("LoadBehavior", 3, RegistryValueKind.DWord);
|
||||
key.SetValue("FriendlyName", "AI Word Assistant for WPS", RegistryValueKind.String);
|
||||
key.SetValue("Description", "AI Assistant", RegistryValueKind.String);
|
||||
key.SetValue("CommandLineSafe", 0, RegistryValueKind.DWord);
|
||||
|
||||
Console.WriteLine(" Created Key: HKCU\\" + keyPath);
|
||||
Console.WriteLine(" Set LoadBehavior = 3");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(" Error writing WPS registry keys: " + ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static void CleanupVstoKeys()
|
||||
{
|
||||
try
|
||||
{
|
||||
// VSTO adds keys in HKCU\Software\Microsoft\Office\Word\Addins\WordAddIn
|
||||
string vstoKeyPath = @"Software\Microsoft\Office\Word\Addins\WordAddIn";
|
||||
|
||||
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(vstoKeyPath, true))
|
||||
{
|
||||
if (key != null)
|
||||
{
|
||||
Console.WriteLine(" Found VSTO key in HKCU\\" + vstoKeyPath + ". Deleting to avoid conflicts...");
|
||||
Registry.CurrentUser.DeleteSubKeyTree(vstoKeyPath);
|
||||
Console.WriteLine(" [OK] VSTO key deleted.");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(" Warning: Failed to cleanup VSTO keys: " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("WpsInstaller")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("WpsInstaller")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("a1b2c3d4-e5f6-4789-0011-223344556677")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,58 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{A1B2C3D4-E5F6-4789-0011-223344556677}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>WpsInstaller</RootNamespace>
|
||||
<AssemblyName>WpsInstaller</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.manifest" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="WpsInstaller.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +0,0 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
|
||||
@@ -1,5 +0,0 @@
|
||||
D:\dsWork\aiData\WordAddIn\WpsInstaller\bin\Debug\WpsInstaller.exe
|
||||
D:\dsWork\aiData\WordAddIn\WpsInstaller\bin\Debug\WpsInstaller.pdb
|
||||
D:\dsWork\aiData\WordAddIn\WpsInstaller\obj\Debug\WpsInstaller.exe
|
||||
D:\dsWork\aiData\WordAddIn\WpsInstaller\obj\Debug\WpsInstaller.pdb
|
||||
d:\dsWork\aiData\WordAddIn\WpsInstaller\obj\Debug\WpsInstaller.csprojResolveAssemblyReference.cache
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,4 +0,0 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
|
||||
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
979fc59c1f2afcc3443738cd70ff09bf60f7ecb8fbff0eec3eb8b752a83b3e04
|
||||
@@ -1,6 +0,0 @@
|
||||
D:\dsWork\aiData\WordAddIn\WpsInstaller\bin\Release\WpsInstaller.exe
|
||||
D:\dsWork\aiData\WordAddIn\WpsInstaller\bin\Release\WpsInstaller.pdb
|
||||
D:\dsWork\aiData\WordAddIn\WpsInstaller\obj\Release\WpsInstaller.csproj.AssemblyReference.cache
|
||||
D:\dsWork\aiData\WordAddIn\WpsInstaller\obj\Release\WpsInstaller.csproj.CoreCompileInputs.cache
|
||||
D:\dsWork\aiData\WordAddIn\WpsInstaller\obj\Release\WpsInstaller.exe
|
||||
D:\dsWork\aiData\WordAddIn\WpsInstaller\obj\Release\WpsInstaller.pdb
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,20 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2007 James Newton-King
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
Binary file not shown.
@@ -1,71 +0,0 @@
|
||||
#  Json.NET
|
||||
|
||||
[](https://www.nuget.org/packages/Newtonsoft.Json/)
|
||||
[](https://dev.azure.com/jamesnk/Public/_build/latest?definitionId=8)
|
||||
|
||||
Json.NET is a popular high-performance JSON framework for .NET
|
||||
|
||||
## Serialize JSON
|
||||
|
||||
```csharp
|
||||
Product product = new Product();
|
||||
product.Name = "Apple";
|
||||
product.Expiry = new DateTime(2008, 12, 28);
|
||||
product.Sizes = new string[] { "Small" };
|
||||
|
||||
string json = JsonConvert.SerializeObject(product);
|
||||
// {
|
||||
// "Name": "Apple",
|
||||
// "Expiry": "2008-12-28T00:00:00",
|
||||
// "Sizes": [
|
||||
// "Small"
|
||||
// ]
|
||||
// }
|
||||
```
|
||||
|
||||
## Deserialize JSON
|
||||
|
||||
```csharp
|
||||
string json = @"{
|
||||
'Name': 'Bad Boys',
|
||||
'ReleaseDate': '1995-4-7T00:00:00',
|
||||
'Genres': [
|
||||
'Action',
|
||||
'Comedy'
|
||||
]
|
||||
}";
|
||||
|
||||
Movie m = JsonConvert.DeserializeObject<Movie>(json);
|
||||
|
||||
string name = m.Name;
|
||||
// Bad Boys
|
||||
```
|
||||
|
||||
## LINQ to JSON
|
||||
|
||||
```csharp
|
||||
JArray array = new JArray();
|
||||
array.Add("Manual text");
|
||||
array.Add(new DateTime(2000, 5, 23));
|
||||
|
||||
JObject o = new JObject();
|
||||
o["MyArray"] = array;
|
||||
|
||||
string json = o.ToString();
|
||||
// {
|
||||
// "MyArray": [
|
||||
// "Manual text",
|
||||
// "2000-05-23T00:00:00"
|
||||
// ]
|
||||
// }
|
||||
```
|
||||
|
||||
## Links
|
||||
|
||||
- [Homepage](https://www.newtonsoft.com/json)
|
||||
- [Documentation](https://www.newtonsoft.com/json/help)
|
||||
- [NuGet Package](https://www.nuget.org/packages/Newtonsoft.Json)
|
||||
- [Release Notes](https://github.com/JamesNK/Newtonsoft.Json/releases)
|
||||
- [Contributing Guidelines](https://github.com/JamesNK/Newtonsoft.Json/blob/master/CONTRIBUTING.md)
|
||||
- [License](https://github.com/JamesNK/Newtonsoft.Json/blob/master/LICENSE.md)
|
||||
- [Stack Overflow](https://stackoverflow.com/questions/tagged/json.net)
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user