private static void PublishUpdatedRemoteSourceConfig(RemoteSourcePublishOptions options, TextWriter output)
        {
            output.WriteLine();
            output.WriteCommandText("Generating updated configuration file info (config.json)...");

            var targetFile = Path.Combine(Path.Combine(Path.GetTempPath(), "config.json"));

            Fs.SafeDeleteFile(targetFile);

            TemplatesSourceConfig config = RemoteSource.GetTemplatesSourceConfig(options.StorageAccount, options.Env);

            using (FileStream fs = new FileStream(targetFile, FileMode.CreateNew, FileAccess.Write))
            {
                StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);

                JsonSerializerSettings settings = new JsonSerializerSettings();
                settings.NullValueHandling = NullValueHandling.Ignore;
                settings.Converters.Add(new StringEnumConverter());
                settings.Converters.Add(new VersionConverter());
                string content = JsonConvert.SerializeObject(config, settings);

                sw.WriteLine(content);
                sw.Flush();
            }

            output.WriteCommandText("Updating CND configuration file (config.json)...");
            output.WriteCommandText(RemoteSource.UploadElement(options.StorageAccount, options.AccountKey, options.Env.ToString().ToLowerInvariant(), targetFile));
        }
 private static TemplatesSourceConfig GetConfig(RemoteSourceListOptions options, TextWriter output)
 {
     if (options.Build)
     {
         output.WriteCommandText("Building Remote Templates Source Configuration information...");
         return(RemoteSource.GetTemplatesSourceConfig(options.StorageAccount, options.Env));
     }
     else
     {
         output.WriteCommandText("Getting config file from the CDN (config.json)...");
         return(GetConfigFromCdn(options.Env));
     }
 }