mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-25 12:55:28 +00:00
f2ac1ece55
add
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: 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.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;
|
|
}
|
|
}
|
|
}
|