protected virtual void PreProcessTargetProperty()
 {
     if (targetPackage != null)
     {
         //check that a property matching the given name exists. Case don't matter
         //this MUST be done in ProcessMacros() because it goes before validateCommands
         packageType = targetPackage.GetType();
         Logging.Debug("PackageType: {0}", packageType.ToString());
         property = packageType.GetProperties().First(prop => prop.Name.ToLower().Equals(PropertyName.ToLower()));
     }
 }
Example #2
0
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            this.Write("import { Pipe, PipeTransform } from \'@angular/core\';\r\nimport { ");

            #line 7 "C:\aurea-projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName));

            #line default
            #line hidden
            this.Write("Service } from \"app/");

            #line 7 "C:\aurea-projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(Module.ModuleName));

            #line default
            #line hidden
            this.Write("/");

            #line 7 "C:\aurea-projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName.ToLower(new System.Globalization.CultureInfo("en-EN", false))));

            #line default
            #line hidden
            this.Write("/");

            #line 7 "C:\aurea-projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName.ToLower(new System.Globalization.CultureInfo("en-EN", false))));

            #line default
            #line hidden
            this.Write(".service\";\r\n\r\n@Pipe({\r\n  name: \'");

            #line 10 "C:\aurea-projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName));

            #line default
            #line hidden
            this.Write("Pipe\',\r\n  pure: false\r\n})\r\nexport class ");

            #line 13 "C:\aurea-projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName));

            #line default
            #line hidden
            this.Write("Pipe implements PipeTransform {\r\n\r\n  transform(key: number): string {\r\n    if (ke" +
                       "y == null)\r\n      return \"\";\r\n\r\n      var ");

            #line 19 "C:\aurea-projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName.ToLower(new System.Globalization.CultureInfo("en-EN", false))));

            #line default
            #line hidden
            this.Write("Service: ");

            #line 19 "C:\aurea-projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName));

            #line default
            #line hidden
            this.Write("Service = new ");

            #line 19 "C:\aurea-projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName));

            #line default
            #line hidden
            this.Write("Service();\r\n      var arr = ");

            #line 20 "C:\aurea-projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName.ToLower(new System.Globalization.CultureInfo("en-EN", false))));

            #line default
            #line hidden
            this.Write("Service.getList();\r\n      var res = arr.filter(t => t.value === key);\r\n      if (" +
                       "res != null)\r\n        return res[0].key;\r\n      return \"\";\r\n  }\r\n}\r\n");
            return(this.GenerationEnvironment.ToString());
        }
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     return(PropertyName.ToLower().GetHashCode());
 }