We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Checking if a serialization file is valid

Hi, I''ve been some files generated with SaveSoap from diagram. As I change some of the classes members, the serialization writes them in a different way and they became incompatible. My question is how to detect they are incompatible efficiently. I''m doing this: private bool IsValidProject(string fileName){ try{ new Diagram().LoadSoap(fileName); }catch{return false;} return true; } which is bad... (since if it''s valid I''m loading it to the right variable). By the way, I put it on the right variable and it''s invalid the interface gets fuzzy (because LoadSoap put the variables with invalid values). Regards, Jose Santos

1 Reply

AD Administrator Syncfusion Team January 31, 2005 09:23 AM

Hi Jose, You could try providing a variant of the Diagram.LoadSoap(string fileName)/Diagram.LoadSoap(Stream streamin) methods so that the Diagram control''s attributes(the Diagram.Model, Diagram.View and Diagram.DiagramScript objects) are re-initialized only when you want them to. Adding a helper method that deserializes the provided soap stream, but returns without re-initializing the current instance of the diagram with the deserialized mode/view/diagramscript objects will let you test the validity of the serialized file. Please refer to the Diagram.LoadSoap(Stream streamin) method in the ''..\Diagram.Windows\Src\Controls\Diagram.cs'' file for details on the deserializing process. Thanks, Prakash

Loader.
Live Chat Icon For mobile
Up arrow icon