mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-19 18:06:10 +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: 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.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;
|
|
}
|
|
}
|
|
}
|