Beispiel #1
0
 private static Tuple <BaseSchema, string, TaskBase, string> GetMetadata(
     ApplyOptions opts, IServiceProvider services, IDeserializer deserializer, string file)
 {
     if (File.Exists(file))
     {
         var payload    = File.ReadAllText(file);
         var baseSchema = deserializer.Deserialize <BaseSchema>(payload);
         var service    = MappedApiServiceAttribute.GetApiServiceInstance(baseSchema.Kind, services);
         return(new Tuple <BaseSchema, string, TaskBase, string>(baseSchema, file, service, payload));
     }
     throw new InvalidOperationException("Manifest file couldn't be found or loaded.");
 }
        public int RunApplyVerb(ApplyOptions opts)
        {
            var deserializer = new DeserializerBuilder()
                               .WithNamingConvention(new CamelCaseNamingConvention())
                               .IgnoreUnmatchedProperties()
                               .Build();

            foreach (var file in opts.ManifestFiles)
            {
                if (File.Exists(file))
                {
                    var payload    = File.ReadAllText(file);
                    var baseSchema = deserializer.Deserialize <BaseSchema>(payload);
                    MappedApiServiceAttribute
                    .GetApiServiceInstance(baseSchema.Kind,
                                           opts.OrganizationURL,
                                           opts.PAT)
                    .ExecuteAsync(baseSchema, payload).Wait();
                }
            }
            Console.ResetColor();
            return(0);
        }