C# Class Microsoft.Samples.VisualStudio.GeneratorSample.BaseCodeGenerator

A managed wrapper for VS's concept of an IVsSingleFileGenerator which is a custom tool invoked at design time which can take any file as an input and provide any file as output.
Inheritance: IVsSingleFileGenerator
Mostra file Open project: StevePotter/LessCssForVisualStudio

Private Properties

Property Type Description
IVsSingleFileGenerator int
IVsSingleFileGenerator int

Protected Methods

Method Description
GenerateCode ( string inputFileContent ) : byte[]

The method that does the actual work of generating code given the input file

GeneratorError ( uint level, string message, uint line, uint column ) : void

Method that will communicate an error via the shell callback mechanism

GeneratorWarning ( uint level, string message, uint line, uint column ) : void

Method that will communicate a warning via the shell callback mechanism

GetDefaultExtension ( ) : string

Gets the default extension for this generator

Private Methods

Method Description
IVsSingleFileGenerator ( string &pbstrDefaultExtension ) : int

Implements the IVsSingleFileGenerator.DefaultExtension method. Returns the extension of the generated file

IVsSingleFileGenerator ( string wszInputFilePath, string bstrInputFileContents, string wszDefaultNamespace, IntPtr rgbOutputFileContents, uint &pcbOutput, IVsGeneratorProgress pGenerateProgress ) : int

Implements the IVsSingleFileGenerator.Generate method. Executes the transformation and returns the newly generated output file, whenever a custom tool is loaded, or the input file is saved

Method Details

GenerateCode() protected abstract method

The method that does the actual work of generating code given the input file
protected abstract GenerateCode ( string inputFileContent ) : byte[]
inputFileContent string File contents as a string
return byte[]

GeneratorError() protected method

Method that will communicate an error via the shell callback mechanism
protected GeneratorError ( uint level, string message, uint line, uint column ) : void
level uint Level or severity
message string Text displayed to the user
line uint Line number of error
column uint Column number of error
return void

GeneratorWarning() protected method

Method that will communicate a warning via the shell callback mechanism
protected GeneratorWarning ( uint level, string message, uint line, uint column ) : void
level uint Level or severity
message string Text displayed to the user
line uint Line number of warning
column uint Column number of warning
return void

GetDefaultExtension() protected abstract method

Gets the default extension for this generator
protected abstract GetDefaultExtension ( ) : string
return string