public static string Serialize(IEnumerable <KeyValuePair <string, object> > value) { if (value == null) { return(string.Empty); } using (var w = new GenxyWriter()) { foreach (var kvp in value) { if (!HasValue(kvp.Value)) { continue; } w.WriteChar('#'); w.WriteString(kvp.Key); w.WriteChar('='); SerializeObject(w, kvp.Value); } return(w.ToString()); } }
private static void ConvertEnumerableStringObject(GenxyWriter writer, IEnumerable <KeyValuePair <string, object> > d) { writer.WriteToken(GenxyToken.StartProp); foreach (var kvp in d) { if (!HasValue(kvp.Value)) { continue; } writer.WriteToken(GenxyToken.Prop); writer.WriteString(kvp.Key); writer.WriteChar('='); SerializeObject(writer, kvp.Value); } writer.WriteToken(GenxyToken.EndProp); }
private static void ConvertGenxyString(GenxyWriter writer, GenxyString value) { writer.WriteToken(GenxyToken.StartProp); writer.WriteString(value.ToString().Replace('#', '|')); writer.WriteToken(GenxyToken.EndProp); }
private static void ConvertByteArray(GenxyWriter writer, byte[] value) { writer.WriteToken(GenxyToken.ByteArray); writer.WriteString(BitConverter.ToString(value).Replace("-", "")); }