mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-22 19:36:11 +00:00
94 lines
3.3 KiB
C#
94 lines
3.3 KiB
C#
|
// Decompiled with JetBrains decompiler
|
|||
|
// Type: Microsoft.InfoCards.UserPreference
|
|||
|
// Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
|
|||
|
// MVID: 516D8B44-4448-4D2C-8B8E-FFBB3FFE472B
|
|||
|
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Virus.Win32.Expiro.w-69bb73081eac86b8cf86f45e33515d0095855636967076e2b593d7a30cd80a07.exe
|
|||
|
|
|||
|
using Microsoft.InfoCards.Diagnostics;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Globalization;
|
|||
|
using System.IO;
|
|||
|
using System.Text;
|
|||
|
|
|||
|
namespace Microsoft.InfoCards
|
|||
|
{
|
|||
|
internal class UserPreference
|
|||
|
{
|
|||
|
private const byte Version = 1;
|
|||
|
private const byte Marker = 29;
|
|||
|
private const string Id = "urn:microsoft.com:infocards:user_prefs";
|
|||
|
private const int s_ATApplicationsDisabled = 0;
|
|||
|
private int m_ATApplicationsFlags;
|
|||
|
private bool m_showClaimsFlag;
|
|||
|
|
|||
|
public UserPreference()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
public UserPreference(Stream stream) => this.Deserialize(stream);
|
|||
|
|
|||
|
public void Serialize(Stream stream)
|
|||
|
{
|
|||
|
BinaryWriter binaryWriter = new BinaryWriter(stream, Encoding.Unicode);
|
|||
|
binaryWriter.Write((byte) 1);
|
|||
|
binaryWriter.Write(this.m_ATApplicationsFlags);
|
|||
|
binaryWriter.Write(this.m_showClaimsFlag);
|
|||
|
binaryWriter.Write((byte) 29);
|
|||
|
}
|
|||
|
|
|||
|
public void Deserialize(Stream stream)
|
|||
|
{
|
|||
|
BinaryReader binaryReader = (BinaryReader) new InfoCardBinaryReader(stream, Encoding.Unicode);
|
|||
|
if ((byte) 1 != binaryReader.ReadByte())
|
|||
|
InfoCardTrace.Assert(false, "Incorrect version found in stream deserialization");
|
|||
|
this.m_ATApplicationsFlags = binaryReader.ReadInt32();
|
|||
|
this.m_showClaimsFlag = binaryReader.ReadBoolean();
|
|||
|
if ((byte) 29 == binaryReader.ReadByte())
|
|||
|
return;
|
|||
|
InfoCardTrace.Assert(false, "malformed stream detected");
|
|||
|
}
|
|||
|
|
|||
|
public void Save(StoreConnection con)
|
|||
|
{
|
|||
|
DataRow row = con.GetSingleRow(new QueryParameter("ix_objecttype", new object[1]
|
|||
|
{
|
|||
|
(object) -2
|
|||
|
}), new QueryParameter("ix_globalid", new object[1]
|
|||
|
{
|
|||
|
(object) GlobalId.DeriveFrom("urn:microsoft.com:infocards:user_prefs")
|
|||
|
}));
|
|||
|
if (row == null)
|
|||
|
{
|
|||
|
row = new DataRow();
|
|||
|
row.ObjectType = -2;
|
|||
|
row.GlobalId = GlobalId.DeriveFrom("urn:microsoft.com:infocards:user_prefs");
|
|||
|
}
|
|||
|
MemoryStream memoryStream = new MemoryStream();
|
|||
|
this.Serialize((Stream) memoryStream);
|
|||
|
row.SetDataField(memoryStream.ToArray());
|
|||
|
con.Save(row);
|
|||
|
}
|
|||
|
|
|||
|
public override string ToString()
|
|||
|
{
|
|||
|
StringBuilder stringBuilder = new StringBuilder();
|
|||
|
stringBuilder.AppendFormat("Background Color:\t{0}\n", (object) this.m_ATApplicationsFlags.ToString((IFormatProvider) CultureInfo.InvariantCulture));
|
|||
|
stringBuilder.AppendFormat("List expansion flag:\t{0}\n", (object) this.m_showClaimsFlag.ToString());
|
|||
|
return stringBuilder.ToString();
|
|||
|
}
|
|||
|
|
|||
|
public static UserPreference Get(StoreConnection con)
|
|||
|
{
|
|||
|
DataRow singleRow = con.GetSingleRow(new List<QueryParameter>()
|
|||
|
{
|
|||
|
new QueryParameter("ix_objecttype", new object[1]
|
|||
|
{
|
|||
|
(object) -2
|
|||
|
})
|
|||
|
}.ToArray());
|
|||
|
return singleRow != null ? new UserPreference((Stream) new MemoryStream(singleRow.GetDataField())) : (UserPreference) null;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|