// Decompiled with JetBrains decompiler // Type: RegAsm.CommandLine // 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; namespace RegAsm { internal class CommandLine { private string[] m_aArgList; private Option[] m_aOptList; private int m_iArgCursor; private int m_iOptCursor; private Abbrevs m_sValidOptions; public CommandLine(string[] aArgs, string[] aValidOpts) { this.m_sValidOptions = new Abbrevs(aValidOpts); string[] sourceArray1 = new string[aArgs.Length]; Option[] sourceArray2 = new Option[aArgs.Length]; int length1 = 0; int length2 = 0; for (int index = 0; index < aArgs.Length; ++index) { if (aArgs[index].StartsWith("/") || aArgs[index].StartsWith("-")) { string strValue = (string) null; int num = aArgs[index].IndexOfAny(new char[2] { ':', '=' }); bool bRequiresValue; bool bCanHaveValue; string str = this.m_sValidOptions.Lookup(num != -1 ? aArgs[index].Substring(1, num - 1) : aArgs[index].Substring(1), out bRequiresValue, out bCanHaveValue); if (!bCanHaveValue && num != -1) throw new ApplicationException(Resource.FormatString("Err_NoValueRequired", (object) str)); if (bRequiresValue && num == -1) throw new ApplicationException(Resource.FormatString("Err_ValueRequired", (object) str)); if (bCanHaveValue && num != -1) { if (num == aArgs[index].Length - 1) { if (index + 1 == aArgs.Length) throw new ApplicationException(Resource.FormatString("Err_ValueRequired", (object) str)); strValue = !aArgs[index + 1].StartsWith("/") && !aArgs[index + 1].StartsWith("-") ? aArgs[index + 1] : throw new ApplicationException(Resource.FormatString("Err_ValueRequired", (object) str)); ++index; } else strValue = aArgs[index].Substring(num + 1); } sourceArray2[length2++] = new Option(str, strValue); } else sourceArray1[length1++] = aArgs[index]; } this.m_aArgList = new string[length1]; this.m_aOptList = new Option[length2]; Array.Copy((Array) sourceArray1, (Array) this.m_aArgList, length1); Array.Copy((Array) sourceArray2, (Array) this.m_aOptList, length2); this.m_iArgCursor = 0; this.m_iOptCursor = 0; } public int NumArgs => this.m_aArgList.Length; public int NumOpts => this.m_aOptList.Length; public string GetNextArg() => this.m_iArgCursor >= this.m_aArgList.Length ? (string) null : this.m_aArgList[this.m_iArgCursor++]; public Option GetNextOption() => this.m_iOptCursor >= this.m_aOptList.Length ? (Option) null : this.m_aOptList[this.m_iOptCursor++]; } }