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

77 lines
2.8 KiB
C#

// Decompiled with JetBrains decompiler
// Type: Microsoft.InfoCards.UIAgentMonitor
// Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: ADE0A079-11DB-4A46-8BDE-D2A592CA8DEA
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Virus.Win32.Expiro.w-1f15ee7e9f7da02b6bfb4c5a5e6484eb9fa71b82d3699c54bcc7a31794b4a66d.exe
using Microsoft.InfoCards.Diagnostics;
using System;
using System.Collections.Generic;
namespace Microsoft.InfoCards
{
internal class UIAgentMonitor
{
private static UIAgentMonitor s_singleton = (UIAgentMonitor) null;
private static object s_syncRoot = new object();
private Dictionary<string, UIAgentMonitorHandle> m_currentCallingUsers;
private Dictionary<int, UIAgentMonitorHandle> m_currentTSSessions;
private UIAgentMonitor()
{
this.m_currentCallingUsers = new Dictionary<string, UIAgentMonitorHandle>();
this.m_currentTSSessions = new Dictionary<int, UIAgentMonitorHandle>();
}
public static UIAgentMonitor Instance()
{
if (UIAgentMonitor.s_singleton == null)
{
lock (UIAgentMonitor.s_syncRoot)
{
if (UIAgentMonitor.s_singleton == null)
UIAgentMonitor.s_singleton = new UIAgentMonitor();
}
}
return UIAgentMonitor.s_singleton;
}
public void AddNewClient(UIAgentMonitorHandle handle)
{
lock (UIAgentMonitor.s_syncRoot)
{
string userName = handle.UserName;
int tsSessionId = handle.TsSessionId;
if (this.m_currentCallingUsers.ContainsKey(userName))
throw InfoCardTrace.ThrowHelperError((Exception) new ServiceBusyException(SR.GetString("ServiceInUseOnAnotherSession")));
if (this.m_currentTSSessions.ContainsKey(tsSessionId))
throw InfoCardTrace.ThrowHelperError((Exception) new ServiceBusyException(SR.GetString("ServiceInUseOnAnotherSession")));
this.m_currentCallingUsers.Add(userName, handle);
try
{
this.m_currentTSSessions.Add(tsSessionId, handle);
}
catch (Exception ex)
{
this.m_currentCallingUsers.Remove(userName);
throw;
}
}
}
public void RemoveClient(UIAgentMonitorHandle handle)
{
lock (UIAgentMonitor.s_syncRoot)
{
string userName = handle.UserName;
int tsSessionId = handle.TsSessionId;
if (!string.IsNullOrEmpty(userName) && this.m_currentCallingUsers.ContainsKey(userName) && handle == this.m_currentCallingUsers[userName])
this.m_currentCallingUsers.Remove(userName);
if (!this.m_currentTSSessions.ContainsKey(tsSessionId) || handle != this.m_currentTSSessions[tsSessionId])
return;
this.m_currentTSSessions.Remove(tsSessionId);
}
}
}
}