///-------------------------------------------------------------------------------------------------------------
/// <summary>
///
/// </summary>
///-------------------------------------------------------------------------------------------------------------
void IVsCodeBehindCodeGenerator.BeginGenerate(string document, string codeBehindFile, string className_Full, bool create)
{
DisposeGenerateState();
_itemCode = VsHierarchyItem.CreateFromMoniker(codeBehindFile, _hierarchy);
_itemDesigner = GetDesignerItem(_itemCode, false);
_create = create;
_className_Full = className_Full;
if (_itemCode != null)
{
// Get the CodeDomProvider for the language (MergedCodeDomProvider C#/VB)
_codeDomProvider = CreateCodeDomProvider(_itemCode.VsItemID);
if (_codeDomProvider != null)
{
// Get the field names so we can preserve location and access
bool caseSensitive = IsCaseSensitive(_codeDomProvider);
_codeFields = GetFieldNames(_itemCode, _className_Full, caseSensitive, false, 30);
_designerFields = GetFieldNames(_itemDesigner, _className_Full, caseSensitive, false, 0);
// Generate the class
string designerContents = _itemDesigner.GetDocumentText();
TextReader reader = new StringReader(designerContents);
_ccu = _codeDomProvider.Parse(reader);
GenerateClass();
}
}
}