Click here to Skip to main content
16,007,610 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionProject config out of date? Pin
Lunchy19-May-02 7:49
Lunchy19-May-02 7:49 
AnswerRe: Project config out of date? Pin
James T. Johnson21-May-02 6:10
James T. Johnson21-May-02 6:10 
GeneralRe: Project config out of date? Pin
Lunchy21-May-02 6:25
Lunchy21-May-02 6:25 
GeneralRe: Project config out of date? Pin
James T. Johnson21-May-02 6:27
James T. Johnson21-May-02 6:27 
GeneralRe: Project config out of date? Pin
Lunchy21-May-02 7:37
Lunchy21-May-02 7:37 
GeneralCustom Serialization Pin
Gluber17-May-02 9:58
Gluber17-May-02 9:58 
GeneralRe: Custom Serialization Pin
James T. Johnson17-May-02 16:09
James T. Johnson17-May-02 16:09 
GeneralRe: Custom Serialization Pin
Gluber18-May-02 2:56
Gluber18-May-02 2:56 
Hi !

THanks for you answer. I know that the serializer stores each object only once. But thats not the idea behind my question, because in my graph there are CERTAIN objects that MUST NOT be serialized... This is because e.g high level objects are in the graph like the graphics renderer or sound engine, which can be different on other machines, but still the serialized files should be loadable. So i need the Iserializeable interface.

The code i sent in was just some dummy code, here is the REAL CODE now:

private Node ( SerializationInfo info, StreamingContext c )
{
m_children = new SortedList();

Debug.WriteLine("Deserializing object");

// And finally the node data itself.
m_reference = info.GetValue("WrappedObject",typeof(object) );
m_id = (Identifier)info.GetValue("Id",typeof(Identifier) );

Debug.WriteLine(m_id.Name,"Assigned key to");

// Add number of children
int numChildren = (int)info.GetValue( "ChildrenCount",typeof(int) );

// Serialize the child nodes first
for( int i = 0; i < numChildren; i++ )
{
// Generate an index key
string nodeName = "Node" + i;
Node newNode = (Node)info.GetValue(nodeName,typeof(Node) );
Attach( newNode );
}

// Now we store the parent reference.
if ( m_parentSerialize )
m_parent = (Node)info.GetValue("NodeParent",typeof(Node) );
}

///
/// Serialization method for nodes. This is required
/// so that the class tree does not get walked in the
/// wrong direction, since we want certain node wrapped
/// classes to be kept out of serialization.
///

/// <param name="info" />Serialization info.
/// <param name="context" />Serialization context.
public void GetObjectData( SerializationInfo info, StreamingContext context )
{
Debug.WriteLine(Id.Name,"GetObjectData called for");

// And finally the node data itself.
info.AddValue("WrappedObject",m_reference );
info.AddValue("Id",m_id,typeof(Identifier) );

// Add number of children
info.AddValue( "ChildrenCount",m_children.Count );

int index = 0;
// Serialize the child nodes first
foreach( Node n in m_children.Values )
{
// Generate an index ke
string nodeIndex = "Node" + index;
info.AddValue( nodeIndex,n,typeof(Node) );
index ++;
}

// Now we store the parent reference.
if ( m_parentSerialize )
info.AddValue("NodeParent",m_parent,typeof(Node) );
}


The problem now is that "Attach" adds the node to the SOrtedList representing the children with m_id as the key and the node as the value. HOWEVER i get the exception that the KEY is NULL all the time. I added some debug messages and it seems that a child node is added BEFORE it got an ID, so it is not complety reconstructed....

Any clues ?
GeneralRe: Custom Serialization Pin
James T. Johnson21-May-02 6:06
James T. Johnson21-May-02 6:06 
GeneralRe: Custom Serialization Pin
Neil Van Note21-May-02 19:21
Neil Van Note21-May-02 19:21 
QuestionPaste as plain text in VC7? Pin
Todd Smith16-May-02 12:21
Todd Smith16-May-02 12:21 
AnswerRe: Paste as plain text in VC7? Pin
Andres Manggini16-May-02 14:26
Andres Manggini16-May-02 14:26 
GeneralRe: Paste as plain text in VC7? Pin
Todd Smith16-May-02 14:42
Todd Smith16-May-02 14:42 
AnswerRe: Paste as plain text in VC7? Pin
James T. Johnson17-May-02 1:16
James T. Johnson17-May-02 1:16 
GeneralRe: Paste as plain text in VC7? Pin
Todd Smith20-May-02 10:50
Todd Smith20-May-02 10:50 
QuestionWhat is the min OS I can install .Net on? Pin
Srini Kella15-May-02 7:38
Srini Kella15-May-02 7:38 
AnswerRe: What is the min OS I can install .Net on? Pin
Mazdak15-May-02 8:14
Mazdak15-May-02 8:14 
AnswerRe: What is the min OS I can install .Net on? Pin
James T. Johnson15-May-02 8:17
James T. Johnson15-May-02 8:17 
GeneralRe: What is the min OS I can install .Net on? Pin
Kevin McFarlane27-May-02 9:55
Kevin McFarlane27-May-02 9:55 
QuestionWhat is your %PATH% after installing .NET? Pin
Todd Smith13-May-02 18:42
Todd Smith13-May-02 18:42 
AnswerRe: What is your %PATH% after installing .NET? Pin
James T. Johnson13-May-02 18:41
James T. Johnson13-May-02 18:41 
General.NET via C++ COM Pin
rkiesler13-May-02 8:44
rkiesler13-May-02 8:44 
GeneralRe: .NET via C++ COM Pin
Rama Krishna Vavilala16-May-02 14:49
Rama Krishna Vavilala16-May-02 14:49 
GeneralRe: .NET via C++ COM Pin
rkiesler17-May-02 3:19
rkiesler17-May-02 3:19 
GeneralRe: .NET via C++ COM Pin
Rama Krishna Vavilala17-May-02 3:46
Rama Krishna Vavilala17-May-02 3:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.