public string[] Serialize() { if (!this.Enabled || this.data == null) { return(null); } string[] array = new string[this.data.Count]; int num = 0; bool flag = false; foreach (IEnumerable <KeyValuePair <string, object> > enumerable in this.data) { array[num] = LogRowFormatter.FormatCollection(enumerable, out flag); if (flag) { byte[] array2 = Utf8Csv.EncodeAndEscape(array[num]); if (array2 == null) { return(null); } array[num] = Encoding.UTF8.GetString(array2); } num++; } return(array); }
private void WriteContact(Stream stream, IStorePropertyBag contact) { List <byte[]> list = new List <byte[]>(this.properties.Length); foreach (PropertyDefinition propertyDefinition in this.properties) { object obj = contact.TryGetProperty(propertyDefinition); if (obj == null || PropertyError.IsPropertyNotFound(obj)) { obj = string.Empty; } list.Add(Utf8Csv.EncodeAndEscape(obj.ToString())); } Utf8Csv.WriteRawRow(stream, list.ToArray()); }
private static string GetCsvEscapedString(object value) { return(Encoding.UTF8.GetString(Utf8Csv.EncodeAndEscape(value.ToString(), true))); }