Пример #1
0
 private SingleTaskEnumsGenerator(ISingleTaskEnumsGeneratorContext context, EnumsGeneratorItem item)
 {
     _item         = item;
     _context      = context;
     _lazyMyStruct = new Lazy <CsClass>(() =>
     {
         var res       = MyNamespace.GetOrCreateClass(OptionsClassName);
         res.IsPartial = true;
         return(res);
     });
     _lazyMyNamespace     = new Lazy <CsNamespace>(() => _context.GetOrCreateNamespace(_item.Namespace));
     _lazyMyEnum          = new Lazy <CsEnum>(() => new CsEnum(MyEnumTypeName));
     _lazyExtensionsClass = new Lazy <CsClass>(() =>
     {
         var extensionsClass = MyNamespace.GetOrCreateClass(_item.EnumName + "Extensions")
                               .WithStatic();
         extensionsClass.IsPartial = true;
         return(extensionsClass);
     });
 }
Пример #2
0
        public static void CreateCode(ISingleTaskEnumsGeneratorContext context, EnumsGeneratorItem item)
        {
            var stat = new SingleTaskEnumsGenerator(context, item);

            stat.CreateCode();
        }