Ejemplo n.º 1
0
 private bool ValidateToolPath(string toolFileName, string currentValue, Func <Version, string, string> getToolPath, out string foundPath)
 {
     if (ExportTaskImplementation <TTask> .PropertyHasValue(this.TargetFrameworkVersion))
     {
         string toolDirectory = currentValue;
         if (this.TryToGetToolDirForFxVersion(toolFileName, getToolPath, ref toolDirectory))
         {
             foundPath = toolDirectory;
             return(true);
         }
     }
     if (ExportTaskImplementation <TTask> .PropertyHasValue(currentValue) && ExportTaskImplementation <TTask> .TrySearchToolPath(currentValue, toolFileName, out foundPath))
     {
         return(true);
     }
     foundPath = (string)null;
     return(false);
 }
Ejemplo n.º 2
0
        private bool ValidateLibToolPath()
        {
            string str1 = (string)null;

            if (ExportTaskImplementation <TTask> .PropertyHasValue(this.LibToolPath))
            {
                if (ExportTaskImplementation <TTask> .TrySearchToolPath(this.LibToolPath, "lib.exe", out str1))
                {
                    this.LibToolPath = str1;
                }
                else
                {
                    this._ActualTask.Log.LogMessage(MessageImportance.Low, Resources.Cannot_find_lib_exe_in_0_, (object)this.LibToolPath);
                    this.LibToolPath = (string)null;
                    return(false);
                }
            }
            else
            {
                this.LibToolPath = (string)null;
                string str2 = Null.NullIfEmpty(Environment.GetEnvironmentVariable("DevEnvDir")) ?? ExportTaskImplementation <TTask> .GetVsPath();

                if (ExportTaskImplementation <TTask> .PropertyHasValue(str2))
                {
                    if (ExportTaskImplementation <TTask> .TrySearchToolPath(str2, "lib.exe", out str1) || ExportTaskImplementation <TTask> .TrySearchToolPath(Path.Combine(str2, "VC"), "lib.exe", out str1) || ExportTaskImplementation <TTask> .TrySearchToolPath(Path.Combine(Path.Combine(str2, "VC"), "bin"), "lib.exe", out str1))
                    {
                        this.LibToolPath = str1;
                    }
                    else
                    {
                        this._ActualTask.Log.LogMessage(MessageImportance.Low, Resources.Cannot_find_lib_exe_in_0_, (object)this.LibToolPath);
                        this.LibToolPath = (string)null;
                        return(true);
                    }
                }
            }
            if (!ExportTaskImplementation <TTask> .PropertyHasValue(str1))
            {
                str1 = (string)null;
            }
            if (!ExportTaskImplementation <TTask> .PropertyHasValue(this.LibToolDllPath))
            {
                if (!ExportTaskImplementation <TTask> .PropertyHasValue(str1))
                {
                    this.LibToolDllPath = (string)null;
                }
                else
                {
                    DirectoryInfo directoryInfo = new DirectoryInfo(str1);
                    while (directoryInfo != null && !Directory.Exists(Path.Combine(Path.Combine(directoryInfo.FullName, "Common7"), "IDE")))
                    {
                        directoryInfo = directoryInfo.Parent;
                    }
                    if (directoryInfo != null)
                    {
                        string path = Path.Combine(Path.Combine(directoryInfo.FullName, "Common7"), "IDE");
                        if (Directory.Exists(path))
                        {
                            this.LibToolDllPath = path;
                        }
                    }
                }
            }
            return(true);
        }