Exemplo n.º 1
0
 private void FlushCacheIntoPropertyBag()
 {
     if (this.storePropertyBag == null)
     {
         return;
     }
     this.storePropertyBag.Load(null);
     byte[] array = this.cache.ToArray();
     if (this.property.MapiPropertyType == PropType.Binary)
     {
         this.storePropertyBag.MemoryPropertyBag[this.property] = array;
         return;
     }
     if (this.property.MapiPropertyType == PropType.String)
     {
         this.storePropertyBag.MemoryPropertyBag[this.property] = StoreObjectStream.GetUnicodeEncoding().GetString(array, 0, StoreObjectStream.GetByteCount(array));
     }
 }
Exemplo n.º 2
0
 private void CreateCache(object value)
 {
     if (value == null)
     {
         this.cache = StoreObjectStream.CreateExpandableMemoryStream(null);
     }
     else if (this.property.MapiPropertyType == PropType.Binary)
     {
         this.cache = StoreObjectStream.CreateExpandableMemoryStream((byte[])value);
     }
     else if (this.property.MapiPropertyType == PropType.String)
     {
         byte[]             bytes = StoreObjectStream.GetUnicodeEncoding().GetBytes((string)value);
         PooledMemoryStream pooledMemoryStream = StoreObjectStream.CreateExpandableMemoryStream(bytes);
         pooledMemoryStream.Position = 0L;
         this.cache = pooledMemoryStream;
     }
     this.maximumCacheSize = ((32768 > (int)this.cache.Length) ? 32768 : ((int)this.cache.Length));
 }