예제 #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, ""));
        }