/// <summary>
        /// Gets the contract class file.
        /// </summary>
        /// <returns>
        /// A <see cref="SourceFile"/> containing the contract class,
        /// namespace (if applicable), namespace references, and header comment.
        /// </returns>
        private SourceFile GetContractClassFile()
        {
            var sourceFile = new SourceFile();

            // Nested namespace?
            LanguageElement cursor = sourceFile;

            if (this.InterfaceNamespace != null)
            {
                cursor = new Namespace(this.InterfaceNamespace.Name);
                sourceFile.AddNode(cursor);
            }

            // Add namespace references
            var namespaceNodes = this.InterfaceUpdater.NamespaceReferences;

            cursor.AddNamespaceReferences(namespaceNodes);

            // Class
            cursor.AddNode(this.GetClassDocumentationComment());
            cursor.AddNode(this.GetContractClass());
            return(sourceFile);
        }
    /// <summary>
    /// Gets the contract class file.
    /// </summary>
    /// <returns>
    /// A <see cref="SourceFile"/> containing the contract class,
    /// namespace (if applicable), namespace references, and header comment.
    /// </returns>
    private SourceFile GetContractClassFile()
    {
      var sourceFile = new SourceFile();

      // Nested namespace?
      LanguageElement cursor = sourceFile;
      if (this.InterfaceNamespace != null)
      {
        cursor = new Namespace(this.InterfaceNamespace.Name);
        sourceFile.AddNode(cursor);
      }

      // Add namespace references
      var namespaceNodes = this.InterfaceUpdater.NamespaceReferences;
      cursor.AddNamespaceReferences(namespaceNodes);

      // Class
      cursor.AddNode(this.GetClassDocumentationComment());
      cursor.AddNode(this.GetContractClass());
      return sourceFile;
    }
 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);
 }