Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

Gluber

@Gluber
About
Posts
3
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Getting Bitmap from WebBrowser2
    G Gluber

    Hi there ! I want to embed the MS IE Control into my application ( as covered by some tutorials here ) However ih ave one special requirement. Is it possible to get a BITMAP ( System.Drawing.Bitmap ) from this control ? I need that because i want to store it in a Texture for Managed DX9 .... any clues on this one ? Of course it would also be great to do that even if the webbrowser was not visible on screen.. In C++ i did that already ( overridng WM_PRINT etc and copying the image data by hand ) But how to do this in C#/NET Thanks

    C# graphics csharp c++ tutorial question

  • Custom Serialization
    G Gluber

    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. /// /// Serialization info. /// 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

    .NET (Core and Framework) question csharp game-dev json architecture

  • Custom Serialization
    G Gluber

    Hi there ! I have a tricky little problem. First I have to elaborate on my custom application architecture. I am desigining a highly extensible game engine which gets almost all functionality out of plugins which are implemented as .NET assemblies. I have a class called "Node" which wraps dynamically loaded classes via their object base class and supports invocation of methods via reflection as well as other things.. Nodes are organized in a hierarchy . Every Node contains a SortedList storing all child nodes, as well as a Node Reference pointing to the Parent node of a given node, as well as an object reference pointing to the wrapped class ( which was imported from the plugin assembly ) Now i want to save the hierarchy to a file via serialization. However i only want to save parts of the hierarchy from a given node. However since there is a parent reference , always the whole hierarchy gets serialized since the serializer walks both ways automatcially. So i want to restrict the serialization of the parent reference in certain cases dynamically. I can'T just add "Noserialze" attribute to the parent reference, since all classes are wrapped in Nodes and there can't be derived classes. Because of that i want to support ISerialize on the Node class to control what gets serialized and stop at a given node. However i do not seem to get that working. In particular how do i have to serialize the SortedList for the child nodes ? This is what i have so far: public void Node.GetObjectData( SerializationInfo info,StreamingContext context ) { info.AddValue("Id",m_identifier ); // Store the node id foreach( Node n in m_children.Values ) { string name = n.Name; info.AddValue ( "Name",name ); info.AddValue ( "Node",n ); } if ( m_parentSerialize ) info.AddValue("Parent",n.Parent ); } However this does not seem to work I also tried calling GetObjectData for the child nodes.. Seems not to work either.. . Any clues ?

    .NET (Core and Framework) question csharp game-dev json architecture
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups