private string GetCode(string language) { SourceFile file = new SourceFile(); LanguageElement sourceNode = null; sourceNode = optSourceFile.Checked ? lastMember.FileNode : lastMember; if (CodeRush.Language.Active == "Basic") { var ProjectSpace = sourceNode.Project.RootNamespace; if (ProjectSpace != String.Empty) { var RootSpace = new Namespace(ProjectSpace); if (optSourceFile.Checked) { foreach (LanguageElement Node in sourceNode.Nodes) { RootSpace.AddNode((LanguageElement)Node.Clone()); } } else RootSpace.AddNode((LanguageElement)sourceNode.Clone()); sourceNode = RootSpace; } } LanguageElement sourceNodeClone = (LanguageElement)sourceNode.Clone(); file.AddNode(sourceNodeClone); //NodeList sourceNodes = new NodeList(); //if (optSourceFile.Checked) // sourceNodes = lastMember.FileNode.Nodes; //else //{ // sourceNodes = new NodeList(); // sourceNodes.Add(lastMember); //} //if (CodeRush.Language.Active == "Basic") //{ // var ProjectSpace = ((LanguageElement)sourceNodes[0]).Project.RootNamespace; // if (ProjectSpace != String.Empty) // { // var RootSpace = new Namespace(ProjectSpace); // foreach (LanguageElement Node in sourceNodes) // { // RootSpace.AddNode(Node); // } // sourceNodes.Add(RootSpace); // } //} return CodeRush.Language.GenerateElement(file, language); }