internal static int GetSharedPathIndex(int startIndexForNewPath, List <InstancePathItem> oldPath, List <InstancePathItem> newPath, bool returnPreviousIndex, out bool identicalPaths)
        {
            identicalPaths = false;
            int result = -1;
            int num    = -1;

            if (oldPath == null != (newPath == null))
            {
                return(num);
            }
            if (oldPath == null && newPath == null)
            {
                return(num);
            }
            int count  = oldPath.Count;
            int count2 = newPath.Count;
            int i      = startIndexForNewPath;
            int j      = startIndexForNewPath;

            if (startIndexForNewPath < 0 || startIndexForNewPath >= count || startIndexForNewPath >= count2)
            {
                return(num);
            }
            while (i < count && j < count2)
            {
                for (; i < count && oldPath[i].IsEmpty; i++)
                {
                }
                for (; j < count2 && newPath[j].IsEmpty; j++)
                {
                }
                if (returnPreviousIndex && i < count && j + 1 == count2)
                {
                    return(result);
                }
                if (i < count != j < count2)
                {
                    return(num);
                }
                if (i == count && j == count2)
                {
                    break;
                }
                InstancePathItem instancePathItem  = oldPath[i];
                InstancePathItem instancePathItem2 = newPath[j];
                if (instancePathItem.m_indexType != instancePathItem2.m_indexType || instancePathItem.m_indexInCollection != instancePathItem2.m_indexInCollection || instancePathItem.m_instanceIndex != instancePathItem2.m_instanceIndex)
                {
                    return(num);
                }
                result = num;
                num    = j;
                i++;
                j++;
            }
            if (i == count && j == count2)
            {
                identicalPaths = true;
            }
            return(num);
        }
Example #2
0
 private void UpdateVisibilityDataCacheFlag(ref bool cacheHasValue)
 {
     cacheHasValue = true;
     if (m_romScopeInstance == null || m_romScopeInstance.IsNewContext)
     {
         InstancePathItem.DeepCopyPath(InstancePath, ref m_visibilityCacheLastInstancePath);
     }
 }
 internal static bool IsValidContext(List <InstancePathItem> path)
 {
     for (int i = 0; i < path.Count; i++)
     {
         InstancePathItem instancePathItem = path[i];
         if (instancePathItem.IsDynamicMember && instancePathItem.InstanceIndex < 0)
         {
             return(false);
         }
     }
     return(true);
 }
Example #4
0
 private bool IsVisibilityCacheInstancePathInvalid()
 {
     if (m_visibilityCacheLastInstancePath != null)
     {
         if (m_visibilityCacheLastInstancePath.Count > 0)
         {
             return(!InstancePathItem.IsSamePath(InstancePath, m_visibilityCacheLastInstancePath));
         }
         return(false);
     }
     return(true);
 }
        internal static void DeepCopyPath(List <InstancePathItem> instancePath, ref List <InstancePathItem> copy)
        {
            if (instancePath == null)
            {
                return;
            }
            int i     = 0;
            int count = instancePath.Count;

            if (copy == null)
            {
                copy = new List <InstancePathItem>(count);
                for (; i < count; i++)
                {
                    copy.Add(new InstancePathItem(instancePath[i]));
                }
                return;
            }
            int num = copy.Count;

            if (count == 0)
            {
                if (num > 0)
                {
                    copy.Clear();
                }
                return;
            }
            if (num > count)
            {
                int num2 = num - count;
                copy.RemoveRange(count, num2);
                num -= num2;
            }
            for (; i < num; i++)
            {
                InstancePathItem instancePathItem  = copy[i];
                InstancePathItem instancePathItem2 = instancePath[i];
                instancePathItem.m_hash = 0;
                instancePathItem.m_indexInCollection = instancePathItem2.m_indexInCollection;
                instancePathItem.m_indexType         = instancePathItem2.m_indexType;
                instancePathItem.m_instanceIndex     = instancePathItem2.m_instanceIndex;
            }
            for (; i < count; i++)
            {
                copy.Add(new InstancePathItem(instancePath[i]));
            }
        }
 internal InstancePathItem(InstancePathItem original)
 {
     m_indexType         = original.m_indexType;
     m_instanceIndex     = original.m_instanceIndex;
     m_indexInCollection = original.m_indexInCollection;
 }
        private static string GenerateInstancePathString(List <InstancePathItem> instancePath, int parentInstanceIndex)
        {
            if (instancePath == null || instancePath.Count == 0)
            {
                return("");
            }
            int count = instancePath.Count;
            ReverseStringBuilder builder = new ReverseStringBuilder(count * 2 + 4);
            bool flag  = true;
            bool flag2 = true;
            bool flag3 = parentInstanceIndex >= 0;

            for (int num = count - 1; num >= 0; num--)
            {
                InstancePathItem instancePathItem = instancePath[num];
                switch (instancePathItem.m_indexType)
                {
                case InstancePathItemType.ColumnMemberInstanceIndexTopMost:
                case InstancePathItemType.ColumnMemberInstanceIndex:
                    if (flag3)
                    {
                        flag3 = false;
                        AppendInteger(ref builder, parentInstanceIndex);
                    }
                    else
                    {
                        AppendInteger(ref builder, instancePathItem.m_instanceIndex);
                    }
                    if (flag)
                    {
                        flag = false;
                        builder.Append('x');
                        AppendInteger(ref builder, instancePathItem.m_indexInCollection);
                    }
                    builder.Append('C');
                    break;

                case InstancePathItemType.RowMemberInstanceIndex:
                    if (flag3)
                    {
                        flag3 = false;
                        AppendInteger(ref builder, parentInstanceIndex);
                    }
                    else
                    {
                        AppendInteger(ref builder, instancePathItem.m_instanceIndex);
                    }
                    if (flag2)
                    {
                        flag2 = false;
                        builder.Append('x');
                        AppendInteger(ref builder, instancePathItem.m_indexInCollection);
                    }
                    builder.Append('R');
                    break;

                case InstancePathItemType.DataRegion:
                    AppendInteger(ref builder, instancePathItem.m_indexInCollection);
                    builder.Append('T');
                    break;

                case InstancePathItemType.SubReport:
                    AppendInteger(ref builder, instancePathItem.m_indexInCollection);
                    builder.Append('S');
                    break;
                }
            }
            return(builder.ToString());
        }
Example #8
0
 internal string GetRecursiveUniqueName(int parentInstanceIndex)
 {
     return(InstancePathItem.GenerateUniqueNameString(base.ID, InstancePath, parentInstanceIndex));
 }