コード例 #1
0
        public TemplateSchema CreateSchema()
        {
            var assembly = Assembly.GetExecutingAssembly();
            var json     = default(String);

            using (var stream = assembly.GetManifestResourceStream("GitHub.DistributedTask.Pipelines.ObjectTemplating.workflow-v1.0.json"))
                using (var streamReader = new StreamReader(stream))
                {
                    json = streamReader.ReadToEnd();
                }

            var objectReader = new JsonObjectReader(null, json);

            return(TemplateSchema.Load(objectReader));
        }
コード例 #2
0
        public static TemplateSchema GetSchema()
        {
            if (s_schema == null)
            {
                var assembly = Assembly.GetExecutingAssembly();
                var json     = default(String);
                using (var stream = assembly.GetManifestResourceStream("GitHub.DistributedTask.Pipelines.ObjectTemplating.workflow-v1.0.json"))
                    using (var streamReader = new StreamReader(stream))
                    {
                        json = streamReader.ReadToEnd();
                    }

                var objectReader = new JsonObjectReader(null, json);
                var schema       = TemplateSchema.Load(objectReader);
                Interlocked.CompareExchange(ref s_schema, schema, null);
            }

            return(s_schema);
        }