public 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 (null == oldPath != (null == newPath))
            {
                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)
            {
                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);
            }
            return(num);
        }
 public static string GenerateUniqueNameString(string idString, List <InstancePathItem> instancePath)
 {
     if (instancePath != null && instancePath.Count != 0)
     {
         return(idString + 'i' + InstancePathItem.GenerateInstancePathString(instancePath, -1));
     }
     return(idString);
 }
 private static void AppendInteger(ref ReverseStringBuilder builder, int value)
 {
     while (value > 9)
     {
         builder.Append(InstancePathItem.GetIntegerChar(value % 10));
         value /= 10;
     }
     builder.Append(InstancePathItem.GetIntegerChar(value));
 }
        public static string GenerateUniqueNameString(int id, List <InstancePathItem> instancePath, int parentInstanceIndex)
        {
            string text = id.ToString(CultureInfo.InvariantCulture);

            if (instancePath != null && instancePath.Count != 0)
            {
                return(text + 'i' + InstancePathItem.GenerateInstancePathString(instancePath, parentInstanceIndex));
            }
            return(text);
        }
 public 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);
 }
 public static void DeepCopyPath(List <InstancePathItem> instancePath, ref List <InstancePathItem> copy)
 {
     if (instancePath != null)
     {
         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]));
             }
         }
         else
         {
             int num = copy.Count;
             if (count == 0)
             {
                 if (num > 0)
                 {
                     copy.Clear();
                 }
             }
             else
             {
                 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]));
                 }
             }
         }
     }
 }
        public static bool IsSameScopePath(IInstancePath originalRIFObject, IInstancePath lastRIFObject)
        {
            if (null == originalRIFObject != (null == lastRIFObject))
            {
                return(false);
            }
            if (originalRIFObject == null && lastRIFObject == null)
            {
                return(true);
            }
            if (originalRIFObject.Equals(lastRIFObject))
            {
                return(true);
            }
            List <InstancePathItem> instancePath  = originalRIFObject.InstancePath;
            List <InstancePathItem> instancePath2 = lastRIFObject.InstancePath;
            bool flag            = default(bool);
            int  sharedPathIndex = InstancePathItem.GetSharedPathIndex(0, instancePath, instancePath2, false, out flag);

            if (flag)
            {
                return(true);
            }
            if (sharedPathIndex < 0)
            {
                return(false);
            }
            int count  = instancePath.Count;
            int count2 = instancePath2.Count;
            int i      = sharedPathIndex + 1;
            int j      = sharedPathIndex + 1;

            for (; i < count && !instancePath[i].IsScope; i++)
            {
            }
            if (i + 1 == count && instancePath[i].m_indexType == InstancePathItemType.SubReport)
            {
                i = count;
            }
            for (; j < count2 && !instancePath2[j].IsScope; j++)
            {
            }
            if (i == count && j == count2)
            {
                return(true);
            }
            return(false);
        }
        public static bool IsSamePath(List <InstancePathItem> path1, List <InstancePathItem> path2)
        {
            if (null == path1 != (null == path2))
            {
                return(false);
            }
            if (path1 == null && path2 == null)
            {
                return(true);
            }
            if (path1.Count != path2.Count)
            {
                return(false);
            }
            bool result = default(bool);

            InstancePathItem.GetSharedPathIndex(0, path1, path2, false, out result);
            return(result);
        }
        public static List <InstancePathItem> CombineRowColPath(List <InstancePathItem> rowPath, List <InstancePathItem> columnPath)
        {
            int parentDataRegionIndex  = InstancePathItem.GetParentDataRegionIndex(rowPath);
            int parentDataRegionIndex2 = InstancePathItem.GetParentDataRegionIndex(columnPath);

            Global.Tracer.Assert(rowPath[parentDataRegionIndex].m_indexInCollection == columnPath[parentDataRegionIndex2].m_indexInCollection && parentDataRegionIndex == parentDataRegionIndex2);
            int num = columnPath.Count - parentDataRegionIndex2 - 1;
            List <InstancePathItem> list = new List <InstancePathItem>(rowPath.Count + num);

            list.AddRange(rowPath);
            if (0 < num)
            {
                columnPath[parentDataRegionIndex2 + 1].m_indexType = InstancePathItemType.ColumnMemberInstanceIndexTopMost;
                for (int i = 0; i < num; i++)
                {
                    list.Add(columnPath[parentDataRegionIndex2 + 1 + i]);
                }
            }
            return(list);
        }
 public string GetRecursiveUniqueName(int parentInstanceIndex)
 {
     return(InstancePathItem.GenerateUniqueNameString(base.ID, this.InstancePath, parentInstanceIndex));
 }
        private static string GenerateInstancePathString(List <InstancePathItem> instancePath, int parentInstanceIndex)
        {
            if (instancePath != null && instancePath.Count != 0)
            {
                int count = instancePath.Count;
                ReverseStringBuilder reverseStringBuilder = 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;
                            InstancePathItem.AppendInteger(ref reverseStringBuilder, parentInstanceIndex);
                        }
                        else
                        {
                            InstancePathItem.AppendInteger(ref reverseStringBuilder, instancePathItem.m_instanceIndex);
                        }
                        if (flag)
                        {
                            flag = false;
                            reverseStringBuilder.Append('x');
                            InstancePathItem.AppendInteger(ref reverseStringBuilder, instancePathItem.m_indexInCollection);
                        }
                        reverseStringBuilder.Append('C');
                        break;

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

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

                    case InstancePathItemType.SubReport:
                        InstancePathItem.AppendInteger(ref reverseStringBuilder, instancePathItem.m_indexInCollection);
                        reverseStringBuilder.Append('S');
                        break;
                    }
                }
                return(reverseStringBuilder.ToString());
            }
            return("");
        }
 public static string GenerateInstancePathString(List <InstancePathItem> instancePath)
 {
     return(InstancePathItem.GenerateInstancePathString(instancePath, -1));
 }
 public static string GenerateUniqueNameString(int id, List <InstancePathItem> instancePath)
 {
     return(InstancePathItem.GenerateUniqueNameString(id.ToString(CultureInfo.InvariantCulture), instancePath));
 }
        public static int GetSharedPathIndex(int startIndexForNewPath, List <InstancePathItem> oldPath, List <InstancePathItem> newPath)
        {
            bool flag = default(bool);

            return(InstancePathItem.GetSharedPathIndex(startIndexForNewPath, oldPath, newPath, false, out flag));
        }
 public InstancePathItem(InstancePathItem original)
 {
     this.m_indexType         = original.m_indexType;
     this.m_instanceIndex     = original.m_instanceIndex;
     this.m_indexInCollection = original.m_indexInCollection;
 }