//------------------------------------------------------------------------------------------------- //--- Create an Encrypted String out of an Infoblock object //------------------------------------------------------------------------------------------------- public static string EncodeToString(InfoBlock anInfoBlock) { string myEncryptedString = ""; string myString; theJsonSerializerSettings.TypeNameHandling = TypeNameHandling.None; try { myString = JsonConvert.SerializeObject(anInfoBlock, theJsonSerializerSettings); myEncryptedString = myStringEncryptor.Encrypt(myString); } catch (Exception ex) { } return(myEncryptedString); }
//------------------------------------------------------------------------------------------------- //--- Create an Infoblock object out of an Encrypted String //------------------------------------------------------------------------------------------------- public static InfoBlock DecodeFromString(string aString) { InfoBlock myInfoBlock = null; theJsonSerializerSettings.TypeNameHandling = TypeNameHandling.None; try { string decryptedString = myStringEncryptor.Decrypt(aString); myInfoBlock = JsonConvert.DeserializeObject <InfoBlock>(decryptedString, theJsonSerializerSettings); } catch (Exception ex) { } return(myInfoBlock); }