コード例 #1
0
        public static void AddHeaderArrayField(DataStringCollection source, string[] values, string name, string delimiter)
        {
            StringCollection strings = new StringCollection();

            strings.AddRange(values);
            AddHeaderMultiField(source, strings, name, delimiter);
        }
コード例 #2
0
 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++;
             }
         }
     }
 }
コード例 #3
0
 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));
         }
     }
 }
コード例 #4
0
 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)));
     }
 }
コード例 #5
0
        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);
                }
            }
        }
コード例 #6
0
 public DataStringEnumerator(DataStringCollection collection)
 {
     this.collection     = collection;
     this.baseEnumerator = collection.data.GetEnumerator();
 }
コード例 #7
0
 public static string GetStringsAsString(DataStringCollection strings)
 {
     string[] array = new string[strings.Count];
     strings.CopyTo(array, 0);
     return(GetStringsAsString(array));
 }
コード例 #8
0
 public TcpListEventArgs(DataStringCollection list)
 {
     this.list = list;
 }