Alright, I've been trying to write an object data to a file for 3 hours ... I'm pretty much at my whits end.
An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll
Additional information: The type $ArrayType$0x7b463bb7 in Assembly LSpriteEdit, Version=1.0.2250.26616, Culture=neutral, PublicKeyToken=null is not marked as serializable.
#define SStringToString(s) (char*)(void*)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(s)
#using <mscorlib.dll>
#using <system.dll>
#using <system.runtime.serialization.formatters.soap.dll>
#include <tchar.h>
#include <map>
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::IO;
using namespace System::Runtime::Serialization;
using namespace System::Runtime::Serialization::Formatters::Binary;
[Serializable] __gc class LSF_SPRITEFILE : public System::Object
{
public:
BYTE filetype __nogc [3];
BYTE version;
BYTE filename __nogc [80];
};
[Serializable] __gc class LSF_TEXTUREMASK : public System::Object
{
public:
BYTE name __nogc [30];
float x __nogc [2];
float y __nogc [2];
public:
System::String __gc *ToString(void){
return S"";
}
};
[Serializable] __gc class LSF_FRAMESET : public System::Object
{
public:
BYTE animationSetName __nogc [30];
DWORD numberFrames;
public:
System::String __gc *ToString(void){
return S"";
}
};
[Serializable] __gc class LSF_FRAMEINFO : public System::Object
{
public:
DWORD frameNum;
BYTE maskName __nogc [30];
float position __nogc [2];
float scale __nogc [2];
float centre __nogc [2];
float rotation;
DWORD diffuse;
DWORD duration;
float depth;
public:
System::String __gc *ToString(void){
return S"";
}
};
bool SpriteModel::saveFile(System::String* filename)
{
Stream* stream = File::Open(filename, FileMode::Create);
BinaryFormatter* bf = new BinaryFormatter();
LSF_TEXTUREMASK*tm = new LSF_TEXTUREMASK;
tm->x[0] = 10;
tm->x[1] = 5;
tm->y[0] = 10;
tm->y[1] = 5;
bf->Serialize(stream, tm);
return false;
}
No matter what I do it throws an exception
// lessbread edit - go easy on the long titles!
// PumpkinPieman edit - I would if I wasn't so ticked off ...
[Edited by - PumpkinPieman on February 28, 2006 2:34:56 PM]