UpkManager.Domain.Models.UpkFile.Tables.DomainExportTableEntry.objectTypeFactory C# (CSharp) Method

objectTypeFactory() private method

private objectTypeFactory ( ) : DomainObjectBase
return DomainObjectBase
    private DomainObjectBase objectTypeFactory() {
      ObjectTypes type;

      Enum.TryParse(TypeReferenceNameIndex?.Name, true, out type);

      if (type == ObjectTypes.Unknown && TypeReferenceNameIndex != null) {
        if (TypeReferenceNameIndex.Name.StartsWith("CustomUIComp", StringComparison.CurrentCultureIgnoreCase) ||
            TypeReferenceNameIndex.Name.StartsWith("Distribution", StringComparison.CurrentCultureIgnoreCase) ||
            TypeReferenceNameIndex.Name.StartsWith("UIComp",       StringComparison.CurrentCultureIgnoreCase) ||
            TypeReferenceNameIndex.Name.EndsWith("Component",      StringComparison.CurrentCultureIgnoreCase)) type = ObjectTypes.ArchetypeObjectReference;
      }

      switch(type) {
        case ObjectTypes.ArchetypeObjectReference: return new DomainObjectArchetypeBase();
        case ObjectTypes.ObjectRedirector:         return new DomainObjectObjectRedirector();
        case ObjectTypes.ShadowMapTexture2D:       return new DomainObjectShadowMapTexture2D();
        case ObjectTypes.SoundNodeWave:            return new DomainObjectSoundNodeWave();
        case ObjectTypes.Texture2D:                return new DomainObjectTexture2D();
        case ObjectTypes.TextureMovie:             return new DomainObjectTextureMovie();

        default: return new DomainObjectBase();
      }
    }