Esempio n. 1
0
        public VersionedId(byte[] byteArray)
        {
            int  num  = 0;
            bool flag = false;

            if (byteArray == null)
            {
                throw new ArgumentNullException("byteArray", ServerStrings.ExInvalidIdFormat);
            }
            if (byteArray.Length <= 1)
            {
                flag = true;
            }
            else
            {
                num = (int)byteArray[0];
                if (byteArray.Length <= num)
                {
                    flag = true;
                }
            }
            if (!flag)
            {
                this.ItemId    = StoreObjectId.Parse(byteArray, num + 1);
                this.ChangeKey = new byte[num];
                for (int i = 0; i < num; i++)
                {
                    this.ChangeKey[i] = byteArray[1 + i];
                }
                return;
            }
            throw new CorruptDataException(ServerStrings.ExInvalidIdFormat);
        }
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            object value = propertyBag.GetValue(this.backingPropertyDefinition);

            byte[] array = value as byte[];
            if (array != null)
            {
                object result;
                try
                {
                    result = StoreObjectId.Parse(array, 0);
                }
                catch (CorruptDataException)
                {
                    result = new PropertyError(this, PropertyErrorCode.CorruptedData);
                }
                return(result);
            }
            PropertyError propertyError = (PropertyError)value;

            if (propertyError.PropertyErrorCode == PropertyErrorCode.NotEnoughMemory)
            {
                return(new PropertyError(this, PropertyErrorCode.CorruptedData));
            }
            return(new PropertyError(this, propertyError.PropertyErrorCode));
        }
Esempio n. 3
0
 internal VersionedId(byte[] storeObjectIdByteArray, byte[] changeKeyByteArray)
 {
     if (changeKeyByteArray.Length > 255)
     {
         throw new CorruptDataException(ServerStrings.ExChangeKeyTooLong);
     }
     this.ItemId    = StoreObjectId.Parse(storeObjectIdByteArray, 0);
     this.ChangeKey = (byte[])changeKeyByteArray.Clone();
 }
        internal void ParseUserConfigurationCacheEntries(BinaryReader reader)
        {
            reader.ReadUInt16();
            int num = reader.ReadInt32();

            this.hasUserConfigurationLoaded = true;
            if (num <= 32)
            {
                for (int i = 0; i < num; i++)
                {
                    string configName = reader.ReadString();
                    int    count      = reader.ReadInt32();
                    byte[] byteArray  = reader.ReadBytes(count);
                    count = reader.ReadInt32();
                    byte[] byteArray2 = reader.ReadBytes(count);
                    this.AddUserConfigurationCachedEntry(StoreObjectId.Parse(byteArray, 0), configName, StoreObjectId.Parse(byteArray2, 0), true);
                }
                return;
            }
            ExTraceGlobals.UserConfigurationTracer.TraceError <int>((long)this.GetHashCode(), "UserConfigurationCache::Load. The retreived cache count is too big, persisted data is corrupted. Count = {0}.", num);
        }
        internal override QueryFilter NativeFilterToSmartFilter(QueryFilter filter)
        {
            SinglePropertyFilter singlePropertyFilter = filter as SinglePropertyFilter;

            if (singlePropertyFilter != null && singlePropertyFilter.Property.Equals(this.backingPropertyDefinition))
            {
                ComparisonFilter comparisonFilter = filter as ComparisonFilter;
                if (comparisonFilter != null)
                {
                    return(new ComparisonFilter(comparisonFilter.ComparisonOperator, this, StoreObjectId.Parse((byte[])comparisonFilter.PropertyValue, 0)));
                }
                ExistsFilter existsFilter = filter as ExistsFilter;
                if (existsFilter != null)
                {
                    return(new ExistsFilter(this));
                }
            }
            return(null);
        }