public static bool MarkAllFolderDependenciesForDiscarding(ParentViewState pvState, ParentViewState anotherPvState) { bool flag1 = false; bool flag2 = false; int index1 = 0; List<string> stringList = new List<string>(); for (int index2 = 0; index2 < pvState.folders.Length; ++index2) { ParentViewFolder folder = pvState.folders[index2]; if (ASCommitWindow.HasFlag(folder.changeFlags, ChangeFlags.Deleted)) { bool flag3 = false; for (int index3 = 1; index3 <= folder.files.Length; ++index3) { if (pvState.selectedItems[index1 + index3]) { flag3 = true; pvState.selectedItems[index1] = true; stringList.Add(folder.guid); break; } } if (pvState.selectedItems[index1] || flag3) { string str = folder.guid; while (AssetServer.IsGUIDValid(str = AssetServer.GetParentGUID(str, -1)) != 0) { int folderIndex = ASCommitWindow.IndexOfFolderWithGUID(pvState.folders, str); if (folderIndex != -1) { int totalIndex = ASCommitWindow.FolderIndexToTotalIndex(pvState.folders, folderIndex); if (!pvState.selectedItems[totalIndex] && ASCommitWindow.HasFlag(pvState.folders[totalIndex].changeFlags, ChangeFlags.Deleted)) { pvState.selectedItems[totalIndex] = true; stringList.Add(str); flag1 = true; } } else break; } } } else if (!ASCommitWindow.AllFolderWouldBeMovedAnyway(pvState, folder.guid)) { if (ASCommitWindow.AnyOfTheParentsIsSelected(ref pvState, folder.guid)) { pvState.selectedItems[index1] = true; stringList.Add(folder.guid); for (int index3 = 1; index3 <= folder.files.Length; ++index3) pvState.selectedItems[index1 + index3] = true; flag1 = true; } } else { for (int index3 = 1; index3 <= folder.files.Length; ++index3) { if (!pvState.selectedItems[index1 + index3]) pvState.selectedItems[index1 + index3] = true; } stringList.Add(folder.guid); } index1 += 1 + pvState.folders[index2].files.Length; } if (anotherPvState != null) { for (int index2 = 0; index2 < anotherPvState.folders.Length; ++index2) { ParentViewFolder folder = anotherPvState.folders[index2]; if (ASCommitWindow.AnyOfTheParentsIsSelected(ref pvState, folder.guid)) stringList.Add(folder.guid); } for (int index2 = anotherPvState.folders.Length - 1; index2 >= 0; --index2) { if (stringList.Contains(anotherPvState.folders[index2].guid)) { ParentViewFolder folder1 = anotherPvState.folders[index2]; int index3 = ASCommitWindow.FolderSelectionIndexFromGUID(pvState.folders, folder1.guid); if (index3 != -1) { ParentViewFolder folder2 = pvState.folders[index3]; int length = pvState.lv.totalRows - index3 - 1 - folder2.files.Length; int sourceIndex = index3 + 1 + folder2.files.Length; Array.Copy((Array) pvState.selectedItems, sourceIndex, (Array) pvState.selectedItems, sourceIndex + folder1.files.Length, length); ArrayUtility.AddRange<ParentViewFile>(ref folder2.files, folder1.files); for (int index4 = 1; index4 <= folder2.files.Length; ++index4) pvState.selectedItems[index3 + index4] = true; Array.Sort<ParentViewFile>(folder2.files, new Comparison<ParentViewFile>(ParentViewState.CompareViewFile)); } else { int index4 = 0; for (int index5 = 0; index5 < pvState.folders.Length && ParentViewState.CompareViewFolder(pvState.folders[index4], folder1) <= 0; ++index5) index4 += 1 + pvState.folders[index5].files.Length; int length = pvState.lv.totalRows - index4; int sourceIndex = index4; Array.Copy((Array) pvState.selectedItems, sourceIndex, (Array) pvState.selectedItems, sourceIndex + 1 + folder1.files.Length, length); ArrayUtility.Add<ParentViewFolder>(ref pvState.folders, folder1); for (int index5 = 0; index5 <= folder1.files.Length; ++index5) pvState.selectedItems[index4 + index5] = true; flag2 = true; } ArrayUtility.RemoveAt<ParentViewFolder>(ref anotherPvState.folders, index2); flag1 = true; } } anotherPvState.SetLineCount(); } pvState.SetLineCount(); if (flag2) Array.Sort<ParentViewFolder>(pvState.folders, new Comparison<ParentViewFolder>(ParentViewState.CompareViewFolder)); return flag1; }
public static bool MarkAllFolderDependenciesForDiscarding(ParentViewState pvState, ParentViewState anotherPvState) { bool result = false; bool flag = false; int num = 0; List<string> list = new List<string>(); for (int i = 0; i < pvState.folders.Length; i++) { ParentViewFolder parentViewFolder = pvState.folders[i]; if (ASCommitWindow.HasFlag(parentViewFolder.changeFlags, ChangeFlags.Deleted)) { bool flag2 = false; for (int j = 1; j <= parentViewFolder.files.Length; j++) { if (pvState.selectedItems[num + j]) { flag2 = true; pvState.selectedItems[num] = true; list.Add(parentViewFolder.guid); break; } } if (pvState.selectedItems[num] || flag2) { string text = parentViewFolder.guid; while (AssetServer.IsGUIDValid(text = AssetServer.GetParentGUID(text, -1)) != 0) { int num2 = ASCommitWindow.IndexOfFolderWithGUID(pvState.folders, text); if (num2 == -1) { break; } num2 = ASCommitWindow.FolderIndexToTotalIndex(pvState.folders, num2); if (!pvState.selectedItems[num2] && ASCommitWindow.HasFlag(pvState.folders[num2].changeFlags, ChangeFlags.Deleted)) { pvState.selectedItems[num2] = true; list.Add(text); result = true; } } } } else { if (!ASCommitWindow.AllFolderWouldBeMovedAnyway(pvState, parentViewFolder.guid)) { if (ASCommitWindow.AnyOfTheParentsIsSelected(ref pvState, parentViewFolder.guid)) { pvState.selectedItems[num] = true; list.Add(parentViewFolder.guid); for (int k = 1; k <= parentViewFolder.files.Length; k++) { pvState.selectedItems[num + k] = true; } result = true; } } else { for (int l = 1; l <= parentViewFolder.files.Length; l++) { if (!pvState.selectedItems[num + l]) { pvState.selectedItems[num + l] = true; } } list.Add(parentViewFolder.guid); } } num += 1 + pvState.folders[i].files.Length; } if (anotherPvState != null) { for (int m = 0; m < anotherPvState.folders.Length; m++) { ParentViewFolder parentViewFolder2 = anotherPvState.folders[m]; if (ASCommitWindow.AnyOfTheParentsIsSelected(ref pvState, parentViewFolder2.guid)) { list.Add(parentViewFolder2.guid); } } for (int n = anotherPvState.folders.Length - 1; n >= 0; n--) { if (list.Contains(anotherPvState.folders[n].guid)) { ParentViewFolder parentViewFolder3 = anotherPvState.folders[n]; int num3 = ASCommitWindow.FolderSelectionIndexFromGUID(pvState.folders, parentViewFolder3.guid); if (num3 != -1) { ParentViewFolder parentViewFolder4 = pvState.folders[num3]; int length = pvState.lv.totalRows - num3 - 1 - parentViewFolder4.files.Length; int num4 = num3 + 1 + parentViewFolder4.files.Length; Array.Copy(pvState.selectedItems, num4, pvState.selectedItems, num4 + parentViewFolder3.files.Length, length); ArrayUtility.AddRange<ParentViewFile>(ref parentViewFolder4.files, parentViewFolder3.files); for (int num5 = 1; num5 <= parentViewFolder4.files.Length; num5++) { pvState.selectedItems[num3 + num5] = true; } Array.Sort<ParentViewFile>(parentViewFolder4.files, new Comparison<ParentViewFile>(ParentViewState.CompareViewFile)); } else { num3 = 0; for (int num6 = 0; num6 < pvState.folders.Length; num6++) { if (ParentViewState.CompareViewFolder(pvState.folders[num3], parentViewFolder3) > 0) { break; } num3 += 1 + pvState.folders[num6].files.Length; } int length2 = pvState.lv.totalRows - num3; int num7 = num3; Array.Copy(pvState.selectedItems, num7, pvState.selectedItems, num7 + 1 + parentViewFolder3.files.Length, length2); ArrayUtility.Add<ParentViewFolder>(ref pvState.folders, parentViewFolder3); for (int num8 = 0; num8 <= parentViewFolder3.files.Length; num8++) { pvState.selectedItems[num3 + num8] = true; } flag = true; } ArrayUtility.RemoveAt<ParentViewFolder>(ref anotherPvState.folders, n); result = true; } } anotherPvState.SetLineCount(); } pvState.SetLineCount(); if (flag) { Array.Sort<ParentViewFolder>(pvState.folders, new Comparison<ParentViewFolder>(ParentViewState.CompareViewFolder)); } return result; }