Actually, when you mark an object as serializable and then write it using
the binary formatter, it doesn't put "special" markings stating the object
type. It just writes the data. If you want to, you can read the data from
the data file into a byte array, rearrange the bytes to match the
expectations of the deserializer, create a memory stream from your modified
byte array, and deserialize to the object from the stream.
Honestly, I wouldn't think it to be worth doing, but that's your call.
--- Nick
Blmn said:
not possible.
seialization only works when the file being created by serialization. then
they can be deserialized. it can't apply to ordinary files.
actually i don't create these files, i just read'em. the program that create
these files is uder unix and works from 1989. can't even dream about
changing that program.
Andriy Gnennyy said:
Hello,
Use binary serialization.
Mark your structure as [Serializable] and use the
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter class.
--
Andriy Gnennyy
pulsar2003@{no-spam}email.ru (Please remove {no-spam} for reply)
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Blmn said:
Hello
how can i creat e structure and read the struct from a binary file?
binaryreader doesn't accept objects so i have to read like reader.getbyte(),
reader.getint32(),... . but it should be a way to create a class líke
FileHeader and read compelet header at once, like C++ .
do you know how?