void Parse() { AllowDuplicateResources = cmd.Modifier("allowduplicateresources"); foreach (string dupType in cmd.Options("allowdup")) { AllowDuplicateType(dupType); } AllowMultipleAssemblyLevelAttributes = cmd.Modifier("allowmultiple"); AllowWildCards = cmd.Modifier("wildcards"); AllowZeroPeKind = cmd.Modifier("zeropekind"); Parallel = cmd.Modifier("parallel"); PauseBeforeExit = cmd.Modifier("pause"); AttributeFile = cmd.Option("attr"); Closed = cmd.Modifier("closed"); CopyAttributes = cmd.Modifier("copyattrs"); DebugInfo = !cmd.Modifier("ndebug"); DelaySign = cmd.Modifier("delaysign"); UsePrimaryAssemblyName = cmd.Modifier("useprimaryassemblyname"); cmd.Option("align"); // not supported, just prevent interpreting this as file... Internalize = cmd.HasOption("internalize"); if (Internalize) { // this file shall contain one regex per line to compare agains FullName of types NOT to internalize ExcludeFile = cmd.Option("internalize"); } RenameInternalized = cmd.Modifier("renameinternalized"); KeyFile = cmd.Option("keyfile"); KeyContainer = cmd.Option("keycontainer"); Log = cmd.HasOption("log"); if (Log) { LogFile = cmd.Option("log"); } OutputFile = cmd.Option("out"); PublicKeyTokens = cmd.Modifier("usefullpublickeyforreferences"); var targetKind = cmd.Option("target"); if (string.IsNullOrEmpty(targetKind)) { targetKind = cmd.Option("t"); } if (!string.IsNullOrEmpty(targetKind)) { switch (targetKind) { case ("library"): TargetKind = ILRepack.Kind.Dll; break; case ("exe"): TargetKind = ILRepack.Kind.Exe; break; case ("winexe"): TargetKind = ILRepack.Kind.WinExe; break; default: throw new InvalidTargetKindException("Invalid target: \"" + targetKind + "\"."); } } // TargetPlatformDirectory -> how does cecil handle that? var targetPlatform = cmd.Option("targetplatform"); if (targetPlatform != null) { int dirIndex = targetPlatform.IndexOf(','); if (dirIndex != -1) { TargetPlatformDirectory = targetPlatform.Substring(dirIndex + 1); TargetPlatformVersion = targetPlatform.Substring(0, dirIndex); } else { TargetPlatformVersion = targetPlatform; } } if (cmd.Modifier("v2")) { TargetPlatformVersion = "v2"; } if (cmd.Modifier("v4")) { TargetPlatformVersion = "v4"; } UnionMerge = cmd.Modifier("union"); var version = cmd.Option("ver"); if (!string.IsNullOrEmpty(version)) { Version = new Version(version); } XmlDocumentation = cmd.Modifier("xmldocs"); NoRepackRes = cmd.Modifier("norepackres"); KeepOtherVersionReferences = cmd.Modifier("keepotherversionreferences"); SearchDirectories = cmd.Options("lib"); // private cmdline-Options: LogVerbose = cmd.Modifier("verbose"); LineIndexation = cmd.Modifier("index"); if (cmd.HasOption("repackdrop")) { RepackDropAttribute = cmd.Option("repackdrop"); if (String.IsNullOrWhiteSpace(RepackDropAttribute)) { RepackDropAttribute = "RepackDropAttribute"; } } // everything that doesn't start with a '/' must be a file to merge (verify when loading the files) InputAssemblies = cmd.OtherAguments; }
public bool ShouldShowUsage() { return(cmd.Modifier("?") | cmd.Modifier("help") | cmd.Modifier("h") | cmd.HasNoOptions); }