public static bool WriteConsumerConfigFile(string tenant, string product, string component, string topic, Consumer consumer) { try { if (File.Exists(ConsumerLocations.GetConsumerConfigFile(tenant, product, component, topic, consumer.Name))) { File.Delete(ConsumerLocations.GetConsumerConfigFile(tenant, product, component, topic, consumer.Name)); } File.WriteAllText(ConsumerLocations.GetConsumerConfigFile(tenant, product, component, topic, consumer.Name), consumer.ToJsonAndEncrypt()); return(true); } catch (Exception) { return(false); } }
public static Consumer ReadConsumerConfigFile(string tenant, string product, string component, string topic, string consumer) { return(File .ReadAllText(ConsumerLocations.GetConsumerConfigFile(tenant, product, component, topic, consumer)) .JsonToObjectAndDecrypt <Consumer>()); }