Esempio n. 1
0
        /// <summary>
        /// Gets the text template information.
        /// </summary>
        /// <param name="projectService">The project service.</param>
        /// <param name="templateName">Name of the template.</param>
        /// <param name="name">The name.</param>
        /// <param name="directory">The directory.</param>
        /// <param name="projectSuffix">The project suffix.</param>
        /// <param name="projectSuffixName">Name of the project suffix.</param>
        /// <param name="baseDictionary">The base dictionary.</param>
        /// <param name="useProjectSuffix">if set to <c>true</c> [use project suffix].</param>
        /// <param name="projectSuffixOverride">The project suffix override.</param>
        /// <returns>
        /// A TextTemplateInfo.
        /// </returns>
        protected TextTemplateInfo GetTextTemplateInfo(
            IProjectService projectService,
            string templateName,
            string name,
            string directory,
            ProjectSuffix projectSuffix,
            string projectSuffixName,
            Dictionary <string, string> baseDictionary,
            bool useProjectSuffix,
            string projectSuffixOverride = "")
        {
            string projectSuffixString = projectSuffixName;

            if (projectSuffixOverride != string.Empty)
            {
                projectSuffixString = projectSuffixOverride;
            }

            string nameSpace = this.GetNameSpace(projectService, directory);
            string className = this.GetClassName(name, projectSuffix, useProjectSuffix);
            string fileName  = this.GetFileName(name, projectSuffix, useProjectSuffix);

            return(new TextTemplateInfo
            {
                TemplateName = templateName,
                ProjectFolder = directory,
                ProjectSuffix = projectSuffixName,
                FileName = fileName,
                Tokens = this.GetDictionary(baseDictionary, nameSpace, className, projectSuffixString)
            });
        }
        /// <summary>
        /// Gets the name of the class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="projectSuffix">The project suffix.</param>
        /// <param name="useProjectSuffix">if set to <c>true</c> [use project suffix].</param>
        /// <returns>The class name.</returns>
        internal string GetClassName(
            string name,
            ProjectSuffix projectSuffix,
            bool useProjectSuffix)
        {
            if (useProjectSuffix)
            {
                return name + this.GetProjectType(projectSuffix);
            }

            return name;
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the name of the class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="projectSuffix">The project suffix.</param>
        /// <param name="useProjectSuffix">if set to <c>true</c> [use project suffix].</param>
        /// <returns>The class name.</returns>
        internal string GetClassName(
            string name,
            ProjectSuffix projectSuffix,
            bool useProjectSuffix)
        {
            if (useProjectSuffix)
            {
                return(name + this.GetProjectType(projectSuffix));
            }

            return(name);
        }
Esempio n. 4
0
        /// <summary>
        /// Gets the name of the file.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="projectSuffix">The project suffix.</param>
        /// <param name="useProjectSuffix">if set to <c>true</c> [use project suffix].</param>
        /// <returns>The name of the file.</returns>
        internal string GetFileName(
            string name,
            ProjectSuffix projectSuffix,
            bool useProjectSuffix)
        {
            if (useProjectSuffix == false)
            {
                return(name + ".cs");
            }

            if (name.StartsWith("I") ||
                projectSuffix == ProjectSuffix.XamarinForms)
            {
                return(name + ".cs");
            }

            return(name + this.GetProjectType(projectSuffix) + ".cs");
        }
        /// <summary>
        /// Gets the name of the file.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="projectSuffix">The project suffix.</param>
        /// <param name="useProjectSuffix">if set to <c>true</c> [use project suffix].</param>
        /// <returns>The name of the file.</returns>
        internal string GetFileName(
            string name,
            ProjectSuffix projectSuffix,
            bool useProjectSuffix)
        {
            if (useProjectSuffix == false)
            {
                return name + ".cs";
            }

            if (name.StartsWith("I") ||
                projectSuffix == ProjectSuffix.XamarinForms)
            {
                return name + ".cs";
            }

            return name + this.GetProjectType(projectSuffix) + ".cs";
        }
        /// <summary>
        /// Gets the text template information.
        /// </summary>
        /// <param name="projectService">The project service.</param>
        /// <param name="templateName">Name of the template.</param>
        /// <param name="name">The name.</param>
        /// <param name="directory">The directory.</param>
        /// <param name="projectSuffix">The project suffix.</param>
        /// <param name="projectSuffixName">Name of the project suffix.</param>
        /// <param name="baseDictionary">The base dictionary.</param>
        /// <param name="useProjectSuffix">if set to <c>true</c> [use project suffix].</param>
        /// <param name="projectSuffixOverride">The project suffix override.</param>
        /// <returns>
        /// A TextTemplateInfo.
        /// </returns>
        protected TextTemplateInfo GetTextTemplateInfo(
            IProjectService projectService,
            string templateName,
            string name,
            string directory,
            ProjectSuffix projectSuffix,
            string projectSuffixName,
            Dictionary<string, string> baseDictionary,
            bool useProjectSuffix,
            string projectSuffixOverride = "")
        {
            string projectSuffixString = projectSuffixName;

            if (projectSuffixOverride != string.Empty)
            {
                projectSuffixString = projectSuffixOverride;
            }

            string nameSpace = this.GetNameSpace(projectService, directory);
            string className = this.GetClassName(name, projectSuffix, useProjectSuffix);
            string fileName = this.GetFileName(name, projectSuffix, useProjectSuffix);

            return new TextTemplateInfo
                       {
                           TemplateName = templateName,
                           ProjectFolder = directory,
                           ProjectSuffix = projectSuffixName,
                           FileName = fileName,
                           Tokens = this.GetDictionary(baseDictionary, nameSpace, className, projectSuffixString)
                       };
        }
 /// <summary>
 /// Gets the type of the project.
 /// </summary>
 /// <param name="projectSuffix">The project suffix.</param>
 /// <returns>The descripiont of the project suffix.</returns>
 protected string GetProjectType(ProjectSuffix projectSuffix)
 {
     return projectSuffix.GetDescription().Replace(".", string.Empty);
 }
Esempio n. 8
0
 /// <summary>
 /// Gets the type of the project.
 /// </summary>
 /// <param name="projectSuffix">The project suffix.</param>
 /// <returns>The descripiont of the project suffix.</returns>
 protected string GetProjectType(ProjectSuffix projectSuffix)
 {
     return(projectSuffix.GetDescription().Replace(".", string.Empty));
 }