Пример #1
0
 private void _OnProcessExited(object sender, EventArgs e)
 {
     if (File.Exists(this._settingsFile))
     {
         this.Log(Level.Verbose, "Deleting settings file: " + this._settingsFile);
         File.Delete(this._settingsFile);
     }
     if (this._registerProfiler)
     {
         NCoverUtilities.UnregisterNCover();
     }
 }
Пример #2
0
        protected override Process StartProcess()
        {
            if (!Path.IsPathRooted(this.ExeName))
            {
                this.ExeName = this.Project.GetFullPath(this.ExeName);
            }
            this._CreateNCoverInfo();
            if (this._registerProfiler)
            {
                this.Log(Level.Verbose, "Registering profiler");
                NCoverUtilities.RegisterNCover(Path.GetDirectoryName(this.ExeName), this._ncoverInfo.VersionNumber);
            }
            Process process = base.StartProcess();

            process.Exited += new EventHandler(this._OnProcessExited);
            return(process);
        }
Пример #3
0
        private void Run()
        {
            ConsoleMain.InvokeMember("Main", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Static, null, null, new object[] { new string[] { "//r", this._settingsFile } });

            this.RestorConsoleOutput();

            lock (SyncLock)
            {
                Signal = true;
            }

            if (File.Exists(this._settingsFile))
            {
                this.Log(Level.Verbose, "Deleting settings file: " + this._settingsFile);
                File.Delete(this._settingsFile);
            }
            if (this._registerProfiler)
            {
                NCoverUtilities.UnregisterNCover();
            }
        }
Пример #4
0
        protected override void ExecuteTask()
        {
            this.CreateNCoverInfo();
            if (this._registerProfiler)
            {
                this.Log(Level.Verbose, "Registering profiler");
                NCoverUtilities.RegisterNCover(Path.GetDirectoryName(this.ExeName), this._ncoverInfo.VersionNumber);
            }
            this.Prepare();

            Evidence       securityInfo = new Evidence(AppDomain.CurrentDomain.Evidence);
            AppDomainSetup setup        = new AppDomainSetup();

            setup.ApplicationBase = Path.GetDirectoryName(this.ExeName);

            NCoverAppDomain = AppDomain.CreateDomain("NCover", securityInfo, setup);

            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(this.AssemblyResolveHandler);

            NCoverAssembly = NCoverAppDomain.Load(Assembly.LoadFile(this.ExeName).GetName().Name);

            ConsoleMain = null;

            foreach (Type type in NCoverAssembly.GetTypes())
            {
                if (type.Name == "ConsoleMain")
                {
                    ConsoleMain = type;
                    break;
                }
            }

            this.SubvertConsoleOutput();

            Thread NCoverWorker = new Thread(new ThreadStart(Run));

            NCoverWorker.Start();
        }