Example #1
0
        //FIXME - where should the pe really be?  Embedded in the dll? Next to it?
        public static string FindPEForDll(string pathDll, bool fTargetIsBigEndian, string frameworkVersion)
        {
            string pathPE = pathDll;

            Microsoft.SPOT.Debugger.PlatformInfo pi = new Microsoft.SPOT.Debugger.PlatformInfo(frameworkVersion);
            ArrayList searchPaths = new ArrayList();

            searchPaths.Add(Path.GetDirectoryName(pathDll));
            searchPaths.AddRange(pi.AssemblyFolders);
            string ext = Path.GetExtension(pathPE).ToLower();

            if (ext != ".pe")
            {
                if (ext != ".dll" && ext != ".exe")
                {
                    pathPE += ".pe";
                }
                else
                {
                    pathPE = Path.ChangeExtension(pathDll, "pe");
                }
                if (!File.Exists(pathPE))
                {
                    //this is a hack to find the pe....
                    //in our build system, back up one directory and look in the pe folder
                    string fileName = Path.GetFileName(pathPE);

                    foreach (string path in searchPaths)
                    {
                        pathPE = Path.Combine(path, fileName);
                        if (File.Exists(pathPE))
                        {
                            break;
                        }

                        if (fTargetIsBigEndian)
                        {
                            pathPE = Path.Combine(Path.Combine(path, "..", "pe", "be"), fileName);

                            if (!File.Exists(pathPE))
                            {
                                pathPE = Path.Combine(Path.Combine(path, "be"), fileName);
                            }
                        }
                        else
                        {
                            pathPE = Path.Combine(Path.Combine(path, "..", "pe", "le"), fileName);

                            if (!File.Exists(pathPE))
                            {
                                pathPE = Path.Combine(Path.Combine(path, "le"), fileName);
                            }
                        }

                        if (File.Exists(pathPE))
                        {
                            break;
                        }
                    }
                }
            }

            Debug.Assert(File.Exists(pathPE));
            return(File.Exists(pathPE) ? pathPE : null);
        }
Example #2
0
        //FIXME - where should the pe really be?  Embedded in the dll? Next to it?
        public static string FindPEForDll(string pathDll, bool fTargetIsBigEndian, string frameworkVersion)
        {
            string pathPE = pathDll;

            Microsoft.SPOT.Debugger.PlatformInfo pi = new Microsoft.SPOT.Debugger.PlatformInfo(frameworkVersion);
            ArrayList searchPaths = new ArrayList();

            searchPaths.Add(Path.GetDirectoryName(pathDll));
            searchPaths.AddRange(pi.AssemblyFolders);
            string ext = Path.GetExtension(pathPE).ToLower();

            if (ext != ".pe")
            {
                if (ext != ".dll" && ext != ".exe")
                {
                    pathPE += ".pe";
                }
                else
                {
                    pathPE = Path.ChangeExtension(pathDll, "pe");
                }
                if (!File.Exists(pathPE))
                {
                    // For user applications in v3.0 the pe file is found in the object directory 
                    pathPE = pathPE.ToLower().Replace("\\bin\\", "\\obj\\");
                }
                if(!File.Exists(pathPE))
                {
                    //this is a hack to find the pe....
                    //in our build system, back up one directory and look in the pe folder
                    string fileName = Path.GetFileName(pathPE);

                    foreach (string path in searchPaths)
                    {
                        pathPE = Path.Combine(path, fileName);
                        if (File.Exists(pathPE)) break;
                        
                        if (fTargetIsBigEndian)
                        {
                            pathPE = Path.Combine(Path.Combine(path, @"..\pe\be"), fileName);

                            if (!File.Exists(pathPE))
                            {
                                pathPE = Path.Combine(Path.Combine(path, "be"), fileName);
                            }
                        }
                        else
                        {
                            pathPE = Path.Combine(Path.Combine(path, @"..\pe\le"), fileName);

                            if (!File.Exists(pathPE))
                            {
                                pathPE = Path.Combine(Path.Combine(path, "le"), fileName);
                            }
                        }

                        if (File.Exists(pathPE)) break;
                    }
                }
            }

            //Debug.Assert(File.Exists(pathPE));
            return File.Exists(pathPE) ? pathPE : null;
        }