SimpleScriptBuilder Class

Summary

[Editor-Only] A simple Weaver.Editor.Procedural.Scripting.ScriptBuilder which builds a script containing a single class.
graph BT Type-->Base0["ScriptBuilder"] click Base0 "/weaver/api/Weaver.Editor.Procedural.Scripting/ScriptBuilder" Base0-->Base1["NamespaceBuilder"] click Base1 "/weaver/api/Weaver.Editor.Procedural.Scripting/NamespaceBuilder" Base1-->Base2["ElementBuilder"] click Base2 "/weaver/api/Weaver.Editor.Procedural.Scripting/ElementBuilder" Base2-->Base3["Object"] Type-.->Interface0["IElementBuilderGroup"] click Interface0 "/weaver/api/Weaver.Editor.Procedural.Scripting/IElementBuilderGroup" Type["SimpleScriptBuilder"] class Type type-node Derived0["AnimationsScriptBuilder"]-->Type click Derived0 "/weaver/api/Weaver.Editor.Procedural/AnimationsScriptBuilder" Derived1["ScenesScriptBuilder"]-->Type click Derived1 "/weaver/api/Weaver.Editor.Procedural/ScenesScriptBuilder" Derived2["ShadersScriptBuilder"]-->Type click Derived2 "/weaver/api/Weaver.Editor.Procedural/ShadersScriptBuilder" Derived3["LayersScriptBuilder"]-->Type click Derived3 "/weaver/api/Weaver.Editor.Procedural/LayersScriptBuilder" Derived4["TagsScriptBuilder"]-->Type click Derived4 "/weaver/api/Weaver.Editor.Procedural/TagsScriptBuilder" Derived5["InjectorScriptBuilder"]-->Type click Derived5 "/weaver/api/Weaver.Editor.Procedural/InjectorScriptBuilder"

Syntax

public abstract class SimpleScriptBuilder : ScriptBuilder, IElementBuilderGroup

Constructors

Name Summary
SimpleScriptBuilder(Action<StringBuilder>) Creates a new Weaver.Editor.Procedural.SimpleScriptBuilder which will be used to generate the procedural script associated with the specified `generatorMethod`.

Fields

Name Constant Value Summary
DefaultCommentBuilder
The default delegate to use to build the XML comment for this element. Assigned using the return value of Weaver.Editor.Procedural.Scripting.ElementBuilder.GetDefaultCommentBuilder.
Inherited from ElementBuilder
Elements
The members to build in this type, including Weaver.Editor.Procedural.Scripting.TypeBuilders for any nested types.
Inherited from NamespaceBuilder
GeneratorMethod
The method used to generate the Weaver.Editor.Procedural.SimpleScriptBuilder.ProceduralAsset.

Properties

Name Value Summary
CommentBuilder Action<StringBuilder>
This delegate is used to append the XML comment for this element. By default it will simply append the Weaver.Editor.Procedural.Scripting.ElementBuilder.NameSource.
Inherited from ElementBuilder
CompilationSymbolIndex int
The index in Weaver.Editor.Procedural.Scripting.ScriptBuilder.CompilationSymbols of the symbol in which this element will be declared, I.E. #if SYMBOL.
Inherited from ElementBuilder
CompilationSymbols string[]
The conditional compilation symbols used in #if regions in the procedural script. The indices of these values are referenced by Weaver.Editor.Procedural.Scripting.ElementBuilder.CompilationSymbolIndex.
Inherited from ScriptBuilder
DisableAllWarnings bool
If true, #pragma warning disable will be put at the top of the script to disable all warnings. Default true.
Enabled bool
Override to return false when you don't want the script to be generated.
ExistingType CachedTypeInfo
The information about an existing type with the same name as this script (if any).
FullName string
Returns the full name of this element, including its Weaver.Editor.Procedural.Scripting.ElementBuilder.Parent (and any types and namespaces it is nested inside).
Inherited from ElementBuilder
HasBuildErrors bool
Returns true if any errors occurred during the last call to Weaver.Editor.Procedural.Scripting.ElementBuilder.PrepareToBuild(System.Boolean,System.Boolean@).
Inherited from ScriptBuilder
static
HasExistingMember bool
Returns true if this element is associated with an existing System.Reflection.MemberInfo.
Inherited from ElementBuilder
IsFallbackName bool
Indicates whether the current Weaver.Editor.Procedural.Scripting.ElementBuilder.Name of this element is the primary name derived from the Weaver.Editor.Procedural.Scripting.ElementBuilder.NameSource. A value of false means that there was a name conflict between this element and another, and the Weaver.Editor.Procedural.Scripting.ElementBuilder.Name was re-derived using Weaver.Editor.Procedural.Scripting.ScriptBuilder.GetFallbackMemberName(System.String,System.String).
Inherited from ElementBuilder
LogBuildErrors bool
If true, errors encountered while building the script will be logged. Default true.
MemberType MemberTypes
Namespaces are not members, so this property returns System.Reflection.MemberTypes.Custom.
Inherited from NamespaceBuilder
Name string
The actual Weaver.Editor.Procedural.Scripting.ElementBuilder.Name of this element. This value is derived from Weaver.Editor.Procedural.Scripting.ElementBuilder.NameSource during Weaver.Editor.Procedural.Scripting.ElementBuilder.PrepareToBuild(System.Boolean,System.Boolean@).
Inherited from ElementBuilder
NameSource string
The source string which will be used to determine the actual Weaver.Editor.Procedural.Scripting.ElementBuilder.Name of this element.
Inherited from ElementBuilder
Namespace string
The namespace to put the root type in.
ObsoleteAttributeMessage string
The message given to the [System.ObsoleteAttribute] constructor to be displayed whenever an obsolete member is referenced.
Inherited from ScriptBuilder
ObsoleteMembersAreEditorOnly bool
If true, obsolete members will be contained in a #if UNITY_EDITOR region to ensure that the user removes all references to them prior to compiling a build (because otherwise they would get compile errors). By default this property returns true.
Inherited from ScriptBuilder
Parent IElementBuilderGroup
The builder of the type in which this element will be declared.
Inherited from ElementBuilder
ProceduralAsset ProceduralAsset
The Weaver.Editor.Procedural.SimpleScriptBuilder.ProceduralAsset which uses this builder.
RegionIndex int
The index in Weaver.Editor.Procedural.Scripting.ScriptBuilder.Regions of the region in which this element will be declared, I.E. #region Region Name.
Inherited from ElementBuilder
Regions string[]
The names used in #regions in the procedural script. The indices of these values are referenced by Weaver.Editor.Procedural.Scripting.ElementBuilder.RegionIndex.
Inherited from ScriptBuilder
RetainObsoleteMembers bool
If true: the generated script will include all previous members that have been removed and give them [System.ObsoleteAttribute].
RootType TypeBuilder
The builder for the root type of the script.
ScriptBuilder ScriptBuilder
The Weaver.Editor.Procedural.Scripting.ScriptBuilder in which this element is currently being used.
Inherited from ElementBuilder
ScriptExistsButIsntCompiled bool
Returns true if the target file exists but its root type cannot be retrieved via reflection.

Methods

Name Value Summary
AddMember<T>(T) T
Adds the specified `member` to the Weaver.Editor.Procedural.Scripting.NamespaceBuilder.Elements list and returns it.
Inherited from NamespaceBuilder
AddNamespace(string) NamespaceBuilder
Get a Weaver.Editor.Procedural.Scripting.ConstructorBuilder from the object pool and initialize it with the specified parameters as a member of this namespace.
Inherited from NamespaceBuilder
AddType(string) TypeBuilder
Get a Weaver.Editor.Procedural.Scripting.TypeBuilder from the object pool and initialize it with the specified parameters as a member of this namespace.
Inherited from NamespaceBuilder
AddType(string, CachedTypeInfo) TypeBuilder
Get a Weaver.Editor.Procedural.Scripting.TypeBuilder from the object pool and initialize it with the specified parameters as a member of this namespace.
Inherited from NamespaceBuilder
AddType(string, Type) TypeBuilder
Get a Weaver.Editor.Procedural.Scripting.TypeBuilder from the object pool and initialize it with the specified parameters as a member of this namespace.
Inherited from NamespaceBuilder
AppendDescription(StringBuilder, int) void
Appends a description of this namespace and its Weaver.Editor.Procedural.Scripting.NamespaceBuilder.Elements.
Inherited from NamespaceBuilder
AppendFullName(StringBuilder) void
Appends the full name of this element, including its Weaver.Editor.Procedural.Scripting.ElementBuilder.Parent (and any types and namespaces it is nested inside).
Inherited from ElementBuilder
AppendHeader(StringBuilder, int) void
Appends a C# XML comment using the Weaver.Editor.Procedural.Scripting.ElementBuilder.CommentBuilder.
Inherited from ElementBuilder
AppendScript(StringBuilder) void
Appends the declaration of the elements of this script in C# code to the specified `text`.
AppendScript(StringBuilder, int) void
Appends the declaration of this namespace in C# code to the specified `text`.
Inherited from NamespaceBuilder
BuildScript(StringBuilder, bool) bool
If Weaver.Editor.Procedural.SimpleScriptBuilder.ShouldBuild returns true, this method calls Weaver.Editor.Procedural.SimpleScriptBuilder.AppendScript(System.Text.StringBuilder).
DetermineMemberName(ScriptBuilder) void
Uses the specified Weaver.Editor.Procedural.Scripting.ScriptBuilder.GetMemberName(System.String,System.String,System.Boolean@) to determine the Weaver.Editor.Procedural.Scripting.ElementBuilder.Name of this element.
Inherited from ElementBuilder
GatherScriptDetails() void
Gathers the element details of this script.
Generate() void
Generates the Weaver.Editor.Procedural.SimpleScriptBuilder.ProceduralAsset which uses this script builder.
Get(IElementBuilderGroup, string) NamespaceBuilder
Get a Weaver.Editor.Procedural.Scripting.NamespaceBuilder from the object pool and initialize it with the specified parameters.
Inherited from NamespaceBuilder
static
Get(ScriptBuilder, string) NamespaceBuilder
Get a Weaver.Editor.Procedural.Scripting.NamespaceBuilder from the object pool and initialize it with the specified parameters.
Inherited from NamespaceBuilder
static
GetBuilderInstance(Type) SimpleScriptBuilder
Returns an instance of the specified Weaver.Editor.Procedural.SimpleScriptBuilder type.
static
GetCompilationSymbolCount() int
Returns the number of Weaver.Editor.Procedural.Scripting.ScriptBuilder.CompilationSymbols .
Inherited from ScriptBuilder
GetDefaultCommentBuilder() Action<StringBuilder>
Namespaces are not generally allowed to have comments.
Inherited from NamespaceBuilder
GetDescription() string
Gets a description of this element by calling Weaver.Editor.Procedural.Scripting.ElementBuilder.ToString on it and any sub-members.
Inherited from ElementBuilder
GetFallbackMemberName(string, string) string
Converts the `nameSource` into a valid member name according to the desired naming convention when the primary name returned by Weaver.Editor.Procedural.Scripting.ScriptBuilder.GetPrimaryMemberName(System.String) caused a naming conflict.

By default, this method uses Weaver.Editor.Procedural.Scripting.CSharpProcedural.ValidateMemberName(System.String,System.Boolean) with the `replaceWithUnderscores` parameter set to false.
Inherited from ScriptBuilder
GetMemberName(string, string, bool) string
Converts the `nameSource` into a valid member name using Weaver.Editor.Procedural.Scripting.ScriptBuilder.GetPrimaryMemberName(System.String). If the name is the same as the `declaringTypeName`, Weaver.Editor.Procedural.Scripting.ScriptBuilder.GetFallbackMemberName(System.String,System.String) will be used instead.
Inherited from ScriptBuilder
GetPrimaryMemberName(string) string
Converts the `nameSource` into a valid member name according to the desired naming convention.

By default, this method uses Weaver.Editor.Procedural.Scripting.CSharpProcedural.ValidateMemberName(System.String,System.Boolean).
Inherited from ScriptBuilder
GetRegionCount() int
Returns the number of Weaver.Editor.Procedural.Scripting.ScriptBuilder.Regions .
Inherited from ScriptBuilder
HasAnyObsoleteMembers() bool
Returns true if there are any obsolete members in the existing root type.
Initialize(IElementBuilderGroup, string) void
Assigns the specified parameters to this element and determines the Weaver.Editor.Procedural.Scripting.ElementBuilder.Name.
Inherited from ElementBuilder
IsExistingMember(MemberInfo, bool) bool
Returns false because namespaces don't have any System.Reflection.MemberInfo.
Inherited from NamespaceBuilder
LogRebuildReason(string) void
Logs the `reason` that this script should be rebuilt.
PrepareForReuse() void
Reset this type and call Weaver.Editor.Procedural.Scripting.ElementBuilder.ReleaseToPool on all its members so that it can be reused without releasing this type itself to the pool.
Inherited from NamespaceBuilder
PrepareToBuild(bool, bool) bool
Determines the Weaver.Editor.Procedural.Scripting.ElementBuilder.Name of this type's members, attempts to resolve any naming conflicts, matches existing System.Reflection.MemberInfos with their appropriate members, and returns true if the script should be rebuilt for any reason (such as a member being added, removed, or renamed).
Inherited from ScriptBuilder
RebuildScriptWithoutObsoleteMembers() void
Rebuilds the script without any obsolete members.
ReleaseElementsToPool() void
Releases all elements currently in this namespace back to their respective pools.
Inherited from NamespaceBuilder
ReleaseToPool() void
Resets this element and adds it to its object pool to be reused later.
Inherited from NamespaceBuilder
Reset() void
Resets all of the fields and properties of this element to their default values.
Inherited from NamespaceBuilder
SetName(string) void
Sets the Weaver.Editor.Procedural.Scripting.ElementBuilder.Name and Weaver.Editor.Procedural.Scripting.ElementBuilder.NameSource.
Inherited from ElementBuilder
ShouldBuild() bool
Indicates whether the script should be rebuilt based on whether its contents need to be changed.
ToString() string
Returns a summary of this element including its type, Weaver.Editor.Procedural.Scripting.ElementBuilder.NameSource, Weaver.Editor.Procedural.Scripting.ElementBuilder.Name, and Weaver.Editor.Procedural.Scripting.ElementBuilder.FullName.
Inherited from ElementBuilder