Exemplo n.º 1
0
        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)));
        }
Exemplo n.º 2
0
        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)));
        }
Exemplo n.º 3
0
        /// <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));
        }
Exemplo n.º 4
0
        /// <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);
Exemplo n.º 5
0
 internal EntryReadonlyStream(PagedContainerAbstract parent, PagedContainerEntry entry)
 {
     this.parent = parent;
     this.entry  = entry;
     pages       = parent.Stream.ReadPageSequence(parent.Header, entry.FirstPage);
 }