实现完整的Creo Web API集成系统

- 添加模块化HTTP服务器架构,支持路由注册和请求处理
- 实现Creo状态检测API,提供连接状态和模型状态实时监控
- 完成STEP格式模型导出功能,支持装配体和零件导出
- 实现装配体层级结构分析,支持无限深度遍历和组件信息提取
- 添加层级组件安全删除功能,使用抑制策略保持装配体完整性
- 集成WebSocket服务器框架,为实时通信和长操作做准备
- 完善JSON处理、日志记录和认证管理基础设施
- 修复OTK API兼容性问题和内存管理优化
- 解决DeleteFeatures崩溃问题,采用SuppressFeatures替代方案

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root 2025-07-19 15:46:25 +08:00
parent 0fe01d65f3
commit cd59030b73
25 changed files with 3726 additions and 1606 deletions

38
.gitignore vendored
View File

@ -1,20 +1,20 @@
otk_cpp_doc/
.vs/
.claude/
.vscode/
*.user
*.userosscache
*.suo
*.ncrunch*
*.dbmdl
*.jfm
*.userprefs
*.aps
*.cache
*.ilk
*.log
*.tmp
*.tmp_proj
*.user
*.userosscache
otk_cpp_doc/
.vs/
.claude/
.vscode/
*.user
*.userosscache
*.suo
*.ncrunch*
*.dbmdl
*.jfm
*.userprefs
*.aps
*.cache
*.ilk
*.log
*.tmp
*.tmp_proj
*.user
*.userosscache
*.sln.docstates

View File

@ -1 +1 @@
#pragma once
#pragma once

145
CLAUDE.md
View File

@ -145,9 +145,134 @@ MFCCreoDll/
}
```
#### 模块4: 层级分析功能 (完成)
**功能:** 装配体层级结构分析,支持无限深度遍历
**文件:** CreoManager.h, CreoManager.cpp, MFCCreoDll.cpp
**测试状态:** ✅ 编译成功,已修复循环调用问题
**API端点**
- `POST /api/creo/analysis/hierarchy` - 装配体层级分析
**技术细节:**
- 使用SOTA算法基于ListFeaturesByType进行组件遍历
- 支持装配体和零件的完整层级分析
- 优化了API调用链避免重复的LoadComponentModel和ListFeaturesByType调用
- 实现了组件信息提取、文件大小计算和删除安全评估
- 支持无层级限制的递归分析
**API请求格式**
```json
{
"software_type": "creo",
"project_name": "Assembly Analysis",
"max_depth": 0,
"include_geometry": false
}
```
**API响应格式**
```json
{
"success": true,
"message": "Hierarchy analysis completed",
"data": {
"project_name": "ASM0001.asm",
"total_levels": 9,
"total_components": 223,
"hierarchy": [
{
"level": 0,
"name": "Main Assembly",
"components": [
{
"id": "ASM0001.asm",
"name": "Asm0001",
"type": "assembly",
"level": 0,
"children_count": 5,
"path": "ASM0001.asm",
"file_size": "2.5MB",
"deletion_safety": "forbidden"
}
]
}
],
"deletion_recommendations": {
"safe_deletions": [],
"risky_deletions": []
}
},
"error": null
}
```
**已解决的技术问题:**
1. **重复API调用优化** - 修复了LoadComponentModel和ListFeaturesByType的重复调用
2. **递归调用优化** - 优化了组件加载流程,避免不必要的重复操作
3. **内存管理改进** - 使用预加载模型参数传递,减少内存分配
#### 模块5: 层级删除功能 (完成)
**功能:** 装配体层级组件删除,支持安全的组件移除
**文件:** CreoManager.h, CreoManager.cpp, MFCCreoDll.cpp
**测试状态:** ✅ 编译成功,功能测试通过,已解决崩溃问题
**API端点**
- `POST /api/creo/hierarchy/delete` - 层级组件删除接口
**技术细节:**
- 使用 `SuppressFeatures` 替代 `DeleteFeatures` 实现安全删除
- 保持特征引用关系完整,避免装配体结构破坏
- 支持任意层级的组件删除,包括根层级组件
- 使用重生成指令确保模型状态一致性
- 完善的异常处理和错误恢复机制
**API请求格式**
```json
{
"software_type": "creo",
"project_name": "Assembly Delete",
"target_level": 2
}
```
**API响应格式**
```json
{
"success": true,
"message": "All components suppressed successfully (safer than deletion)",
"data": {
"original_levels": 5,
"target_level": 2,
"final_levels": 3,
"deleted_components": {
"level_2": [
"component1.prt",
"component2.asm"
]
},
"deletion_summary": {
"total_deleted": 15,
"successful": 15,
"failed": 0
}
},
"error": null
}
```
**已解决的技术问题:**
1. **Creo崩溃问题** - 使用SuppressFeatures替代DeleteFeatures避免引用丢失导致的崩溃
2. **层级安全性** - 支持删除任意层级的组件,包括根层级的关键组件
3. **引用完整性** - 抑制特征保持引用关系,避免外部依赖丢失
4. **模型重生成** - 使用重生成指令确保删除后模型状态正确
5. **异常处理** - 完善的错误处理机制,操作失败时提供详细信息
**关键技术突破:**
- 发现并解决了OTK DeleteFeatures在删除装配体核心组件时的崩溃问题
- 采用Suppression策略实现视觉删除效果同时保持模型结构完整性
- 实现了从根层级到任意深度的安全组件删除
### 🔄 待实现模块(按优先级排序)
#### 模块4: WebSocket服务 (高优先级)
#### 模块6: WebSocket服务 (高优先级)
**目标:** 实现双向实时通信,支持长时间操作
**预计文件:** WebSocketServer.h, WebSocketServer.cpp
**主要功能:**
@ -156,7 +281,7 @@ MFCCreoDll/
- 长操作进度反馈
- 客户端连接管理
#### 模块5: Creo长操作接口 (中优先级)
#### 模块7: Creo长操作接口 (中优先级)
**目标:** 实现模型加载、特征删除、多格式导出等操作
**预计文件:** ModelAnalyzer.h, ModelAnalyzer.cpp
**主要功能:**
@ -165,7 +290,7 @@ MFCCreoDll/
- 多格式导出STL、IGES等
- 操作进度监控
#### 模块6: 日志系统 (低优先级)
#### 模块8: 日志系统 (低优先级)
**目标:** 统一的日志记录和错误追踪
**预计文件:** Logger.h, Logger.cpp
**主要功能:**
@ -174,7 +299,7 @@ MFCCreoDll/
- 文件和控制台输出
- 调试信息记录
#### 模块7: 用户认证 (最低优先级)
#### 模块9: 用户认证 (最低优先级)
**目标:** 简单的用户识别和访问控制
**预计文件:** AuthManager.h, AuthManager.cpp
**主要功能:**
@ -219,10 +344,20 @@ Web前端 -> HTTP API (快速查询) -> CreoManager -> Creo
7. **JSON解析问题** - 实现了安全的JSON解析机制
8. **线程安全问题** - 使用mutex和atomic保证多线程安全
9. **API参数验证** - 完善了输入参数的验证机制
10. **DeleteFeatures崩溃问题** - 使用SuppressFeatures替代DeleteFeatures避免装配体结构破坏
11. **层级删除安全性** - 实现了任意层级的安全组件删除,包括根层级组件
12. **特征引用完整性** - 采用抑制策略保持特征引用关系,避免外部依赖丢失
### 下一步计划
建议继续实现模块3HTTP路由系统为后续WebSocket和复杂操作奠定基础。
建议继续实现模块6WebSocket服务为后续长操作和实时通信奠定基础。核心删除功能已经完成现在可以专注于实时通信和用户体验优化。
## 测试记录
### 测试原则与特点
- **所有的测试由我进行因为我在IDEvisual studio中开发的**
- **不能用任何假数据、模拟数据**
- **不能限制层级和数量**
## 构建和编译

View File

@ -1,25 +1,25 @@
#pragma once
// 系统配置常量
class Config {
public:
// 端口配置
static const int HTTP_PORT = 12345;
static const int WEBSOCKET_PORT = 12346;
// API配置
static constexpr const char* API_PREFIX = "/api";
// 超时配置
static const int HTTP_TIMEOUT_MS = 30000; // 30秒
static const int WEBSOCKET_TIMEOUT_MS = 300000; // 5分钟
// 缓冲区大小
static const int BUFFER_SIZE = 4096;
// Creo配置
static const int CREO_CHECK_INTERVAL_MS = 100; // 检查间隔
private:
Config() = delete; // 禁止实例化
};
#pragma once
// 系统配置常量
class Config {
public:
// 端口配置
static const int HTTP_PORT = 12345;
static const int WEBSOCKET_PORT = 12346;
// API配置
static constexpr const char* API_PREFIX = "/api";
// 超时配置
static const int HTTP_TIMEOUT_MS = 30000; // 30秒
static const int WEBSOCKET_TIMEOUT_MS = 300000; // 5分钟
// 缓冲区大小
static const int BUFFER_SIZE = 4096;
// Creo配置
static const int CREO_CHECK_INTERVAL_MS = 100; // 检查间隔
private:
Config() = delete; // 禁止实例化
};

File diff suppressed because it is too large Load Diff

View File

@ -1,94 +1,224 @@
#pragma once
#include <wfcSession.h>
#include <wfcGlobal.h>
#include <pfcExport.h>
#include <string>
#include <vector>
// Creo状态信息结构
struct CreoStatus {
bool is_connected = false;
std::string version;
std::string build;
std::string working_directory;
int session_id = 0;
};
// 模型状态信息结构
struct ModelStatus {
bool has_model = false;
std::string name;
std::string filename;
std::string type;
std::string software; // 从OTK API获取不设默认值
std::string version; // 从OTK API获取不设默认值
std::string connection_time;
bool is_assembly = false;
int total_parts = 0;
int assembly_levels = 0;
std::string file_size;
std::string connection_status;
std::string open_time;
};
// 导出结果结构
struct ExportResult {
bool success = false;
std::string export_path;
std::string file_size;
std::string format;
std::string export_time;
std::string software;
std::string original_file;
std::string dirname;
std::string filename;
std::string error_message;
};
// Creo管理器类
class CreoManager {
public:
static CreoManager& Instance();
// 状态检测
CreoStatus GetCreoStatus();
ModelStatus GetModelStatus();
// 基础操作
bool ShowMessage(const std::string& message);
// 导出功能
ExportResult ExportModelToSTEP(const std::string& export_path, const std::string& geom_flags = "solids");
// 辅助功能
std::string GetCurrentTimeString();
std::string GetCurrentTimeStringISO();
std::string GetFileSize(const std::string& filepath);
int SafeCalculateAssemblyLevels(wfcWAssembly_ptr assembly);
// 文件大小统计
std::string GetModelFileSize(pfcModel_ptr model);
std::string CalculateAssemblyTotalSize(pfcModel_ptr model);
double ParseMBFromSizeString(const std::string& size_str);
private:
CreoManager() = default;
~CreoManager() = default;
CreoManager(const CreoManager&) = delete;
CreoManager& operator=(const CreoManager&) = delete;
// 辅助函数
std::string XStringToString(const xstring& xstr);
xstring StringToXString(const std::string& str);
// 会话管理(避免重复代码)
struct SessionInfo {
pfcSession_ptr session;
wfcWSession_ptr wSession;
bool is_valid;
std::string version;
std::string build;
};
SessionInfo GetSessionInfo();
};
#pragma once
// 基础OTK头文件 - 确保正确的包含顺序
#include <pfcGlobal.h>
#include <pfcSession.h>
#include <wfcSession.h>
#include <wfcGlobal.h>
#include <pfcModel.h>
#include <pfcExceptions.h>
#include <pfcExport.h>
#include <pfcFeature.h>
#include <pfcComponentFeat.h>
#include <pfcFeature_s.h>
#include <pfcSolid.h>
#include <wfcSolid.h>
#include <wfcSolidInstructions.h>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
// Creo状态信息结构
struct CreoStatus {
bool is_connected = false;
std::string version;
std::string build;
std::string working_directory;
int session_id = 0;
};
// 模型状态信息结构
struct ModelStatus {
bool has_model = false;
std::string name;
std::string filename;
std::string type;
std::string software; // 从OTK API获取不设默认值
std::string version; // 从OTK API获取不设默认值
std::string connection_time;
bool is_assembly = false;
int total_parts = 0;
int assembly_levels = 0;
std::string file_size;
std::string connection_status;
std::string open_time;
};
// 导出结果结构
struct ExportResult {
bool success = false;
std::string export_path;
std::string file_size;
std::string format;
std::string export_time;
std::string software;
std::string original_file;
std::string dirname;
std::string filename;
std::string error_message;
};
// 层级分析组件信息结构
struct ComponentInfo {
std::string id;
std::string name;
std::string type; // "assembly" 或 "part"
int level;
int children_count;
std::string path;
std::string file_size;
std::string deletion_safety; // "forbidden", "risky", "moderate"
bool is_visible;
std::string model_type; // "MDL_ASSEMBLY", "MDL_PART", "MDL_DRAWING" 等
std::string full_path; // 完整的组件路径
};
// 层级分析请求结构
struct HierarchyAnalysisRequest {
std::string software_type;
std::string project_name;
int max_depth;
bool include_geometry;
std::map<std::string, std::string> analysis_options;
};
// 删除建议结构
struct DeletionRecommendation {
std::string component_id;
std::string component_name;
int level;
std::string reason;
std::vector<std::string> risk_factors;
double confidence;
};
// 层级分析结果结构
struct HierarchyAnalysisResult {
bool success = false;
std::string message;
std::string project_name;
int total_levels;
int total_components;
std::vector<std::vector<ComponentInfo>> hierarchy;
std::vector<DeletionRecommendation> safe_deletions;
std::vector<DeletionRecommendation> risky_deletions;
std::string error_message;
};
// Creo管理器类
class CreoManager {
public:
static CreoManager& Instance();
// 状态检测
CreoStatus GetCreoStatus();
ModelStatus GetModelStatus();
// 基础操作
bool ShowMessage(const std::string& message);
// 导出功能
ExportResult ExportModelToSTEP(const std::string& export_path, const std::string& geom_flags = "solids");
// 层级分析功能
HierarchyAnalysisResult AnalyzeModelHierarchy(const HierarchyAnalysisRequest& request);
// 层级删除功能
struct HierarchyDeleteResult {
bool success = false;
std::string message;
int original_levels;
int target_level;
int final_levels;
std::map<int, std::vector<std::string>> deleted_components;
int total_deleted;
int successful;
int failed;
std::string error_message;
};
HierarchyDeleteResult DeleteHierarchyComponents(const std::string& project_name, int target_level);
// 辅助功能
std::string GetCurrentTimeString();
std::string GetCurrentTimeStringISO();
std::string GetFileSize(const std::string& filepath);
int SafeCalculateAssemblyLevels(wfcWAssembly_ptr assembly);
// 文件大小统计
std::string GetModelFileSize(pfcModel_ptr model);
std::string CalculateAssemblyTotalSize(pfcModel_ptr model);
double ParseMBFromSizeString(const std::string& size_str);
private:
CreoManager(); // 需要自定义构造函数来设置配置
~CreoManager() = default;
CreoManager(const CreoManager&) = delete;
CreoManager& operator=(const CreoManager&) = delete;
// 辅助函数
std::string XStringToString(const xstring& xstr);
xstring StringToXString(const std::string& str);
// 层级分析私有方法 (新SOTA算法)
void AnalyzeAssemblyNode(wfcWAssembly_ptr assembly,
int level,
const std::string& parentName,
const std::string& currentPath,
HierarchyAnalysisResult& result);
ComponentInfo CreateComponentFromFeature(pfcComponentFeat_ptr compFeat,
int level,
const std::string& parentName,
const std::string& currentPath,
pfcModel_ptr preloadedModel = nullptr);
pfcModel_ptr LoadComponentModel(pfcComponentFeat_ptr compFeat);
// 旧方法 (保留用于兼容)
void TraverseAssemblyLevels(wfcWAssembly_ptr assembly,
int current_level,
const std::string& parent_path,
std::vector<std::vector<ComponentInfo>>& hierarchy_levels,
std::vector<ComponentInfo>& all_components);
void ClearStaticVisitedModels();
ComponentInfo CreateComponentInfo(wfcWComponentPath_ptr component_path,
int level, const std::string& parent_path);
// 新增CREOSON风格的安全方法
ComponentInfo CreateComponentInfoSafe(wfcWComponentPath_ptr component_path,
int level, const std::string& parent_path);
bool CheckCanRecurseSafely(wfcWComponentPath_ptr component_path);
wfcWAssembly_ptr GetSubAssemblySafely(wfcWComponentPath_ptr component_path);
std::string GetComponentTypeSafe(wfcWComponentPath_ptr component_path);
std::string GenerateComponentPathId(wfcWComponentPath_ptr component_path);
std::string EvaluateDeletionSafety(const ComponentInfo& component);
std::string GetComponentFileSize(wfcWComponentPath_ptr component_path);
std::string GetModelTypeString(pfcModelType model_type);
int CountChildComponents(wfcWComponentPath_ptr component_path);
// 会话管理(避免重复代码)
struct SessionInfo {
pfcSession_ptr session;
wfcWSession_ptr wSession;
bool is_valid;
std::string version;
std::string build;
};
SessionInfo GetSessionInfo();
};

View File

@ -1 +1 @@
#pragma once
#pragma once

View File

@ -1,57 +1,57 @@
#pragma once
#include <winsock2.h>
#include <ws2tcpip.h>
#include <string>
#include <map>
#include <functional>
#include "Config.h"
// HTTP请求结构
struct HttpRequest {
std::string method;
std::string path;
std::string query;
std::map<std::string, std::string> headers;
std::string body;
};
// HTTP响应结构
struct HttpResponse {
int status_code = 200;
std::map<std::string, std::string> headers;
std::string body;
HttpResponse() {
headers["Content-Type"] = "application/json";
headers["Access-Control-Allow-Origin"] = "*";
headers["Access-Control-Allow-Methods"] = "GET, POST, OPTIONS";
headers["Access-Control-Allow-Headers"] = "Content-Type";
}
};
// HTTP服务器类
class HttpServer {
public:
HttpServer();
~HttpServer();
bool Start();
void Stop();
bool IsRunning() const { return running_; }
// 设置路由处理器
void SetRouteHandler(const std::string& path,
std::function<HttpResponse(const HttpRequest&)> handler);
private:
static DWORD WINAPI ServerThread(LPVOID lpParam);
void HandleClient(SOCKET client_socket);
HttpRequest ParseRequest(const std::string& raw_request);
void SendResponse(SOCKET client_socket, const HttpResponse& response);
SOCKET server_socket_;
volatile bool running_;
HANDLE thread_handle_;
std::map<std::string, std::function<HttpResponse(const HttpRequest&)>> route_handlers_;
};
#pragma once
#include <winsock2.h>
#include <ws2tcpip.h>
#include <string>
#include <map>
#include <functional>
#include "Config.h"
// HTTP请求结构
struct HttpRequest {
std::string method;
std::string path;
std::string query;
std::map<std::string, std::string> headers;
std::string body;
};
// HTTP响应结构
struct HttpResponse {
int status_code = 200;
std::map<std::string, std::string> headers;
std::string body;
HttpResponse() {
headers["Content-Type"] = "application/json; charset=utf-8";
headers["Access-Control-Allow-Origin"] = "*";
headers["Access-Control-Allow-Methods"] = "GET, POST, OPTIONS";
headers["Access-Control-Allow-Headers"] = "Content-Type";
}
};
// HTTP服务器类
class HttpServer {
public:
HttpServer();
~HttpServer();
bool Start();
void Stop();
bool IsRunning() const { return running_; }
// 设置路由处理器
void SetRouteHandler(const std::string& path,
std::function<HttpResponse(const HttpRequest&)> handler);
private:
static DWORD WINAPI ServerThread(LPVOID lpParam);
void HandleClient(SOCKET client_socket);
HttpRequest ParseRequest(const std::string& raw_request);
void SendResponse(SOCKET client_socket, const HttpResponse& response);
SOCKET server_socket_;
volatile bool running_;
HANDLE thread_handle_;
std::map<std::string, std::function<HttpResponse(const HttpRequest&)>> route_handlers_;
};

View File

@ -1 +1 @@
#pragma once
#pragma once

View File

@ -1 +1 @@
#pragma once
#pragma once

View File

@ -1,341 +1,627 @@
// MFCCreoDll.cpp: 定义 DLL 的初始化例程。
//
#include "pch.h"
#include "framework.h"
#include "MFCCreoDll.h"
#include "HttpServer.h"
#include "CreoManager.h"
#include <wfcSession.h>
#include <wfcGlobal.h>
#include <string>
#include <sstream>
#include <regex>
#include <mutex>
#include <atomic>
#include <memory>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// --- 全局变量 ---
static std::unique_ptr<HttpServer> g_http_server;
static std::mutex message_mutex;
static std::string pending_message; // 待处理的消息
static std::atomic<bool> has_pending_message{false};
static UINT_PTR timer_id = 0;
// --- 辅助函数:将 std::string 转换为 xstring ---
xstring ConvertStringToXstring(const std::string& str)
{
std::wstring wstr(str.begin(), str.end());
return xstring(wstr.c_str());
}
// 定时器回调函数,在主线程中处理待处理的消息
VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
if (has_pending_message.load()) {
std::lock_guard<std::mutex> lock(message_mutex);
if (has_pending_message.load()) {
has_pending_message = false; // 立即清除标志,避免重复触发
try {
pfcSession_ptr Session = pfcGetCurrentSessionWithCompatibility(pfcC4Compatible);
wfcWSession_ptr wSession = wfcWSession::cast(Session);
xstring info = ConvertStringToXstring(pending_message);
wSession->UIShowMessageDialog(info, NULL);
}
catch (...) {
// 处理失败
}
}
}
}
// 测试路由处理器
HttpResponse TestHandler(const HttpRequest& request) {
bool creo_connected = false;
try {
pfcSession_ptr session = pfcGetCurrentSessionWithCompatibility(pfcC4Compatible);
creo_connected = (session != nullptr);
}
catch (...) {
creo_connected = false;
}
std::ostringstream json;
json << "{"
<< "\"success\": true,"
<< "\"data\": {"
<< "\"running\": " << (creo_connected ? "true" : "false") << ","
<< "\"message\": \"" << (creo_connected ? "CREOSON 与 Creo 均已启动" : "Creo 未连接") << "\""
<< "},"
<< "\"error\": null"
<< "}";
HttpResponse response;
response.body = json.str();
return response;
}
// 显示消息路由处理器
HttpResponse ShowMessageHandler(const HttpRequest& request) {
// 从查询参数获取消息
std::string message = "Default message";
size_t text_pos = request.query.find("text=");
if (text_pos != std::string::npos) {
text_pos += 5; // 跳过"text="
size_t end_pos = request.query.find("&", text_pos);
if (end_pos == std::string::npos) {
end_pos = request.query.length();
}
message = request.query.substr(text_pos, end_pos - text_pos);
}
// 设置待处理消息
{
std::lock_guard<std::mutex> lock(message_mutex);
pending_message = message;
has_pending_message = true;
}
HttpResponse response;
response.body = "{\"status\":\"ok\",\"message\":\"Message sent to Creo\"}";
return response;
}
// Creo状态检测路由处理器
HttpResponse CreoStatusHandler(const HttpRequest& request) {
CreoStatus status = CreoManager::Instance().GetCreoStatus();
std::ostringstream json;
json << "{"
<< "\"is_connected\":" << (status.is_connected ? "true" : "false") << ","
<< "\"version\":\"" << status.version << "\","
<< "\"build\":\"" << status.build << "\","
<< "\"working_directory\":\"" << status.working_directory << "\","
<< "\"session_id\":" << status.session_id
<< "}";
HttpResponse response;
response.body = json.str();
return response;
}
// 模型状态检测路由处理器
HttpResponse ModelStatusHandler(const HttpRequest& request) {
ModelStatus status = CreoManager::Instance().GetModelStatus();
std::ostringstream json;
if (status.has_model) {
json << "{"
<< "\"success\": true,"
<< "\"data\": {"
<< "\"name\": \"" << status.name << "\","
<< "\"filename\": \"" << status.filename << "\","
<< "\"type\": \"" << status.type << "\","
<< "\"software\": \"" << status.software << "\","
<< "\"version\": \"" << status.version << "\","
<< "\"connectionTime\": \"" << status.connection_time << "\","
<< "\"isAssembly\": " << (status.is_assembly ? "true" : "false") << ",";
if (status.is_assembly) {
json << "\"basicStats\": {"
<< "\"totalParts\": " << status.total_parts << ","
<< "\"assemblyLevels\": " << status.assembly_levels << ","
<< "\"fileSize\": \"" << status.file_size << "\""
<< "},";
}
json << "\"fileName\": \"" << status.filename << "\","
<< "\"sourceSoftware\": \"" << status.software << "\","
<< "\"partCount\": " << status.total_parts << ","
<< "\"assemblyLevel\": " << status.assembly_levels << ","
<< "\"connectionStatus\": \"" << status.connection_status << "\","
<< "\"openTime\": \"" << status.open_time << "\""
<< "},"
<< "\"error\": null"
<< "}";
} else {
json << "{"
<< "\"success\": false,"
<< "\"data\": null,"
<< "\"error\": \"No model is currently open\""
<< "}";
}
HttpResponse response;
response.body = json.str();
return response;
}
// 简单的JSON解析函数
std::string ExtractJsonValue(const std::string& json, const std::string& key) {
// 查找键值对 "key": "value"
std::string key_pattern = "\"" + key + "\"";
size_t key_pos = json.find(key_pattern);
if (key_pos != std::string::npos) {
// 找到冒号
size_t colon_pos = json.find(":", key_pos);
if (colon_pos != std::string::npos) {
// 跳过空格找到值的开始
size_t value_start = colon_pos + 1;
while (value_start < json.length() && (json[value_start] == ' ' || json[value_start] == '\t' || json[value_start] == '\n' || json[value_start] == '\r')) {
value_start++;
}
// 检查是否是字符串值(以双引号开始)
if (value_start < json.length() && json[value_start] == '"') {
size_t value_end = json.find('"', value_start + 1);
if (value_end != std::string::npos) {
return json.substr(value_start + 1, value_end - value_start - 1);
}
}
}
}
return "";
}
bool ExtractJsonBool(const std::string& json, const std::string& key) {
std::regex pattern("\"" + key + "\"\s*:\s*(true|false)");
std::smatch match;
if (std::regex_search(json, match, pattern)) {
return match[1].str() == "true";
}
return false;
}
// 模型导出路由处理器
HttpResponse ExportModelHandler(const HttpRequest& request) {
if (request.method != "POST") {
HttpResponse response;
response.status_code = 405;
response.body = "{\"success\": false, \"error\": \"Method not allowed\"}";
return response;
}
// 解析JSON请求体
std::string software_type = ExtractJsonValue(request.body, "software_type");
std::string format_type = ExtractJsonValue(request.body, "format_type");
std::string export_path = ExtractJsonValue(request.body, "export_path");
// 提取options中的geom_flags - 简化处理,避免正则表达式崩溃
std::string geom_flags = "solids"; // 默认值
// 简单的字符串查找方式,避免正则表达式
size_t options_pos = request.body.find("\"options\"");
if (options_pos != std::string::npos) {
size_t start_brace = request.body.find("{", options_pos);
if (start_brace != std::string::npos) {
size_t end_brace = request.body.find("}", start_brace);
if (end_brace != std::string::npos) {
std::string options_content = request.body.substr(start_brace + 1, end_brace - start_brace - 1);
std::string extracted_geom_flags = ExtractJsonValue(options_content, "geom_flags");
if (!extracted_geom_flags.empty()) {
geom_flags = extracted_geom_flags;
}
}
}
}
// 验证参数
if (software_type != "creo" || format_type != "step" || export_path.empty()) {
HttpResponse response;
response.status_code = 400;
response.body = "{\"success\": false, \"error\": \"Invalid parameters\"}";
return response;
}
// 执行导出
ExportResult result = CreoManager::Instance().ExportModelToSTEP(export_path, geom_flags);
HttpResponse response;
if (result.success) {
std::ostringstream json;
json << "{"
<< "\"success\": true,"
<< "\"data\": {"
<< "\"exportPath\": \"" << result.export_path << "\","
<< "\"fileSize\": \"" << result.file_size << "\","
<< "\"format\": \"" << result.format << "\","
<< "\"exportTime\": \"" << result.export_time << "\","
<< "\"software\": \"" << result.software << "\","
<< "\"originalFile\": \"" << result.original_file << "\","
<< "\"details\": {"
<< "\"dirname\": \"" << result.dirname << "\","
<< "\"filename\": \"" << result.filename << "\","
<< "\"creoson_response\": {"
<< "\"dirname\": \"" << result.dirname << "\","
<< "\"filename\": \"" << result.filename << "\","
<< "\"full_path\": \"" << result.export_path << "\""
<< "}}"
<< "},"
<< "\"error\": null"
<< "}";
response.body = json.str();
} else {
std::ostringstream json;
json << "{"
<< "\"success\": false,"
<< "\"data\": null,"
<< "\"error\": \"" << result.error_message << "\""
<< "}";
response.body = json.str();
response.status_code = 500;
}
return response;
}
extern "C" int user_initialize(
int argc,
char* argv[],
char* version,
char* build,
wchar_t errbuf[80])
{
pfcSession_ptr Session = pfcGetCurrentSessionWithCompatibility(pfcC4Compatible);
wfcWSession_ptr wSession = wfcWSession::cast(Session);
xstring info = L"New HTTP Server Starting on port 12345";
wSession->UIShowMessageDialog(info, NULL);
// 启动定时器处理消息
timer_id = SetTimer(NULL, 0, 100, TimerProc);
// 创建并启动HTTP服务器
g_http_server = std::make_unique<HttpServer>();
// 设置路由
g_http_server->SetRouteHandler("/test", TestHandler);
g_http_server->SetRouteHandler("/show_message", ShowMessageHandler);
g_http_server->SetRouteHandler("/api/status/creo", CreoStatusHandler);
g_http_server->SetRouteHandler("/api/status/model", ModelStatusHandler);
g_http_server->SetRouteHandler("/api/export/model", ExportModelHandler);
if (g_http_server->Start()) {
return 0;
} else {
g_http_server.reset();
return 1;
}
}
// --- OTK 出口函数 ---
// 这个函数在卸载插件或关闭 Creo 时被调用,非常重要!
extern "C" void user_terminate()
{
if (g_http_server) {
g_http_server->Stop();
g_http_server.reset();
}
if (timer_id != 0) {
KillTimer(NULL, timer_id);
timer_id = 0;
}
// MFCCreoDll.cpp: 定义 DLL 的初始化例程。
//
#include "pch.h"
#include "framework.h"
#include "MFCCreoDll.h"
#include "HttpServer.h"
#include "CreoManager.h"
#include <wfcSession.h>
#include <wfcGlobal.h>
#include <string>
#include <sstream>
#include <regex>
#include <mutex>
#include <atomic>
#include <memory>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// --- 全局变量 ---
static std::unique_ptr<HttpServer> g_http_server;
static std::mutex message_mutex;
static std::string pending_message; // 待处理的消息
static std::atomic<bool> has_pending_message{false};
static UINT_PTR timer_id = 0;
// --- 辅助函数:将 std::string 转换为 xstring ---
xstring ConvertStringToXstring(const std::string& str)
{
std::wstring wstr(str.begin(), str.end());
return xstring(wstr.c_str());
}
// 定时器回调函数,在主线程中处理待处理的消息
VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
if (has_pending_message.load()) {
std::lock_guard<std::mutex> lock(message_mutex);
if (has_pending_message.load()) {
has_pending_message = false; // 立即清除标志,避免重复触发
try {
pfcSession_ptr Session = pfcGetCurrentSession();
if (Session) {
// 创建字符串序列
xstringsequence_ptr messages = xstringsequence::create();
messages->append(xstring("Hello World Test"));
Session->UIDisplayMessage("message.txt", "USER_INFO", messages);
}
}
catch (...) {
// 处理失败
}
}
}
}
// 测试路由处理器
HttpResponse TestHandler(const HttpRequest& request) {
bool creo_connected = false;
try {
pfcSession_ptr session = pfcGetCurrentSessionWithCompatibility(pfcC4Compatible);
creo_connected = (session != nullptr);
}
catch (...) {
creo_connected = false;
}
std::ostringstream json;
json << "{"
<< "\"success\": true,"
<< "\"data\": {"
<< "\"running\": " << (creo_connected ? "true" : "false") << ","
<< "\"message\": \"" << (creo_connected ? "CREOSON 与 Creo 均已启动" : "Creo 未连接") << "\""
<< "},"
<< "\"error\": null"
<< "}";
HttpResponse response;
response.body = json.str();
return response;
}
// 显示消息路由处理器
HttpResponse ShowMessageHandler(const HttpRequest& request) {
// 从查询参数获取消息
std::string message = "Default message";
size_t text_pos = request.query.find("text=");
if (text_pos != std::string::npos) {
text_pos += 5; // 跳过"text="
size_t end_pos = request.query.find("&", text_pos);
if (end_pos == std::string::npos) {
end_pos = request.query.length();
}
message = request.query.substr(text_pos, end_pos - text_pos);
}
// 设置待处理消息
{
std::lock_guard<std::mutex> lock(message_mutex);
pending_message = message;
has_pending_message = true;
}
HttpResponse response;
response.body = "{\"status\":\"ok\",\"message\":\"Message sent to Creo\"}";
return response;
}
// Creo状态检测路由处理器
HttpResponse CreoStatusHandler(const HttpRequest& request) {
CreoStatus status = CreoManager::Instance().GetCreoStatus();
std::ostringstream json;
json << "{"
<< "\"is_connected\":" << (status.is_connected ? "true" : "false") << ","
<< "\"version\":\"" << status.version << "\","
<< "\"build\":\"" << status.build << "\","
<< "\"working_directory\":\"" << status.working_directory << "\","
<< "\"session_id\":" << status.session_id
<< "}";
HttpResponse response;
response.body = json.str();
return response;
}
// 模型状态检测路由处理器
HttpResponse ModelStatusHandler(const HttpRequest& request) {
ModelStatus status = CreoManager::Instance().GetModelStatus();
std::ostringstream json;
if (status.has_model) {
json << "{"
<< "\"success\": true,"
<< "\"data\": {"
<< "\"name\": \"" << status.name << "\","
<< "\"filename\": \"" << status.filename << "\","
<< "\"type\": \"" << status.type << "\","
<< "\"software\": \"" << status.software << "\","
<< "\"version\": \"" << status.version << "\","
<< "\"connectionTime\": \"" << status.connection_time << "\","
<< "\"isAssembly\": " << (status.is_assembly ? "true" : "false") << ",";
if (status.is_assembly) {
json << "\"basicStats\": {"
<< "\"totalParts\": " << status.total_parts << ","
<< "\"assemblyLevels\": " << status.assembly_levels << ","
<< "\"fileSize\": \"" << status.file_size << "\""
<< "},";
}
json << "\"fileName\": \"" << status.filename << "\","
<< "\"sourceSoftware\": \"" << status.software << "\","
<< "\"partCount\": " << status.total_parts << ","
<< "\"assemblyLevel\": " << status.assembly_levels << ","
<< "\"connectionStatus\": \"" << status.connection_status << "\","
<< "\"openTime\": \"" << status.open_time << "\""
<< "},"
<< "\"error\": null"
<< "}";
} else {
json << "{"
<< "\"success\": false,"
<< "\"data\": null,"
<< "\"error\": \"No model is currently open\""
<< "}";
}
HttpResponse response;
response.body = json.str();
return response;
}
// 简单的JSON解析函数
std::string ExtractJsonValue(const std::string& json, const std::string& key) {
// 查找键值对 "key": "value"
std::string key_pattern = "\"" + key + "\"";
size_t key_pos = json.find(key_pattern);
if (key_pos != std::string::npos) {
// 找到冒号
size_t colon_pos = json.find(":", key_pos);
if (colon_pos != std::string::npos) {
// 跳过空格找到值的开始
size_t value_start = colon_pos + 1;
while (value_start < json.length() && (json[value_start] == ' ' || json[value_start] == '\t' || json[value_start] == '\n' || json[value_start] == '\r')) {
value_start++;
}
// 检查是否是字符串值(以双引号开始)
if (value_start < json.length() && json[value_start] == '"') {
size_t value_end = json.find('"', value_start + 1);
if (value_end != std::string::npos) {
return json.substr(value_start + 1, value_end - value_start - 1);
}
}
// 处理数字值(不以双引号开始)
else if (value_start < json.length()) {
size_t value_end = value_start;
while (value_end < json.length() &&
json[value_end] != ',' &&
json[value_end] != '}' &&
json[value_end] != ']' &&
json[value_end] != ' ' &&
json[value_end] != '\t' &&
json[value_end] != '\n' &&
json[value_end] != '\r') {
value_end++;
}
if (value_end > value_start) {
return json.substr(value_start, value_end - value_start);
}
}
}
}
return "";
}
bool ExtractJsonBool(const std::string& json, const std::string& key) {
std::regex pattern("\"" + key + "\"\s*:\s*(true|false)");
std::smatch match;
if (std::regex_search(json, match, pattern)) {
return match[1].str() == "true";
}
return false;
}
// 模型导出路由处理器
HttpResponse ExportModelHandler(const HttpRequest& request) {
if (request.method != "POST") {
HttpResponse response;
response.status_code = 405;
response.body = "{\"success\": false, \"error\": \"Method not allowed\"}";
return response;
}
// 解析JSON请求体
std::string software_type = ExtractJsonValue(request.body, "software_type");
std::string format_type = ExtractJsonValue(request.body, "format_type");
std::string export_path = ExtractJsonValue(request.body, "export_path");
// 提取options中的geom_flags - 简化处理,避免正则表达式崩溃
std::string geom_flags = "solids"; // 默认值
// 简单的字符串查找方式,避免正则表达式
size_t options_pos = request.body.find("\"options\"");
if (options_pos != std::string::npos) {
size_t start_brace = request.body.find("{", options_pos);
if (start_brace != std::string::npos) {
size_t end_brace = request.body.find("}", start_brace);
if (end_brace != std::string::npos) {
std::string options_content = request.body.substr(start_brace + 1, end_brace - start_brace - 1);
std::string extracted_geom_flags = ExtractJsonValue(options_content, "geom_flags");
if (!extracted_geom_flags.empty()) {
geom_flags = extracted_geom_flags;
}
}
}
}
// 验证参数
if (software_type != "creo" || format_type != "step" || export_path.empty()) {
HttpResponse response;
response.status_code = 400;
response.body = "{\"success\": false, \"error\": \"Invalid parameters\"}";
return response;
}
// 执行导出
ExportResult result = CreoManager::Instance().ExportModelToSTEP(export_path, geom_flags);
HttpResponse response;
if (result.success) {
std::ostringstream json;
json << "{"
<< "\"success\": true,"
<< "\"data\": {"
<< "\"exportPath\": \"" << result.export_path << "\","
<< "\"fileSize\": \"" << result.file_size << "\","
<< "\"format\": \"" << result.format << "\","
<< "\"exportTime\": \"" << result.export_time << "\","
<< "\"software\": \"" << result.software << "\","
<< "\"originalFile\": \"" << result.original_file << "\","
<< "\"details\": {"
<< "\"dirname\": \"" << result.dirname << "\","
<< "\"filename\": \"" << result.filename << "\","
<< "\"creoson_response\": {"
<< "\"dirname\": \"" << result.dirname << "\","
<< "\"filename\": \"" << result.filename << "\","
<< "\"full_path\": \"" << result.export_path << "\""
<< "}}"
<< "},"
<< "\"error\": null"
<< "}";
response.body = json.str();
} else {
std::ostringstream json;
json << "{"
<< "\"success\": false,"
<< "\"data\": null,"
<< "\"error\": \"" << result.error_message << "\""
<< "}";
response.body = json.str();
response.status_code = 500;
}
return response;
}
// JSON字符串转义函数
std::string EscapeJsonString(const std::string& str) {
std::string escaped = str;
// 替换反斜杠
size_t pos = 0;
while ((pos = escaped.find("\\", pos)) != std::string::npos) {
escaped.replace(pos, 1, "\\\\");
pos += 2;
}
// 替换双引号
pos = 0;
while ((pos = escaped.find("\"", pos)) != std::string::npos) {
escaped.replace(pos, 1, "\\\"");
pos += 2;
}
// 替换换行符
pos = 0;
while ((pos = escaped.find("\n", pos)) != std::string::npos) {
escaped.replace(pos, 1, "\\n");
pos += 2;
}
// 替换制表符
pos = 0;
while ((pos = escaped.find("\t", pos)) != std::string::npos) {
escaped.replace(pos, 1, "\\t");
pos += 2;
}
return escaped;
}
// 层级分析路由处理器
HttpResponse HierarchyAnalysisHandler(const HttpRequest& request) {
HttpResponse response;
if (request.method != "POST") {
response.status_code = 405;
response.body = "{\"success\": false, \"error\": \"Method not allowed\"}";
return response;
}
try {
// 解析JSON请求
HierarchyAnalysisRequest analysis_request;
// 简单的JSON解析参考现有的ExtractJsonValue方法
analysis_request.software_type = ExtractJsonValue(request.body, "software_type");
analysis_request.project_name = ExtractJsonValue(request.body, "project_name");
analysis_request.include_geometry = ExtractJsonValue(request.body, "include_geometry") == "true";
// 解析max_depth参数保持兼容性但不实际使用
std::string max_depth_str = ExtractJsonValue(request.body, "max_depth");
if (!max_depth_str.empty()) {
try {
analysis_request.max_depth = std::stoi(max_depth_str);
} catch (...) {
analysis_request.max_depth = 0; // 0表示无限制
}
} else {
analysis_request.max_depth = 0; // 0表示无限制
}
// 执行层级分析
HierarchyAnalysisResult result = CreoManager::Instance().AnalyzeModelHierarchy(analysis_request);
if (result.success) {
// 构建成功响应
std::ostringstream json;
json << "{"
<< "\"success\": true,"
<< "\"message\": \"" << result.message << "\","
<< "\"data\": {"
<< "\"project_name\": \"" << EscapeJsonString(result.project_name) << "\","
<< "\"total_levels\": " << result.total_levels << ","
<< "\"total_components\": " << result.total_components << ","
<< "\"hierarchy\": [";
// 构建层级数据
for (size_t level = 0; level < result.hierarchy.size(); level++) {
if (level > 0) json << ",";
json << "{"
<< "\"level\": " << level << ","
<< "\"name\": \"" << (level == 0 ? "Main Assembly" :
level == 1 ? "Sub Assembly" :
level == 2 ? "Parts" :
"Level " + std::to_string(level + 1) + " Components") << "\","
<< "\"components\": [";
for (size_t comp = 0; comp < result.hierarchy[level].size(); comp++) {
if (comp > 0) json << ",";
const ComponentInfo& component = result.hierarchy[level][comp];
json << "{"
<< "\"id\": \"" << EscapeJsonString(component.id) << "\","
<< "\"name\": \"" << EscapeJsonString(component.name) << "\","
<< "\"type\": \"" << EscapeJsonString(component.type) << "\","
<< "\"level\": " << component.level << ","
<< "\"children_count\": " << component.children_count << ","
<< "\"path\": \"" << EscapeJsonString(component.full_path) << "\","
<< "\"file_size\": \"" << EscapeJsonString(component.file_size) << "\","
<< "\"deletion_safety\": \"" << EscapeJsonString(component.deletion_safety) << "\""
<< "}";
}
json << "]}";
}
json << "],"
<< "\"deletion_recommendations\": {"
<< "\"safe_deletions\": [],"
<< "\"risky_deletions\": [";
// 构建删除建议
for (size_t i = 0; i < result.risky_deletions.size(); i++) {
if (i > 0) json << ",";
const DeletionRecommendation& rec = result.risky_deletions[i];
json << "{"
<< "\"component_id\": \"" << EscapeJsonString(rec.component_id) << "\","
<< "\"component_name\": \"" << EscapeJsonString(rec.component_name) << "\","
<< "\"level\": " << rec.level << ","
<< "\"reason\": \"" << EscapeJsonString(rec.reason) << "\","
<< "\"risk_factors\": [";
for (size_t j = 0; j < rec.risk_factors.size(); j++) {
if (j > 0) json << ",";
json << "\"" << EscapeJsonString(rec.risk_factors[j]) << "\"";
}
json << "],"
<< "\"confidence\": " << rec.confidence
<< "}";
}
json << "]"
<< "}"
<< "}"
<< "}";
response.body = json.str();
} else {
// 构建失败响应
std::ostringstream json;
json << "{"
<< "\"success\": false,"
<< "\"data\": null,"
<< "\"error\": \"" << result.error_message << "\""
<< "}";
response.body = json.str();
response.status_code = 500;
}
} catch (const std::exception& e) {
response.status_code = 500;
response.body = "{\"success\": false, \"error\": \"JSON parsing error: " + std::string(e.what()) + "\"}";
} catch (...) {
response.status_code = 500;
response.body = "{\"success\": false, \"error\": \"Unknown error during hierarchy analysis\"}";
}
return response;
}
// 层级删除路由处理器
HttpResponse HierarchyDeleteHandler(const HttpRequest& request) {
HttpResponse response;
if (request.method != "POST") {
response.status_code = 405;
response.body = "{\"success\": false, \"error\": \"Method not allowed\"}";
return response;
}
try {
// 解析JSON请求
std::string software_type = ExtractJsonValue(request.body, "software_type");
std::string project_name = ExtractJsonValue(request.body, "project_name");
std::string target_level_str = ExtractJsonValue(request.body, "target_level");
if (software_type.empty() || project_name.empty() || target_level_str.empty()) {
response.status_code = 400;
response.body = "{\"success\": false, \"error\": \"Missing required parameters: software_type, project_name, target_level\"}";
return response;
}
int target_level;
try {
target_level = std::stoi(target_level_str);
} catch (...) {
response.status_code = 400;
response.body = "{\"success\": false, \"error\": \"Invalid target_level parameter\"}";
return response;
}
// 执行层级删除
CreoManager::HierarchyDeleteResult result = CreoManager::Instance().DeleteHierarchyComponents(project_name, target_level);
if (result.success) {
// 构建成功响应
std::ostringstream json;
json << "{"
<< "\"success\": true,"
<< "\"message\": \"" << EscapeJsonString(result.message) << "\","
<< "\"data\": {"
<< "\"original_levels\": " << result.original_levels << ","
<< "\"target_level\": " << result.target_level << ","
<< "\"final_levels\": " << result.final_levels << ","
<< "\"deleted_components\": {";
// 构建删除组件数据
bool first_level = true;
for (const auto& level_pair : result.deleted_components) {
if (!first_level) json << ",";
first_level = false;
json << "\"level_" << level_pair.first << "\": [";
bool first_component = true;
for (const auto& component : level_pair.second) {
if (!first_component) json << ",";
first_component = false;
json << "\"" << EscapeJsonString(component) << "\"";
}
json << "]";
}
json << "},"
<< "\"deletion_summary\": {"
<< "\"total_deleted\": " << result.total_deleted << ","
<< "\"successful\": " << result.successful << ","
<< "\"failed\": " << result.failed
<< "}"
<< "},"
<< "\"error\": null"
<< "}";
response.body = json.str();
} else {
// 构建错误响应
std::ostringstream json;
json << "{"
<< "\"success\": false,"
<< "\"message\": \"" << EscapeJsonString(result.message) << "\","
<< "\"error\": \"" << EscapeJsonString(result.error_message) << "\""
<< "}";
response.status_code = 500;
response.body = json.str();
}
} catch (const std::exception& e) {
response.status_code = 500;
response.body = "{\"success\": false, \"error\": \"JSON parsing error: " + std::string(e.what()) + "\"}";
} catch (...) {
response.status_code = 500;
response.body = "{\"success\": false, \"error\": \"Unknown error during hierarchy deletion\"}";
}
return response;
}
extern "C" int user_initialize(
int argc,
char* argv[],
char* version,
char* build,
wchar_t errbuf[80])
{
pfcSession_ptr Session = pfcGetCurrentSessionWithCompatibility(pfcC4Compatible);
wfcWSession_ptr wSession = wfcWSession::cast(Session);
xstring info = L"New HTTP Server Starting on port 12345";
wSession->UIShowMessageDialog(info, NULL);
// 启动定时器处理消息
timer_id = SetTimer(NULL, 0, 100, TimerProc);
// 创建并启动HTTP服务器
g_http_server = std::make_unique<HttpServer>();
// 设置路由
g_http_server->SetRouteHandler("/test", TestHandler);
g_http_server->SetRouteHandler("/show_message", ShowMessageHandler);
g_http_server->SetRouteHandler("/api/status/creo", CreoStatusHandler);
g_http_server->SetRouteHandler("/api/status/model", ModelStatusHandler);
g_http_server->SetRouteHandler("/api/export/model", ExportModelHandler);
g_http_server->SetRouteHandler("/api/creo/analysis/hierarchy", HierarchyAnalysisHandler);
g_http_server->SetRouteHandler("/api/creo/hierarchy/delete", HierarchyDeleteHandler);
if (g_http_server->Start()) {
return 0;
} else {
g_http_server.reset();
return 1;
}
}
// --- OTK 出口函数 ---
// 这个函数在卸载插件或关闭 Creo 时被调用,非常重要!
extern "C" void user_terminate()
{
if (g_http_server) {
g_http_server->Stop();
g_http_server.reset();
}
if (timer_id != 0) {
KillTimer(NULL, timer_id);
timer_id = 0;
}
}

View File

@ -1,6 +1,6 @@
; MFCCreoDll.def: DLL
LIBRARY
EXPORTS
;
; MFCCreoDll.def: DLL
LIBRARY
EXPORTS
;

View File

@ -1,27 +1,27 @@
// MFCCreoDll.h: MFCCreoDll DLL 的主标头文件
//
#pragma once
#ifndef __AFXWIN_H__
#error "在包含此文件之前包含 'pch.h' 以生成 PCH"
#endif
#include "resource.h" // 主符号
// CMFCCreoDllApp
// 有关此类实现的信息,请参阅 MFCCreoDll.cpp
//
class CMFCCreoDllApp : public CWinApp
{
public:
CMFCCreoDllApp();
// 重写
public:
virtual BOOL InitInstance();
DECLARE_MESSAGE_MAP()
};
// MFCCreoDll.h: MFCCreoDll DLL 的主标头文件
//
#pragma once
#ifndef __AFXWIN_H__
#error "在包含此文件之前包含 'pch.h' 以生成 PCH"
#endif
#include "resource.h" // 主符号
// CMFCCreoDllApp
// 有关此类实现的信息,请参阅 MFCCreoDll.cpp
//
class CMFCCreoDllApp : public CWinApp
{
public:
CMFCCreoDllApp();
// 重写
public:
virtual BOOL InitInstance();
DECLARE_MESSAGE_MAP()
};

View File

@ -1,31 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35303.130
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MFCCreoDll", "MFCCreoDll.vcxproj", "{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}.Debug|x64.ActiveCfg = Debug|x64
{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}.Debug|x64.Build.0 = Debug|x64
{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}.Debug|x86.ActiveCfg = Debug|Win32
{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}.Debug|x86.Build.0 = Debug|Win32
{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}.Release|x64.ActiveCfg = Release|x64
{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}.Release|x64.Build.0 = Release|x64
{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}.Release|x86.ActiveCfg = Release|Win32
{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BA9E3D0E-615B-4C19-A67E-98D7B8BD303D}
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35303.130
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MFCCreoDll", "MFCCreoDll.vcxproj", "{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}.Debug|x64.ActiveCfg = Debug|x64
{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}.Debug|x64.Build.0 = Debug|x64
{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}.Debug|x86.ActiveCfg = Debug|Win32
{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}.Debug|x86.Build.0 = Debug|Win32
{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}.Release|x64.ActiveCfg = Release|x64
{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}.Release|x64.Build.0 = Release|x64
{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}.Release|x86.ActiveCfg = Release|Win32
{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BA9E3D0E-615B-4C19-A67E-98D7B8BD303D}
EndGlobalSection
EndGlobal

View File

@ -1,105 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<ProjectGuid>{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}</ProjectGuid>
<Keyword>MFCDLLProj</Keyword>
<RootNamespace>MFCCreoDll</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>C:\Program Files\PTC\Creo 5.0.0.0\Common Files\protoolkit\protk_appls\includes;C:\Program Files\PTC\Creo 5.0.0.0\Common Files\protoolkit\includes;C:\Program Files\PTC\Creo 5.0.0.0\Common Files\otk\otk_cpp\otk_examples\includes;C:\Program Files\PTC\Creo 5.0.0.0\Common Files\otk\otk_cpp\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files\PTC\Creo 5.0.0.0\Common Files\protoolkit\x86e_win64\obj;C:\Program Files\PTC\Creo 5.0.0.0\Common Files\otk\otk_cpp\x86e_win64\obj;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_WINDOWS;_USRDLL;USE_ANSI_IOSTREAMS;PRO_USE_VAR_ARGS;PRO_MACHINE=36;HYCOMMONWINAPI_EXPORTS;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<ModuleDefinitionFile>.\MFCCreoDll.def</ModuleDefinitionFile>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<ProjectGuid>{7DAAD03E-2254-46D7-9554-ECEE69E76DCA}</ProjectGuid>
<Keyword>MFCDLLProj</Keyword>
<RootNamespace>MFCCreoDll</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>C:\Program Files\PTC\Creo 5.0.0.0\Common Files\protoolkit\protk_appls\includes;C:\Program Files\PTC\Creo 5.0.0.0\Common Files\protoolkit\includes;C:\Program Files\PTC\Creo 5.0.0.0\Common Files\otk\otk_cpp\otk_examples\includes;C:\Program Files\PTC\Creo 5.0.0.0\Common Files\otk\otk_cpp\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files\PTC\Creo 5.0.0.0\Common Files\protoolkit\x86e_win64\obj;C:\Program Files\PTC\Creo 5.0.0.0\Common Files\otk\otk_cpp\x86e_win64\obj;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_WINDOWS;_USRDLL;USE_ANSI_IOSTREAMS;PRO_USE_VAR_ARGS;PRO_MACHINE=36;HYCOMMONWINAPI_EXPORTS;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<ModuleDefinitionFile>.\MFCCreoDll.def</ModuleDefinitionFile>
<AdditionalDependencies>protk_dllmd_NU.lib
;otk_cpp_md.lib
;otk_222_md.lib;
@ -117,138 +117,139 @@ gdi32.lib
;shell32.lib;
comdlg32.lib
;ole32.lib;
ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/FORCE:MULTIPLE /ignore:4049,4219,4217,4286
%(AdditionalOptions)</AdditionalOptions>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<ModuleDefinitionFile>.\MFCCreoDll.def</ModuleDefinitionFile>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>.\MFCCreoDll.def</ModuleDefinitionFile>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>.\MFCCreoDll.def</ModuleDefinitionFile>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="AuthManager.cpp" />
<ClCompile Include="CreoManager.cpp" />
<ClCompile Include="HttpRouter.cpp" />
<ClCompile Include="HttpServer.cpp" />
<ClCompile Include="JsonHelper.cpp" />
<ClCompile Include="Logger.cpp" />
<ClCompile Include="MFCCreoDll.cpp" />
<ClCompile Include="ModelAnalyzer.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="ServerManager.cpp" />
<ClCompile Include="WebSocketServer.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="MFCCreoDll.def" />
<None Include="res\MFCCreoDll.rc2" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="AuthManager.h" />
<ClInclude Include="Config.h" />
<ClInclude Include="CreoManager.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="httplib.h" />
<ClInclude Include="HttpRouter.h" />
<ClInclude Include="HttpServer.h" />
<ClInclude Include="JsonHelper.h" />
<ClInclude Include="Logger.h" />
<ClInclude Include="MFCCreoDll.h" />
<ClInclude Include="ModelAnalyzer.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="ServerManager.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="WebSocketServer.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MFCCreoDll.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/FORCE:MULTIPLE /ignore:4049,4219,4217,4286
%(AdditionalOptions)</AdditionalOptions>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<ModuleDefinitionFile>.\MFCCreoDll.def</ModuleDefinitionFile>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>.\MFCCreoDll.def</ModuleDefinitionFile>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>.\MFCCreoDll.def</ModuleDefinitionFile>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="AuthManager.cpp" />
<ClCompile Include="CreoManager.cpp" />
<ClCompile Include="HttpRouter.cpp" />
<ClCompile Include="HttpServer.cpp" />
<ClCompile Include="JsonHelper.cpp" />
<ClCompile Include="Logger.cpp" />
<ClCompile Include="MFCCreoDll.cpp" />
<ClCompile Include="ModelAnalyzer.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="ServerManager.cpp" />
<ClCompile Include="WebSocketServer.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="MFCCreoDll.def" />
<None Include="res\MFCCreoDll.rc2" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="AuthManager.h" />
<ClInclude Include="Config.h" />
<ClInclude Include="CreoManager.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="httplib.h" />
<ClInclude Include="HttpRouter.h" />
<ClInclude Include="HttpServer.h" />
<ClInclude Include="JsonHelper.h" />
<ClInclude Include="Logger.h" />
<ClInclude Include="MFCCreoDll.h" />
<ClInclude Include="ModelAnalyzer.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="pfcExceptions.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="ServerManager.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="WebSocketServer.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MFCCreoDll.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,136 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="源文件\src">
<UniqueIdentifier>{761da677-5d81-41dd-89a3-4633b68a3f51}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\src\core">
<UniqueIdentifier>{8fd55369-70b2-40ec-b5b1-de98ac94474c}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\src\http">
<UniqueIdentifier>{44545dfa-015e-4a96-8606-2c8300f12584}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\src\websocket">
<UniqueIdentifier>{c49458d6-8af1-4d4b-a0f6-b1bd38624f61}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\src\creo">
<UniqueIdentifier>{54f41b77-5391-47a5-bb0e-e066a43eb9d1}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\src\utils">
<UniqueIdentifier>{1fe71b11-38e5-49f6-8f30-c63793ff05fc}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\src\auth">
<UniqueIdentifier>{a2c62494-7ba1-4dec-97ed-b38aba84f3a6}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="MFCCreoDll.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="pch.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ServerManager.cpp">
<Filter>源文件\src\core</Filter>
</ClCompile>
<ClCompile Include="HttpServer.cpp">
<Filter>源文件\src\http</Filter>
</ClCompile>
<ClCompile Include="HttpRouter.cpp">
<Filter>源文件\src\http</Filter>
</ClCompile>
<ClCompile Include="WebSocketServer.cpp">
<Filter>源文件\src\websocket</Filter>
</ClCompile>
<ClCompile Include="CreoManager.cpp">
<Filter>源文件\src\creo</Filter>
</ClCompile>
<ClCompile Include="ModelAnalyzer.cpp">
<Filter>源文件\src\creo</Filter>
</ClCompile>
<ClCompile Include="JsonHelper.cpp">
<Filter>源文件\src\utils</Filter>
</ClCompile>
<ClCompile Include="Logger.cpp">
<Filter>源文件\src\utils</Filter>
</ClCompile>
<ClCompile Include="AuthManager.cpp">
<Filter>源文件\src\auth</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="MFCCreoDll.def">
<Filter>源文件</Filter>
</None>
<None Include="res\MFCCreoDll.rc2">
<Filter>资源文件</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="MFCCreoDll.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="pch.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="httplib.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="ServerManager.h">
<Filter>源文件\src\core</Filter>
</ClInclude>
<ClInclude Include="Config.h">
<Filter>源文件\src\core</Filter>
</ClInclude>
<ClInclude Include="HttpServer.h">
<Filter>源文件\src\http</Filter>
</ClInclude>
<ClInclude Include="HttpRouter.h">
<Filter>源文件\src\http</Filter>
</ClInclude>
<ClInclude Include="WebSocketServer.h">
<Filter>源文件\src\websocket</Filter>
</ClInclude>
<ClInclude Include="CreoManager.h">
<Filter>源文件\src\creo</Filter>
</ClInclude>
<ClInclude Include="ModelAnalyzer.h">
<Filter>源文件\src\creo</Filter>
</ClInclude>
<ClInclude Include="JsonHelper.h">
<Filter>源文件\src\utils</Filter>
</ClInclude>
<ClInclude Include="Logger.h">
<Filter>源文件\src\utils</Filter>
</ClInclude>
<ClInclude Include="AuthManager.h">
<Filter>源文件\src\auth</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MFCCreoDll.rc">
<Filter>资源文件</Filter>
</ResourceCompile>
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="源文件\src">
<UniqueIdentifier>{761da677-5d81-41dd-89a3-4633b68a3f51}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\src\core">
<UniqueIdentifier>{8fd55369-70b2-40ec-b5b1-de98ac94474c}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\src\http">
<UniqueIdentifier>{44545dfa-015e-4a96-8606-2c8300f12584}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\src\websocket">
<UniqueIdentifier>{c49458d6-8af1-4d4b-a0f6-b1bd38624f61}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\src\creo">
<UniqueIdentifier>{54f41b77-5391-47a5-bb0e-e066a43eb9d1}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\src\utils">
<UniqueIdentifier>{1fe71b11-38e5-49f6-8f30-c63793ff05fc}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\src\auth">
<UniqueIdentifier>{a2c62494-7ba1-4dec-97ed-b38aba84f3a6}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="MFCCreoDll.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="pch.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ServerManager.cpp">
<Filter>源文件\src\core</Filter>
</ClCompile>
<ClCompile Include="HttpServer.cpp">
<Filter>源文件\src\http</Filter>
</ClCompile>
<ClCompile Include="HttpRouter.cpp">
<Filter>源文件\src\http</Filter>
</ClCompile>
<ClCompile Include="WebSocketServer.cpp">
<Filter>源文件\src\websocket</Filter>
</ClCompile>
<ClCompile Include="CreoManager.cpp">
<Filter>源文件\src\creo</Filter>
</ClCompile>
<ClCompile Include="ModelAnalyzer.cpp">
<Filter>源文件\src\creo</Filter>
</ClCompile>
<ClCompile Include="JsonHelper.cpp">
<Filter>源文件\src\utils</Filter>
</ClCompile>
<ClCompile Include="Logger.cpp">
<Filter>源文件\src\utils</Filter>
</ClCompile>
<ClCompile Include="AuthManager.cpp">
<Filter>源文件\src\auth</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="MFCCreoDll.def">
<Filter>源文件</Filter>
</None>
<None Include="res\MFCCreoDll.rc2">
<Filter>资源文件</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="MFCCreoDll.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="pch.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="httplib.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="ServerManager.h">
<Filter>源文件\src\core</Filter>
</ClInclude>
<ClInclude Include="Config.h">
<Filter>源文件\src\core</Filter>
</ClInclude>
<ClInclude Include="HttpServer.h">
<Filter>源文件\src\http</Filter>
</ClInclude>
<ClInclude Include="HttpRouter.h">
<Filter>源文件\src\http</Filter>
</ClInclude>
<ClInclude Include="WebSocketServer.h">
<Filter>源文件\src\websocket</Filter>
</ClInclude>
<ClInclude Include="CreoManager.h">
<Filter>源文件\src\creo</Filter>
</ClInclude>
<ClInclude Include="ModelAnalyzer.h">
<Filter>源文件\src\creo</Filter>
</ClInclude>
<ClInclude Include="JsonHelper.h">
<Filter>源文件\src\utils</Filter>
</ClInclude>
<ClInclude Include="Logger.h">
<Filter>源文件\src\utils</Filter>
</ClInclude>
<ClInclude Include="AuthManager.h">
<Filter>源文件\src\auth</Filter>
</ClInclude>
<ClInclude Include="pfcExceptions.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MFCCreoDll.rc">
<Filter>资源文件</Filter>
</ResourceCompile>
</ItemGroup>
</Project>

View File

@ -1 +1 @@
#pragma once
#pragma once

View File

@ -1,16 +1,16 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// 供 MFCCreoDll.rc 使用
//
// 新对象的下一组默认值
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 1000
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 1000
#define _APS_NEXT_COMMAND_VALUE 32771
#endif
#endif
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// 供 MFCCreoDll.rc 使用
//
// 新对象的下一组默认值
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 1000
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 1000
#define _APS_NEXT_COMMAND_VALUE 32771
#endif
#endif

View File

@ -1 +1 @@
#pragma once
#pragma once

View File

@ -1 +1 @@
#pragma once
#pragma once

View File

@ -1,35 +1,35 @@
#pragma once
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
#endif
#include "targetver.h"
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
#include <afxwin.h> // MFC 核心组件和标准组件
#include <afxext.h> // MFC 扩展
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxole.h> // MFC OLE 类
#include <afxodlgs.h> // MFC OLE 对话框类
#include <afxdisp.h> // MFC 自动化类
#endif // _AFX_NO_OLE_SUPPORT
#ifndef _AFX_NO_DB_SUPPORT
#include <afxdb.h> // MFC ODBC 数据库类
#endif // _AFX_NO_DB_SUPPORT
#ifndef _AFX_NO_DAO_SUPPORT
#include <afxdao.h> // MFC DAO 数据库类
#endif // _AFX_NO_DAO_SUPPORT
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h> // MFC 对 Internet Explorer 4 公共控件的支持
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC 对 Windows 公共控件的支持
#endif // _AFX_NO_AFXCMN_SUPPORT
#pragma once
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
#endif
#include "targetver.h"
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
#include <afxwin.h> // MFC 核心组件和标准组件
#include <afxext.h> // MFC 扩展
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxole.h> // MFC OLE 类
#include <afxodlgs.h> // MFC OLE 对话框类
#include <afxdisp.h> // MFC 自动化类
#endif // _AFX_NO_OLE_SUPPORT
#ifndef _AFX_NO_DB_SUPPORT
#include <afxdb.h> // MFC ODBC 数据库类
#endif // _AFX_NO_DB_SUPPORT
#ifndef _AFX_NO_DAO_SUPPORT
#include <afxdao.h> // MFC DAO 数据库类
#endif // _AFX_NO_DAO_SUPPORT
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h> // MFC 对 Internet Explorer 4 公共控件的支持
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC 对 Windows 公共控件的支持
#endif // _AFX_NO_AFXCMN_SUPPORT

10
pch.cpp
View File

@ -1,5 +1,5 @@
// pch.cpp: 与预编译标头对应的源文件
#include "pch.h"
// 当使用预编译的头时,需要使用此源文件,编译才能成功。
// pch.cpp: 与预编译标头对应的源文件
#include "pch.h"
// 当使用预编译的头时,需要使用此源文件,编译才能成功。

26
pch.h
View File

@ -1,13 +1,13 @@
// pch.h: 这是预编译标头文件。
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
#ifndef PCH_H
#define PCH_H
// 添加要在此处预编译的标头
#include "framework.h"
#endif //PCH_H
// pch.h: 这是预编译标头文件。
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
#ifndef PCH_H
#define PCH_H
// 添加要在此处预编译的标头
#include "framework.h"
#endif //PCH_H

976
pfcExceptions.h Normal file
View File

@ -0,0 +1,976 @@
/*
Copyright (c) 2018 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved.
*/
//*****************************************************************************
# ifndef pfcExceptions_h
# define pfcExceptions_h
# ifdef GetMessage
# undef GetMessage
# endif /* GetMessage */
# ifdef GetCharWidth
# undef GetCharWidth
# endif /* GetCharWidth */
# include <pfcExceptions_s.h>
#ifdef OTK_CPP_XTOP
#include <usxobject.h>
#else
#include <nopkdefs_pfc.h>
#endif
# include <fstream>
static fstream globalLogFile;
static bool doGlobalLogFuncs;
void pfcLogFuncCall(xrstring Name);
void pfcFuncLogFileOpen(xrstring folder);
void pfcFuncLogFileClose();
void pfcSetFuncLogFlag(bool in);
bool pfcGetFuncLogFlag();
int otk_print_std(char *filename, char* buffer );
int pfcGetOtkLogging();
void pfcGetBtkTimeStr(char* timestr);
//*****************************************************************************
class pfcXPFC : public virtual XOBJECT, public virtual xthrowable
{
ootk_xdeclare (pfcXPFC)
public:
virtual xstring GetMessage ();
protected:
xstring mMessage;
protected:
pfcXPFC (xrstring inMessage);
};
//*****************************************************************************
class pfcXMethodForbidden : public virtual pfcXPFC
{
ootk_xdeclare (pfcXMethodForbidden)
public:
virtual xstring GetMethodName ();
protected:
xstring mMethodName;
protected:
pfcXMethodForbidden (xrstring inMethodName);
public:
static void Throw (xrstring inMethodName);
};
//*****************************************************************************
class pfcXMethodNotLicensed : public virtual pfcXPFC
{
ootk_xdeclare (pfcXMethodNotLicensed)
public:
virtual xstring GetMethodName ();
protected:
xstring mMethodName;
protected:
pfcXMethodNotLicensed (xrstring inMethodName);
public:
static void Throw (xrstring inMethodName);
};
//*****************************************************************************
class pfcXCompatibilityNotSet : public virtual pfcXPFC
{
ootk_xdeclare (pfcXCompatibilityNotSet)
public:
virtual xstring GetMethodName ();
protected:
xstring mMethodName;
protected:
pfcXCompatibilityNotSet (xrstring inMethodName);
public:
static void Throw (xrstring inMethodName);
};
//*****************************************************************************
class pfcXInAMethod : public virtual pfcXPFC
{
ootk_xdeclare (pfcXInAMethod)
public:
virtual xstring GetMethodName ();
protected:
xstring mMethodName;
protected:
pfcXInAMethod (xrstring inMethodName);
pfcXInAMethod (xrstring inMessage, xrstring inMethodName);
public:
static void Throw (xrstring inMessage, xrstring inMethodName);
};
//*****************************************************************************
class pfcXCannotAccess : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXCannotAccess)
public:
virtual xstring GetVariableName ();
virtual xstring GetMessage ();
private:
xstring mVariableName;
public:
pfcXCannotAccess (xrstring inMethodName, xrstring inVariableName);
static void Throw (xrstring inMethodName, xrstring inVariableName);
};
//*****************************************************************************
class pfcXBadArgument : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXBadArgument)
public:
virtual xstring GetArgumentName ();
virtual xstring GetMessage ();
private:
xstring mArgumentName;
protected:
pfcXBadArgument (xrstring inMethodName, xrstring inArgumentName);
pfcXBadArgument (xrstring inMessage,
xrstring inMethodName, xrstring inArgumentName);
};
//*****************************************************************************
class pfcXUnusedValue : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXUnusedValue)
public:
virtual xstring GetValue ();
virtual xstring GetMessage ();
private:
xstring mValue;
protected:
pfcXUnusedValue (xrstring inMethodName, xrstring inValue);
pfcXUnusedValue (xrstring inMessage,
xrstring inMethodName, xrstring inValue);
public:
static void Throw (xrstring inMethodName, xrstring inValue);
};
//*****************************************************************************
class pfcXToolkitDllInitializeFailed : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXToolkitDllInitializeFailed)
public:
virtual xstring GetUserInitializeMessage ();
virtual int GetUserInitializeReturn ();
virtual xstring GetMessage ();
private:
xstring mUserInitializeMessage;
int mUserInitializeReturn;
protected:
pfcXToolkitDllInitializeFailed (xrstring inMethodName, int mUserInitializeReturn,
xrstring inUserInitializeMessage);
pfcXToolkitDllInitializeFailed (xrstring inMessage,
xrstring inMethodName, int mUserInitializeReturn,
xrstring inUserInitializeMessage);
public:
static void Throw (xrstring inMethodName, int mUserInitializeReturn,
xrstring inUserInitializeMessage);
};
//*****************************************************************************
class pfcXProdevError : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXProdevError)
public:
virtual xstring GetDevelopFunctionName ();
virtual xint GetErrorCode ();
private:
xstring mDevelopFunctionName;
xint mErrorCode;
public:
pfcXProdevError (xrstring inMethodName, xrstring inDevelopFunctionName,
xint inErrorCode);
pfcXProdevError (xrstring inMessage,
xrstring inMethodName, xrstring inDevelopFunctionName,
xint inErrorCode);
static void Throw (xrstring inMethodName,
xrstring inDevelopFunctionName,
xint inErrorCode);
};
//*****************************************************************************
class pfcXToolkitError : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXToolkitError)
public:
virtual xstring GetToolkitFunctionName ();
virtual xint GetErrorCode ();
private:
xstring mToolkitFunctionName;
protected:
pfcXToolkitError (xrstring inMethodName, xrstring inToolkitFunctionName);
pfcXToolkitError (xrstring inMessage,
xrstring inMethodName, xrstring inToolkitFunctionName);
};
//*****************************************************************************
class pfcXToolkitUnrecognizedErrorCode : public virtual pfcXToolkitError
{
ootk_xdeclare (pfcXToolkitUnrecognizedErrorCode)
public:
virtual xint GetErrorCode();
static void Throw (xrstring inMethodName,
xrstring inToolkitFunctionName,
xint inErrorCode);
private:
xint mErrorCode;
protected:
pfcXToolkitUnrecognizedErrorCode(xrstring inMessage,
xrstring inMethodName, xint inErrorCode);
};
//*****************************************************************************
class pfcXToolkitCheckoutConflict : public virtual pfcXToolkitError
{
ootk_xdeclare ( pfcXToolkitCheckoutConflict )
private:
xstring mConflictDescription;
public:
virtual xstring GetConflictDescription();
virtual xstring GetMessage ();
pfcXToolkitCheckoutConflict(xrstring inMethodName,
xrstring inToolkitFunctionName,
xrstring inConflictDescription,
xint inTemp);
static void Throw (xrstring inMethodName,
xrstring inToolkitFunctionName,
xrstring inConflictDescription);
pfcXToolkitCheckoutConflict(xrstring inMethodName,
xrstring inToolkitFunctionName);
pfcXToolkitCheckoutConflict(xrstring inMessage, xrstring inMethodName,
xrstring inToolkitFunctionName);
static void Throw (xrstring inMethodName,
xrstring inToolkitFunctionName);
};
//*****************************************************************************
class pfcXExternalDataError : public virtual pfcXToolkitError
{
ootk_xdeclare (pfcXExternalDataError)
protected:
pfcXExternalDataError (xrstring inMethodName, xrstring inToolkitFunctionName);
pfcXExternalDataError (xrstring inMessage,
xrstring inMethodName, xrstring inToolkitFunctionName);
};
//****************************************************************************
# define DeclareSpecificToolkitException(ErrName) \
class pfcXToolkit##ErrName : public virtual pfcXToolkitError \
{ \
ootk_xdeclare (pfcXToolkit##ErrName) \
public: \
pfcXToolkit##ErrName (xrstring inMethodName, \
xrstring inToolkitFunctionName); \
\
pfcXToolkit##ErrName (xrstring inMessage, xrstring inMethodName, \
xrstring inToolkitFunctionName); \
\
public: \
static void Throw (xrstring inMethodName, \
xrstring inToolkitFunctionName); \
}
//****************************************************************************
# define DeclareSpecificExtdataException(ErrName) \
class pfcXExternalData##ErrName : public virtual pfcXExternalDataError \
{ \
ootk_xdeclare (pfcXExternalData##ErrName) \
public: \
pfcXExternalData##ErrName (xrstring inMethodName, \
xrstring inToolkitFunctionName); \
\
pfcXExternalData##ErrName (xrstring inMessage, xrstring inMethodName, \
xrstring inToolkitFunctionName); \
\
public: \
static void Throw (xrstring inMethodName, \
xrstring inToolkitFunctionName); \
}
DeclareSpecificToolkitException (GeneralError);
DeclareSpecificToolkitException (BadInputs);
DeclareSpecificToolkitException (UserAbort);
DeclareSpecificToolkitException (NotFound);
DeclareSpecificToolkitException (Found);
DeclareSpecificToolkitException (LineTooLong);
DeclareSpecificToolkitException (Continue);
DeclareSpecificToolkitException (BadContext);
DeclareSpecificToolkitException (NotImplemented);
DeclareSpecificToolkitException (OutOfMemory);
DeclareSpecificToolkitException (CommError);
DeclareSpecificToolkitException (NoChange);
DeclareSpecificToolkitException (SuppressedParents);
DeclareSpecificToolkitException (PickAbove);
DeclareSpecificToolkitException (InvalidDir);
DeclareSpecificToolkitException (InvalidFile);
DeclareSpecificToolkitException (CantWrite);
DeclareSpecificToolkitException (InvalidType);
DeclareSpecificToolkitException (InvalidPtr);
DeclareSpecificToolkitException (UnavailableSection);
DeclareSpecificToolkitException (InvalidMatrix);
DeclareSpecificToolkitException (InvalidName);
DeclareSpecificToolkitException (NotExist);
DeclareSpecificToolkitException (CantOpen);
DeclareSpecificToolkitException (Abort);
DeclareSpecificToolkitException (NotValid);
DeclareSpecificToolkitException (InvalidItem);
DeclareSpecificToolkitException (MsgNotFound);
DeclareSpecificToolkitException (MsgNoTrans);
DeclareSpecificToolkitException (MsgFmtError);
DeclareSpecificToolkitException (MsgUserQuit);
DeclareSpecificToolkitException (MsgTooLong);
DeclareSpecificToolkitException (CantAccess);
DeclareSpecificToolkitException (ObsoleteFunc);
DeclareSpecificToolkitException (NoCoordSystem);
DeclareSpecificToolkitException (Ambiguous);
DeclareSpecificToolkitException (DeadLock);
DeclareSpecificToolkitException (Busy);
DeclareSpecificToolkitException (InUse);
DeclareSpecificToolkitException (NoLicense);
DeclareSpecificToolkitException (BsplUnsuitableDegree);
DeclareSpecificToolkitException (BsplNonStdEndKnots);
DeclareSpecificToolkitException (BsplMultiInnerKnots);
DeclareSpecificToolkitException (BadSrfCrv);
DeclareSpecificToolkitException (Empty);
DeclareSpecificToolkitException (BadDimAttach);
DeclareSpecificToolkitException (NotDisplayed);
DeclareSpecificToolkitException (CantModify);
DeclareSpecificToolkitException (CreateViewBadSheet);
DeclareSpecificToolkitException (CreateViewBadModel);
DeclareSpecificToolkitException (CreateViewBadParent);
DeclareSpecificToolkitException (CreateViewBadType);
DeclareSpecificToolkitException (CreateViewBadExplode);
DeclareSpecificToolkitException (UnattachedFeats);
DeclareSpecificToolkitException (RegenerateAgain);
DeclareSpecificToolkitException (Unsupported);
DeclareSpecificToolkitException (NoPermission);
DeclareSpecificToolkitException (AuthenticationFailure);
DeclareSpecificToolkitException (AppExcessCallbacks);
DeclareSpecificToolkitException (AppStartupFailed);
DeclareSpecificToolkitException (AppInitializationFailed);
DeclareSpecificToolkitException (AppVersionMismatch);
DeclareSpecificToolkitException (AppCommunicationFailure);
DeclareSpecificToolkitException (AppNewVersion);
DeclareSpecificToolkitException (NeedsUnlock);
DeclareSpecificToolkitException (AppNoLicense);
DeclareSpecificToolkitException (AppBadDataPath);
DeclareSpecificToolkitException (AppBadEncoding);
DeclareSpecificToolkitException (AppCreoBarred);
DeclareSpecificToolkitException (AppTooOld);
DeclareSpecificToolkitException (CheckLastError);
DeclareSpecificToolkitException (CheckOmitted);
DeclareSpecificToolkitException (Incomplete);
DeclareSpecificToolkitException (MaxLimitReached);
DeclareSpecificToolkitException (OutOfRange);
DeclareSpecificToolkitException (Outdated);
DeclareSpecificExtdataException (InvalidObject);
DeclareSpecificExtdataException (ClassOrSlotExists);
DeclareSpecificExtdataException (NamesTooLong);
DeclareSpecificExtdataException (SlotNotFound);
DeclareSpecificExtdataException (BadKeyByFlag);
DeclareSpecificExtdataException (InvalidObjType);
DeclareSpecificExtdataException (EmptySlot);
DeclareSpecificExtdataException (BadDataArgs);
DeclareSpecificExtdataException (StreamTooLarge);
DeclareSpecificExtdataException (InvalidSlotName);
DeclareSpecificExtdataException (TKError);
//*****************************************************************************
class pfcXUnimplemented : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXUnimplemented)
public:
pfcXUnimplemented (xrstring inMethodName);
pfcXUnimplemented (xrstring inMessage, xrstring inMethodName);
static void Throw (xrstring inMethodName);
virtual xstring GetMessage ();
};
//*****************************************************************************
class pfcXToolkitInvalidReference : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXToolkitInvalidReference)
public:
pfcXToolkitInvalidReference(xrstring inMethodName);
pfcXToolkitInvalidReference(xrstring inMessage, xrstring inMethodName);
static void Throw (xrstring inMessage, xrstring inMethodName);
};
//*****************************************************************************
class pfcXInvalidEnumValue : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXInvalidEnumValue)
public:
virtual xstring GetName ();
virtual xint GetValue ();
virtual xstring GetMessage ();
private:
xstring mName;
xint mValue;
public:
pfcXInvalidEnumValue (xrstring inMethodName, xrstring inName, xint inValue);
pfcXInvalidEnumValue (xrstring inMessage,
xrstring inMethodName, xrstring inName, xint inValue);
static void Throw (xrstring inMethodName, xrstring inName,
xint inValue);
};
//*****************************************************************************
class pfcXEmptyString : public virtual pfcXBadArgument
{
ootk_xdeclare (pfcXEmptyString)
public:
pfcXEmptyString (xrstring inMethodName, xrstring inArgumentName);
pfcXEmptyString (xrstring inMessage,
xrstring inMethodName, xrstring inArgumentName);
static void Throw (xrstring inMethodName, xrstring inArgumentName);
};
//*****************************************************************************
class pfcXStringTooLong : public virtual pfcXBadArgument
{
ootk_xdeclare (pfcXStringTooLong)
public:
virtual xstring GetString ();
virtual xint GetMaxLength ();
virtual xstring GetMessage ();
private:
xstring mString;
xint mMaxLength;
public:
pfcXStringTooLong (xrstring inMethodName, xrstring inArgumentName,
xrstring inString, xint inMaxLength);
pfcXStringTooLong (xrstring inMessage,
xrstring inMethodName, xrstring inArgumentName,
xrstring inString, xint inMaxLength);
static void Throw (xrstring inMethodName, xrstring inArgumentName,
xrstring inString, xint inMaxLength);
};
//*****************************************************************************
class pfcXNegativeNumber : public virtual pfcXBadArgument
{
ootk_xdeclare (pfcXNegativeNumber)
public:
pfcXNegativeNumber (xrstring inMethodName, xrstring inArgumentName);
pfcXNegativeNumber (xrstring inMessage,
xrstring inMethodName, xrstring inArgumentName);
static void Throw (xrstring inMethodName, xrstring inArgumentName);
};
//*****************************************************************************
class pfcXNumberTooLarge : public virtual pfcXBadArgument
{
ootk_xdeclare (pfcXNumberTooLarge)
public:
virtual xreal GetValue ();
virtual xreal GetMaxValue ();
virtual xstring GetMessage ();
private:
xreal mValue;
xreal mMaxValue;
public:
pfcXNumberTooLarge (xrstring inMethodName, xrstring inArgumentName,
xreal inValue, xreal inMaxValue);
pfcXNumberTooLarge (xrstring inMessage,
xrstring inMethodName, xrstring inArgumentName,
xreal inValue, xreal inMaxValue);
static void Throw (xrstring inMethodName, xrstring inArgumentName,
xreal inValue, xreal inMaxValue);
};
//*****************************************************************************
class pfcXSequenceTooLong : public virtual pfcXBadArgument
{
ootk_xdeclare (pfcXSequenceTooLong)
public:
virtual xint GetMaxLength ();
virtual xstring GetMessage ();
private:
xint mMaxLength;
public:
pfcXSequenceTooLong (xrstring inMethodName, xrstring inArgumentName,
xint inMaxLength);
pfcXSequenceTooLong (xrstring inMessage,
xrstring inMethodName, xrstring inArgumentName,
xint inMaxLength);
static void Throw (xrstring inMethodName, xrstring inArgumentName,
xint inMaxLength);
};
//*****************************************************************************
class pfcXBadOutlineExcludeType : public virtual pfcXBadArgument
{
ootk_xdeclare (pfcXBadOutlineExcludeType)
public:
virtual pfcModelItemType GetType ();
private:
pfcModelItemType mType;
public:
pfcXBadOutlineExcludeType (xrstring inMethodName, xrstring inArgumentName,
pfcModelItemType inType);
pfcXBadOutlineExcludeType (xrstring inMessage,
xrstring inMethodName, xrstring inArgumentName,
pfcModelItemType inType);
static void Throw (xrstring inMethodName, xrstring inArgumentName,
pfcModelItemType inType);
};
//*****************************************************************************
class pfcXBadGetParamValue : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXBadGetParamValue)
public:
virtual pfcParamValueType GetValueType ();
private:
pfcParamValueType mValueType;
public:
pfcXBadGetParamValue (xrstring inMethodName, pfcParamValueType inValueType);
pfcXBadGetParamValue (xrstring inMessage,
xrstring inMethodName, pfcParamValueType inValueType);
static void Throw (xrstring inMethodName,
pfcParamValueType inValueType);
};
//****************************************************************************
class pfcXBadGetExternalData : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXBadGetExternalData)
public:
virtual pfcExternalDataType GetType ();
private:
pfcExternalDataType Type;
public:
pfcXBadGetExternalData (xrstring inMethodName, pfcExternalDataType inValueType);
pfcXBadGetExternalData (xrstring inMessage, xrstring inMethodName, pfcExternalDataType inValueType);
static void Throw (xrstring inMessage, xrstring inMethodName,
pfcExternalDataType inValueType);
};
//****************************************************************************
class pfcXBadGetArgValue : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXBadGetArgValue)
public:
virtual pfcArgValueType GetType ();
private:
pfcArgValueType Type;
public:
pfcXBadGetArgValue (xrstring inMethodName, pfcArgValueType inValueType);
pfcXBadGetArgValue (xrstring inMessage, xrstring inMethodName, pfcArgValueType inValueType);
static void Throw (xrstring inMethodName,
pfcArgValueType inValueType);
};
//****************************************************************************
class pfcXToolkitDllInactive : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXToolkitDllInactive)
public:
pfcXToolkitDllInactive (xrstring inMethodName);
pfcXToolkitDllInactive (xrstring inMessage, xrstring inMethodName);
static void Throw (xrstring inMethodName);
};
//*****************************************************************************
class pfcXBadExternalData : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXBadExternalData)
public:
pfcXBadExternalData (xrstring inMethodName);
pfcXBadExternalData (xrstring inMessage, xrstring inMethodName);
static void Throw (xrstring inMessage, xrstring inMethodName);
};
//*****************************************************************************
class pfcXUnknownModelExtension : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXUnknownModelExtension)
public:
virtual xstring GetExtension ();
virtual xstring GetMessage ();
private:
xstring mExtension;
public:
pfcXUnknownModelExtension (xrstring inMethodName, xrstring inExtension);
pfcXUnknownModelExtension (xrstring inMessage, xrstring inMethodName,
xrstring inExtension);
static void Throw (xrstring inMethodName, xrstring inExtension);
};
//*****************************************************************************
class pfcXInvalidSelection : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXInvalidSelection)
public:
pfcXInvalidSelection (xrstring inMethodName);
pfcXInvalidSelection (xrstring inMessage, xrstring inMethodName);
static void Throw (xrstring inMethodName);
};
//*****************************************************************************
class pfcXModelNotInSession : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXModelNotInSession)
public:
pfcXModelNotInSession (xrstring inMethodName);
pfcXModelNotInSession (xrstring inMessage, xrstring inMethodName);
static void Throw (xrstring inMethodName);
};
//*****************************************************************************
class pfcXInvalidModelItem : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXInvalidModelItem)
public:
pfcXInvalidModelItem (xrstring inMethodName);
pfcXInvalidModelItem (xrstring inMessage, xrstring inMethodName);
static void Throw (xrstring inMethodName);
};
//*****************************************************************************
class pfcXInvalidFileType : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXInvalidFileType)
public:
pfcXInvalidFileType (xrstring inMethodName, xrstring inExtension);
pfcXInvalidFileType (xrstring inMessage, xrstring inMethodName, xrstring inExtension);
virtual xstring GetExtension ();
virtual xstring GetMessage ();
private:
xstring mExtension;
public:
static void Throw (xrstring inMethodName,
xrstring inExtension);
};
//*****************************************************************************
class pfcXInvalidFileName : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXInvalidFileName)
public:
pfcXInvalidFileName (xrstring inMethodName, xrstring inFileName);
pfcXInvalidFileName (xrstring inMessage, xrstring inMethodName, xrstring inFileName);
virtual xstring GetFileName ();
virtual xstring GetMessage ();
private:
xstring mFileName;
public:
static void Throw (xrstring inMethodName,
xrstring inFileName);
};
//*****************************************************************************
enum pfcDrawingCreateErrorType {
pfcDWGCREATE_ERR_SAVED_VIEW_DOESNT_EXIST,
pfcDWGCREATE_ERR_X_SEC_DOESNT_EXIST,
pfcDWGCREATE_ERR_EXPLODE_DOESNT_EXIST,
pfcDWGCREATE_ERR_MODEL_NOT_EXPLODABLE,
pfcDWGCREATE_ERR_SEC_NOT_PERP,
pfcDWGCREATE_ERR_NO_RPT_REGIONS,
pfcDWGCREATE_ERR_FIRST_REGION_USED,
pfcDWGCREATE_ERR_NOT_PROCESS_ASSEM,
pfcDWGCREATE_ERR_NO_STEP_NUM,
pfcDWGCREATE_ERR_TEMPLATE_USED,
pfcDWGCREATE_ERR_NO_PARENT_VIEW_FOR_PROJ,
pfcDWGCREATE_ERR_CANT_GET_PROJ_PARENT,
pfcDWGCREATE_ERR_SEC_NOT_PARALLEL,
pfcDWGCREATE_ERR_SIMP_REP_DOESNT_EXIST,
pfcDWGCRTERR_COMB_STATE_DOESNT_EXIST,
pfcDWGCRTERR_TOOL_DOESNT_EXIST,
pfcDWGCRTERR_NOT_ALL_BALLOONS_CLEANED_WRN,
pfcDrawingCreateErrorType_nil
};
//*****************************************************************************
class pfcXCancelProEAction : public virtual pfcXPFC
{
ootk_xdeclare (pfcXCancelProEAction)
public:
pfcXCancelProEAction (xrstring inMessage);
static void Throw ();
};
//*****************************************************************************
class pfcXJLinkApplicationException : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXJLinkApplicationException)
public:
virtual xstring GetExceptionDescription ();
virtual void SetExceptionDescription (xrstring value);
virtual xstring GetMessage ();
private:
xstring mExceptionDescription;
public:
pfcXJLinkApplicationException (xrstring inMessage, xrstring inMethodName, xrstring inExceptionDescription);
static void Throw (xrstring inMessage, xrstring inMethodName, xrstring inExceptionDescription);
};
//*****************************************************************************
class pfcDrawingCreateError : public virtual XOBJECT
{
ootk_xdeclare (pfcDrawingCreateError)
public:
virtual pfcDrawingCreateErrorType GetType();
virtual void SetType( pfcDrawingCreateErrorType inType );
virtual xstring GetViewName();
virtual void SetViewName( xstring inViewName );
virtual int GetSheetNumber();
virtual void SetSheetNumber( int inSheetNumber );
virtual optional xstring GetObjectName();
virtual void SetObjectName( optional xstring inObjectName );
virtual optional pfcView2D_ptr GetView();
virtual void SetView( optional pfcView2D_ptr inView );
virtual xstring GetMessage ();
virtual xstring GetTypeMessage();
// Constructor
pfcDrawingCreateError (
pfcDrawingCreateErrorType Type,
xstring ViewName,
int SheetNumber,
optional xstring ObjectName,
optional pfcView2D_ptr View
);
private:
pfcDrawingCreateErrorType Type;
xstring ViewName;
int SheetNumber;
optional xstring ObjectName;
optional pfcView2D_ptr View;
protected:
};
//*****************************************************************************
pk_xclssequence_decl (pfcDrawingCreateError, pfcDrawingCreateErrors);
//*****************************************************************************
class pfcXToolkitDrawingCreateErrors : public virtual pfcXToolkitError
{
ootk_xdeclare ( pfcXToolkitDrawingCreateErrors )
public:
virtual pfcDrawingCreateErrors_ptr GetErrors();
virtual void SetErrors( pfcDrawingCreateErrors_ptr errors );
virtual pfcDrawing_ptr GetCreatedDrawing();
virtual xstring GetMessage ();
static void Throw (
pfcDrawing_ptr inCreatedDrawing,
pfcDrawingCreateErrors_ptr inDrawingCreateErrors,
xstring inMethodName,
xstring inToolkitFunctionName );
pfcXToolkitDrawingCreateErrors (
pfcDrawing_ptr inCreatedDrawing,
xrstring inMessage,
xrstring inMethodName,
xrstring inToolkitFunctionName,
pfcDrawingCreateErrors_ptr inDrawingCreateErrors);
private:
pfcDrawingCreateErrors_ptr Errors;
pfcDrawing_ptr CreatedDrawing;
};
//*****************************************************************************
//** Moved from pfcCreation.h
pfcXToolkitDrawingCreateErrors_ptr pfcXToolkitDrawingCreateErrorsCreate (
pfcDrawing_ptr inCreatedDrawing,
xrstring inMessage,
xrstring inMethodName,
xrstring inToolkitFunctionName,
pfcDrawingCreateErrors_ptr inDrawingCreateErrors
);
//*****************************************************************************
//*****************************************************************************
class pfcXJLinkTaskNotFound : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXJLinkTaskNotFound)
public:
virtual xstring GetTaskId ();
virtual void SetTaskId (xrstring value);
virtual xstring GetMessage ();
private:
xstring mTaskId;
public:
pfcXJLinkTaskNotFound (xrstring inMessage, xrstring inMethodName, xrstring inTaskId);
static void Throw (xrstring inMessage, xrstring inMethodName, xrstring inTaskId);
};
//*****************************************************************************
class pfcXJLinkTaskExists : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXJLinkTaskExists)
public:
virtual xstring GetTaskId ();
virtual void SetTaskId (xrstring value);
virtual xstring GetMessage ();
private:
xstring mTaskId;
public:
pfcXJLinkTaskExists (xrstring inMessage, xrstring inMethodName, xrstring inTaskId);
static void Throw (xrstring inMessage, xrstring inMethodName, xrstring inTaskId);
};
//*****************************************************************************
class pfcXJLinkApplicationInactive : public virtual pfcXInAMethod
{
ootk_xdeclare (pfcXJLinkApplicationInactive)
public:
pfcXJLinkApplicationInactive (xrstring inMessage, xrstring inMethodName);
static void Throw (xrstring inMessage, xrstring inMethodName);
};
# endif

View File

@ -1,8 +1,8 @@
#pragma once
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
//如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h
// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
#include <SDKDDKVer.h>
#pragma once
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
//如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h
// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
#include <SDKDDKVer.h>