Example #1
0
        private static OwaFilterState ParseFromPropertyValue(object propertyValue)
        {
            string[] array = propertyValue as string[];
            if (array == null || array.Length < 2 || string.IsNullOrEmpty(array[0]))
            {
                return(null);
            }
            OwaFilterState owaFilterState = new OwaFilterState();

            owaFilterState.version = 0.0;
            if (string.IsNullOrEmpty(array[1]))
            {
                return(owaFilterState);
            }
            try
            {
                owaFilterState.sourceFolderId = StoreId.EwsIdToStoreObjectId(array[0]);
            }
            catch (Exception)
            {
                ExTraceGlobals.StorageTracer.TraceDebug(0L, "[OwaFilterState::ParseFromPropertyValue] id of property was not valid EWS id: " + array[0]);
                return(owaFilterState);
            }
            int    num  = 0;
            double num2 = 0.0;

            string[] array2 = array[1].Split(new char[]
            {
                ':'
            });
            if (array2.Length < 2 || !int.TryParse(array2[0], out num) || !double.TryParse(array2[1], out num2))
            {
                return(owaFilterState);
            }
            if (num2 != 15.1)
            {
                return(owaFilterState);
            }
            bool          flag          = array2.Length == 3;
            OwaViewFilter owaViewFilter = (OwaViewFilter)num;

            if (!EnumValidator.IsValidValue <OwaViewFilter>(owaViewFilter))
            {
                ExTraceGlobals.StorageTracer.TraceDebug(0L, "[OwaFilterState::ParseFromPropertyValue] ViewFilter of property was not valid enum value: " + owaViewFilter.ToString());
                return(owaFilterState);
            }
            if (owaViewFilter == OwaViewFilter.All && !flag)
            {
                ExTraceGlobals.StorageTracer.TraceDebug(0L, "[OwaFilterState::ParseFromPropertyValue] ViewFilter All is not valid enum value if FromFilter is not specified.");
                return(owaFilterState);
            }
            owaFilterState.version    = num2;
            owaFilterState.viewFilter = owaViewFilter;
            if (flag)
            {
                owaFilterState.fromFilter = array2[2];
            }
            return(owaFilterState);
        }