MalwareSourceCode/MSIL/Virus/Win32/S/Virus.Win32.Sality.q-546c12c90ae93fcd5a74cdd328faf956effcec6da290a1b13f3f45331b4d58cd/Abbrevs.cs

69 lines
2.3 KiB
C#
Raw Normal View History

2022-08-18 11:28:56 +00:00
// Decompiled with JetBrains decompiler
// Type: RegAsm.Abbrevs
// Assembly: RegAsm, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// MVID: 0D2001F8-49C5-49A7-BF2D-B8D87970A226
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Virus.Win32.Sality.q-546c12c90ae93fcd5a74cdd328faf956effcec6da290a1b13f3f45331b4d58cd.exe
using System;
using System.Globalization;
namespace RegAsm
{
internal class Abbrevs
{
private string[] m_aOptions;
private bool[] m_bRequiresValue;
private bool[] m_bCanHaveValue;
public Abbrevs(string[] aOptions)
{
this.m_aOptions = new string[aOptions.Length];
this.m_bRequiresValue = new bool[aOptions.Length];
this.m_bCanHaveValue = new bool[aOptions.Length];
for (int index = 0; index < aOptions.Length; ++index)
{
string str = aOptions[index].ToLower(CultureInfo.InvariantCulture);
if (str.StartsWith("*"))
{
this.m_bRequiresValue[index] = true;
this.m_bCanHaveValue[index] = true;
str = str.Substring(1);
}
else if (str.StartsWith("+"))
{
this.m_bRequiresValue[index] = false;
this.m_bCanHaveValue[index] = true;
str = str.Substring(1);
}
this.m_aOptions[index] = str;
}
}
public string Lookup(string strOpt, out bool bRequiresValue, out bool bCanHaveValue)
{
string lower = strOpt.ToLower(CultureInfo.InvariantCulture);
bool flag = false;
int index1 = -1;
for (int index2 = 0; index2 < this.m_aOptions.Length; ++index2)
{
if (lower.Equals(this.m_aOptions[index2]))
{
bRequiresValue = this.m_bRequiresValue[index2];
bCanHaveValue = this.m_bCanHaveValue[index2];
return this.m_aOptions[index2];
}
if (this.m_aOptions[index2].StartsWith(lower))
{
flag = !flag ? true : throw new ApplicationException(Resource.FormatString("Err_AmbigousOption", (object) strOpt));
index1 = index2;
}
}
if (!flag)
throw new ApplicationException(Resource.FormatString("Err_UnknownOption", (object) strOpt));
bRequiresValue = this.m_bRequiresValue[index1];
bCanHaveValue = this.m_bCanHaveValue[index1];
return this.m_aOptions[index1];
}
}
}