示例#1
0
 /// <summary>
 /// XNode as Bytes, encoded with UTF8.
 /// </summary>
 public XNodeBytes(XNode node)
 {
     this.bytes =
         new ScalarOf <byte[]>(() =>
     {
         return
         (new BytesOf(
              Encoding.UTF8.GetBytes(node.ToString())
              ).AsBytes());
     });
 }
示例#2
0
        /// <summary>
        /// A cache which ignores the given items.
        /// </summary>
        public IgnoringCache(ICache <TData> origin, IEnumerable <string> ignored)
        {
            this.patterns =
                new ScalarOf <string[]>(() =>
            {
                var items    = new ListOf <string>(ignored);
                var compiled = new string[items.Count];
                for (int i = 0; i < items.Count; i++)
                {
                    compiled[i] = Regex.Escape(items[i].ToLower()).Replace("\\*", ".*").Replace("\\?", ".") + "$";
                }
                return(compiled);
            });

            this.origin = origin;
        }
示例#3
0
 /// <summary>
 /// A cell which exists physically as a file.
 /// </summary>
 private FileCell(IScalar <string> name, ScalarOf <IMnemonic> mem)
 {
     this.mem  = mem;
     this.name = name;
 }
示例#4
0
 /// <summary>
 /// A cell whose content is stored in memory.
 /// </summary>
 private MemorizedCell(string name, ScalarOf <IMnemonic> mem)
 {
     this.name = new Normalized(name);
     this.mem  = mem;
 }