Ejemplo n.º 1
0
        protected override void OnDeserialize(System.Runtime.Serialization.IFormatter formatter, System.Runtime.Serialization.SurrogateSelector selector)
        {
            FlowchartSerialize surrogate = new FlowchartSerialize();

            selector.AddSurrogate(typeof(Flowchart), new StreamingContext(StreamingContextStates.All), surrogate);
            base.OnDeserialize(formatter, selector);
        }
Ejemplo n.º 2
0
 static object Deserialize(string location, System.Runtime.Serialization.IFormatter formatter)
 {
     using (StreamReader writer = new StreamReader(location))
     {
         return(formatter.Deserialize(writer.BaseStream));
     }
 }
Ejemplo n.º 3
0
 static void Serialize(object targetObject, string location, System.Runtime.Serialization.IFormatter formatter)
 {
     using (StreamWriter writer = new StreamWriter(location, false))
     {
         formatter.Serialize(writer.BaseStream, targetObject);
         writer.Flush();
     }
 }
Ejemplo n.º 4
0
 protected override void OnDeserialize(System.Runtime.Serialization.IFormatter formatter, System.Runtime.Serialization.SurrogateSelector selector)
 {
     selector.AddSurrogate(typeof(CustomDiagram), new StreamingContext(StreamingContextStates.All), new CustomDiagramSerialize());
     base.OnDeserialize(formatter, selector);
 }
 public static byte[] Serialize <TEntity>(this TEntity entity, Serialization.IFormatter formatter)
 {
     if (entity == null)
     {
         return(default);