/// <summary> /// Chargement d'un flux(Json/Ou XML) dans le datavalue /// </summary> /// <param name="itemdv"></param> /// <param name="flux"></param> public static void FromFlux(this ParamValues datavalue, string flux, bool?isXml = null) { //clean if (string.IsNullOrWhiteSpace(flux)) { return; } flux = flux.Trim(); if (!isXml.HasValue) { isXml = flux.TrimStart().StartsWith("<"); } IParamValuesSerializer serial = ParamValuesTools.SerializerFactory(isXml.Value); serial.DeSerialize(flux, datavalue); //parse //if (flux.StartsWith("{")) this.FromFluxJson(flux); //if (flux.StartsWith("<")) fromFluxXML(datavalue,flux); }
/// <summary> /// Exporter un flux du datavalue /// </summary> /// <param name="datavalue"></param> /// <param name="Xml">true=xml, false=json</param> /// <returns></returns> public static string ToFlux(this ParamValues datavalue, bool isXml = true) { IParamValuesSerializer serial = ParamValuesTools.SerializerFactory(isXml); return(serial.Serialize(datavalue)); }