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

86 lines
2.9 KiB
C#

// Decompiled with JetBrains decompiler
// Type: Microsoft.InfoCards.DisplayToken
// 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.IO;
namespace Microsoft.InfoCards
{
internal class DisplayToken
{
private string m_displayString;
private string m_mimeType;
private List<DisplayClaim> m_displayList;
private DisplayClaimType m_displayType;
public IEnumerable<DisplayClaim> ClaimList => (IEnumerable<DisplayClaim>) this.m_displayList;
public DisplayToken() => this.m_displayType = DisplayClaimType.NoDisplayToken;
public DisplayToken(string displayString, string mimeType)
{
this.m_displayString = displayString;
this.m_mimeType = mimeType;
this.m_displayType = DisplayClaimType.DisplayClaimString;
}
public DisplayToken(List<DisplayClaim> claimList)
{
this.m_displayList = claimList;
this.m_displayType = DisplayClaimType.DisplayClaimList;
}
public void Serialize(BinaryWriter writer)
{
writer.Write((byte) this.m_displayType);
switch (this.m_displayType)
{
case DisplayClaimType.NoDisplayToken:
break;
case DisplayClaimType.DisplayClaimString:
Utility.SerializeString(writer, this.m_displayString);
Utility.SerializeString(writer, this.m_mimeType);
break;
case DisplayClaimType.DisplayClaimList:
writer.Write((uint) this.m_displayList.Count);
using (List<DisplayClaim>.Enumerator enumerator = this.m_displayList.GetEnumerator())
{
while (enumerator.MoveNext())
enumerator.Current.Serialize(writer);
break;
}
default:
InfoCardTrace.ThrowInvalidArgumentConditional(true, "ClaimType");
break;
}
}
public void Deserialize(BinaryReader reader)
{
this.m_displayType = (DisplayClaimType) reader.ReadByte();
switch (this.m_displayType)
{
case DisplayClaimType.NoDisplayToken:
break;
case DisplayClaimType.DisplayClaimString:
this.m_displayString = Utility.DeserializeString(reader);
this.m_mimeType = Utility.DeserializeString(reader);
break;
case DisplayClaimType.DisplayClaimList:
this.m_displayList.Clear();
uint num = reader.ReadUInt32();
for (uint index = 0; index < num; ++index)
this.m_displayList.Add(new DisplayClaim(reader));
break;
default:
throw InfoCardTrace.ThrowHelperError((Exception) new InvalidOperationException(SR.GetString("InvalidDisplayClaimType")));
}
}
}
}