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

81 lines
2.8 KiB
C#
Raw Normal View History

2022-08-18 11:28:56 +00:00
// Decompiled with JetBrains decompiler
// Type: Microsoft.InfoCards.RPIdentityRequirement
// 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.IO;
using System.Text;
namespace Microsoft.InfoCards
{
internal class RPIdentityRequirement
{
private const int InvalidRow = 0;
private Uri m_infoCardId;
private int m_rowId;
private bool m_RPIdentityRequirement;
private RPIdentityRequirement()
{
}
public RPIdentityRequirement(Uri infoCardId, bool RPIdentityRequirement)
: this()
{
this.m_infoCardId = !((Uri) null == infoCardId) ? infoCardId : throw InfoCardTrace.ThrowHelperArgumentNull(nameof (infoCardId));
this.m_RPIdentityRequirement = RPIdentityRequirement;
}
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) => new BinaryWriter(stream, Encoding.Unicode).Write(this.m_RPIdentityRequirement);
public void Deserialize(Stream stream) => this.m_RPIdentityRequirement = new InfoCardBinaryReader(stream, Encoding.Unicode).ReadBoolean();
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 = 5;
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 bool StrongIdentityRequired
{
get => this.m_RPIdentityRequirement;
set => this.m_RPIdentityRequirement = value;
}
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) 5
}), new QueryParameter("ix_parentid", new object[1]
{
(object) GlobalId.DeriveFrom(this.m_infoCardId.ToString())
}));
}
}
}