| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- // DtkSDK.ApiParameters
- using System.Collections.Generic;
- namespace Dataoke
- {
- public class ApiParameters
- {
- private List<KeyValuePair<string, string>> parameters = new List<KeyValuePair<string, string>>();
- public List<KeyValuePair<string, string>> Value => parameters;
- public void Add(string key, string value)
- {
- parameters.Add(new KeyValuePair<string, string>(key, value));
- }
- public bool Delete(string key)
- {
- try
- {
- int find = parameters.FindIndex((KeyValuePair<string, string> a) => a.Key == key);
- if (find >= 0)
- {
- parameters.RemoveAt(find);
- }
- return true;
- }
- catch
- {
- return false;
- }
- }
- public bool EditOrAdd(string key, string value)
- {
- try
- {
- int find = parameters.FindIndex((KeyValuePair<string, string> a) => a.Key == key);
- if (find >= 0)
- {
- parameters.RemoveAt(find);
- }
- Add(key, value);
- return true;
- }
- catch
- {
- return false;
- }
- }
- public bool Edit(string key, string value)
- {
- try
- {
- int find = parameters.FindIndex((KeyValuePair<string, string> a) => a.Key == key);
- if (find >= 0)
- {
- parameters.RemoveAt(find);
- Add(key, value);
- }
- return true;
- }
- catch
- {
- return false;
- }
- }
- public void Clear()
- {
- parameters.Clear();
- }
- }
- }
|