MalwareSourceCode/MSIL/Virus/Win32/E/Virus.Win32.Expiro.w-1f15ee7e9f7da02b6bfb4c5a5e6484eb9fa71b82d3699c54bcc7a31794b4a66d/Microsoft/InfoCards/DisplayToken.cs

86 lines
2.9 KiB
C#
Raw Normal View History

2022-08-18 11:28:56 +00:00
// Decompiled with JetBrains decompiler
// Type: Microsoft.InfoCards.DisplayToken
// 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;
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")));
}
}
}
}