private void GenerateHelper() { using (GenParamsForm gpf = new GenParamsForm()) { gpf.Namespace = _rootCategory.Name; if (gpf.ShowDialog(this) == DialogResult.OK) { CodeCompileUnit ccu = HelperGenerator.Generate(_rootCategory, gpf.Namespace, gpf.IsInternal); CSharpCodeProvider cscp = new CSharpCodeProvider(); CodeGeneratorOptions cgo = new CodeGeneratorOptions(); cgo.BracingStyle = "C"; using (StreamWriter sw = new StreamWriter( Path.Combine(_directory, _rootCategory.TreeName + ".cs"))) cscp.GenerateCodeFromCompileUnit(ccu, sw, cgo); if (gpf.ShowResult) using (ShowResultForm srf = new ShowResultForm()) using (StringWriter strW = new StringWriter()) { cscp.GenerateCodeFromCompileUnit(ccu, strW, cgo); srf.Result = strW.ToString(); srf.ShowDialog(this); } } } }
private void GenerateHelper() { using (GenParamsForm gpf = new GenParamsForm()) { gpf.Namespace = _rootCategory.Name; if (gpf.ShowDialog(this) == DialogResult.OK) { CodeCompileUnit ccu = HelperGenerator.Generate(_rootCategory, gpf.Namespace, gpf.IsInternal); CSharpCodeProvider cscp = new CSharpCodeProvider(); CodeGeneratorOptions cgo = new CodeGeneratorOptions(); cgo.BracingStyle = "C"; using (StreamWriter sw = new StreamWriter( Path.Combine(_directory, _rootCategory.TreeName + ".cs"))) cscp.GenerateCodeFromCompileUnit(ccu, sw, cgo); if (gpf.ShowResult) { using (ShowResultForm srf = new ShowResultForm()) using (StringWriter strW = new StringWriter()) { cscp.GenerateCodeFromCompileUnit(ccu, strW, cgo); srf.Result = strW.ToString(); srf.ShowDialog(this); } } } } }