Inheritance: Logger, IDisposable
Esempio n. 1
0
 /// <summary>
 /// Associate window output pane to the build logger
 /// </summary>
 /// <param name="output"></param>
 protected virtual void SetOutputLogger(IVsOutputWindowPane output)
 {
     // Create our logger, if it was not specified
     if (!this.useProvidedLogger || this.buildLogger == null)
     {
         // Because we may be aggregated, we need to make sure to get the outer IVsHierarchy
         IntPtr unknown = IntPtr.Zero;
         IVsHierarchy hierarchy = null;
         try
         {
             unknown = Marshal.GetIUnknownForObject(this);
             hierarchy = Marshal.GetTypedObjectForIUnknown(unknown, typeof(IVsHierarchy)) as IVsHierarchy;
         }
         finally
         {
             if (unknown != IntPtr.Zero)
                 Marshal.Release(unknown);
         }
         // Create the logger
         var logger = new IDEBuildLogger(output, this.TaskProvider, hierarchy);
         logger.ErrorString = ErrorString;
         logger.WarningString = WarningString;
         var oldLogger = this.BuildLogger as IDisposable;
         this.BuildLogger = logger;
         if (oldLogger != null) {
             oldLogger.Dispose();
         }
     }
     else
     {
         ((IDEBuildLogger)this.BuildLogger).OutputWindowPane = output;
     }
 }