This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ConfigurationHelper | |
{ | |
public static IConfigurationRoot GetConfiguration() | |
{ | |
var builder = new ConfigurationBuilder() | |
.SetBasePath(Directory.GetCurrentDirectory()) // Define o diretório base | |
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); // Carrega o arquivo JSON | |
return builder.Build(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Configure(IApplicationBuilder app, IHostingEnvironment env) | |
{ | |
if (env.IsDevelopment()) | |
{ | |
app.UseDeveloperExceptionPage(); // Exibe erros detalhados em desenvolvimento | |
} | |
else | |
{ | |
// Em produção, você pode optar por exibir detalhes de erro | |
app.UseExceptionHandler(errorApp => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function IsSmartCardCertificate(pCertContext As LongPtr) As Boolean | |
Dim cbData As Long | |
Dim provInfo As String | |
Dim isSmartCard As Boolean | |
' Obtém o tamanho das informações do provedor de chaves | |
If CertGetCertificateContextProperty(pCertContext, CERT_KEY_PROV_INFO_PROP_ID, 0, cbData) = 0 Then | |
IsSmartCardCertificate = False | |
Exit Function | |
End If |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
' Windows API Declarations | |
Private Declare PtrSafe Function CertOpenSystemStore Lib "crypt32.dll" Alias "CertOpenSystemStoreA" (ByVal hProv As LongPtr, ByVal szSubsystemProtocol As String) As LongPtr | |
Private Declare PtrSafe Function CertFindCertificateInStore Lib "crypt32.dll" (ByVal hCertStore As LongPtr, ByVal dwCertEncodingType As Long, ByVal dwFindFlags As Long, ByVal dwFindType As Long, ByVal pvFindPara As LongPtr, ByVal pPrevCertContext As LongPtr) As LongPtr | |
Private Declare PtrSafe Function CertGetNameString Lib "crypt32.dll" Alias "CertGetNameStringA" (ByVal pCertContext As LongPtr, ByVal dwType As Long, ByVal dwFlags As Long, ByVal pvTypePara As LongPtr, ByVal pszNameString As String, ByVal cchNameString As Long) As Long | |
Private Declare PtrSafe Function CertGetCertificateContextProperty Lib "crypt32.dll" (ByVal pCertContext As LongPtr, ByVal dwPropId As Long, ByVal pvData As LongPtr, ByRef pcbData As Long) As Long | |
Private Declare PtrSafe Function CertCloseStore Lib "crypt32.dll" (ByV |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Declare PtrSafe Function CertOpenStore Lib "Crypt32.dll" ( _ | |
ByVal lpszStoreProvider As String, _ | |
ByVal dwEncodingType As Long, _ | |
ByVal hCryptProv As LongPtr, _ | |
ByVal dwFlags As Long, _ | |
ByVal pvPara As LongPtr) As LongPtr | |
Private Declare PtrSafe Function CertCloseStore Lib "Crypt32.dll" ( _ | |
ByVal hCertStore As LongPtr, _ | |
ByVal dwFlags As Long) As Long |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digo VBA para Extrair o Conteúdo entre Parênteses | |
vba | |
Copiar | |
Editar | |
Function ExtrairConteudoParenteses(ByVal texto As String) As String | |
Dim regex As Object | |
Dim match As Object | |
Set regex = CreateObject("VBScript.RegExp") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Declare PtrSafe Function CertOpenStore Lib "Crypt32.dll" ( _ | |
ByVal lpszStoreProvider As String, _ | |
ByVal dwEncodingType As Long, _ | |
ByVal hCryptProv As LongPtr, _ | |
ByVal dwFlags As Long, _ | |
ByVal pvPara As LongPtr) As LongPtr | |
Private Declare PtrSafe Function CertCloseStore Lib "Crypt32.dll" ( _ | |
ByVal hCertStore As LongPtr, _ | |
ByVal dwFlags As Long) As Long |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Diagnostics; | |
using System.Drawing; | |
using System.Linq; | |
using System.Net; | |
using System.Net.NetworkInformation; | |
using System.Runtime.InteropServices; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Result<T> | |
{ | |
public T Value { get; } | |
public string Error { get; } | |
public bool IsSuccess => Error == null; | |
private Result(T value, string error) | |
{ | |
Value = value; | |
Error = error; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub RequisicaoWinHTTP() | |
' Cria o objeto WinHttpRequest | |
Dim http As Object | |
Set http = CreateObject("WinHttp.WinHttpRequest.5.1") | |
' URL de destino | |
Dim url As String | |
url = "https://jsonplaceholder.typicode.com/posts/1" | |
On Error GoTo ErroHandler |