public bool TryGet(out string username, out string password) { username = this._storage.Get <string>("Username"); password = this._storage.Get <string>("Password"); if (!username.NullOrEmpty() && !password.NullOrEmpty()) { bool result; try { username = MachineProtectedData.Decrypt(username); password = MachineProtectedData.Decrypt(password); goto IL_5E; } catch (CryptographicException ex) { this._logger.Error(ex); result = false; } return(result); IL_5E: return(!username.NullOrEmpty() && !password.NullOrEmpty()); } return(false); }
public bool TryDecrypt(out string username, out string password) { RunSettings runSettings = this._settings.Of <RunSettings>(); username = runSettings.get_Username(); password = runSettings.get_Password(); if (!username.IsNullOrEmpty() && !password.IsNullOrEmpty()) { bool result; try { username = MachineProtectedData.Decrypt(username); password = MachineProtectedData.Decrypt(password); goto IL_56; } catch (CryptographicException ex) { LogExtensions.Error(this._log, ex); result = false; } return(result); IL_56: return(!username.IsNullOrEmpty() && !password.IsNullOrEmpty()); } return(false); }