protected void salvaDadosInterfaceConfiguracao(ref mdlComponentesGraficos.TextBox tbSMTP, ref mdlComponentesGraficos.TextBox tbUsuario, ref mdlComponentesGraficos.TextBox tbSenha, ref mdlComponentesGraficos.ComboBox cbAuth) { if (m_bAtivado) { m_bAtivado = false; try { m_strSMTP = tbSMTP.Text.Clone().ToString(); m_strUsuario = tbUsuario.Text; m_strSenha = tbSenha.Text; m_enumTipoAutenticacao = (mdlEmail.AUTENTICACAO)cbAuth.ReturnObjectSelectedItem(); m_bConfiguracaoInicial = false; m_bVerificarConfiguracao = false; } catch (Exception err) { Object erro = err; m_cls_ter_tratadorErro.trataErro(ref erro); } m_bAtivado = true; } }
private void carregaDadosBDEspecifico() { try { mdlDataBaseAccess.Tabelas.XsdTbUsuarios.tbUsuariosRow dtrwRowTbUsuarios; if (m_typDatSetTbUsuarios.tbUsuarios.Rows.Count > 0) { dtrwRowTbUsuarios = (mdlDataBaseAccess.Tabelas.XsdTbUsuarios.tbUsuariosRow)m_typDatSetTbUsuarios.tbUsuarios.Rows[0]; if (!dtrwRowTbUsuarios.IsstrEmailNull()) { m_strCampoDe = dtrwRowTbUsuarios.strEmail; } if (!dtrwRowTbUsuarios.IsstrUserNull()) { m_strUsuario = dtrwRowTbUsuarios.strUser; } if (!dtrwRowTbUsuarios.IsstrSMTPNull()) { m_strSMTP = dtrwRowTbUsuarios.strSMTP; } if (!dtrwRowTbUsuarios.IsstrPasswordNull()) { m_strSenha = mdlCriptografia.clsCriptografia.strDecifraString(dtrwRowTbUsuarios.strPassword); } if (!dtrwRowTbUsuarios.IsnSMTPAutenticacaoNull()) { m_enumTipoAutenticacao = (mdlEmail.AUTENTICACAO)dtrwRowTbUsuarios.nSMTPAutenticacao; } } } catch (Exception err) { Object erro = err; m_cls_ter_tratadorErro.trataErro(ref erro); } }
private void carregaDadosDoRegistro() { try { System.Text.ASCIIEncoding decoderASCII = new System.Text.ASCIIEncoding(); bool bExiste = false, bPadraoOutlook = false; string strChave = ""; m_rgKyRegistrosCurrentUser = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Internet Account Manager\\Accounts\\00000001"); if (m_rgKyRegistrosCurrentUser == null) { m_rgKyRegistrosCurrentUser = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Office\\Outlook\\OMI Account Manager\\Accounts\\00000001"); if (m_rgKyRegistrosCurrentUser == null) { m_rgKyRegistrosCurrentUser = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows Messaging Subsystem\\Profiles\\Outlook"); if (m_rgKyRegistrosCurrentUser == null) { return; } else { Microsoft.Win32.RegistryKey rgKeyTemp; string[] strSubKeys = m_rgKyRegistrosCurrentUser.GetSubKeyNames(); foreach (string strSubKey in strSubKeys) { rgKeyTemp = m_rgKyRegistrosCurrentUser.OpenSubKey(strSubKey); rgKeyTemp = rgKeyTemp.OpenSubKey("00000004"); if (rgKeyTemp != null) { m_rgKyRegistrosCurrentUser = rgKeyTemp; bExiste = true; bPadraoOutlook = true; break; } } if (!bExiste) { return; } } } } if (m_rgKyRegistrosCurrentUser != null) { m_enumTipoAutenticacao = mdlEmail.AUTENTICACAO.Nenhuma; try { if (bPadraoOutlook) { strChave = ""; byte[] byArray = (byte[])m_rgKyRegistrosCurrentUser.GetValue("SMTP Server"); strChave = decoderASCII.GetString(byArray, 0, byArray.Length).Replace("\0", ""); } else { strChave = m_rgKyRegistrosCurrentUser.GetValue("SMTP Server").ToString(); } m_bConfiguracaoInicial = false; } catch { strChave = ""; } m_strSMTP = strChave; try { if (bPadraoOutlook) { strChave = ""; byte[] byArray = (byte[])m_rgKyRegistrosCurrentUser.GetValue("POP3 User"); strChave = decoderASCII.GetString(byArray, 0, byArray.Length).Replace("\0", ""); } else { strChave = m_rgKyRegistrosCurrentUser.GetValue("POP3 User Name").ToString(); } } catch { strChave = ""; } m_strUsuario = strChave; try { if (bPadraoOutlook) { strChave = ""; byte[] byArray = (byte[])m_rgKyRegistrosCurrentUser.GetValue("Email"); strChave = decoderASCII.GetString(byArray, 0, byArray.Length).Replace("\0", ""); } else { strChave = m_rgKyRegistrosCurrentUser.GetValue("SMTP Email Address").ToString(); } } catch { strChave = ""; } m_strCampoDe = strChave; try { byte[] byTemp; if (bPadraoOutlook) { byTemp = (byte[])m_rgKyRegistrosCurrentUser.GetValue("POP3 Password"); } else { byTemp = (byte[])m_rgKyRegistrosCurrentUser.GetValue("SMTP Password2"); } strChave = decoderASCII.GetString(byTemp, 0, byTemp.Length).Replace("\0", ""); m_rgKyRegistrosCurrentUser.Close(); } catch { strChave = ""; } } } catch (Exception err) { m_cls_ter_tratadorErro.trataErro(ref err); } }