Exemplo n.º 1
0
        public void DoForEachAssembly(AssemblyAction assemblyAction)
        {
            List <IAppDomainInfo> theDomains = new List <IAppDomainInfo>();

            this.DoForEachAppDomain(
                delegate(IAppDomainInfo adi)
            {
                theDomains.Add(adi);
            }
                );

            _WP.Commands.Debugging_Resolve_Assembly[] reply = m_eng.ResolveAllAssemblies();
            if (reply != null)
            {
                foreach (_WP.Commands.Debugging_Resolve_Assembly resolvedAssm in reply)
                {
                    AssemblyInfoFromResolveAssembly ai = new AssemblyInfoFromResolveAssembly(resolvedAssm);

                    foreach (IAppDomainInfo adi in theDomains)
                    {
                        if (Array.IndexOf <uint>(adi.AssemblyIndicies, ai.Index) != -1)
                        {
                            ai.AddDomain(adi);
                        }
                    }

                    assemblyAction(ai);
                }
            }
        }
Exemplo n.º 2
0
        private static ArrayList GetPeFileList(string buildPath, ArrayList referenceList, 
            bool isDevEnvironment, string assemblyName, Engine engine)
        {
            m_isDevEnvironment = isDevEnvironment;
            Hashtable systemAssemblies = new Hashtable();
            foreach (Debugging_Resolve_Assembly resolvedAssembly in engine.ResolveAllAssemblies())
            {
                if ((resolvedAssembly.m_reply.m_flags & Debugging_Resolve_Assembly.Reply.c_Deployed) == 0)
                {
                    systemAssemblies[resolvedAssembly.m_reply.Name] = true;
                }
            }

            // Build an array list of the pe files that this test needs in order to execute.
            // This would include the pe files for all the references and the test itself.            
            ArrayList peList = new ArrayList();
            for (int i = 0; i < referenceList.Count; i++)
            {
                string peFile = referenceList[i] + ".pe";
                string pePath = string.Empty;

                // Look for the pe file in the Build Path.
                if (isDevEnvironment)
                {
                    if (engine.IsTargetBigEndian)
                    {
                        pePath = buildPath + @"\..\pe\be\" + peFile;
                    }
                    else
                    {
                        pePath = buildPath + @"\..\pe\le\" + peFile;
                    }
                }
                else
                {
                    if (engine.IsTargetBigEndian)
                    {
                        pePath = buildPath + @"\be\" + peFile;
                    }
                    else
                    {
                        pePath = buildPath + @"\le\" + peFile;
                    }
                }

                if (!File.Exists(pePath))
                {
                    // Look for the pe file in the MF Tools Path.
                    if (isDevEnvironment)
                    {
                        if (engine.IsTargetBigEndian)
                        {
                            pePath = FindBuildRelativePath(@"pe\be\" + peFile);
                        }
                        else
                        {
                            pePath = FindBuildRelativePath(@"pe\le\" + peFile);
                        }
                    }
                    else
                    {
                        pePath = FindBuildRelativePath( @"Tools\" + peFile );
                    }

                    if (!File.Exists(pePath))
                    {
                        // Look for the pe files in the MF Assemblies Path (used only on test machines.)
                        if (isDevEnvironment)
                        {
                            throw new FileNotFoundException("Unable to locate " + peFile);
                        }
                        else
                        {
                            if (engine.IsTargetBigEndian)
                            {
                                pePath = FindBuildRelativePath(@"Assemblies\be\" + peFile);
                            }
                            else
                            {
                                pePath = FindBuildRelativePath(@"Assemblies\le\" + peFile);
                            }

                            if (!File.Exists(pePath))
                            {
                                throw new FileNotFoundException("Unable to locate " + peFile);
                            }
                        }
                    }
                }

                pePath = pePath.Replace("\\\\", "\\");
                
                if (!systemAssemblies.ContainsKey(peFile.Replace(".pe", "")))
                {
                    peList.Add(GetAssemblyBinary(pePath));
                }
            }

            // Finally add the pe file for the current test to the array list.
            if (isDevEnvironment)
            {
                if (engine.IsTargetBigEndian)
                {
                    peList.Add(GetAssemblyBinary(buildPath + @"\..\pe\be\" + assemblyName + ".pe"));
                }
                else
                {
                    peList.Add(GetAssemblyBinary(buildPath + @"\..\pe\le\" + assemblyName + ".pe"));
                }

            }
            else
            {
                if (engine.IsTargetBigEndian)
                {
                    peList.Add(GetAssemblyBinary(buildPath + @"\be\" + assemblyName + ".pe"));
                }
                else
                {
                    peList.Add(GetAssemblyBinary(buildPath + @"\le\" + assemblyName + ".pe"));
                }
            }

            return peList;
        }