void MsVisitProjects(VisitProject visitor)
        {
            Engine e = new Engine(RuntimeEnvironment.GetRuntimeDirectory());

            if (e.GetType().Assembly.GetName().Version.Major == 2)
            {
                try { e.GlobalProperties.SetProperty("MSBuildToolsPath", RuntimeEnvironment.GetRuntimeDirectory()); }
                catch { }
            }

            foreach (FileInfo file in _projects)
            {
                Project prj = new Project(e);
                try
                {
                    prj.Load(file.FullName);
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Unable to open project: {0}", file);
                    Log.Verbose(ex.ToString());
                    continue;
                }

                visitor(new MsBuildProject(prj));
                e.UnloadProject(prj);
            }
        }
		void MsVisitProjects(VisitProject visitor)
		{
			Engine e = new Engine(RuntimeEnvironment.GetRuntimeDirectory());
            if(e.GetType().Assembly.GetName().Version.Major == 2)
				try { e.GlobalProperties.SetProperty("MSBuildToolsPath", RuntimeEnvironment.GetRuntimeDirectory()); }
				catch { }

			foreach (FileInfo file in _projects)
			{
				Project prj = new Project(e);
				try
				{
					prj.Load(file.FullName);
				}
				catch (Exception ex)
				{
					Console.Error.WriteLine("Unable to open project: {0}", file);
					Log.Verbose(ex.ToString());
					continue;
				}

				visitor(new MsBuildProject(prj));
				e.UnloadProject(prj);
			}
		}
 static void FauxVisitProjects(IEnumerable <FileInfo> projects, VisitProject visitor)
 {
     foreach (FileInfo file in projects)
     {
         FauxVisit(file, visitor);
     }
 }
		public void VisitProjects(VisitProject visitor)
		{
#if !MSVISITOR
			if (_fastLoader) FastVisitProjects(visitor);
			else 
#endif                
                MsVisitProjects(visitor);
		}
        public void VisitProjects(VisitProject visitor)
        {
#if !MSVISITOR
            if (_fastLoader)
            {
                FastVisitProjects(visitor);
            }
            else
#endif
            MsVisitProjects(visitor);
        }
        static void FauxVisit(FileInfo file, VisitProject visitor)
        {
            IProjectInfo prj;

            try
            {
                prj = new FauxProject(file.FullName);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Unable to open project: {0}", file);
                Log.Verbose(ex.ToString());
                return;
            }

            visitor(prj);
        }
		void FastVisitProjects(VisitProject visitor)
		{
			VisitProjectList proc = FauxVisitProjects;
			List<IAsyncResult> results = new List<IAsyncResult>();
			List<FileInfo> projects = new List<FileInfo>(_projects);
			int count = Math.Max(1, projects.Count / Math.Max(1, Environment.ProcessorCount));
			while (projects.Count > 0)
			{
				FileInfo[] set = new FileInfo[Math.Min(count, projects.Count)];
				projects.CopyTo(0, set, 0, set.Length);
				projects.RemoveRange(0, set.Length);

				results.Add(proc.BeginInvoke(set, visitor, null, null));
			}

			foreach (IAsyncResult r in results)
				proc.EndInvoke(r);
		}
		void MsVisitProjects(VisitProject visitor)
		{
			foreach (FileInfo file in _projects)
			{
			    FauxProject prj;
				try
                {
                    prj = new FauxProject(file.FullName);
				}
				catch (Exception ex)
				{
					Console.Error.WriteLine("Unable to open project: {0}", file);
					Log.Verbose(ex.ToString());
					continue;
				}

				visitor(prj);
			}
		}
Beispiel #9
0
        void MsVisitProjects(VisitProject visitor)
        {
            foreach (FileInfo file in _projects)
            {
                FauxProject prj;
                try
                {
                    prj = new FauxProject(file.FullName);
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Unable to open project: {0}", file);
                    Log.Verbose(ex.ToString());
                    continue;
                }

                visitor(prj);
            }
        }
        void FastVisitProjects(VisitProject visitor)
        {
            VisitProjectList    proc     = FauxVisitProjects;
            List <IAsyncResult> results  = new List <IAsyncResult>();
            List <FileInfo>     projects = new List <FileInfo>(_projects);
            int count = Math.Max(1, projects.Count / Math.Max(1, Environment.ProcessorCount));

            while (projects.Count > 0)
            {
                FileInfo[] set = new FileInfo[Math.Min(count, projects.Count)];
                projects.CopyTo(0, set, 0, set.Length);
                projects.RemoveRange(0, set.Length);

                results.Add(proc.BeginInvoke(set, visitor, null, null));
            }

            foreach (IAsyncResult r in results)
            {
                proc.EndInvoke(r);
            }
        }
		static void FauxVisit(FileInfo file, VisitProject visitor)
		{
			IProjectInfo prj;
			try
			{
				prj = new FauxProject(file.FullName);
			}
			catch (Exception ex)
			{
				Console.Error.WriteLine("Unable to open project: {0}", file);
				Log.Verbose(ex.ToString());
				return;
			}

			visitor(prj);
		}
		static void FauxVisitProjects(IEnumerable<FileInfo> projects, VisitProject visitor)
		{
			foreach (FileInfo file in projects)
				FauxVisit(file, visitor);
		}