当前位置: 首页>>代码示例>>C#>>正文


C# IProjectService.AddToFolderFromTemplate方法代码示例

本文整理汇总了C#中IProjectService.AddToFolderFromTemplate方法的典型用法代码示例。如果您正苦于以下问题:C# IProjectService.AddToFolderFromTemplate方法的具体用法?C# IProjectService.AddToFolderFromTemplate怎么用?C# IProjectService.AddToFolderFromTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IProjectService的用法示例。


在下文中一共展示了IProjectService.AddToFolderFromTemplate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddConverter

        /// <summary>
        /// Adds the converter.
        /// </summary>
        /// <param name="projectService">The project service.</param>
        /// <param name="templatesPath">The templates path.</param>
        /// <param name="messages">The messages.</param>
        /// <param name="templateInfo">The template info.</param>
        internal void AddConverter(
            IProjectService projectService, 
            string templatesPath, 
            List<string> messages, 
            ItemTemplateInfo templateInfo)
        {
            TraceService.WriteLine("ConvertersService::AddConverters adding from template path " + templatesPath + " template=" + templateInfo.FileName);

            string fileName = templateInfo.FriendlyName + ".cs";

            projectService.AddToFolderFromTemplate("Converters", templateInfo.FileName, fileName, false);

            IProjectItemService projectItemService = projectService.GetProjectItem(fileName);

            //// if we find the project item replace the text in it.
            if (projectItemService != null)
            {
                projectItemService.ReplacePattern("MvvmCross." + templateInfo.FriendlyName, projectService.Name);
                projectItemService.Save();
            }

            messages.Add(@"Converters\" + fileName + " added to project " + projectService.Name + ".");
        }
开发者ID:CliffCawley,项目名称:NinjaCoderForMvvmCross,代码行数:30,代码来源:ConvertersService.cs

示例2: AddProjectPlugins

        /// <summary>
        /// Adds the project plugins.
        /// </summary>
        /// <param name="projectService">The project service.</param>
        /// <param name="plugins">The plugins.</param>
        /// <param name="folderName">Name of the folder.</param>
        /// <param name="extensionName">Name of the extension.</param>
        /// <param name="addTemplates">if set to <c>true</c> [add templates].</param>
        /// <returns>The added plugins.</returns>
        public IEnumerable<Plugin> AddProjectPlugins(
            IProjectService projectService,
            IEnumerable<Plugin> plugins,
            string folderName,
            string extensionName,
            bool addTemplates)
        {
            TraceService.WriteLine("PluginsService::AddProjectPlugins folder=" + folderName);

            List<Plugin> addedPlugins = new List<Plugin>();

            if (projectService != null)
            {
                this.settingsService.PluginsToAdd = string.Empty;

                //// set the project to be the active project!
                this.settingsService.ActiveProject = projectService.Name;

                foreach (Plugin plugin in plugins)
                {
                    bool added = this.pluginService.AddProjectPlugin(
                                                            projectService,
                                                            folderName,
                                                            extensionName,
                                                            plugin);

                    //// we keep a list of plugins that really got added
                    //// assume if we have a nuget command they will be added via nuget!
                    if (added || plugin.NugetCommands.Any())
                    {
                        addedPlugins.Add(plugin);

                        this.Messages.AddRange(this.pluginService.Messages);
                    }
                }

                if (addTemplates)
                {
                    projectService.AddToFolderFromTemplate("MvvmCross.Plugin.zip", "Ninja");
                }
            }

            return addedPlugins;
        }
开发者ID:rmarinho,项目名称:NinjaCoderForMvvmCross,代码行数:53,代码来源:PluginsService.cs

示例3: AddService

        /// <summary>
        /// Adds the service.
        /// </summary>
        /// <param name="visualStudioService">The visual studio service.</param>
        /// <param name="projectService">The project service.</param>
        /// <param name="templateInfo">The template info.</param>
        /// <returns>True or false.</returns>
        internal bool AddService(
            IVisualStudioService visualStudioService,
            IProjectService projectService,
            ItemTemplateInfo templateInfo)
        {
            TraceService.WriteLine("ServicesService::AddServices");

            //// put at the top of the stack!
            if (this.settingsService.UseNugetForPlugins)
            {
                IEnumerable<string> messages = this.nugetService.GetInitNugetMessages(NinjaMessages.ServicesViaNuget);
                this.Messages.AddRange(messages);
            }

            string fileName = templateInfo.FriendlyName + ".cs";

            try
            {
                projectService.AddToFolderFromTemplate(templateInfo.FileName, fileName);

                CodeConfig codeConfig = this.codeConfigFactory.GetServiceConfig(templateInfo.FriendlyName);

                if (codeConfig != null)
                {
                    this.ProcessConfig(
                        visualStudioService,
                        projectService,
                        codeConfig);
                }

                return true;
            }
            catch (Exception exception)
            {
                string message = "AddToFolderFromTemplate error:-" + exception.Message;

                TraceService.WriteError(message);
                this.messageBoxService.Show(
                    message,
                    "Ninja Code for MvvmCross - Add Service",
                    this.settingsService.BetaTesting,
                    Theme.Light,
                    this.settingsService.ThemeColor);

                throw new NinjaCoderServiceException
                {
                    NinjaMessage = "Ninja exception :-" + message,
                    FileName = templateInfo.FileName,
                };
            }
        }
开发者ID:rmarinho,项目名称:NinjaCoderForMvvmCross,代码行数:58,代码来源:ServicesService.cs

示例4: AddService

        /// <summary>
        /// Adds the service.
        /// </summary>
        /// <param name="visualStudioService">The visual studio service.</param>
        /// <param name="projectService">The project service.</param>
        /// <param name="templatesPath">The templates path.</param>
        /// <param name="templateInfo">The template info.</param>
        /// <returns>True or false.</returns>
        internal bool AddService(
            IVisualStudioService visualStudioService,
            IProjectService projectService,
            string templatesPath,
            ItemTemplateInfo templateInfo)
        {
            TraceService.WriteLine("ServicesService::AddServices adding from template path " + templatesPath + " template=" + templateInfo.FileName);

            //// put at the top of the stack!
            if (this.settingsService.UseNugetForPlugins)
            {
                IEnumerable<string> messages = this.nugetService.GetInitNugetMessages(NinjaMessages.ServicesViaNuget);
                this.Messages.AddRange(messages);
            }

            string fileName = templateInfo.FriendlyName + ".cs";

            try
            {
                projectService.AddToFolderFromTemplate("Services", templateInfo.FileName, fileName, false);

                string configFile = string.Format(@"{0}\Services\Config.{1}.xml", this.settingsService.ConfigPath, templateInfo.FriendlyName);

                if (this.fileSystem.File.Exists(configFile))
                {
                    this.ProcessConfig(
                        visualStudioService,
                        projectService,
                        configFile);
                }

                return true;
            }
            catch (Exception exception)
            {
                string message = "AddToFolderFromTemplate error:-" + exception.Message;

                TraceService.WriteError(message);
                this.messageBoxService.Show(message, "Ninja Code for MvvmCross - Add Service");

                throw new NinjaCoderServiceException
                {
                    NinjaMessage = "Ninja exception :-" + message,
                    FileName = templateInfo.FileName,
                    FolderName = templateInfo.FolderName
                };
            }
        }
开发者ID:CliffCawley,项目名称:NinjaCoderForMvvmCross,代码行数:56,代码来源:ServicesService.cs

示例5: AddProjectPlugins

        /// <summary>
        /// Adds the project plugins.
        /// </summary>
        /// <param name="projectService">The project service.</param>
        /// <param name="plugins">The plugins.</param>
        /// <param name="addBootstrapFile">if set to <c>true</c> [add bootstrap file].</param>
        /// <returns>
        /// The added plugins.
        /// </returns>
        internal void AddProjectPlugins(
            IProjectService projectService,
            IEnumerable<Plugin> plugins,
            bool addBootstrapFile)
        {
            TraceService.WriteLine("PluginsService::AddProjectPlugins");

            if (projectService != null)
            {
                this.settingsService.PluginsToAdd = string.Empty;

                //// set the project to be the active project!
                this.settingsService.ActiveProject = projectService.Name;

                foreach (Plugin plugin in plugins)
                {
                    this.pluginService.AddProjectPlugin(
                        projectService,
                        plugin);

                    this.Messages.Add("Plugin " + plugin.FriendlyName + " added to " + projectService.Name + " project.");
                }

                if (addBootstrapFile)
                {
                    projectService.AddToFolderFromTemplate("MvvmCross.Plugin.zip", "Ninja");
                }
            }
        }
开发者ID:RobGibbens,项目名称:NinjaCoderForMvvmCross,代码行数:38,代码来源:PluginsService.cs

示例6: BuildSourceFile

        /// <summary>
        /// Builds the source file.
        /// </summary>
        /// <param name="projectService">The project service.</param>
        /// <param name="extensionSource">The extensionSource.</param>
        /// <param name="extensionDestination">The extension destination.</param>
        /// <param name="friendlyName">Name of the friendly.</param>
        internal void BuildSourceFile(
            IProjectService projectService,
            string extensionSource,
            string extensionDestination,
            string friendlyName)
        {
            TraceService.WriteLine("PluginsService::BuildSourceFile " + friendlyName);

            try
            {
                string message = string.Format("BuildSourceFile Project Name={0} friendlyName={1}", projectService.Name, friendlyName);

                TraceService.WriteLine(message);

                string sourceFile = friendlyName + "PluginBootstrap.cs";

                //// now we need to sort out the item template!
                projectService.AddToFolderFromTemplate("Bootstrap", "MvvmCross.Plugin.zip", sourceFile, false);

                this.Messages.Add(string.Format(@"Bootstrap\{0} added to {1} project.", sourceFile, projectService.Name));

                IProjectItemService projectItemService = projectService.GetProjectItem(sourceFile);

                //// if we find the project item replace the text in it.

                if (projectItemService.ProjectItem != null)
                {
                    this.FixUpFile(projectService, friendlyName, projectItemService);
                }
            }
            catch (Exception exception)
            {
                TraceService.WriteError("BuildSourceFile " + exception.Message);
            }
        }
开发者ID:nanohex,项目名称:NinjaCoderForMvvmCross,代码行数:42,代码来源:PluginsService.cs


注:本文中的IProjectService.AddToFolderFromTemplate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。