void ReplaceCharset(Encoding encoding) { for (int i = 0; i < _entries.Count; i++) { var entry = _entries[i]; if (!String.IsNullOrEmpty(entry.Name) && entry.Name.Is("_charset_") && entry.Type.Isi(InputTypeNames.Hidden)) { _entries[i] = new TextDataSetEntry(entry.Name, encoding.WebName, entry.Type); } } }
/// <summary> /// Replaces a charset field (if any) that is hidden with the given /// character encoding. /// </summary> /// <param name="encoding">The encoding to use.</param> void ReplaceCharset(Encoding encoding) { for (int i = 0; i < _entries.Count; i++) { var entry = _entries[i]; if (!String.IsNullOrEmpty(entry.Name) && entry.Name.Equals("_charset_") && entry.Type.Equals(InputTypeNames.Hidden, StringComparison.OrdinalIgnoreCase)) { _entries[i] = new TextDataSetEntry(entry.Name, encoding.WebName, entry.Type); } } }
/// <summary> /// Replaces a charset field (if any) that is hidden with the given character encoding. /// </summary> /// <param name="encoding">The encoding to use.</param> void ReplaceCharset(Encoding encoding) { for (int i = 0; i < _entries.Count; i++) { var entry = _entries[i]; if (!String.IsNullOrEmpty(entry.Name) && entry.Name.Equals("_charset_") && entry.Type.Equals("hidden", StringComparison.OrdinalIgnoreCase)) { _entries[i] = new TextDataSetEntry { Name = entry.Name, Type = entry.Type, Value = encoding.WebName } } ; } } /// <summary> /// Checks the entries for boundary collisions. If a collision is detected, then a new /// boundary string is generated. This algorithm will produce a boundary string that /// satisfies all requirements. /// </summary> /// <param name="encoding">The encoding to use.</param> void CheckBoundaries(Encoding encoding) { var found = false; do { for (int i = 0; i < _entries.Count; i++) { if (found = _entries[i].Contains(_boundary, encoding)) { _boundary = Guid.NewGuid().ToString(); break; } } } while (found); }