// Token: 0x060075AC RID: 30124 RVA: 0x002196E0 File Offset: 0x002178E0
 internal LiveShapingList(ICollectionViewLiveShaping view, LiveShapingFlags flags, IComparer comparer)
 {
     this._view            = view;
     this._comparer        = comparer;
     this._isCustomSorting = !(comparer is SortFieldComparer);
     this._dpFromPath      = new LiveShapingList.DPFromPath();
     this._root            = new LiveShapingTree(this);
     if (comparer != null)
     {
         this._root.Comparison = new Comparison <LiveShapingItem>(this.CompareLiveShapingItems);
     }
     this._sortDirtyItems   = new List <LiveShapingItem>();
     this._filterDirtyItems = new List <LiveShapingItem>();
     this._groupDirtyItems  = new List <LiveShapingItem>();
     this.SetLiveShapingProperties(flags);
 }
 bool TestLiveShapingFlag(LiveShapingFlags flags, LiveShapingFlags flag)
 {
     return((flags & flag) != 0);
 }
        // reset the collections of properties to observe, and their
        // corresponding DPs
        internal void SetLiveShapingProperties(LiveShapingFlags flags)
        {
            int    k, n;
            string path;

            _dpFromPath.BeginReset();

            // Sorting //

            // get the properties used for comparison
            SortDescriptionCollection sdc = ((ICollectionView)View).SortDescriptions;

            n          = sdc.Count;
            _compInfos = new LivePropertyInfo[n];
            for (k = 0; k < n; ++k)
            {
                path          = NormalizePath(sdc[k].PropertyName);
                _compInfos[k] = new LivePropertyInfo(path, _dpFromPath.GetDP(path));
            }


            if (TestLiveShapingFlag(flags, LiveShapingFlags.Sorting))
            {
                // get the list of property paths to observe
                Collection <string> sortProperties = View.LiveSortingProperties;

                if (sortProperties.Count == 0)
                {
                    // use the sort description properties
                    _sortInfos = _compInfos;
                }
                else
                {
                    // use the explicit list of properties
                    n          = sortProperties.Count;
                    _sortInfos = new LivePropertyInfo[n];
                    for (k = 0; k < n; ++k)
                    {
                        path          = NormalizePath(sortProperties[k]);
                        _sortInfos[k] = new LivePropertyInfo(path, _dpFromPath.GetDP(path));
                    }
                }
            }
            else
            {
                _sortInfos = new LivePropertyInfo[0];
            }


            // Filtering //

            if (TestLiveShapingFlag(flags, LiveShapingFlags.Filtering))
            {
                // get the list of property paths to observe
                Collection <string> filterProperties = View.LiveFilteringProperties;
                n            = filterProperties.Count;
                _filterInfos = new LivePropertyInfo[n];
                for (k = 0; k < n; ++k)
                {
                    path            = NormalizePath(filterProperties[k]);
                    _filterInfos[k] = new LivePropertyInfo(path, _dpFromPath.GetDP(path));
                }

                _filterRoot = new LiveShapingTree(this);
            }
            else
            {
                _filterInfos = new LivePropertyInfo[0];
                _filterRoot  = null;
            }


            // Grouping //

            if (TestLiveShapingFlag(flags, LiveShapingFlags.Grouping))
            {
                // get the list of property paths to observe
                Collection <string> groupingProperties = View.LiveGroupingProperties;

                if (groupingProperties.Count == 0)
                {
                    // if no explicit list, use the group description properties
                    groupingProperties = new Collection <string>();
                    ICollectionView icv = View as ICollectionView;
                    ObservableCollection <GroupDescription> groupDescriptions = (icv != null) ? icv.GroupDescriptions : null;

                    if (groupDescriptions != null)
                    {
                        foreach (GroupDescription gd in groupDescriptions)
                        {
                            PropertyGroupDescription pgd = gd as PropertyGroupDescription;
                            if (pgd != null)
                            {
                                groupingProperties.Add(pgd.PropertyName);
                            }
                        }
                    }
                }

                n           = groupingProperties.Count;
                _groupInfos = new LivePropertyInfo[n];
                for (k = 0; k < n; ++k)
                {
                    path           = NormalizePath(groupingProperties[k]);
                    _groupInfos[k] = new LivePropertyInfo(path, _dpFromPath.GetDP(path));
                }
            }
            else
            {
                _groupInfos = new LivePropertyInfo[0];
            }

            _dpFromPath.EndReset();
        }
        // Token: 0x060075AF RID: 30127 RVA: 0x0021977C File Offset: 0x0021797C
        internal void SetLiveShapingProperties(LiveShapingFlags flags)
        {
            this._dpFromPath.BeginReset();
            SortDescriptionCollection sortDescriptions = ((ICollectionView)this.View).SortDescriptions;
            int count = sortDescriptions.Count;

            this._compInfos = new LivePropertyInfo[count];
            for (int i = 0; i < count; i++)
            {
                string path = this.NormalizePath(sortDescriptions[i].PropertyName);
                this._compInfos[i] = new LivePropertyInfo(path, this._dpFromPath.GetDP(path));
            }
            if (this.TestLiveShapingFlag(flags, LiveShapingFlags.Sorting))
            {
                Collection <string> liveSortingProperties = this.View.LiveSortingProperties;
                if (liveSortingProperties.Count == 0)
                {
                    this._sortInfos = this._compInfos;
                }
                else
                {
                    count           = liveSortingProperties.Count;
                    this._sortInfos = new LivePropertyInfo[count];
                    for (int i = 0; i < count; i++)
                    {
                        string path = this.NormalizePath(liveSortingProperties[i]);
                        this._sortInfos[i] = new LivePropertyInfo(path, this._dpFromPath.GetDP(path));
                    }
                }
            }
            else
            {
                this._sortInfos = new LivePropertyInfo[0];
            }
            if (this.TestLiveShapingFlag(flags, LiveShapingFlags.Filtering))
            {
                Collection <string> liveFilteringProperties = this.View.LiveFilteringProperties;
                count             = liveFilteringProperties.Count;
                this._filterInfos = new LivePropertyInfo[count];
                for (int i = 0; i < count; i++)
                {
                    string path = this.NormalizePath(liveFilteringProperties[i]);
                    this._filterInfos[i] = new LivePropertyInfo(path, this._dpFromPath.GetDP(path));
                }
                this._filterRoot = new LiveShapingTree(this);
            }
            else
            {
                this._filterInfos = new LivePropertyInfo[0];
                this._filterRoot  = null;
            }
            if (this.TestLiveShapingFlag(flags, LiveShapingFlags.Grouping))
            {
                Collection <string> collection = this.View.LiveGroupingProperties;
                if (collection.Count == 0)
                {
                    collection = new Collection <string>();
                    ICollectionView collectionView = this.View as ICollectionView;
                    ObservableCollection <GroupDescription> observableCollection = (collectionView != null) ? collectionView.GroupDescriptions : null;
                    if (observableCollection != null)
                    {
                        foreach (GroupDescription groupDescription in observableCollection)
                        {
                            PropertyGroupDescription propertyGroupDescription = groupDescription as PropertyGroupDescription;
                            if (propertyGroupDescription != null)
                            {
                                collection.Add(propertyGroupDescription.PropertyName);
                            }
                        }
                    }
                }
                count            = collection.Count;
                this._groupInfos = new LivePropertyInfo[count];
                for (int i = 0; i < count; i++)
                {
                    string path = this.NormalizePath(collection[i]);
                    this._groupInfos[i] = new LivePropertyInfo(path, this._dpFromPath.GetDP(path));
                }
            }
            else
            {
                this._groupInfos = new LivePropertyInfo[0];
            }
            this._dpFromPath.EndReset();
        }
 // Token: 0x060075B0 RID: 30128 RVA: 0x00219A10 File Offset: 0x00217C10
 private bool TestLiveShapingFlag(LiveShapingFlags flags, LiveShapingFlags flag)
 {
     return((flags & flag) > (LiveShapingFlags)0);
 }