Beispiel #1
0
 protected override void BeforeLiveGeneration()
 {
     if (!(string.IsNullOrEmpty(decorated.@namespace) || string.IsNullOrWhiteSpace(decorated.@namespace)))
     {
         @namespace = NamespaceGenerator.Namespace([email protected]().LegalMemberName());
     }
     @class = ClassGenerator.Class(
         RootAccessModifier.Public,
         ClassModifier.None,
         decorated.title.LegalMemberName(),
         decorated.inheritance.type);
     @class.AddAttribute(AttributeGenerator.Attribute <IncludeInSettingsAttribute>().AddParameter(true));
     @class.AddAttribute(AttributeGenerator.Attribute <InspectableAttribute>());
     @class.AddInterface(typeof(IUAClass));
     guid = decorated.GetGUID();
 }
Beispiel #2
0
        protected override void AfterLiveGeneration()
        {
            var uaClass = FieldGenerator.Field(AccessModifier.Private, FieldModifier.None, typeof(UAClass), "data").CustomDefault("new UAClass(" + guid.As().Code(false) + ");");

            uaClass.AddAttribute(AttributeGenerator.Attribute <SerializeField>());
            uaClass.AddAttribute(AttributeGenerator.Attribute <InspectableAttribute>());

            var interfaceUAClass = PropertyGenerator.Property(AccessModifier.Public, PropertyModifier.None, typeof(UAClass), "Class", false).SingleStatementGetter(AccessModifier.Public, "data");

            @class.AddField(uaClass);
            @class.AddProperty(interfaceUAClass);

            @namespace?.AddClass(@class);
            var usings = CodeBuilder.Using(@class.Usings()) + "\n\n";

            output = (string.IsNullOrEmpty(decorated.@namespace) || string.IsNullOrWhiteSpace(decorated.@namespace)) ? usings + @class.Generate(0) : usings + @namespace.Generate(0);
        }