Merge pull request #416 from hiroj/add_cache_enum

Add cache enum
This commit is contained in:
hiroj 2020-05-29 16:24:25 +09:00 committed by GitHub
commit ca88e2b685
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 422 additions and 13 deletions

View File

@ -0,0 +1,21 @@
using NUnit.Framework;
using UnityEngine;
namespace UniGLTF
{
public class CacheEnumTest
{
[Test]
public void CacheEnumTestSimplePasses()
{
Assert.AreEqual(default(HumanBodyBones), CacheEnum.TryParseOrDefault<HumanBodyBones>("xxx"));
#if UNITY_5_6_OR_NEWER
Assert.AreEqual(HumanBodyBones.UpperChest, CacheEnum.TryParseOrDefault<HumanBodyBones>("upperchest", true));
#else
Assert.AreEqual(default(HumanBodyBones), CacheEnum.TryParseOrDefault<HumanBodyBones>("upperchest"));
#endif
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9051db9a028cfa64bacbae8644969dd0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 980062d19c06cb347b7a8874479d90b7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,100 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace UniGLTF
{
public sealed class CacheEnum
{
public static T Parse<T>(string name, bool ignoreCase = false) where T : struct, Enum
{
if(ignoreCase)
{
return CacheParse<T>.ParseIgnoreCase(name);
}
else
{
return CacheParse<T>.Parse(name);
}
}
public static T TryParseOrDefault<T>(string name, bool ignoreCase = false, T defaultValue=default(T)) where T : struct, Enum
{
try
{
if(ignoreCase)
{
return CacheParse<T>.ParseIgnoreCase(name);
}
else
{
return CacheParse<T>.Parse(name);
}
}
catch
{
return defaultValue;
}
}
public static T[] GetValues<T>() where T : struct, Enum
{
return CacheValues<T>.Values;
}
private static class CacheParse<T> where T : struct, Enum
{
private static Dictionary<string, T> _values = new Dictionary<string, T>();
private static Dictionary<string, T> _ignoreCaseValues = new Dictionary<string, T>(StringComparer.OrdinalIgnoreCase);
static CacheParse()
{
}
public static T ParseIgnoreCase(string name)
{
if(_ignoreCaseValues.TryGetValue(name, out var value))
{
return value;
}
else
{
T result;
value = Enum.TryParse<T>(name, true, out result)
? result
: throw new ArgumentException(nameof(result));
_ignoreCaseValues.Add(name, value);
return value;
}
}
public static T Parse(string name)
{
if(_values.TryGetValue(name, out var value))
{
return value;
}
else
{
T result;
value = Enum.TryParse<T>(name, false, out result)
? result
: throw new ArgumentException(nameof(result));
_values.Add(name, value);
return value;
}
}
}
private static class CacheValues<T> where T : struct, Enum
{
public static readonly T[] Values;
static CacheValues()
{
Values = Enum.GetValues(typeof(T)) as T[];
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 517a813d69d7a774f8277f39bfde8a76
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a08328e411d14d8419fc89356b6ddbc4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,71 @@
using UnityEngine;
namespace UniHumanoid
{
public static class EnumExtensions
{
public static string ToStringFromEnum(this HumanBodyBones val, bool compareBoneTrait = false)
{
switch (val)
{
case HumanBodyBones.Hips: return "Hips";
case HumanBodyBones.LeftUpperLeg: return "LeftUpperLeg";
case HumanBodyBones.RightUpperLeg: return "RightUpperLeg";
case HumanBodyBones.LeftLowerLeg: return "LeftLowerLeg";
case HumanBodyBones.RightLowerLeg: return "RightLowerLeg";
case HumanBodyBones.LeftFoot: return "LeftFoot";
case HumanBodyBones.RightFoot: return "RightFoot";
case HumanBodyBones.Spine: return "Spine";
case HumanBodyBones.Chest: return "Chest";
case HumanBodyBones.Neck: return "Neck";
case HumanBodyBones.Head: return "Head";
case HumanBodyBones.LeftShoulder: return "LeftShoulder";
case HumanBodyBones.RightShoulder: return "RightShoulder";
case HumanBodyBones.LeftUpperArm: return "LeftUpperArm";
case HumanBodyBones.RightUpperArm: return "RightUpperArm";
case HumanBodyBones.LeftLowerArm: return "LeftLowerArm";
case HumanBodyBones.RightLowerArm: return "RightLowerArm";
case HumanBodyBones.LeftHand: return "LeftHand";
case HumanBodyBones.RightHand: return "RightHand";
case HumanBodyBones.LeftToes: return "LeftToes";
case HumanBodyBones.RightToes: return "RightToes";
case HumanBodyBones.LeftEye: return "LeftEye";
case HumanBodyBones.RightEye: return "RightEye";
case HumanBodyBones.Jaw: return "Jaw";
case HumanBodyBones.LeftThumbProximal: return compareBoneTrait ? "Left Thumb Proximal" : "LeftThumbProximal";
case HumanBodyBones.LeftThumbIntermediate: return compareBoneTrait ? "Left Thumb Intermediate" : "LeftThumbIntermediate";
case HumanBodyBones.LeftThumbDistal: return compareBoneTrait ? "Left Thumb Distal" : "LeftThumbDistal";
case HumanBodyBones.LeftIndexProximal: return compareBoneTrait ? "Left Index Proximal" : "LeftIndexProximal";
case HumanBodyBones.LeftIndexIntermediate: return compareBoneTrait ? "Left Index Intermediate" : "LeftIndexIntermediate";
case HumanBodyBones.LeftIndexDistal: return compareBoneTrait ? "Left Index Distal" : "LeftIndexDistal";
case HumanBodyBones.LeftMiddleProximal: return compareBoneTrait ? "Left Middle Proximal" : "LeftMiddleProximal";
case HumanBodyBones.LeftMiddleIntermediate: return compareBoneTrait ? "Left Middle Intermediate" : "LeftMiddleIntermediate";
case HumanBodyBones.LeftMiddleDistal: return compareBoneTrait ? "Left Middle Distal" : "LeftMiddleDistal";
case HumanBodyBones.LeftRingProximal: return compareBoneTrait ? "Left Ring Proximal" : "LeftRingProximal";
case HumanBodyBones.LeftRingIntermediate: return compareBoneTrait ? "Left Ring Intermediate" : "LeftRingIntermediate";
case HumanBodyBones.LeftRingDistal: return compareBoneTrait ? "Left Ring Distal" : "LeftRingDistal";
case HumanBodyBones.LeftLittleProximal: return compareBoneTrait ? "Left Little Proximal" : "LeftLittleProximal";
case HumanBodyBones.LeftLittleIntermediate: return compareBoneTrait ? "Left Little Intermediate" : "LeftLittleIntermediate";
case HumanBodyBones.LeftLittleDistal: return compareBoneTrait ? "Left Little Distal" : "LeftLittleDistal";
case HumanBodyBones.RightThumbProximal: return compareBoneTrait ? "Right Thumb Proximal" : "RightThumbProximal";
case HumanBodyBones.RightThumbIntermediate: return compareBoneTrait ? "Right Thumb Intermediate" : "RightThumbIntermediate";
case HumanBodyBones.RightThumbDistal: return compareBoneTrait ? "Right Thumb Distal" : "RightThumbDistal";
case HumanBodyBones.RightIndexProximal: return compareBoneTrait ? "Right Index Proximal" : "RightIndexProximal";
case HumanBodyBones.RightIndexIntermediate: return compareBoneTrait ? "Right Index Intermediate" : "RightIndexIntermediate";
case HumanBodyBones.RightIndexDistal: return compareBoneTrait ? "Right Index Distal" : "RightIndexDistal";
case HumanBodyBones.RightMiddleProximal: return compareBoneTrait ? "Right Middle Proximal" : "RightMiddleProximal";
case HumanBodyBones.RightMiddleIntermediate: return compareBoneTrait ? "Right Middle Intermediate" : "RightMiddleIntermediate";
case HumanBodyBones.RightMiddleDistal: return compareBoneTrait ? "Right Middle Distal" : "RightMiddleDistal";
case HumanBodyBones.RightRingProximal: return compareBoneTrait ? "Right Ring Proximal" : "RightRingProximal";
case HumanBodyBones.RightRingIntermediate: return compareBoneTrait ? "Right Ring Intermediate" : "RightRingIntermediate";
case HumanBodyBones.RightRingDistal: return compareBoneTrait ? "Right Ring Distal" : "RightRingDistal";
case HumanBodyBones.RightLittleProximal: return compareBoneTrait ? "Right Little Proximal" : "RightLittleProximal";
case HumanBodyBones.RightLittleIntermediate: return compareBoneTrait ? "Right Little Intermediate" : "RightLittleIntermediate";
case HumanBodyBones.RightLittleDistal: return compareBoneTrait ? "Right Little Distal" : "RightLittleDistal";
case HumanBodyBones.UpperChest: return "UpperChest";
case HumanBodyBones.LastBone: return "LastBone";
default: throw new System.InvalidOperationException();
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 04d0b56405dbe18439be5a95598deb36
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -79,17 +79,29 @@ namespace VRM
/// </summary>
public void CreateDefaultPreset()
{
foreach (var preset in ((BlendShapePreset[])Enum.GetValues(typeof(BlendShapePreset)))
.Where(x => x != BlendShapePreset.Unknown))
var presets = CacheEnum.GetValues<BlendShapePreset>();
foreach (var preset in presets)
{
if (preset == BlendShapePreset.Unknown) continue;
CreateDefaultPreset(preset);
}
}
void CreateDefaultPreset(BlendShapePreset preset)
{
var clip = GetClip(preset);
BlendShapeClip clip = null;
foreach (var c in Clips)
{
if (c.Preset == preset)
{
clip = c;
break;
}
}
if (clip != null) return;
clip = ScriptableObject.CreateInstance<BlendShapeClip>();
clip.name = preset.ToString();
clip.BlendShapeName = preset.ToString();

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 62d471cb6d6ebcb43b1ec282ae6cd8d0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,137 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace VRM
{
public static class EnumExtensions
{
public static HumanBodyBones ToUnityBone(this VRMBone val)
{
switch (val)
{
case VRMBone.hips: return HumanBodyBones.Hips;//"hips"
case VRMBone.leftUpperLeg: return HumanBodyBones.LeftUpperLeg;//"leftUpperLeg";
case VRMBone.rightUpperLeg: return HumanBodyBones.RightUpperLeg;//"rightUpperLeg";
case VRMBone.leftLowerLeg: return HumanBodyBones.LeftLowerLeg;//"leftLowerLeg";
case VRMBone.rightLowerLeg: return HumanBodyBones.RightLowerLeg;//"rightLowerLeg";
case VRMBone.leftFoot: return HumanBodyBones.LeftFoot;//"leftFoot";
case VRMBone.rightFoot: return HumanBodyBones.RightFoot;//"rightFoot";
case VRMBone.spine: return HumanBodyBones.Spine;//"spine";
case VRMBone.chest: return HumanBodyBones.Chest;//"chest";
case VRMBone.neck: return HumanBodyBones.Neck;//"neck";
case VRMBone.head: return HumanBodyBones.Head;//"head";
case VRMBone.leftShoulder: return HumanBodyBones.LeftShoulder;//"leftShoulder";
case VRMBone.rightShoulder: return HumanBodyBones.RightShoulder;//"rightShoulder";
case VRMBone.leftUpperArm: return HumanBodyBones.LeftUpperArm;//"leftUpperArm";
case VRMBone.rightUpperArm: return HumanBodyBones.RightUpperArm;//"rightUpperArm";
case VRMBone.leftLowerArm: return HumanBodyBones.LeftLowerArm;//"leftLowerArm";
case VRMBone.rightLowerArm: return HumanBodyBones.RightLowerArm;//"rightLowerArm";
case VRMBone.leftHand: return HumanBodyBones.LeftHand;//"leftHand";
case VRMBone.rightHand: return HumanBodyBones.RightHand;//"rightHand";
case VRMBone.leftToes: return HumanBodyBones.LeftToes;//"leftToes";
case VRMBone.rightToes: return HumanBodyBones.RightToes;//"rightToes";
case VRMBone.leftEye: return HumanBodyBones.LeftEye;//"leftEye";
case VRMBone.rightEye: return HumanBodyBones.RightEye;//"rightEye";
case VRMBone.jaw: return HumanBodyBones.Jaw;//"jaw";
case VRMBone.leftThumbProximal: return HumanBodyBones.LeftThumbProximal;
case VRMBone.leftThumbIntermediate: return HumanBodyBones.LeftThumbIntermediate;
case VRMBone.leftThumbDistal: return HumanBodyBones.LeftThumbDistal;
case VRMBone.leftIndexProximal: return HumanBodyBones.LeftIndexProximal;
case VRMBone.leftIndexIntermediate: return HumanBodyBones.LeftIndexIntermediate;
case VRMBone.leftIndexDistal: return HumanBodyBones.LeftIndexDistal;
case VRMBone.leftMiddleProximal: return HumanBodyBones.LeftMiddleProximal;
case VRMBone.leftMiddleIntermediate: return HumanBodyBones.LeftMiddleIntermediate;
case VRMBone.leftMiddleDistal: return HumanBodyBones.LeftMiddleDistal;
case VRMBone.leftRingProximal: return HumanBodyBones.LeftRingProximal;
case VRMBone.leftRingIntermediate: return HumanBodyBones.LeftRingIntermediate;
case VRMBone.leftRingDistal: return HumanBodyBones.LeftRingDistal;
case VRMBone.leftLittleProximal: return HumanBodyBones.LeftLittleProximal;
case VRMBone.leftLittleIntermediate: return HumanBodyBones.LeftLittleIntermediate;
case VRMBone.leftLittleDistal: return HumanBodyBones.LeftLittleDistal;
case VRMBone.rightThumbProximal: return HumanBodyBones.RightThumbProximal;
case VRMBone.rightThumbIntermediate: return HumanBodyBones.RightThumbIntermediate;
case VRMBone.rightThumbDistal: return HumanBodyBones.RightThumbDistal;
case VRMBone.rightIndexProximal: return HumanBodyBones.RightIndexProximal;
case VRMBone.rightIndexIntermediate: return HumanBodyBones.RightIndexIntermediate;
case VRMBone.rightIndexDistal: return HumanBodyBones.RightIndexDistal;
case VRMBone.rightMiddleProximal: return HumanBodyBones.RightMiddleProximal;
case VRMBone.rightMiddleIntermediate: return HumanBodyBones.RightMiddleIntermediate;
case VRMBone.rightMiddleDistal: return HumanBodyBones.RightMiddleDistal;
case VRMBone.rightRingProximal: return HumanBodyBones.RightRingProximal;
case VRMBone.rightRingIntermediate: return HumanBodyBones.RightRingIntermediate;
case VRMBone.rightRingDistal: return HumanBodyBones.RightRingDistal;
case VRMBone.rightLittleProximal: return HumanBodyBones.RightLittleProximal;
case VRMBone.rightLittleIntermediate: return HumanBodyBones.RightLittleIntermediate;
case VRMBone.rightLittleDistal: return HumanBodyBones.RightLittleDistal;
case VRMBone.upperChest: return HumanBodyBones.UpperChest;
default: throw new System.InvalidOperationException();
}
}
public static VRMBone ToVrmBone(this HumanBodyBones val)
{
switch (val)
{
case HumanBodyBones.Hips: return VRMBone.hips;
case HumanBodyBones.LeftUpperLeg: return VRMBone.leftUpperLeg;
case HumanBodyBones.RightUpperLeg: return VRMBone.rightUpperLeg;
case HumanBodyBones.LeftLowerLeg: return VRMBone.leftLowerLeg;
case HumanBodyBones.RightLowerLeg: return VRMBone.rightLowerLeg;
case HumanBodyBones.LeftFoot: return VRMBone.leftFoot;
case HumanBodyBones.RightFoot: return VRMBone.rightFoot;
case HumanBodyBones.Spine: return VRMBone.spine;
case HumanBodyBones.Chest: return VRMBone.chest;
case HumanBodyBones.Neck: return VRMBone.neck;
case HumanBodyBones.Head: return VRMBone.head;
case HumanBodyBones.LeftShoulder: return VRMBone.leftShoulder;
case HumanBodyBones.RightShoulder: return VRMBone.rightShoulder;
case HumanBodyBones.LeftUpperArm: return VRMBone.leftUpperArm;
case HumanBodyBones.RightUpperArm: return VRMBone.rightUpperArm;
case HumanBodyBones.LeftLowerArm: return VRMBone.leftLowerArm;
case HumanBodyBones.RightLowerArm: return VRMBone.rightLowerArm;
case HumanBodyBones.LeftHand: return VRMBone.leftHand;
case HumanBodyBones.RightHand: return VRMBone.rightHand;
case HumanBodyBones.LeftToes: return VRMBone.leftToes;
case HumanBodyBones.RightToes: return VRMBone.rightToes;
case HumanBodyBones.LeftEye: return VRMBone.leftEye;
case HumanBodyBones.RightEye: return VRMBone.rightEye;
case HumanBodyBones.Jaw: return VRMBone.jaw;
case HumanBodyBones.LeftThumbProximal: return VRMBone.leftThumbProximal;
case HumanBodyBones.LeftThumbIntermediate: return VRMBone.leftThumbIntermediate;
case HumanBodyBones.LeftThumbDistal: return VRMBone.leftThumbDistal;
case HumanBodyBones.LeftIndexProximal: return VRMBone.leftIndexProximal;
case HumanBodyBones.LeftIndexIntermediate: return VRMBone.leftIndexIntermediate;
case HumanBodyBones.LeftIndexDistal: return VRMBone.leftIndexDistal;
case HumanBodyBones.LeftMiddleProximal: return VRMBone.leftMiddleProximal;
case HumanBodyBones.LeftMiddleIntermediate: return VRMBone.leftMiddleIntermediate;
case HumanBodyBones.LeftMiddleDistal: return VRMBone.leftMiddleDistal;
case HumanBodyBones.LeftRingProximal: return VRMBone.leftRingProximal;
case HumanBodyBones.LeftRingIntermediate: return VRMBone.leftRingIntermediate;
case HumanBodyBones.LeftRingDistal: return VRMBone.leftRingDistal;
case HumanBodyBones.LeftLittleProximal: return VRMBone.leftLittleProximal;
case HumanBodyBones.LeftLittleIntermediate: return VRMBone.leftLittleIntermediate;
case HumanBodyBones.LeftLittleDistal: return VRMBone.leftLittleDistal;
case HumanBodyBones.RightThumbProximal: return VRMBone.rightThumbProximal;
case HumanBodyBones.RightThumbIntermediate: return VRMBone.rightThumbIntermediate;
case HumanBodyBones.RightThumbDistal: return VRMBone.rightThumbDistal;
case HumanBodyBones.RightIndexProximal: return VRMBone.rightIndexProximal;
case HumanBodyBones.RightIndexIntermediate: return VRMBone.rightIndexIntermediate;
case HumanBodyBones.RightIndexDistal: return VRMBone.rightIndexDistal;
case HumanBodyBones.RightMiddleProximal: return VRMBone.rightMiddleProximal;
case HumanBodyBones.RightMiddleIntermediate: return VRMBone.rightMiddleIntermediate;
case HumanBodyBones.RightMiddleDistal: return VRMBone.rightMiddleDistal;
case HumanBodyBones.RightRingProximal: return VRMBone.rightRingProximal;
case HumanBodyBones.RightRingIntermediate: return VRMBone.rightRingIntermediate;
case HumanBodyBones.RightRingDistal: return VRMBone.rightRingDistal;
case HumanBodyBones.RightLittleProximal: return VRMBone.rightLittleProximal;
case HumanBodyBones.RightLittleIntermediate: return VRMBone.rightLittleIntermediate;
case HumanBodyBones.RightLittleDistal: return VRMBone.rightLittleDistal;
case HumanBodyBones.UpperChest: return VRMBone.upperChest;
//case HumanBodyBones.LastBone:
default: throw new System.InvalidOperationException();
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d5e9521d3f142254ab773f38bacd0905
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -128,7 +128,7 @@ namespace VRM
{
if (x.mesh == index)
{
return EnumUtil.TryParseOrDefault<FirstPersonFlag>(x.firstPersonFlag);
return CacheEnum.TryParseOrDefault<FirstPersonFlag>(x.firstPersonFlag, true);
}
}

View File

@ -158,12 +158,12 @@ namespace VRM
if (group != null)
{
asset.BlendShapeName = groupName;
asset.Preset = EnumUtil.TryParseOrDefault<BlendShapePreset>(group.presetName);
asset.Preset = CacheEnum.TryParseOrDefault<BlendShapePreset>(group.presetName, true);
asset.IsBinary = group.isBinary;
if (asset.Preset == BlendShapePreset.Unknown)
{
// fallback
asset.Preset = EnumUtil.TryParseOrDefault<BlendShapePreset>(group.name);
asset.Preset = CacheEnum.TryParseOrDefault<BlendShapePreset>(group.name, true);
}
asset.Values = group.binds.Select(x =>
{

View File

@ -87,7 +87,7 @@ namespace VRM
{
get
{
return EnumUtil.TryParseOrDefault<LookAtType>(lookAtTypeName);
return CacheEnum.TryParseOrDefault<LookAtType>(lookAtTypeName, true);
}
set { lookAtTypeName = value.ToString(); }
}

View File

@ -73,7 +73,7 @@ namespace VRM
{
public static VRMBone FromHumanBodyBone(this HumanBodyBones human)
{
return EnumUtil.TryParseOrDefault<VRMBone>(human.ToString(), VRMBone.unknown);
return human.ToVrmBone();
}
public static HumanBodyBones ToHumanBodyBone(this VRMBone bone)
@ -85,7 +85,7 @@ namespace VRM
return HumanBodyBones.LastBone;
}
#endif
return EnumUtil.TryParseOrDefault<HumanBodyBones>(bone.ToString(), HumanBodyBones.LastBone);
return bone.ToUnityBone();
}
}
@ -161,7 +161,7 @@ namespace VRM
}
get
{
return EnumUtil.TryParseOrDefault<VRMBone>(bone);
return CacheEnum.Parse<VRMBone>(bone, true);
}
}

View File

@ -36,7 +36,7 @@ namespace VRM
{
static UssageLicense FromString(string src)
{
return EnumUtil.TryParseOrDefault<UssageLicense>(src);
return CacheEnum.TryParseOrDefault<UssageLicense>(src, true);
}
[JsonSchema(Description = "Title of VRM model")]
@ -69,7 +69,7 @@ namespace VRM
{
get
{
return EnumUtil.TryParseOrDefault<AllowedUser>(allowedUserName);
return CacheEnum.TryParseOrDefault<AllowedUser>(allowedUserName, true);
}
set
{
@ -135,7 +135,7 @@ namespace VRM
{
get
{
return EnumUtil.TryParseOrDefault<LicenseType>(licenseName);
return CacheEnum.TryParseOrDefault<LicenseType>(licenseName, true);
}
set
{