mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-22 19:36:11 +00:00
178 lines
5.6 KiB
C#
178 lines
5.6 KiB
C#
|
// Decompiled with JetBrains decompiler
|
|||
|
// Type: LFSTweak.My.InternalXmlHelper
|
|||
|
// Assembly: LFSTweak, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
|||
|
// MVID: C77C2A36-D42F-41E0-A8F4-0FAB7DAB4ECE
|
|||
|
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare.00004-msil\Virus.Win32.Sality.sil-52c1c08a641f4eea7c4c4adfe074b30e92d254f958aa67f4b0ded38b7db3a24d.exe
|
|||
|
|
|||
|
using System;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Diagnostics;
|
|||
|
using System.Linq;
|
|||
|
using System.Runtime.CompilerServices;
|
|||
|
using System.Xml.Linq;
|
|||
|
|
|||
|
namespace LFSTweak.My
|
|||
|
{
|
|||
|
[CompilerGenerated]
|
|||
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|||
|
[DebuggerNonUserCode]
|
|||
|
internal sealed class InternalXmlHelper
|
|||
|
{
|
|||
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|||
|
private InternalXmlHelper()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
public static string get_Value(IEnumerable<XElement> source)
|
|||
|
{
|
|||
|
IEnumerator<XElement> enumerator;
|
|||
|
try
|
|||
|
{
|
|||
|
enumerator = source.GetEnumerator();
|
|||
|
if (enumerator.MoveNext())
|
|||
|
return enumerator.Current.Value;
|
|||
|
}
|
|||
|
finally
|
|||
|
{
|
|||
|
enumerator?.Dispose();
|
|||
|
}
|
|||
|
return (string) null;
|
|||
|
}
|
|||
|
|
|||
|
public static void set_Value(IEnumerable<XElement> source, string value)
|
|||
|
{
|
|||
|
IEnumerator<XElement> enumerator;
|
|||
|
try
|
|||
|
{
|
|||
|
enumerator = source.GetEnumerator();
|
|||
|
if (!enumerator.MoveNext())
|
|||
|
return;
|
|||
|
enumerator.Current.Value = value;
|
|||
|
}
|
|||
|
finally
|
|||
|
{
|
|||
|
enumerator?.Dispose();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static string get_AttributeValue(IEnumerable<XElement> source, XName name)
|
|||
|
{
|
|||
|
IEnumerator<XElement> enumerator;
|
|||
|
try
|
|||
|
{
|
|||
|
enumerator = source.GetEnumerator();
|
|||
|
if (enumerator.MoveNext())
|
|||
|
return (string) enumerator.Current.Attribute(name);
|
|||
|
}
|
|||
|
finally
|
|||
|
{
|
|||
|
enumerator?.Dispose();
|
|||
|
}
|
|||
|
return (string) null;
|
|||
|
}
|
|||
|
|
|||
|
public static void set_AttributeValue(IEnumerable<XElement> source, XName name, string value)
|
|||
|
{
|
|||
|
IEnumerator<XElement> enumerator;
|
|||
|
try
|
|||
|
{
|
|||
|
enumerator = source.GetEnumerator();
|
|||
|
if (!enumerator.MoveNext())
|
|||
|
return;
|
|||
|
enumerator.Current.SetAttributeValue(name, (object) value);
|
|||
|
}
|
|||
|
finally
|
|||
|
{
|
|||
|
enumerator?.Dispose();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static string get_AttributeValue(XElement source, XName name) => (string) source.Attribute(name);
|
|||
|
|
|||
|
public static void set_AttributeValue(XElement source, XName name, string value) => source.SetAttributeValue(name, (object) value);
|
|||
|
|
|||
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|||
|
public static XAttribute CreateAttribute(XName name, object value) => value == null ? (XAttribute) null : new XAttribute(name, RuntimeHelpers.GetObjectValue(value));
|
|||
|
|
|||
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|||
|
public static XAttribute CreateNamespaceAttribute(XName name, XNamespace ns)
|
|||
|
{
|
|||
|
XAttribute namespaceAttribute = new XAttribute(name, (object) ns.NamespaceName);
|
|||
|
namespaceAttribute.AddAnnotation((object) ns);
|
|||
|
return namespaceAttribute;
|
|||
|
}
|
|||
|
|
|||
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|||
|
public static object RemoveNamespaceAttributes(XNamespace[] ns, object obj)
|
|||
|
{
|
|||
|
if (ns != null && obj != null)
|
|||
|
{
|
|||
|
switch (obj)
|
|||
|
{
|
|||
|
case XElement e:
|
|||
|
// ISSUE: reference to a compiler-generated method
|
|||
|
return (object) InternalXmlHelper.RemoveNamespaceAttributes(ns, e);
|
|||
|
case IEnumerable enumerable:
|
|||
|
// ISSUE: reference to a compiler-generated method
|
|||
|
return (object) InternalXmlHelper.RemoveNamespaceAttributes(ns, enumerable);
|
|||
|
}
|
|||
|
}
|
|||
|
return obj;
|
|||
|
}
|
|||
|
|
|||
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|||
|
public static IEnumerable RemoveNamespaceAttributes(XNamespace[] ns, IEnumerable obj)
|
|||
|
{
|
|||
|
if (ns == null || obj == null)
|
|||
|
return obj;
|
|||
|
// ISSUE: object of a compiler-generated type is created
|
|||
|
// ISSUE: reference to a compiler-generated method
|
|||
|
// ISSUE: object of a compiler-generated type is created
|
|||
|
// ISSUE: reference to a compiler-generated method
|
|||
|
return obj is IEnumerable<XElement> source ? (IEnumerable) source.Select<XElement, XElement>(new Func<XElement, XElement>(new InternalXmlHelper.RemoveNamespaceAttributesClosure(ns).ProcessXElement)) : (IEnumerable) obj.Cast<object>().Select<object, object>(new Func<object, object>(new InternalXmlHelper.RemoveNamespaceAttributesClosure(ns).ProcessObject));
|
|||
|
}
|
|||
|
|
|||
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|||
|
public static XElement RemoveNamespaceAttributes(XNamespace[] ns, XElement e)
|
|||
|
{
|
|||
|
XAttribute nextAttribute;
|
|||
|
if (ns != null && e != null)
|
|||
|
{
|
|||
|
for (XAttribute xattribute = e.FirstAttribute; xattribute != null; xattribute = nextAttribute)
|
|||
|
{
|
|||
|
nextAttribute = xattribute.NextAttribute;
|
|||
|
if (xattribute.IsNamespaceDeclaration)
|
|||
|
{
|
|||
|
XNamespace xnamespace = xattribute.Annotation<XNamespace>();
|
|||
|
if ((object) xnamespace != null)
|
|||
|
{
|
|||
|
int num = checked (ns.Length - 1);
|
|||
|
int index = 0;
|
|||
|
while (index <= num)
|
|||
|
{
|
|||
|
if (xnamespace == ns[index])
|
|||
|
{
|
|||
|
xattribute.Remove();
|
|||
|
break;
|
|||
|
}
|
|||
|
checked { ++index; }
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
return e;
|
|||
|
}
|
|||
|
|
|||
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|||
|
public static XNamespace GetNamespace(ref XNamespace xns, string ns)
|
|||
|
{
|
|||
|
if ((object) xns == null)
|
|||
|
xns = XNamespace.Get(ns);
|
|||
|
return xns;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|