public static DecryptData ( byte encryptedData ) : byte[] | ||
encryptedData | byte | |
return | byte[] |
public static object LoadFromFile(string fileName, Type t) { object o = null; try { byte[] fileContents = File.ReadAllBytes(fileName); byte[] decryptedData = Encryption.DecryptData(fileContents); using (MemoryStream stream = new MemoryStream()) { stream.Write(decryptedData, 0, decryptedData.Length); stream.Position = 0; DataContractSerializer serializer = new DataContractSerializer(t); o = serializer.ReadObject(stream); } } catch (Exception ex) { } return(o); }
public static Config LoadFromFile(string fileName) { Config config = new Config(); byte[] fileContents = File.ReadAllBytes(fileName); byte[] decryptedData = Encryption.DecryptData(fileContents); using (MemoryStream stream = new MemoryStream()) { stream.Write(decryptedData, 0, decryptedData.Length); stream.Position = 0; DataContractSerializer serializer = new DataContractSerializer(typeof(Config)); config = (Config)serializer.ReadObject(stream); } return(config); }