コード例 #1
0
        internal static RunStep Deserialize(string json)
        {
            if (string.IsNullOrEmpty(json))
            {
                return(null);
            }

            if (TypeConstruction.TryConstructFromAssemblyQualifiedTypeName <RunStep>(json, out var step))
            {
                return(step);
            }

            return(null);
        }
コード例 #2
0
 public void TryConstruct_DerivedType_FromAssemblyQualifiedTypeName()
 {
     {
         var type = typeof(ConstructibleDerivedType);
         var assemblyQualifiedTypeName = $"{type}, {type.Assembly.GetName().Name}";
         Assert.That(TypeConstruction.TryConstructFromAssemblyQualifiedTypeName <ConstructibleBaseType>(assemblyQualifiedTypeName, out _), Is.True);
         Assert.That(TypeConstruction.TryConstructFromAssemblyQualifiedTypeName <ConstructibleBaseType>("Some.Other.Assembly.DerivedTypeThatIsConstructible, Some.Other.Assembly", out _), Is.True);
     }
     {
         var type = typeof(NonConstructibleDerivedType);
         var assemblyQualifiedTypeName = $"{type}, {type.Assembly.GetName().Name}";
         Assert.That(TypeConstruction.TryConstructFromAssemblyQualifiedTypeName <ConstructibleBaseType>(assemblyQualifiedTypeName, out _), Is.False);
         Assert.That(TypeConstruction.TryConstructFromAssemblyQualifiedTypeName <ConstructibleBaseType>("Some.Other.Assembly.DerivedTypeThatIsNOTConstructible, Some.Other.Assembly", out _), Is.False);
     }
 }
コード例 #3
0
        internal static IBuildStep Deserialize(string json)
        {
            if (string.IsNullOrEmpty(json))
            {
                return(null);
            }

            if (GlobalObjectId.TryParse(json, out var id))
            {
                if (GlobalObjectId.GlobalObjectIdentifierToObjectSlow(id) is BuildPipeline pipeline)
                {
                    return(pipeline);
                }
            }
            else
            {
                if (TypeConstruction.TryConstructFromAssemblyQualifiedTypeName <IBuildStep>(json, out var step))
                {
                    return(step);
                }
            }

            return(null);
        }