コード例 #1
0
        public object Deserialize(SerializedValueView view)
        {
            var json = view.ToString();

            if (string.IsNullOrEmpty(json))
            {
                return(null);
            }

            if (GlobalObjectId.TryParse(json, out var id))
            {
                if (GlobalObjectId.GlobalObjectIdentifierToObjectSlow(id) is BuildPipeline pipeline)
                {
                    return(pipeline);
                }
            }
            else
            {
                if (TypeConstructionHelper.TryConstructFromAssemblyQualifiedTypeName <IBuildStep>(json, out var step))
                {
                    return(step);
                }
            }
            return(null);
        }
コード例 #2
0
        public object Deserialize(SerializedValueView view)
        {
            var json = view.ToString();

            if (string.IsNullOrEmpty(json))
            {
                return(null);
            }
            return(TypeConstructionHelper.TryConstructFromAssemblyQualifiedTypeName <RunStep>(json, out var step) ? step : null);
        }
コード例 #3
0
        public BuildPipelineBase Deserialize(SerializedValueView view)
        {
            if (view.Type != TokenType.String)
            {
                return(null);
            }

            var json = view.AsStringView().ToString();

            if (string.IsNullOrEmpty(json))
            {
                return(null);
            }

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

            throw new ArgumentException($"Failed to construct type. Could not resolve type from TypeName=[{json}].");
        }