public void Remove(string Name) { PostDataParam parameter = this.Params.FirstOrDefault(val => val.Name == Name); if (parameter != null) { this.Params.Remove(parameter); } }
public PostDataParam Set(string Name, string Value) { PostDataParam parameter = this.Params.FirstOrDefault(val => val.Name == Name); if (parameter == null) { parameter = new PostDataParam(Name, Value); this.Params.Add(parameter); } parameter.Value = Value; return(parameter); }
public PostDataParam AddFile(string Name, string FileName, Encoding Encoding = null) { Encoding = Encoding ?? this.Encoding; FileInfo fi = new FileInfo(FileName); PostDataParam parameter = new PostDataParam(Name, fi.Name, File.ReadAllBytes(FileName)); parameter.Encoding = Encoding; parameter.Value = Encoding.GetString(parameter.Bytes); this.Params.Add(parameter); return(parameter); }
public PostDataParam Get(string Name, bool IgnoreCase = true) { PostDataParam parameter = this.Params.FirstOrDefault(val => (IgnoreCase ? val.Name.ToLower() == Name.ToLower() : val.Name == Name)); return(parameter ?? new PostDataParam(Name, "")); }