Пример #1
0
        /// <summary>
        /// Creates a new ProfilerRunner using a ProcessStartInfo and a data writer.
        /// </summary>
        public ProfilerRunner(ProcessStartInfo startInfo, bool useTempFileDatabase, IProfilingDataWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (startInfo == null)
            {
                throw new ArgumentNullException("startInfo");
            }

            if (useTempFileDatabase)
            {
                this.database = new TempFileDatabase();
                this.writer   = writer;
                this.profiler = new Controller.Profiler(startInfo, this.database.GetWriter(), General.CreateProfilerOptions());
            }
            else
            {
                this.database = null;
                this.writer   = writer;
                this.profiler = new Controller.Profiler(startInfo, writer, General.CreateProfilerOptions());
            }

            PrintProfilerOptions();
            this.profiler.RegisterFailed   += delegate { MessageService.ShowError("${res:AddIns.Profiler.Messages.RegisterFailed}"); };
            this.profiler.DeregisterFailed += delegate { MessageService.ShowError("${res:AddIns.Profiler.Messages.UnregisterFailed}"); };
            this.profiler.OutputUpdated    += delegate { SetOutputText(profiler.ProfilerOutput); };
            this.profiler.SessionEnded     += delegate { FinishSession(); };
        }
Пример #2
0
		/// <summary>
		/// Creates a new ProfilerRunner using a ProcessStartInfo and a data writer.
		/// </summary>
		public ProfilerRunner(ProcessStartInfo startInfo, bool useTempFileDatabase, IProfilingDataWriter writer)
		{
			if (writer == null)
				throw new ArgumentNullException("writer");
			if (startInfo == null)
				throw new ArgumentNullException("startInfo");
			
			if (useTempFileDatabase) {
				this.database = new TempFileDatabase();
				this.writer = writer;
				this.profiler = new Controller.Profiler(startInfo, this.database.GetWriter(), General.CreateProfilerOptions());
			} else {
				this.database = null;
				this.writer = writer;
				this.profiler = new Controller.Profiler(startInfo, writer, General.CreateProfilerOptions());
			}
			
			PrintProfilerOptions();
			this.profiler.RegisterFailed += delegate { MessageService.ShowError("${res:AddIns.Profiler.Messages.RegisterFailed}"); };
			this.profiler.DeregisterFailed += delegate { MessageService.ShowError("${res:AddIns.Profiler.Messages.UnregisterFailed}"); };
			this.profiler.OutputUpdated += delegate { SetOutputText(profiler.ProfilerOutput); };
			this.profiler.SessionEnded += delegate { FinishSession(); };
		}