MalwareSourceCode/MSIL/Virus/Win32/E/Virus.Win32.Expiro.w-f8f9f26e940480624825f6bddbea86e70fc4aa746c4dd8efa7d98dcb477000ed/Microsoft/InfoCards/InfoCardMetadataExchangeClient.cs
2022-08-18 06:28:56 -05:00

84 lines
3.2 KiB
C#

// Decompiled with JetBrains decompiler
// Type: Microsoft.InfoCards.InfoCardMetadataExchangeClient
// Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: 1D4D5564-A025-490C-AF1D-DF4FBB709D1F
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Virus.Win32.Expiro.w-f8f9f26e940480624825f6bddbea86e70fc4aa746c4dd8efa7d98dcb477000ed.exe
using Microsoft.InfoCards.Diagnostics;
using System;
using System.Collections.Generic;
using System.Net;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
namespace Microsoft.InfoCards
{
internal class InfoCardMetadataExchangeClient : MetadataExchangeClient
{
private HttpWebRequest m_currentHttpGetRequest;
private object m_abortSync;
private bool m_aborted;
private IWebProxy m_proxy;
public InfoCardMetadataExchangeClient(Binding mexBinding)
: base(mexBinding)
{
this.m_abortSync = new object();
}
public IWebProxy Proxy
{
set => this.m_proxy = value;
}
public void Abort()
{
lock (this.m_abortSync)
{
if (this.m_currentHttpGetRequest != null)
this.m_currentHttpGetRequest.Abort();
else
base.GetChannelFactory((EndpointAddress) null, (string) null, (string) null)?.Abort();
this.m_aborted = true;
}
}
protected override HttpWebRequest GetWebRequest(
Uri location,
string dialect,
string identifier)
{
if (string.Compare(location.Scheme, "https", StringComparison.OrdinalIgnoreCase) != 0)
throw InfoCardTrace.ThrowHelperError((Exception) new TrustExchangeException(SR.GetString("NonHttpsURIFound", (object) location.AbsoluteUri)));
HttpWebRequest webRequest = base.GetWebRequest(location, dialect, identifier);
InfoCardTrace.Assert(null != this.m_proxy, "Set the proxy value before creating a WebRequest");
webRequest.Proxy = this.m_proxy;
lock (this.m_abortSync)
{
if (this.m_aborted)
webRequest.Abort();
return this.m_currentHttpGetRequest = webRequest;
}
}
protected override ChannelFactory<IMetadataExchange> GetChannelFactory(
EndpointAddress metadataAddress,
string dialect,
string identifier)
{
if ((EndpointAddress) null != metadataAddress && string.Compare(metadataAddress.Uri.Scheme, "https", StringComparison.OrdinalIgnoreCase) != 0)
throw InfoCardTrace.ThrowHelperError((Exception) new TrustExchangeException(SR.GetString("NonHttpsURIFound", (object) metadataAddress.Uri.AbsoluteUri)));
InfoCardTrace.Assert(null != this.m_proxy, "Set the proxy value before creating a WebRequest");
ChannelFactory<IMetadataExchange> channelFactory = base.GetChannelFactory(metadataAddress, dialect, identifier);
channelFactory.Endpoint.Binding = (Binding) new CustomBinding((IEnumerable<BindingElement>) HttpProxyTransportBindingElement.ReplaceHttpTransportWithProxy(channelFactory.Endpoint.Binding.CreateBindingElements(), this.m_proxy));
lock (this.m_abortSync)
{
if (this.m_aborted)
channelFactory.Abort();
}
return channelFactory;
}
}
}