public void StoreKeys(AZKeys secrets, string filePath) { XmlSerializer ser = new XmlSerializer(typeof(AZKeys)); TextWriter writer = new StreamWriter(filePath); ser.Serialize(writer, secrets); writer.Close(); }
public AZKeys GetSecrets(string filePath) { XmlSerializer ser = new XmlSerializer(typeof(AZKeys)); FileStream stream = new FileStream(filePath, FileMode.Open); AZKeys keys = (AZKeys)ser.Deserialize(stream); return(keys); }
static void Main(string[] args) { string storePath = @"C:\tools\keys.xml"; AZKeys.AZKeys keys = new AZKeys.AZKeys() { azStorageAccountName = "unityscores", azStoragePrimaryKey = "qevOBB7bEvX69HG18vROe1rQLjZM7ZfLXuW9aOpmAgHnq/XMyuBx/fdagQ4ytWISaksMVKphMlICfPho8/CUIg==" }; AZKeysClass az = new AZKeysClass(); az.StoreKeys(keys, storePath); AZKeys.AZKeys key2 = az.GetSecrets(storePath); }