public static PutAppendResult Append(this PagedContainerAbstract c, string key, string data) { if (string.IsNullOrEmpty(data)) { throw new ArgumentException("Argument can't be null or empty", nameof(data)); } return(c.Append(key, defaultEncoding.GetBytes(data))); }
public static Dictionary <string, PutAppendResult> Append(this PagedContainerAbstract c, Dictionary <string, string> keyValues) { foreach (var item in keyValues) { if (string.IsNullOrEmpty(item.Key)) { throw new ArgumentException("Argument can't be null or empty", nameof(keyValues)); } if (string.IsNullOrEmpty(item.Value)) { throw new ArgumentException($"Argument can't be null or empty: {item.Key}", nameof(keyValues)); } } return(c.Append(keyValues.ToDictionary(p => p.Key, p => defaultEncoding.GetBytes(p.Value), StringComparer.InvariantCultureIgnoreCase))); }
/// <exception cref="ArgumentException"></exception> public static string?GetString(this PagedContainerAbstract c, string key) { var value = c.Get(key); return(value == null ? null : defaultEncoding.GetString(value)); }
/// <summary> Get entries by keys. Mask chars * and ? supported in keys </summary> public static Dictionary <string, string> GetString(this PagedContainerAbstract c, params string[] keys) => c.Get(keys).ToDictionary(p => p.Key, p => defaultEncoding.GetString(p.Value), StringComparer.InvariantCultureIgnoreCase);
internal EntryReadonlyStream(PagedContainerAbstract parent, PagedContainerEntry entry) { this.parent = parent; this.entry = entry; pages = parent.Stream.ReadPageSequence(parent.Header, entry.FirstPage); }