public static void AddHeaderArrayField(DataStringCollection source, string[] values, string name, string delimiter) { StringCollection strings = new StringCollection(); strings.AddRange(values); AddHeaderMultiField(source, strings, name, delimiter); }
public static void InsertHeaderFieldIfNeed(DataStringCollection source, string name, string theValue) { if (!StringUtils.IsEmpty(theValue)) { HeaderFieldList fieldList = new HeaderFieldList(); int index = GetHeaderFieldList(0, source, fieldList); if (!fieldList.ContainsField(name)) { if ((index < 0) || (index > source.Count)) { index = source.Count; } theValue = theValue.Replace("\r\n", "\r\n\t"); if (theValue[theValue.Length - 1] == '\t') { theValue = theValue.Substring(0, theValue.Length - 1); } foreach (string str in StringUtils.GetStringArray(string.Format("{0}: {1}", name, theValue))) { source.Insert(index, str); index++; } } } }
private static void AddHeaderMultiField(DataStringCollection source, StringCollection values, string name, string delimiter) { if (values.Count > 0) { AddHeaderField(source, name, values[0] + ((values.Count > 1) ? delimiter : string.Empty)); for (int i = 1; i < values.Count; i++) { source.Add('\t' + values[i] + ((i < (values.Count - 1)) ? delimiter : string.Empty)); } } }
public static void AddHeaderField(DataStringCollection source, string name, string theValue) { if (!StringUtils.IsEmpty(theValue)) { theValue = theValue.Replace("\r\n", "\r\n\t"); if (theValue[theValue.Length - 1] == '\t') { theValue = theValue.Substring(0, theValue.Length - 1); } source.AddRange(StringUtils.GetStringArray(string.Format("{0}: {1}", name, theValue))); } }
public static void RemoveHeaderField(DataStringCollection source, HeaderFieldList fieldList, string name) { HeaderField field = fieldList[name]; if (field != null) { fieldList.Remove(field); int index = int.Parse(field.Value); source.RemoveAt(index); while (index < source.Count) { string str = source[index]; if (StringUtils.IsEmpty(str) || ((str[0] != '\t') && (str[0] != ' '))) { break; } source.RemoveAt(index); } } }
public DataStringEnumerator(DataStringCollection collection) { this.collection = collection; this.baseEnumerator = collection.data.GetEnumerator(); }
public static string GetStringsAsString(DataStringCollection strings) { string[] array = new string[strings.Count]; strings.CopyTo(array, 0); return(GetStringsAsString(array)); }
public TcpListEventArgs(DataStringCollection list) { this.list = list; }