c#读取solidworks文件_C# SolidWorks 二次开发 API---写入和读取第三方数据流

本文介绍了一个名为ComStream的类,该类实现了C#中的Stream接口,用于读取和写入SolidWorks文件。通过IStream接口,ComStream能够与SolidWorks的原始数据流交互,支持读取、写入、定位、长度获取、位置获取和设置等功能。这个类使得在C#中使用SolidWorks的二次开发API变得更为便捷。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

public class ComStream : Stream

{

//The managed stream being wrapped private IStream originalStream_;

public ComStream(IStream stream)

{

if (stream != null)

{

originalStream_ = stream;

}

else

{

throw new ArgumentNullException("stream");

}

}

~ComStream()

{

Close();

}

// property to get original stream object public IStream UnderlyingStream

{

get

{

return originalStream_;

}

}

// reads a specified number of bytes from the stream object // into memory starting at the current seek pointer public unsafe override int Read(byte[] buffer, int offset, int count)

{

if (originalStream_ == null)

{

throw new ObjectDisposedException("original

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值