示例#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);
        }
示例#2
0
 static object Deserialize(string location, System.Runtime.Serialization.IFormatter formatter)
 {
     using (StreamReader writer = new StreamReader(location))
     {
         return(formatter.Deserialize(writer.BaseStream));
     }
 }
示例#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();
     }
 }
示例#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);