mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-22 19:36:11 +00:00
99 lines
3.5 KiB
C#
99 lines
3.5 KiB
C#
|
// Decompiled with JetBrains decompiler
|
|||
|
// Type: Microsoft.InfoCards.InfocardExtendedInformationCollection
|
|||
|
// 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;
|
|||
|
using System.Text;
|
|||
|
using System.Xml;
|
|||
|
|
|||
|
namespace Microsoft.InfoCards
|
|||
|
{
|
|||
|
internal class InfocardExtendedInformationCollection : List<InfocardExtendedInformationEntry>
|
|||
|
{
|
|||
|
private const int InvalidRow = 0;
|
|||
|
private Uri m_infoCardId;
|
|||
|
private int m_rowId;
|
|||
|
|
|||
|
public InfocardExtendedInformationCollection(Uri infoCardId) => this.m_infoCardId = !((Uri) null == infoCardId) ? infoCardId : throw InfoCardTrace.ThrowHelperArgumentNull(nameof (infoCardId));
|
|||
|
|
|||
|
public void Get(StoreConnection con)
|
|||
|
{
|
|||
|
DataRow dataRow = con != null ? this.TryGetRow(con, QueryDetails.FullRow) : throw InfoCardTrace.ThrowHelperArgumentNull(nameof (con));
|
|||
|
if (dataRow == null)
|
|||
|
return;
|
|||
|
this.Deserialize((Stream) new MemoryStream(dataRow.GetDataField()));
|
|||
|
this.m_rowId = dataRow.LocalId;
|
|||
|
}
|
|||
|
|
|||
|
public void Serialize(Stream stream)
|
|||
|
{
|
|||
|
BinaryWriter writer = new BinaryWriter(stream, Encoding.Unicode);
|
|||
|
writer.Write(this.Count);
|
|||
|
for (int index = 0; index < this.Count; ++index)
|
|||
|
this[index].Serialize(writer);
|
|||
|
}
|
|||
|
|
|||
|
public void Deserialize(Stream stream)
|
|||
|
{
|
|||
|
BinaryReader reader = new BinaryReader(stream, Encoding.Unicode);
|
|||
|
int num = reader.ReadInt32();
|
|||
|
for (int index = 0; index < num; ++index)
|
|||
|
{
|
|||
|
InfocardExtendedInformationEntry informationEntry = new InfocardExtendedInformationEntry();
|
|||
|
informationEntry.Deserialize(reader);
|
|||
|
this.Add(informationEntry);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void Save(StoreConnection con)
|
|||
|
{
|
|||
|
DataRow row = con != null ? this.TryGetRow(con, QueryDetails.FullHeader) : throw InfoCardTrace.ThrowHelperArgumentNull(nameof (con));
|
|||
|
if (row == null)
|
|||
|
{
|
|||
|
row = new DataRow();
|
|||
|
row.ObjectType = 4;
|
|||
|
row.GlobalId = (GlobalId) Guid.NewGuid();
|
|||
|
}
|
|||
|
row.SetIndexValue("ix_parentid", (object) GlobalId.DeriveFrom(this.m_infoCardId.ToString()));
|
|||
|
MemoryStream memoryStream = new MemoryStream();
|
|||
|
this.Serialize((Stream) memoryStream);
|
|||
|
row.SetDataField(memoryStream.ToArray());
|
|||
|
con.Save(row);
|
|||
|
this.m_rowId = row.LocalId;
|
|||
|
}
|
|||
|
|
|||
|
public string GetIssuerInformationElement()
|
|||
|
{
|
|||
|
for (int index = 0; index < this.Count; ++index)
|
|||
|
{
|
|||
|
XmlReader reader = InfoCardSchemas.CreateReader(this[index].GetXml());
|
|||
|
reader.Read();
|
|||
|
if (reader.IsStartElement("IssuerInformation", "http://schemas.xmlsoap.org/ws/2007/01/identity"))
|
|||
|
{
|
|||
|
reader.Close();
|
|||
|
return this[index].GetXml();
|
|||
|
}
|
|||
|
reader.Close();
|
|||
|
}
|
|||
|
return string.Empty;
|
|||
|
}
|
|||
|
|
|||
|
protected DataRow TryGetRow(StoreConnection con, QueryDetails details)
|
|||
|
{
|
|||
|
InfoCardTrace.Assert((Uri) null != this.m_infoCardId, "null infocard id");
|
|||
|
return con.GetSingleRow(details, new QueryParameter("ix_objecttype", new object[1]
|
|||
|
{
|
|||
|
(object) 4
|
|||
|
}), new QueryParameter("ix_parentid", new object[1]
|
|||
|
{
|
|||
|
(object) GlobalId.DeriveFrom(this.m_infoCardId.ToString())
|
|||
|
}));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|