예제 #1
0
        private int RunCore(CpuPlatform cpu, string fileName, string ressourceParam, string ilSuffix)
        {
            string str = (string)null;

            if (!string.IsNullOrEmpty(this.InputValues.KeyFile))
            {
                str = Path.GetFullPath(this.InputValues.KeyFile);
            }
            if (!string.IsNullOrEmpty(str) && !File.Exists(str))
            {
                if (!string.IsNullOrEmpty(this.InputValues.RootDirectory) && Directory.Exists(this.InputValues.RootDirectory))
                {
                    str = Path.Combine(this.InputValues.RootDirectory, this.InputValues.KeyFile);
                }
                if (!File.Exists(str))
                {
                    throw new FileNotFoundException(string.Format(Resources.Provided_key_file_0_cannot_be_found, (object)str));
                }
            }

            int ret = IlParser.RunIlTool
                      (
                String.IsNullOrWhiteSpace(InputValues.OurILAsmPath) ? InputValues.FrameworkPath : InputValues.OurILAsmPath,
                "ilasm.exe",
                null,
                null,
                "ILAsmPath",
                GetCommandLineArguments(cpu, fileName, ressourceParam, ilSuffix, str),
                DllExportLogginCodes.IlAsmLogging,
                DllExportLogginCodes.VerboseToolLogging,
                Notifier,
                Timeout,
                line =>
            {
                int col = line.IndexOf(": ");
                if (col > 0)
                {
                    line = line.Substring(col + 1);
                }

                return(IlAsm
                       ._NormalizeIlErrorLineRegex
                       .Replace(line, "")
                       .ToLowerInvariant()
                       .StartsWith("warningnonvirtualnonabstractinstancemethodininterfacesettosuch"));
            }
                      );

            if (ret != 0)
            {
                return(ret);
            }

            ret = CheckPE(cpu, fileName);
            if (ret == 0)
            {
                RunLibTool(cpu, fileName, Path.GetFullPath(Path.GetDirectoryName(fileName)));
            }
            return(ret);
        }
        private int RunLibToolCore(CpuPlatform cpu, string directory, string defFileName)
        {
            string path = Path.Combine(directory, Path.GetFileNameWithoutExtension(this.InputValues.OutputFileName)) + ".lib";

            try
            {
                return(IlParser.RunIlTool(this.InputValues.LibToolPath, "Lib.exe", string.IsNullOrEmpty(this.InputValues.LibToolDllPath) || !Directory.Exists(this.InputValues.LibToolDllPath) ? (string)null : this.InputValues.LibToolDllPath, (string)null, "LibToolPath", string.Format("\"/def:{0}\" /machine:{1} \"/out:{2}\"", (object)defFileName, (object)cpu, (object)path), DllExportLogginCodes.LibToolLooging, DllExportLogginCodes.LibToolVerboseLooging, this.Notifier, this.Timeout, (Func <string, bool>)null));
            }
            catch (Exception ex)
            {
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
                throw;
            }
        }
예제 #3
0
 public int Run()
 {
     return(IlParser.RunIlTool
            (
                String.IsNullOrWhiteSpace(InputValues.OurILAsmPath) ? InputValues.SdkPath : InputValues.OurILAsmPath,
                "ildasm.exe",
                null,
                null,
                "ILDasmPath",
                String.Format(
                    CultureInfo.InvariantCulture,
                    "/quoteallnames /unicode /nobar{2}\"/out:{0}.il\" \"{1}\"",
                    Path.Combine(TempDirectory, InputValues.FileName),
                    InputValues.InputFileName,
                    InputValues.EmitDebugSymbols ? " /linenum " : " "
                    ),
                DllExportLogginCodes.IlDasmLogging,
                DllExportLogginCodes.VerboseToolLogging,
                Notifier,
                Timeout,
                null
            ));
 }
예제 #4
0
 private int RunLibToolCore(string tool, string args, string path = "", string reqPath = null)
 {
     try
     {
         return(IlParser.RunIlTool
                (
                    path,
                    tool,
                    reqPath,
                    null,
                    "LibToolPath",
                    args,
                    DllExportLogginCodes.LibToolLooging,
                    DllExportLogginCodes.LibToolVerboseLooging,
                    Notifier,
                    Timeout,
                    null
                ));
     }
     catch (Exception ex) {
         Notifier.Notify(-1, DllExportLogginCodes.LibToolLooging, Resources.An_error_occurred_while_calling_0_1_, $" {tool} {args} ", ex.Message);
         return(-1);
     }
 }
예제 #5
0
파일: ILDasm.cs 프로젝트: rebider/DllExport
 public int Run()
 {
     return(IlParser.RunIlTool(this.InputValues.SdkPath, "ildasm.exe", (string)null, (string)null, "ILDasmPath", string.Format((IFormatProvider)CultureInfo.InvariantCulture, "/quoteallnames /unicode /nobar{2}\"/out:{0}.il\" \"{1}\"", (object)Path.Combine(this.TempDirectory, this.InputValues.FileName), (object)this.InputValues.InputFileName, this.InputValues.EmitDebugSymbols ? (object)" /linenum " : (object)" "), DllExportLogginCodes.IlDasmLogging, DllExportLogginCodes.VerboseToolLogging, this.Notifier, this.Timeout, (Func <string, bool>)null));
 }