示例#1
0
        public void Remove(string Name)
        {
            PostDataParam parameter = this.Params.FirstOrDefault(val => val.Name == Name);

            if (parameter != null)
            {
                this.Params.Remove(parameter);
            }
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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, ""));
        }