将CArchive对象反序列化为C#对象 [英] Deserialize CArchive object to C# object

查看:208
本文介绍了将CArchive对象反序列化为C#对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个旧应用程序,它正在使用CArchive将对象序列化为二进制文件。

由于我有源代码,我知道C ++格式的对象结构。



但是,是否可以反序列化CArchive对象C#?



当我尝试使用C#FileStream读取时,它失败并显示错误消息:

输入流不是有效的二进制文件格式。



提前谢谢...... :)



Renjith

Hi,

I have an old application and it''s using CArchive to serialize the object to binary file.
Since I have the source code, I know the object structure in C++ format.

However, is it possible to deserialize CArchive object in C# ?

When I try to read using C# FileStream, it fails with error message :
"The input stream is not a valid binary format."

Thanks in advance... :)

Renjith

推荐答案

如果您知道序列化数据的确切格式,就有可能。但我猜,你不是。没有.NET类型能够序列化/反序列化与CArchive兼容的流。



另一方面,您可以编写一个混合模式DLL来提供该类型功能,充当CArchive的托管包装器。



另一个解决方案是编写一个COM服务器,它提供一个包装CArchive的COM对象。
It would be possible if you knew the exact format of the serialized data. But I guess, you don''t. There is no .NET type that is able to serialize/deserialize CArchive-compatible streams.

On the other hand, you can write a mixed-mode DLL that provides that functionality, acting as a managed wrapper over a CArchive.

And another solution is to write a COM server that provides a COM object that wraps the CArchive.


这篇关于将CArchive对象反序列化为C#对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆