/// <summary>
        /// wsdl生成cs
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WsdlCommandInvoke(object sender, EventArgs e)
        {
            var items = ProjectHelpers.GetSelectedItemPaths(_dte);

            if (items.Count() != 1 ||
                !(items.ElementAt(0).ToLower().EndsWith(".wsdl", StringComparison.OrdinalIgnoreCase)))
            {
                return;
            }
            var _file           = items.ElementAt(0);
            var project         = ProjectHelpers.GetActiveProject();
            var projectFullName = ProjectHelpers.GetActiveProject().FullName;
            var projectInfo     = new FileInfo(projectFullName);
            var folderproject   = projectInfo.Directory?.FullName;

            try
            {
                // Fist display the UI and get the options.
                WebServiceCodeGenDialogNew dialog = new WebServiceCodeGenDialogNew();
                if (!project.IsWebProject())
                {
                    dialog.DestinationNamespace = project.GetProjectProperty("DefaultNamespace");
                    if (string.IsNullOrEmpty(dialog.DestinationNamespace))
                    {
                        dialog.DestinationNamespace = Path.GetFileNameWithoutExtension(_file);
                    }
                }
                else
                {
                    dialog.DestinationNamespace = Path.GetFileNameWithoutExtension(_file);
                }
                dialog.DestinationFilename = ProjectHelpers.GetDefaultDestinationFilename(_file);
                dialog.WsdlLocation        = _file;

                if (dialog.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                var wsdlFile = _file;
                // Try the Rpc2DocumentLiteral translation first.
                // wsdlFile = TryTranslateRpc2DocumentLiteral(wsdlFile);

                CodeGenOptions options = new CodeGenOptions();
                options.MetadataLocation = wsdlFile;
                options.OutputFileName   = dialog.DestinationFilename;
                options.OutputLocation   = folderproject;
                options.ProjectDirectory = project.FullName;
                options.Language         = CodeLanguage.CSharp;
                options.ProjectName      = project.Name;

                options.EnableDataBinding                  = dialog.EnableDataBinding;
                options.EnableSummaryComment               = dialog.Comment;
                options.GenerateCollections                = dialog.Collections;
                options.GenerateTypedLists                 = dialog.TypedList;
                options.EnableLazyLoading                  = dialog.LazyLoading;
                options.GenerateSeparateFiles              = dialog.GenerateMultipleFiles;
                options.OnlyUseDataContractSerializer      = dialog.OnlyUseDataContractSerializer;
                options.GenerateSeparateFilesEachNamespace = dialog.GenerateMultipleFilesEachNamespace;
                options.GenerateSeparateFilesEachXsd       = dialog.GenerateSeparateFilesEachXsd;
                options.AscendingClassByName               = dialog.AscendingClassByName;
                options.OverwriteExistingFiles             = dialog.Overwrite;
                options.ClrNamespace              = dialog.DestinationNamespace;
                options.EnableBaijiSerialization  = dialog.EnableBaijiSerialization;
                options.AddCustomRequestInterface = dialog.AddCustomRequestInterface;
                options.CustomRequestInterface    = dialog.CustomRequestInterface;
                options.ForceElementName          = dialog.ForceElementName;
                options.ForceElementNamespace     = dialog.ForceElementNamespace;
                options.GenerateAsyncOperations   = dialog.GenerateAsyncOperations;

                if (dialog.ServiceCode)
                {
                    options.CodeGeneratorMode = CodeGeneratorMode.Service;
                }
                else if (dialog.ClientCode)
                {
                    options.CodeGeneratorMode = CodeGeneratorMode.Client;
                }
                else
                {
                    options.CodeGeneratorMode = CodeGeneratorMode.ClientForTest;
                }

                options.EnableInitializeFields = true;


                CodeGenerator    codeGenerator = new CodeGenerator();
                CodeWriterOutput output        = codeGenerator.GenerateCode(options);

                AddGeneratedFilesToProject(output);

                // Finally add the project references.
                ProjectHelpers.AddAssemblyReferences(project);

                MessageBox.Show("Code generation successfully completed.", "Ant.SOA.CodeGen", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                ProjectHelpers.AddError(_package, ex.ToString());
                MessageBox.Show(ex.Message, "CodeGeneration", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        /// <summary>
        /// 根据xsd生成model
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ModelCommandInvoke(object sender, EventArgs e)
        {
            //可以选多个
            var items = ProjectHelpers.GetSelectedItemPaths(_dte);

            if (items != null && items.Any(r => !r.ToLower().EndsWith(".xsd", StringComparison.OrdinalIgnoreCase)))
            {
                ProjectHelpers.AddError(_package, "select file is not xsd file");
                return;
            }

            var _file           = items.ElementAt(0);
            var project         = ProjectHelpers.GetActiveProject();
            var projectFullName = ProjectHelpers.GetActiveProject().FullName;
            var projectInfo     = new FileInfo(projectFullName);
            var folderproject   = projectInfo.Directory?.FullName;

            try
            {
                string[]         dataContractFiles = items.ToArray();
                XsdCodeGenDialog dialogForm        = new XsdCodeGenDialog(dataContractFiles);
                if (!project.IsWebProject())
                {
                    dialogForm.Namespace = project.GetProjectProperty("DefaultNamespace");
                    if (string.IsNullOrEmpty(dialogForm.Namespace))
                    {
                        dialogForm.Namespace = Path.GetFileNameWithoutExtension(_file);
                    }
                }
                else
                {
                    dialogForm.Namespace = Path.GetFileNameWithoutExtension(_file);
                }
                dialogForm.TargetFileName = ProjectHelpers.GetDefaultDestinationFilename(_file);
                if (dialogForm.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }

                CodeGenOptions options = new CodeGenOptions();
                options.GenerateDataContractsOnly          = true;
                options.DataContractFiles                  = dataContractFiles;
                options.GenerateSeparateFiles              = dialogForm.GenerateMultipleFiles;
                options.GenerateSeparateFilesEachNamespace = dialogForm.GenerateMultipleFilesEachNamespace;
                options.GenerateSeparateFilesEachXsd       = dialogForm.GenerateSeparateFilesEachXsd;
                options.AscendingClassByName               = dialogForm.AscendingClassByName;
                options.OnlyUseDataContractSerializer      = dialogForm.OnlyUseDataContractSerializer;
                options.OverwriteExistingFiles             = dialogForm.OverwriteFiles;
                options.EnableDataBinding                  = dialogForm.DataBinding;
                options.EnableSummaryComment               = dialogForm.Comment;
                options.GenerateCollections                = dialogForm.Collections;
                options.GenerateTypedLists                 = dialogForm.TypedList;
                options.EnableLazyLoading                  = dialogForm.LazyLoading;
                options.OutputFileName            = dialogForm.TargetFileName;
                options.OutputLocation            = folderproject;
                options.ProjectDirectory          = project.FullName;
                options.Language                  = CodeLanguage.CSharp;
                options.ClrNamespace              = dialogForm.Namespace;
                options.EnableSummaryComment      = dialogForm.Comment;
                options.ProjectName               = project.Name;
                options.EnableBaijiSerialization  = dialogForm.EnableBaijiSerialization;
                options.AddCustomRequestInterface = dialogForm.AddCustomRequestInterface;
                options.CustomRequestInterface    = dialogForm.CustomRequestInterface;
                options.ForceElementName          = dialogForm.ForceElementName;
                options.ForceElementNamespace     = dialogForm.ForceElementNamespace;
                options.GenerateAsyncOperations   = dialogForm.GenerateAsyncOperations;
                options.EnableInitializeFields    = true;



                CodeGenerator    codeGenerator = new CodeGenerator();
                CodeWriterOutput output        = codeGenerator.GenerateCode(options);

                AddGeneratedFilesToProject(output);

                // Finally add the project references.
                ProjectHelpers.AddAssemblyReferences(project);

                MessageBox.Show("Model generation successfully completed.", "Ant.SOA.CodeGen", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                ProjectHelpers.AddError(_package, ex.ToString());
                MessageBox.Show(ex.Message, "CodeGeneration", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }