反序列化特定的二进制文件使用c#属性deserializing specific property of binary file using c#
I've got the following problem, I have a custom filetype and I want it to display a specific image that's serialized in it (this file is serialized in binary) but my files sizes can reach up to Gb of size.
So to avoid performance issues due to possible huge file sizes I would like to deserialize the property of the image without having to deserialize all the unnecessary information that the file contains.
Is that even possible?
(原文：It's totally depends on file format. Binary is not a format, but a term meaning what file is in some format which is not a text. Typically different file formats have header, data, properties, etc. It may be possible by reading only header locate and then read only property you need, if you know its location (position) within file.)user2144236的回复:由于@Sinatr这# 39;只是我所需要的东西但是我# 39;已经意识到房地产,我想反序列化不是以一个恒定的位置,我也不有必要的信息在数学上找到它。我# 39;不得不打开该文件的程序生成的文件和随后得到我需要的信息。
(原文：Thanks @Sinatr that's just about what I need but I've realized that the property that I want to deserialize is not at a constant location, neither do I have the necessary information to mathematically find it. I'll have to open the file with the program that generated the file and subsequently get the piece of information that i need.)Sinatr的回复:文件格式设计的吗?然后您可以简单地使用现有的序列化器来序列化器/反序列化头/属性/数据。看看protobuf.net。文件格式可以是:格式标签,标题大小头、数据。那么你刚才读的格式标记,确保变# 39;你的格式,那么大小,然后头,标题,标题属性进行反序列化。
(原文：Is file format designed by you? Then you can simply use existing serializers to serializer/deserialize header/properties/data. Check out protobuf.net. File format can be: format tag, header size, header, data. Then you just read format tag to ensure it's your format, then size, then header, then deserialize header and get header properties.)Marc Gravell♦的回复:你使用序列化?它是什么格式的?
(原文：What did you use to serialize? What format is it in?)
I'm not sure to have understood your question properly, but you should decode your file manually with a FileStream and extract just the chunk of file containing the Image
- 清除字段内容后保存。netc# - Clear content from fields after save .net c#
- 通过串口将字节数组 - Passing byte array through serialport
- 反序列化特定的二进制文件使用c#属性deserializing specific property of binary file using c#
- 初始化字符串的格式不符合规范指数在129年开始Format of the initialization string does not conform to specification starting at index 129
- 读取数据已经提交给WCF服务的形式的xmlReading Data That Has Been Submitted To WCF Service in form of xml
- 处理异步调用序列Process Asynchronous Calls in Sequence
- 画形状和形状在jpeg图像,得到x,y的位置形状吗?draw shape and move shape on jpeg image and get x, y position of shape?
- “使用”语句应内部或外部名称空间? - Should 'using' statements be inside or outside the namespace?