Nevron Forum
Back
Login
Register
Login
Register
Home
»
Nevron Vision for NET
»
Nevron Diagram for .NET
»
PersistencyFormat.CutomBinary and NDrawingDocument clone problems
PersistencyFormat.CutomBinary and NDrawingDocument clone problems
Post Reply
PersistencyFormat.CutomBinary and NDrawingDocument clone problems
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
Goto Topics Forum
Author
Message
Alexey Ochkov
Alexey Ochkov
posted 12 Years Ago
ANSWER
Topic Details
Group: Forum Members
Posts: 6,
Visits: 15
1) When I save NDrawingDocument to PersistencyFormat.CutomBinary (from my program or from standard Nevron.Diagram.Designer.exe) links between ports and plugs are not saved. I send examples docs.zip with document saved in NDB (all links are ok) and CNDB (all links are broken).
2) NDrawingDocument implements ICloneable interface and CloneWithNewUniqueId method, but both possible clone methods fails when called. It is possible to clone NDrawingDocument without saving anl loading it from temporary file or memory stream? (on implementing cloning through save/restore from memory stream I found error with PersistencyFormat.CutomBinary).
Attachments
docs.zip
(
567 views,
15.00 KB
)
Reply
Like
0
Nevron Support
Nevron Support
posted 10 Years Ago
ANSWER
Post Details
Group: Administrators
Posts: 3.1K,
Visits: 4.2K
Hi,
The problems with connectors serialization in binary format is fixed in the latest version of Nevron Diagram for .NET. In order to clone a drawing document you can now create a simple method that serializes the drawing document to a memory stream in binary format and then deserializes it from the same stream. The following is a simple implementation of such method:
private static NDrawingDocument CloneDocument(NDrawingDocument document)
{
NDrawingDocument clonedDocument;
using (MemoryStream stream = new MemoryStream())
{
// Serialize the document to stream
NPersistencyManager manager = new NPersistencyManager();
manager.Persistentdocument.Sections.Add(new NPersistentSection("Drawing", document));
manager.SaveToStream(stream, PersistencyFormat.Binary, null);
// Deserialize the document from the stream
manager.LoadFromStream(stream, PersistencyFormat.Binary, null);
clonedDocument = (NDrawingDocument)manager.Persistentdocument.Sections.GetByName("Drawing").Object;
}
return clonedDocument;
}
Best Regards,
Nevron Support Team
Reply
Like
0
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Post Reply
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search