Beispiel #1
0
 public void ExecuteSerialization(object orderToSerialize, int cypher = 2)
 {
     if (extension.Equals(".xml"))
     {
         XmlSerialize xml = new XmlSerialize(orderToSerialize, fullFilePath);
         xml.SerializeXmlObject(cypher);
     }
     else if (extension.Equals(".bin"))
     {
         BinarySerializer bin = new BinarySerializer(orderToSerialize, fullFilePath);
         bin.BinarySerializeObject(cypher);
     }
     else if (extension.Equals(".json"))
     {
         JsonSerializer json = new JsonSerializer(orderToSerialize, fullFilePath);
         json.JsonSerializeObject(cypher);
     }
 }
Beispiel #2
0
 public object ExecuteDeserialization(int cypherMode = 2)
 {
     if (extension.Equals(".xml"))
     {
         XmlSerialize xml = new XmlSerialize(fullFilePath);
         return(xml.DeserializeXmlObject(cypherMode));
     }
     else if (extension.Equals(".bin"))
     {
         BinarySerializer bin = new BinarySerializer(fullFilePath);
         return(bin.BinaryDeserializeObject(cypherMode));
     }
     else if (extension.Equals(".json"))
     {
         JsonSerializer json = new JsonSerializer(fullFilePath);
         return(json.JsonDeserializeObject(cypherMode));
     }
     return(null);
 }