Exemple #1
0
        /// <summary>
        /// Converts fleet template to json string.
        /// </summary>
        /// <param name="fleetTemplate">Fleet template to be serialized</param>
        /// <returns>Json string</returns>
        public static string ToJson(this FleetTemplate fleetTemplate)
        {
            if (fleetTemplate == null)
            {
                throw new ArgumentNullException("fleetTemplate");
            }

            JsonSerializerSettings settings = GetJsonSerializerSettings();

            return(JsonConvert.SerializeObject(fleetTemplate, settings));
        }
Exemple #2
0
        /// <summary>
        /// Serializes a fleet template to .json.
        /// </summary>
        /// <param name="fleetTemplate">Fleet Template to be serialized</param>
        /// <param name="filePath">Output file path</param>
        public static void ToFile(this FleetTemplate fleetTemplate, string filePath)
        {
            if (fleetTemplate == null)
            {
                throw new ArgumentNullException("fleetTemplate");
            }

            if (string.IsNullOrEmpty(filePath))
            {
                throw new ArgumentOutOfRangeException("filePath");
            }

            string json = fleetTemplate.ToJson();

            File.WriteAllText(filePath, json);
        }
Exemple #3
0
 public void Populate() => FleetTemplate.Populate(FleetManagerClient);