public void SelectDeletedItem(string guid) { this.SelType = SelectionType.DeletedItems; this.DeletedItemsToggle = true; int index = 0; for (int i = 0; i < this.m_DelPVstate.folders.Length; i++) { ParentViewFolder folder = this.m_DelPVstate.folders[i]; this.m_DelPVstate.selectedItems[index] = false; if (folder.guid == guid) { this.m_DelPVstate.selectedItems[index] = true; this.ScrollToDeletedItem(index); return; } for (int j = 0; j < folder.files.Length; j++) { index++; this.m_DelPVstate.selectedItems[index] = false; if (folder.files[j].guid == guid) { this.m_DelPVstate.selectedItems[index] = true; this.ScrollToDeletedItem(index); return; } } index++; } }
public void SelectDeletedItem(string guid) { this.SelType = ASHistoryFileView.SelectionType.DeletedItems; this.DeletedItemsToggle = true; int num = 0; for (int i = 0; i < this.m_DelPVstate.folders.Length; i++) { ParentViewFolder parentViewFolder = this.m_DelPVstate.folders[i]; this.m_DelPVstate.selectedItems[num] = false; if (parentViewFolder.guid == guid) { this.m_DelPVstate.selectedItems[num] = true; this.ScrollToDeletedItem(num); break; } for (int j = 0; j < parentViewFolder.files.Length; j++) { num++; this.m_DelPVstate.selectedItems[num] = false; if (parentViewFolder.files[j].guid == guid) { this.m_DelPVstate.selectedItems[num] = true; this.ScrollToDeletedItem(num); return; } } num++; } }
private void MarkBoldItemsByGUID(string guid) { for (int i = 0; i < this.m_GUIItems.Length; i++) { ASHistoryWindow.GUIHistoryListItem gUIHistoryListItem = this.m_GUIItems[i]; ParentViewState assets = gUIHistoryListItem.assets; int num = 0; gUIHistoryListItem.boldAssets = new bool[assets.GetLineCount()]; for (int j = 0; j < assets.folders.Length; j++) { ParentViewFolder parentViewFolder = assets.folders[j]; if (parentViewFolder.guid == guid) { gUIHistoryListItem.boldAssets[num] = true; } num++; for (int k = 0; k < parentViewFolder.files.Length; k++) { if (parentViewFolder.files[k].guid == guid) { gUIHistoryListItem.boldAssets[num] = true; } num++; } } } }
public void SelectDeletedItem(string guid) { this.SelType = ASHistoryFileView.SelectionType.DeletedItems; this.DeletedItemsToggle = true; int index1 = 0; for (int index2 = 0; index2 < this.m_DelPVstate.folders.Length; ++index2) { ParentViewFolder folder = this.m_DelPVstate.folders[index2]; this.m_DelPVstate.selectedItems[index1] = false; if (folder.guid == guid) { this.m_DelPVstate.selectedItems[index1] = true; this.ScrollToDeletedItem(index1); break; } for (int index3 = 0; index3 < folder.files.Length; ++index3) { ++index1; this.m_DelPVstate.selectedItems[index1] = false; if (folder.files[index3].guid == guid) { this.m_DelPVstate.selectedItems[index1] = true; this.ScrollToDeletedItem(index1); return; } } ++index1; } }
private void MarkBoldItemsByGUID(string guid) { for (int i = 0; i < this.m_GUIItems.Length; i++) { GUIHistoryListItem item = this.m_GUIItems[i]; ParentViewState assets = item.assets; int index = 0; item.boldAssets = new bool[assets.GetLineCount()]; for (int j = 0; j < assets.folders.Length; j++) { ParentViewFolder folder = assets.folders[j]; if (folder.guid == guid) { item.boldAssets[index] = true; } index++; for (int k = 0; k < folder.files.Length; k++) { if (folder.files[k].guid == guid) { item.boldAssets[index] = true; } index++; } } } }
private int CheckParentViewInFilterAndMarkBoldItems(GUIHistoryListItem item, string text) { ParentViewState assets = item.assets; int num = -1; int index = 0; for (int i = 0; i < assets.folders.Length; i++) { ParentViewFolder folder = assets.folders[i]; if (folder.name.IndexOf(text, StringComparison.InvariantCultureIgnoreCase) != -1) { item.boldAssets[index] = true; if (num == -1) { num = index; } } index++; for (int j = 0; j < folder.files.Length; j++) { if (folder.files[j].name.IndexOf(text, StringComparison.InvariantCultureIgnoreCase) != -1) { item.boldAssets[index] = true; if (num == -1) { num = index; } } index++; } } return(num); }
public bool NextFileFolder(ref int folder, ref int file) { bool result; if (folder >= this.folders.Length) { result = false; } else { ParentViewFolder parentViewFolder = this.folders[folder]; if (file >= parentViewFolder.files.Length - 1) { folder++; file = -1; if (folder >= this.folders.Length) { result = false; return result; } } else { file++; } result = true; } return result; }
internal static int IndexOf(ParentViewFolder[] foldersFrom, string lfname) { for (int index = 0; index < foldersFrom.Length; ++index) { if (string.Compare(foldersFrom[index].name, lfname, true) == 0) return index; } return -1; }
internal static int IndexOf(ParentViewFolder[] foldersFrom, string lfname) { for (int i = 0; i < foldersFrom.Length; i++) { if (string.Compare(foldersFrom[i].name, lfname, true) == 0) { return i; } } return -1; }
private void AddAssetItem(string guid, string pathName, bool isDir, ChangeFlags changeFlags, int changeset) { if (pathName == string.Empty) { return; } if (isDir) { string str = ParentViewFolder.MakeNiceName(pathName); int index = ParentViewState.IndexOf(this.folders, str); if (index == -1) { ArrayUtility.Add <ParentViewFolder>(ref this.folders, new ParentViewFolder(str, guid, changeFlags)); } else { this.folders[index].changeFlags = changeFlags; this.folders[index].guid = guid; } } else { string str1 = ParentViewFolder.MakeNiceName(FileUtil.DeleteLastPathNameComponent(pathName)); string str2 = pathName.Substring(pathName.LastIndexOf("/") + 1); int index1 = ParentViewState.IndexOf(this.folders, str1); ParentViewFolder parentViewFolder; if (index1 == -1) { parentViewFolder = new ParentViewFolder(str1, AssetServer.GetParentGUID(guid, changeset)); ArrayUtility.Add <ParentViewFolder>(ref this.folders, parentViewFolder); } else { parentViewFolder = this.folders[index1]; } int index2 = ParentViewState.IndexOf(parentViewFolder.files, str2); if (index2 != -1) { if ((parentViewFolder.files[index2].changeFlags & ChangeFlags.Deleted) != ChangeFlags.None) { return; } parentViewFolder.files[index2].guid = guid; parentViewFolder.files[index2].changeFlags = changeFlags; } else { ArrayUtility.Add <ParentViewFile>(ref parentViewFolder.files, new ParentViewFile(str2, guid, changeFlags)); } } }
private void AddAssetItem(string guid, string pathName, bool isDir, ChangeFlags changeFlags, int changeset) { if (pathName != string.Empty) { if (isDir) { string lfname = ParentViewFolder.MakeNiceName(pathName); int index = IndexOf(this.folders, lfname); if (index == -1) { ParentViewFolder item = new ParentViewFolder(lfname, guid, changeFlags); ArrayUtility.Add<ParentViewFolder>(ref this.folders, item); } else { this.folders[index].changeFlags = changeFlags; this.folders[index].guid = guid; } } else { ParentViewFolder folder2; string str2 = ParentViewFolder.MakeNiceName(FileUtil.DeleteLastPathNameComponent(pathName)); string str3 = pathName.Substring(pathName.LastIndexOf("/") + 1); int num2 = IndexOf(this.folders, str2); if (num2 == -1) { folder2 = new ParentViewFolder(str2, AssetServer.GetParentGUID(guid, changeset)); ArrayUtility.Add<ParentViewFolder>(ref this.folders, folder2); } else { folder2 = this.folders[num2]; } num2 = IndexOf(folder2.files, str3); if (num2 != -1) { if ((folder2.files[num2].changeFlags & ChangeFlags.Deleted) == ChangeFlags.None) { folder2.files[num2].guid = guid; folder2.files[num2].changeFlags = changeFlags; } } else { ArrayUtility.Add<ParentViewFile>(ref folder2.files, new ParentViewFile(str3, guid, changeFlags)); } } } }
private void AddAssetItem(string guid, string pathName, bool isDir, ChangeFlags changeFlags, int changeset) { if (!(pathName == string.Empty)) { if (isDir) { string text = ParentViewFolder.MakeNiceName(pathName); int num = ParentViewState.IndexOf(this.folders, text); if (num == -1) { ParentViewFolder item = new ParentViewFolder(text, guid, changeFlags); ArrayUtility.Add<ParentViewFolder>(ref this.folders, item); } else { this.folders[num].changeFlags = changeFlags; this.folders[num].guid = guid; } } else { string text2 = ParentViewFolder.MakeNiceName(FileUtil.DeleteLastPathNameComponent(pathName)); string text3 = pathName.Substring(pathName.LastIndexOf("/") + 1); int num2 = ParentViewState.IndexOf(this.folders, text2); ParentViewFolder parentViewFolder; if (num2 == -1) { parentViewFolder = new ParentViewFolder(text2, AssetServer.GetParentGUID(guid, changeset)); ArrayUtility.Add<ParentViewFolder>(ref this.folders, parentViewFolder); } else { parentViewFolder = this.folders[num2]; } num2 = ParentViewState.IndexOf(parentViewFolder.files, text3); if (num2 != -1) { if ((parentViewFolder.files[num2].changeFlags & ChangeFlags.Deleted) == ChangeFlags.None) { parentViewFolder.files[num2].guid = guid; parentViewFolder.files[num2].changeFlags = changeFlags; } } else { ArrayUtility.Add<ParentViewFile>(ref parentViewFolder.files, new ParentViewFile(text3, guid, changeFlags)); } } } }
private void AddAssetItem(string guid, string pathName, bool isDir, ChangeFlags changeFlags, int changeset) { if (pathName != string.Empty) { if (isDir) { string lfname = ParentViewFolder.MakeNiceName(pathName); int index = IndexOf(this.folders, lfname); if (index == -1) { ParentViewFolder item = new ParentViewFolder(lfname, guid, changeFlags); ArrayUtility.Add <ParentViewFolder>(ref this.folders, item); } else { this.folders[index].changeFlags = changeFlags; this.folders[index].guid = guid; } } else { ParentViewFolder folder2; string str2 = ParentViewFolder.MakeNiceName(FileUtil.DeleteLastPathNameComponent(pathName)); string str3 = pathName.Substring(pathName.LastIndexOf("/") + 1); int num2 = IndexOf(this.folders, str2); if (num2 == -1) { folder2 = new ParentViewFolder(str2, AssetServer.GetParentGUID(guid, changeset)); ArrayUtility.Add <ParentViewFolder>(ref this.folders, folder2); } else { folder2 = this.folders[num2]; } num2 = IndexOf(folder2.files, str3); if (num2 != -1) { if ((folder2.files[num2].changeFlags & ChangeFlags.Deleted) == ChangeFlags.None) { folder2.files[num2].guid = guid; folder2.files[num2].changeFlags = changeFlags; } } else { ArrayUtility.Add <ParentViewFile>(ref folder2.files, new ParentViewFile(str3, guid, changeFlags)); } } } }
private int MarkBoldItemsBySelection(ASHistoryWindow.GUIHistoryListItem item) { List <string> list = new List <string>(); ParentViewState assets = item.assets; int num = -1; int num2 = 0; if (Selection.instanceIDs.Length == 0) { return(0); } int[] instanceIDs = Selection.instanceIDs; for (int i = 0; i < instanceIDs.Length; i++) { int instanceID = instanceIDs[i]; list.Add(AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(instanceID))); } for (int j = 0; j < assets.folders.Length; j++) { ParentViewFolder parentViewFolder = assets.folders[j]; if (list.Contains(parentViewFolder.guid)) { item.boldAssets[num2] = true; if (num == -1) { num = num2; } } num2++; for (int k = 0; k < parentViewFolder.files.Length; k++) { if (list.Contains(parentViewFolder.files[k].guid)) { item.boldAssets[num2] = true; if (num == -1) { num = num2; } } num2++; } } return(num); }
private void DoSelectionChange() { if (this.lv.row != -1) { string firstSelected = this.GetFirstSelected(); if (firstSelected != string.Empty) { this.selectedGUID = firstSelected; } if (AssetServer.IsGUIDValid(this.selectedGUID) != 0) { int num = 0; this.pv.lv.row = -1; ParentViewFolder[] folders = this.pv.folders; for (int i = 0; i < folders.Length; i++) { ParentViewFolder parentViewFolder = folders[i]; if (parentViewFolder.guid == this.selectedGUID) { this.pv.lv.row = num; return; } num++; ParentViewFile[] files = parentViewFolder.files; for (int j = 0; j < files.Length; j++) { ParentViewFile parentViewFile = files[j]; if (parentViewFile.guid == this.selectedGUID) { this.pv.lv.row = num; return; } num++; } } } else { this.pv.lv.row = -1; } } }
private int MarkBoldItemsBySelection(GUIHistoryListItem item) { List <string> list = new List <string>(); ParentViewState assets = item.assets; int num = -1; int index = 0; if (Selection.instanceIDs.Length == 0) { return(0); } foreach (int num3 in Selection.instanceIDs) { list.Add(AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(num3))); } for (int i = 0; i < assets.folders.Length; i++) { ParentViewFolder folder = assets.folders[i]; if (list.Contains(folder.guid)) { item.boldAssets[index] = true; if (num == -1) { num = index; } } index++; for (int j = 0; j < folder.files.Length; j++) { if (list.Contains(folder.files[j].guid)) { item.boldAssets[index] = true; if (num == -1) { num = index; } } index++; } } return(num); }
public bool NextFileFolder(ref int folder, ref int file) { if (folder >= this.folders.Length) { return(false); } ParentViewFolder folder1 = this.folders[folder]; if (file >= folder1.files.Length - 1) { folder = folder + 1; file = -1; if (folder >= this.folders.Length) { return(false); } } else { file = file + 1; } return(true); }
public string[] GetSelectedDeletedItemGUIDs() { List <string> list = new List <string>(); int index = 0; for (int i = 0; i < this.m_DelPVstate.folders.Length; i++) { ParentViewFolder folder = this.m_DelPVstate.folders[i]; if (this.m_DelPVstate.selectedItems[index]) { list.Add(folder.guid); } for (int j = 0; j < folder.files.Length; j++) { index++; if (this.m_DelPVstate.selectedItems[index]) { list.Add(folder.files[j].guid); } } index++; } return(list.ToArray()); }
public string[] GetSelectedDeletedItemGUIDs() { List <string> stringList = new List <string>(); int index1 = 0; for (int index2 = 0; index2 < this.m_DelPVstate.folders.Length; ++index2) { ParentViewFolder folder = this.m_DelPVstate.folders[index2]; if (this.m_DelPVstate.selectedItems[index1]) { stringList.Add(folder.guid); } for (int index3 = 0; index3 < folder.files.Length; ++index3) { ++index1; if (this.m_DelPVstate.selectedItems[index1]) { stringList.Add(folder.files[index3].guid); } } ++index1; } return(stringList.ToArray()); }
public void DoDeletedItemsGUI(ASHistoryWindow parentWin, Rect theRect, GUIStyle s, float offset, float endOffset, bool focused) { Event current = Event.current; Texture2D image = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName); offset += 3f; Rect position = new Rect(this.m_Indent, offset, theRect.width - this.m_Indent, ASHistoryFileView.m_RowHeight); if (current.type == EventType.MouseDown && position.Contains(current.mousePosition)) { GUIUtility.keyboardControl = this.m_FileViewControlID; this.SelType = ASHistoryFileView.SelectionType.DeletedItemsRoot; this.ScrollToDeletedItem(-1); parentWin.DoLocalSelectionChange(); } position.width -= position.x; position.x = 0f; GUIContent gUIContent = new GUIContent("Deleted Assets"); gUIContent.image = image; int left = (int)this.m_BaseIndent; s.padding.left = left; if (current.type == EventType.Repaint) { s.Draw(position, gUIContent, false, false, this.SelType == ASHistoryFileView.SelectionType.DeletedItemsRoot, focused); } Rect position2 = new Rect(this.m_BaseIndent - this.m_FoldoutSize, offset, this.m_FoldoutSize, ASHistoryFileView.m_RowHeight); if (!this.m_DeletedItemsInitialized || this.m_DelPVstate.lv.totalRows != 0) { this.DeletedItemsToggle = GUI.Toggle(position2, this.DeletedItemsToggle, GUIContent.none, ASHistoryFileView.ms_Styles.foldout); } offset += ASHistoryFileView.m_RowHeight; if (this.DeletedItemsToggle) { int row = this.m_DelPVstate.lv.row; int num = 0; int num2 = -1; int num3 = -1; int num4 = 0; while (offset <= endOffset && num4 < this.m_DelPVstate.lv.totalRows) { if (offset + ASHistoryFileView.m_RowHeight >= 0f) { if (num2 == -1) { this.m_DelPVstate.IndexToFolderAndFile(num4, ref num2, ref num3); } position = new Rect(0f, offset, (float)Screen.width, ASHistoryFileView.m_RowHeight); ParentViewFolder parentViewFolder = this.m_DelPVstate.folders[num2]; if (current.type == EventType.MouseDown && position.Contains(current.mousePosition)) { if (current.button != 1 || this.SelType != ASHistoryFileView.SelectionType.DeletedItems || !this.m_DelPVstate.selectedItems[num]) { GUIUtility.keyboardControl = this.m_FileViewControlID; this.SelType = ASHistoryFileView.SelectionType.DeletedItems; this.m_DelPVstate.lv.row = num; ListViewShared.MultiSelection(null, row, this.m_DelPVstate.lv.row, ref this.m_DelPVstate.initialSelectedItem, ref this.m_DelPVstate.selectedItems); this.ScrollToDeletedItem(num); parentWin.DoLocalSelectionChange(); } if (current.button == 1 && this.SelType == ASHistoryFileView.SelectionType.DeletedItems) { GUIUtility.hotControl = 0; Rect position3 = new Rect(current.mousePosition.x, current.mousePosition.y, 1f, 1f); EditorUtility.DisplayCustomMenu(position3, this.dropDownMenuItems, -1, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null); } Event.current.Use(); } if (num3 != -1) { gUIContent.text = parentViewFolder.files[num3].name; gUIContent.image = InternalEditorUtility.GetIconForFile(parentViewFolder.files[num3].name); left = (int)(this.m_BaseIndent + this.m_Indent * 2f); } else { gUIContent.text = parentViewFolder.name; gUIContent.image = image; left = (int)(this.m_BaseIndent + this.m_Indent); } s.padding.left = left; if (Event.current.type == EventType.Repaint) { s.Draw(position, gUIContent, false, false, this.m_DelPVstate.selectedItems[num], focused); } this.m_DelPVstate.NextFileFolder(ref num2, ref num3); num++; } num4++; offset += ASHistoryFileView.m_RowHeight; } } }
private bool DoTransfer(ref ParentViewFolder[] foldersFrom, ref ParentViewFolder[] foldersTo, int folder, int file, ref List<string> guidsOfFoldersToRemove, bool leftToRight) { ParentViewFolder item = foldersFrom[folder]; ParentViewFolder folder3 = null; string name = item.name; bool flag = false; bool flag2 = false; if (file == -1) { this.AddFolderToRemove(ref guidsOfFoldersToRemove, foldersFrom[folder].guid); int index = ParentViewState.IndexOf(foldersTo, name); if (index != -1) { folder3 = foldersTo[index]; ArrayUtility.AddRange<ParentViewFile>(ref folder3.files, item.files); } else { ArrayUtility.Add<ParentViewFolder>(ref foldersTo, item); flag2 = true; if (!HasFlag(item.changeFlags, ChangeFlags.Deleted)) { flag = this.TransferDependentParentFolders(ref guidsOfFoldersToRemove, item.guid, leftToRight); } else { flag = this.TransferDeletedDependentParentFolders(ref guidsOfFoldersToRemove, item.guid, leftToRight); } } } else { int num2 = ParentViewState.IndexOf(foldersTo, name); if (num2 == -1) { if (HasFlag(item.files[file].changeFlags, ChangeFlags.Deleted) && HasFlag(item.changeFlags, ChangeFlags.Deleted)) { ArrayUtility.Add<ParentViewFolder>(ref foldersTo, item); this.AddFolderToRemove(ref guidsOfFoldersToRemove, item.guid); num2 = foldersTo.Length - 1; if (!AllFolderWouldBeMovedAnyway(!leftToRight ? this.pv2state : this.pv1state, item.guid)) { flag = true; } flag |= this.TransferDeletedDependentParentFolders(ref guidsOfFoldersToRemove, item.guid, leftToRight); } else { ArrayUtility.Add<ParentViewFolder>(ref foldersTo, item.CloneWithoutFiles()); num2 = foldersTo.Length - 1; flag = this.TransferDependentParentFolders(ref guidsOfFoldersToRemove, item.guid, leftToRight); } flag2 = true; } folder3 = foldersTo[num2]; ArrayUtility.Add<ParentViewFile>(ref folder3.files, item.files[file]); ArrayUtility.RemoveAt<ParentViewFile>(ref item.files, file); if (item.files.Length == 0) { this.AddFolderToRemove(ref guidsOfFoldersToRemove, foldersFrom[folder].guid); } } if (folder3 != null) { if (<>f__mg$cache0 == null) {
private static int FolderSelectionIndexFromGUID(ParentViewFolder[] folders, string guid) { int num = 0; for (int i = 0; i < folders.Length; i++) { if (guid == folders[i].guid) { return num; } num += 1 + folders[i].files.Length; } return -1; }
private static int FolderIndexToTotalIndex(ParentViewFolder[] folders, int folderIndex) { int num = 0; for (int index = 0; index < folderIndex; ++index) num += folders[index].files.Length + 1; return num; }
public ASUpdateConflictResolveWindow(string[] conflicting) { this.downloadConflictsToResolve = 0; ArrayList arrayList1 = new ArrayList(); ArrayList arrayList2 = new ArrayList(); ArrayList arrayList3 = new ArrayList(); ArrayList arrayList4 = new ArrayList(); for (int index = 0; index < conflicting.Length; ++index) { AssetStatus statusGuid = AssetServer.GetStatusGUID(conflicting[index]); if (statusGuid == AssetStatus.Conflict) { arrayList1.Add((object)conflicting[index]); DownloadResolution downloadResolution = AssetServer.GetDownloadResolution(conflicting[index]); arrayList2.Add((object)downloadResolution); if (downloadResolution == DownloadResolution.Unresolved) { ++this.downloadConflictsToResolve; } } if (AssetServer.GetPathNameConflict(conflicting[index]) != null && statusGuid != AssetStatus.ServerOnly) { arrayList4.Add((object)conflicting[index]); NameConflictResolution conflictResolution = AssetServer.GetNameConflictResolution(conflicting[index]); arrayList3.Add((object)conflictResolution); if (conflictResolution == NameConflictResolution.Unresolved) { ++this.downloadConflictsToResolve; } } } this.downloadConflicts = arrayList1.ToArray(typeof(string)) as string[]; this.downloadResolutions = arrayList2.ToArray(typeof(DownloadResolution)) as DownloadResolution[]; this.namingResolutions = arrayList3.ToArray(typeof(NameConflictResolution)) as NameConflictResolution[]; this.nameConflicts = arrayList4.ToArray(typeof(string)) as string[]; this.enableContinueButton = this.downloadConflictsToResolve == 0; this.dConflictPaths = new string[this.downloadConflicts.Length]; this.deletionConflict = new bool[this.downloadConflicts.Length]; for (int index = 0; index < this.downloadConflicts.Length; ++index) { if (AssetServer.HasDeletionConflict(this.downloadConflicts[index])) { this.dConflictPaths[index] = ParentViewFolder.MakeNiceName(AssetServer.GetDeletedItemPathAndName(this.downloadConflicts[index])); this.deletionConflict[index] = true; } else { this.dConflictPaths[index] = ParentViewFolder.MakeNiceName(AssetServer.GetAssetPathName(this.downloadConflicts[index])); this.deletionConflict[index] = false; } } this.dNamingPaths = new string[this.nameConflicts.Length]; for (int index = 0; index < this.nameConflicts.Length; ++index) { this.dNamingPaths[index] = ParentViewFolder.MakeNiceName(AssetServer.GetAssetPathName(this.nameConflicts[index])); } this.showDownloadConflicts = this.downloadConflicts.Length > 0; this.showNamingConflicts = this.nameConflicts.Length > 0; this.lv1.totalRows = this.downloadConflicts.Length; this.lv2.totalRows = this.nameConflicts.Length; this.selectedLV1Items = new bool[this.downloadConflicts.Length]; this.selectedLV2Items = new bool[this.nameConflicts.Length]; this.DoSelectionChange(); }
private void DrawParentView(Rect r, ref GUIHistoryListItem item, int changesetIndex, bool hasFocus) { ParentViewState assets = item.assets; GUIContent content = new GUIContent(); Texture2D textured = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName); Event current = Event.current; hasFocus &= this.m_HistoryControlID == GUIUtility.keyboardControl; r.height = this.m_RowHeight; r.y += 3f; int index = -1; int num2 = (item.collapsedItemCount == 0) ? item.totalLineCount : 4; num2 += item.startShowingFrom; for (int i = 0; i < assets.folders.Length; i++) { GUIStyle label; ParentViewFolder folder = assets.folders[i]; content.text = folder.name; content.image = textured; index++; if (index == num2) { break; } if (index >= item.startShowingFrom) { label = ms_Style.label; if ((current.type == EventType.MouseDown) && r.Contains(current.mousePosition)) { if (((this.ChangeLogSelectionRev == this.m_Changesets[changesetIndex].changeset) && (this.m_ChangeLogSelectionGUID == folder.guid)) && EditorGUI.actionKey) { this.ClearItemSelection(); } else { this.ChangeLogSelectionRev = this.m_Changesets[changesetIndex].changeset; this.m_ChangeLogSelectionGUID = folder.guid; this.m_ChangeLogSelectionAssetName = folder.name; this.m_FolderSelected = true; this.m_AssetSelectionIndex = index; } this.m_ChangesetSelectionIndex = changesetIndex; GUIUtility.keyboardControl = this.m_HistoryControlID; ((ASMainWindow)this.m_ParentWindow).m_SearchToShow = ASMainWindow.ShowSearchField.HistoryList; if (current.clickCount == 2) { this.ShowAssetsHistory(); GUIUtility.ExitGUI(); } else if (current.button == 1) { GUIUtility.hotControl = 0; r = new Rect(current.mousePosition.x, current.mousePosition.y, 1f, 1f); EditorUtility.DisplayCustomMenu(r, this.m_DropDownMenuItems, -1, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null); } this.DoScroll(); current.Use(); } bool on = (this.ChangeLogSelectionRev == this.m_Changesets[changesetIndex].changeset) && (this.m_ChangeLogSelectionGUID == folder.guid); if (item.boldAssets[index] && !on) { GUI.Label(r, string.Empty, ms_Style.ping); } if (Event.current.type == EventType.Repaint) { label.Draw(r, content, false, false, on, hasFocus); this.DrawBadge(r, folder.changeFlags, label, content, GUIClip.visibleRect.width - 150f); } r.y += this.m_RowHeight; } RectOffset padding = ms_Style.label.padding; padding.left += 0x10; RectOffset offset2 = ms_Style.boldLabel.padding; offset2.left += 0x10; try { for (int j = 0; j < folder.files.Length; j++) { index++; if (index == num2) { break; } if (index >= item.startShowingFrom) { label = ms_Style.label; if ((current.type == EventType.MouseDown) && r.Contains(current.mousePosition)) { if (((this.ChangeLogSelectionRev == this.m_Changesets[changesetIndex].changeset) && (this.m_ChangeLogSelectionGUID == folder.files[j].guid)) && EditorGUI.actionKey) { this.ClearItemSelection(); } else { this.ChangeLogSelectionRev = this.m_Changesets[changesetIndex].changeset; this.m_ChangeLogSelectionGUID = folder.files[j].guid; this.m_ChangeLogSelectionAssetName = folder.files[j].name; this.m_FolderSelected = false; this.m_AssetSelectionIndex = index; } this.m_ChangesetSelectionIndex = changesetIndex; GUIUtility.keyboardControl = this.m_HistoryControlID; ((ASMainWindow)this.m_ParentWindow).m_SearchToShow = ASMainWindow.ShowSearchField.HistoryList; if (current.clickCount == 2) { if (this.IsComparableAssetSelected() && (this.m_SelectedGUID == this.m_ChangeLogSelectionGUID)) { this.DoShowDiff(false, this.ChangeLogSelectionRev, -1); } else { this.ShowAssetsHistory(); GUIUtility.ExitGUI(); } } else if (current.button == 1) { GUIUtility.hotControl = 0; r = new Rect(current.mousePosition.x, current.mousePosition.y, 1f, 1f); EditorUtility.DisplayCustomMenu(r, this.m_DropDownMenuItems, -1, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null); } this.DoScroll(); current.Use(); } content.text = folder.files[j].name; content.image = InternalEditorUtility.GetIconForFile(folder.files[j].name); bool flag2 = (this.ChangeLogSelectionRev == this.m_Changesets[changesetIndex].changeset) && (this.m_ChangeLogSelectionGUID == folder.files[j].guid); if (item.boldAssets[index] && !flag2) { GUI.Label(r, string.Empty, ms_Style.ping); } if (Event.current.type == EventType.Repaint) { label.Draw(r, content, false, false, flag2, hasFocus); this.DrawBadge(r, folder.files[j].changeFlags, label, content, GUIClip.visibleRect.width - 150f); } r.y += this.m_RowHeight; } } if (index == num2) { break; } } finally { RectOffset offset3 = ms_Style.label.padding; offset3.left -= 0x10; RectOffset offset4 = ms_Style.boldLabel.padding; offset4.left -= 0x10; } } if (((index == num2) || (num2 >= item.totalLineCount)) && (item.collapsedItemCount != 0)) { r.x += 19f; if (GUI.Button(r, item.collapsedItemCount.ToString() + " more...", ms_Style.foldout)) { GUIUtility.keyboardControl = this.m_HistoryControlID; this.UncollapseListItem(ref item); } } }
public void DoDeletedItemsGUI(ASHistoryWindow parentWin, Rect theRect, GUIStyle s, float offset, float endOffset, bool focused) { Event current = Event.current; Texture2D texture = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName); offset += 3f; Rect position1 = new Rect(this.m_Indent, offset, theRect.width - this.m_Indent, ASHistoryFileView.m_RowHeight); if (current.type == EventType.MouseDown && position1.Contains(current.mousePosition)) { GUIUtility.keyboardControl = this.m_FileViewControlID; this.SelType = ASHistoryFileView.SelectionType.DeletedItemsRoot; this.ScrollToDeletedItem(-1); parentWin.DoLocalSelectionChange(); } position1.width -= position1.x; position1.x = 0.0f; GUIContent content = new GUIContent("Deleted Assets"); content.image = (Texture)texture; int baseIndent = (int)this.m_BaseIndent; s.padding.left = baseIndent; if (current.type == EventType.Repaint) { s.Draw(position1, content, false, false, this.SelType == ASHistoryFileView.SelectionType.DeletedItemsRoot, focused); } Rect position2 = new Rect(this.m_BaseIndent - this.m_FoldoutSize, offset, this.m_FoldoutSize, ASHistoryFileView.m_RowHeight); if (!this.m_DeletedItemsInitialized || this.m_DelPVstate.lv.totalRows != 0) { this.DeletedItemsToggle = GUI.Toggle(position2, this.DeletedItemsToggle, GUIContent.none, ASHistoryFileView.ms_Styles.foldout); } offset += ASHistoryFileView.m_RowHeight; if (!this.DeletedItemsToggle) { return; } int row = this.m_DelPVstate.lv.row; int index1 = 0; int folder1 = -1; int file = -1; int index2 = 0; while ((double)offset <= (double)endOffset && index2 < this.m_DelPVstate.lv.totalRows) { if ((double)offset + (double)ASHistoryFileView.m_RowHeight >= 0.0) { if (folder1 == -1) { this.m_DelPVstate.IndexToFolderAndFile(index2, ref folder1, ref file); } position1 = new Rect(0.0f, offset, (float)Screen.width, ASHistoryFileView.m_RowHeight); ParentViewFolder folder2 = this.m_DelPVstate.folders[folder1]; if (current.type == EventType.MouseDown && position1.Contains(current.mousePosition)) { if (current.button != 1 || this.SelType != ASHistoryFileView.SelectionType.DeletedItems || !this.m_DelPVstate.selectedItems[index1]) { GUIUtility.keyboardControl = this.m_FileViewControlID; this.SelType = ASHistoryFileView.SelectionType.DeletedItems; this.m_DelPVstate.lv.row = index1; ListViewShared.MultiSelection((ListViewShared.InternalListViewState)null, row, this.m_DelPVstate.lv.row, ref this.m_DelPVstate.initialSelectedItem, ref this.m_DelPVstate.selectedItems); this.ScrollToDeletedItem(index1); parentWin.DoLocalSelectionChange(); } if (current.button == 1 && this.SelType == ASHistoryFileView.SelectionType.DeletedItems) { GUIUtility.hotControl = 0; EditorUtility.DisplayCustomMenu(new Rect(current.mousePosition.x, current.mousePosition.y, 1f, 1f), this.dropDownMenuItems, -1, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), (object)null); } Event.current.Use(); } int num; if (file != -1) { content.text = folder2.files[file].name; content.image = (Texture)InternalEditorUtility.GetIconForFile(folder2.files[file].name); num = (int)((double)this.m_BaseIndent + (double)this.m_Indent * 2.0); } else { content.text = folder2.name; content.image = (Texture)texture; num = (int)((double)this.m_BaseIndent + (double)this.m_Indent); } s.padding.left = num; if (Event.current.type == EventType.Repaint) { s.Draw(position1, content, false, false, this.m_DelPVstate.selectedItems[index1], focused); } this.m_DelPVstate.NextFileFolder(ref folder1, ref file); ++index1; } ++index2; offset += ASHistoryFileView.m_RowHeight; } }
private static int FolderSelectionIndexFromGUID(ParentViewFolder[] folders, string guid) { int num = 0; for (int index = 0; index < folders.Length; ++index) { if (guid == folders[index].guid) return num; num += 1 + folders[index].files.Length; } return -1; }
internal static int CompareViewFolder(ParentViewFolder p1, ParentViewFolder p2) { return(string.Compare(p1.name, p2.name, true)); }
private static int IndexOfFolderWithGUID(ParentViewFolder[] folders, string guid) { for (int index = 0; index < folders.Length; ++index) { if (folders[index].guid == guid) return index; } return -1; }
internal static int CompareViewFolder(ParentViewFolder p1, ParentViewFolder p2) { return string.Compare(p1.name, p2.name, true); }
public void UpdateGUI() { SplitterGUILayout.BeginHorizontalSplit(this.horSplit); GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]); GUILayout.Label(this.totalUpdates, this.constants.title, new GUILayoutOption[0]); foreach (ListViewElement listViewElement in ListViewGUILayout.ListView(this.lv, GUIStyle.none)) { Rect position = listViewElement.position; ++position.x; ++position.y; if (Event.current.type == EventType.Repaint) { if (listViewElement.row % 2 == 0) { this.constants.entryEven.Draw(position, false, false, false, false); } else { this.constants.entryOdd.Draw(position, false, false, false, false); } } GUILayout.BeginVertical(listViewElement.row != this.lv.row ? this.constants.entryNormal : this.constants.entrySelected, new GUILayoutOption[0]); GUILayout.Label(this.messageFirstLines[listViewElement.row], this.constants.serverUpdateLog, new GUILayoutOption[1] { GUILayout.MinWidth(50f) }); GUILayout.BeginHorizontal(); GUILayout.Label(this.changesets[listViewElement.row].changeset.ToString() + " " + this.changesets[listViewElement.row].date, this.constants.serverUpdateInfo, new GUILayoutOption[1] { GUILayout.MinWidth(100f) }); GUILayout.Label(this.changesets[listViewElement.row].owner, this.constants.serverUpdateInfo, new GUILayoutOption[1] { GUILayout.Width((float)this.maxNickLength) }); GUILayout.EndHorizontal(); GUILayout.EndVertical(); } if (this.lv.selectionChanged) { this.SetSelectedRevisionLine(this.lv.row); } GUILayout.EndVertical(); SplitterGUILayout.BeginVerticalSplit(this.vertSplit); GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]); GUILayout.Label("Changeset", this.constants.title, new GUILayoutOption[0]); int folder1 = -1; int file = -1; foreach (ListViewElement listViewElement in ListViewGUILayout.ListView(this.pv.lv, GUIStyle.none)) { if (folder1 == -1 && !this.pv.IndexToFolderAndFile(listViewElement.row, ref folder1, ref file)) { return; } ParentViewFolder folder2 = this.pv.folders[folder1]; if (ListViewGUILayout.HasMouseDown(listViewElement.position)) { if (Event.current.clickCount == 2) { if (!this.isDirSelected && this.selectedGUID != string.Empty) { this.DoShowDiff(false); GUIUtility.ExitGUI(); } } else { this.pv.lv.scrollPos = ListViewShared.ListViewScrollToRow((ListViewShared.InternalListViewState) this.pv.lv.ilvState, listViewElement.row); this.DoSelect(folder1, file, listViewElement.row); } } else if (ListViewGUILayout.HasMouseDown(listViewElement.position, 1)) { if (this.lv.row != listViewElement.row) { this.DoSelect(folder1, file, listViewElement.row); } if (!this.isDirSelected && this.selectedGUID != string.Empty) { GUIUtility.hotControl = 0; EditorUtility.DisplayCustomMenu(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 1f, 1f), this.dropDownMenuItems, (int[])null, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), (object)null); Event.current.Use(); } } if (listViewElement.row == this.pv.lv.row && Event.current.type == EventType.Repaint) { this.constants.entrySelected.Draw(listViewElement.position, false, false, false, false); } ChangeFlags changeFlags; if (file != -1) { Texture2D texture2D = AssetDatabase.GetCachedIcon(folder2.name + "/" + folder2.files[file].name) as Texture2D; if ((UnityEngine.Object)texture2D == (UnityEngine.Object)null) { texture2D = InternalEditorUtility.GetIconForFile(folder2.files[file].name); } GUILayout.Label(new GUIContent(folder2.files[file].name, (Texture)texture2D), this.constants.element, new GUILayoutOption[0]); changeFlags = folder2.files[file].changeFlags; } else { GUILayout.Label(folder2.name, this.constants.header, new GUILayoutOption[0]); changeFlags = folder2.changeFlags; } GUIContent content = (GUIContent)null; if (this.HasFlag(changeFlags, ChangeFlags.Undeleted) || this.HasFlag(changeFlags, ChangeFlags.Created)) { content = ASMainWindow.constants.badgeNew; } else if (this.HasFlag(changeFlags, ChangeFlags.Deleted)) { content = ASMainWindow.constants.badgeDelete; } else if (this.HasFlag(changeFlags, ChangeFlags.Renamed) || this.HasFlag(changeFlags, ChangeFlags.Moved)) { content = ASMainWindow.constants.badgeMove; } if (content != null && Event.current.type == EventType.Repaint) { Rect position = new Rect((float)((double)listViewElement.position.x + (double)listViewElement.position.width - (double)content.image.width - 5.0), listViewElement.position.y + listViewElement.position.height / 2f - (float)(content.image.height / 2), (float)content.image.width, (float)content.image.height); EditorGUIUtility.SetIconSize(Vector2.zero); GUIStyle.none.Draw(position, content, false, false, false, false); EditorGUIUtility.SetIconSize(this.iconSize); } this.pv.NextFileFolder(ref folder1, ref file); } if (this.pv.lv.selectionChanged && this.selectedGUID != string.Empty) { if (this.selectedGUID != AssetServer.GetRootGUID()) { AssetServer.SetSelectionFromGUID(this.selectedGUID); } else { AssetServer.SetSelectionFromGUID(string.Empty); } } if (GUIUtility.keyboardControl == this.pv.lv.ID && Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Return && !this.isDirSelected) && this.selectedGUID != string.Empty) { this.DoShowDiff(false); GUIUtility.ExitGUI(); } GUILayout.EndVertical(); GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]); GUILayout.Label("Update Message", this.constants.title, new GUILayoutOption[0]); GUILayout.TextArea(this.lv.row < 0 ? string.Empty : this.changesets[this.lv.row].message, this.constants.wwText, new GUILayoutOption[0]); GUILayout.EndVertical(); SplitterGUILayout.EndVerticalSplit(); SplitterGUILayout.EndHorizontalSplit(); }
private static int FolderIndexToTotalIndex(ParentViewFolder[] folders, int folderIndex) { int num = 0; for (int i = 0; i < folderIndex; i++) { num += folders[i].files.Length + 1; } return num; }
private void AddAssetItem(string guid, string pathName, bool isDir, ChangeFlags changeFlags, int changeset) { if (pathName == string.Empty) { return; } if (isDir) { string text = ParentViewFolder.MakeNiceName(pathName); int num = ParentViewState.IndexOf(this.folders, text); if (num == -1) { ParentViewFolder item = new ParentViewFolder(text, guid, changeFlags); ArrayUtility.Add<ParentViewFolder>(ref this.folders, item); } else { this.folders[num].changeFlags = changeFlags; this.folders[num].guid = guid; } } else { string text2 = ParentViewFolder.MakeNiceName(FileUtil.DeleteLastPathNameComponent(pathName)); string text3 = pathName.Substring(pathName.LastIndexOf("/") + 1); int num2 = ParentViewState.IndexOf(this.folders, text2); ParentViewFolder parentViewFolder; if (num2 == -1) { parentViewFolder = new ParentViewFolder(text2, AssetServer.GetParentGUID(guid, changeset)); ArrayUtility.Add<ParentViewFolder>(ref this.folders, parentViewFolder); } else { parentViewFolder = this.folders[num2]; } num2 = ParentViewState.IndexOf(parentViewFolder.files, text3); if (num2 != -1) { if ((parentViewFolder.files[num2].changeFlags & ChangeFlags.Deleted) == ChangeFlags.None) { parentViewFolder.files[num2].guid = guid; parentViewFolder.files[num2].changeFlags = changeFlags; } return; } ArrayUtility.Add<ParentViewFile>(ref parentViewFolder.files, new ParentViewFile(text3, guid, changeFlags)); } }
public void DoDeletedItemsGUI(ASHistoryWindow parentWin, Rect theRect, GUIStyle s, float offset, float endOffset, bool focused) { Event current = Event.current; Texture2D textured = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName); offset += 3f; Rect position = new Rect(this.m_Indent, offset, theRect.width - this.m_Indent, m_RowHeight); if ((current.type == EventType.MouseDown) && position.Contains(current.mousePosition)) { GUIUtility.keyboardControl = this.m_FileViewControlID; this.SelType = SelectionType.DeletedItemsRoot; this.ScrollToDeletedItem(-1); parentWin.DoLocalSelectionChange(); } position.width -= position.x; position.x = 0f; GUIContent content = new GUIContent("Deleted Assets") { image = textured }; int baseIndent = (int)this.m_BaseIndent; s.padding.left = baseIndent; if (current.type == EventType.Repaint) { s.Draw(position, content, false, false, this.SelType == SelectionType.DeletedItemsRoot, focused); } Rect rect2 = new Rect(this.m_BaseIndent - this.m_FoldoutSize, offset, this.m_FoldoutSize, m_RowHeight); if (!this.m_DeletedItemsInitialized || (this.m_DelPVstate.lv.totalRows != 0)) { this.DeletedItemsToggle = GUI.Toggle(rect2, this.DeletedItemsToggle, GUIContent.none, ms_Styles.foldout); } offset += m_RowHeight; if (this.DeletedItemsToggle) { int row = this.m_DelPVstate.lv.row; int index = 0; int num4 = -1; int file = -1; int num6 = 0; while ((offset <= endOffset) && (num6 < this.m_DelPVstate.lv.totalRows)) { if ((offset + m_RowHeight) >= 0f) { if (num4 == -1) { this.m_DelPVstate.IndexToFolderAndFile(num6, ref num4, ref file); } position = new Rect(0f, offset, (float)Screen.width, m_RowHeight); ParentViewFolder folder = this.m_DelPVstate.folders[num4]; if ((current.type == EventType.MouseDown) && position.Contains(current.mousePosition)) { if (!(((current.button == 1) && (this.SelType == SelectionType.DeletedItems)) && this.m_DelPVstate.selectedItems[index])) { GUIUtility.keyboardControl = this.m_FileViewControlID; this.SelType = SelectionType.DeletedItems; this.m_DelPVstate.lv.row = index; ListViewShared.MultiSelection(null, row, this.m_DelPVstate.lv.row, ref this.m_DelPVstate.initialSelectedItem, ref this.m_DelPVstate.selectedItems); this.ScrollToDeletedItem(index); parentWin.DoLocalSelectionChange(); } if ((current.button == 1) && (this.SelType == SelectionType.DeletedItems)) { GUIUtility.hotControl = 0; Rect rect3 = new Rect(current.mousePosition.x, current.mousePosition.y, 1f, 1f); EditorUtility.DisplayCustomMenu(rect3, this.dropDownMenuItems, -1, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null); } Event.current.Use(); } if (file != -1) { content.text = folder.files[file].name; content.image = InternalEditorUtility.GetIconForFile(folder.files[file].name); baseIndent = (int)(this.m_BaseIndent + (this.m_Indent * 2f)); } else { content.text = folder.name; content.image = textured; baseIndent = (int)(this.m_BaseIndent + this.m_Indent); } s.padding.left = baseIndent; if (Event.current.type == EventType.Repaint) { s.Draw(position, content, false, false, this.m_DelPVstate.selectedItems[index], focused); } this.m_DelPVstate.NextFileFolder(ref num4, ref file); index++; } num6++; offset += m_RowHeight; } } }
public ASUpdateConflictResolveWindow(string[] conflicting) { this.downloadConflictsToResolve = 0; ArrayList arrayList = new ArrayList(); ArrayList arrayList2 = new ArrayList(); ArrayList arrayList3 = new ArrayList(); ArrayList arrayList4 = new ArrayList(); for (int i = 0; i < conflicting.Length; i++) { AssetStatus statusGUID = AssetServer.GetStatusGUID(conflicting[i]); if (statusGUID == AssetStatus.Conflict) { arrayList.Add(conflicting[i]); DownloadResolution downloadResolution = AssetServer.GetDownloadResolution(conflicting[i]); arrayList2.Add(downloadResolution); if (downloadResolution == DownloadResolution.Unresolved) { this.downloadConflictsToResolve++; } } if (AssetServer.GetPathNameConflict(conflicting[i]) != null && statusGUID != AssetStatus.ServerOnly) { arrayList4.Add(conflicting[i]); NameConflictResolution nameConflictResolution = AssetServer.GetNameConflictResolution(conflicting[i]); arrayList3.Add(nameConflictResolution); if (nameConflictResolution == NameConflictResolution.Unresolved) { this.downloadConflictsToResolve++; } } } this.downloadConflicts = (arrayList.ToArray(typeof(string)) as string[]); this.downloadResolutions = (arrayList2.ToArray(typeof(DownloadResolution)) as DownloadResolution[]); this.namingResolutions = (arrayList3.ToArray(typeof(NameConflictResolution)) as NameConflictResolution[]); this.nameConflicts = (arrayList4.ToArray(typeof(string)) as string[]); this.enableContinueButton = (this.downloadConflictsToResolve == 0); this.dConflictPaths = new string[this.downloadConflicts.Length]; this.deletionConflict = new bool[this.downloadConflicts.Length]; for (int j = 0; j < this.downloadConflicts.Length; j++) { if (AssetServer.HasDeletionConflict(this.downloadConflicts[j])) { this.dConflictPaths[j] = ParentViewFolder.MakeNiceName(AssetServer.GetDeletedItemPathAndName(this.downloadConflicts[j])); this.deletionConflict[j] = true; } else { this.dConflictPaths[j] = ParentViewFolder.MakeNiceName(AssetServer.GetAssetPathName(this.downloadConflicts[j])); this.deletionConflict[j] = false; } } this.dNamingPaths = new string[this.nameConflicts.Length]; for (int k = 0; k < this.nameConflicts.Length; k++) { this.dNamingPaths[k] = ParentViewFolder.MakeNiceName(AssetServer.GetAssetPathName(this.nameConflicts[k])); } this.showDownloadConflicts = (this.downloadConflicts.Length > 0); this.showNamingConflicts = (this.nameConflicts.Length > 0); this.lv1.totalRows = this.downloadConflicts.Length; this.lv2.totalRows = this.nameConflicts.Length; this.selectedLV1Items = new bool[this.downloadConflicts.Length]; this.selectedLV2Items = new bool[this.nameConflicts.Length]; this.DoSelectionChange(); }
private bool DoTransfer(ref ParentViewFolder[] foldersFrom, ref ParentViewFolder[] foldersTo, int folder, int file, ref List<string> guidsOfFoldersToRemove, bool leftToRight) { ParentViewFolder parentViewFolder1 = foldersFrom[folder]; ParentViewFolder parentViewFolder2 = (ParentViewFolder) null; string name = parentViewFolder1.name; bool flag1 = false; bool flag2 = false; if (file == -1) { this.AddFolderToRemove(ref guidsOfFoldersToRemove, foldersFrom[folder].guid); int index = ParentViewState.IndexOf(foldersTo, name); if (index != -1) { parentViewFolder2 = foldersTo[index]; ArrayUtility.AddRange<ParentViewFile>(ref parentViewFolder2.files, parentViewFolder1.files); } else { ArrayUtility.Add<ParentViewFolder>(ref foldersTo, parentViewFolder1); flag2 = true; flag1 = ASCommitWindow.HasFlag(parentViewFolder1.changeFlags, ChangeFlags.Deleted) ? this.TransferDeletedDependentParentFolders(ref guidsOfFoldersToRemove, parentViewFolder1.guid, leftToRight) : this.TransferDependentParentFolders(ref guidsOfFoldersToRemove, parentViewFolder1.guid, leftToRight); } } else { int index = ParentViewState.IndexOf(foldersTo, name); if (index == -1) { if (ASCommitWindow.HasFlag(parentViewFolder1.files[file].changeFlags, ChangeFlags.Deleted) && ASCommitWindow.HasFlag(parentViewFolder1.changeFlags, ChangeFlags.Deleted)) { ArrayUtility.Add<ParentViewFolder>(ref foldersTo, parentViewFolder1); this.AddFolderToRemove(ref guidsOfFoldersToRemove, parentViewFolder1.guid); index = foldersTo.Length - 1; if (!ASCommitWindow.AllFolderWouldBeMovedAnyway(!leftToRight ? this.pv2state : this.pv1state, parentViewFolder1.guid)) flag1 = true; flag1 |= this.TransferDeletedDependentParentFolders(ref guidsOfFoldersToRemove, parentViewFolder1.guid, leftToRight); } else { ArrayUtility.Add<ParentViewFolder>(ref foldersTo, parentViewFolder1.CloneWithoutFiles()); index = foldersTo.Length - 1; flag1 = this.TransferDependentParentFolders(ref guidsOfFoldersToRemove, parentViewFolder1.guid, leftToRight); } flag2 = true; } parentViewFolder2 = foldersTo[index]; ArrayUtility.Add<ParentViewFile>(ref parentViewFolder2.files, parentViewFolder1.files[file]); ArrayUtility.RemoveAt<ParentViewFile>(ref parentViewFolder1.files, file); if (parentViewFolder1.files.Length == 0) this.AddFolderToRemove(ref guidsOfFoldersToRemove, foldersFrom[folder].guid); } if (parentViewFolder2 != null) Array.Sort<ParentViewFile>(parentViewFolder2.files, new Comparison<ParentViewFile>(ParentViewState.CompareViewFile)); if (flag2) Array.Sort<ParentViewFolder>(foldersTo, new Comparison<ParentViewFolder>(ParentViewState.CompareViewFolder)); return flag1; }
private void AddAssetItem(string guid, string pathName, bool isDir, ChangeFlags changeFlags, int changeset) { if (pathName == string.Empty) return; if (isDir) { string str = ParentViewFolder.MakeNiceName(pathName); int index = ParentViewState.IndexOf(this.folders, str); if (index == -1) { ArrayUtility.Add<ParentViewFolder>(ref this.folders, new ParentViewFolder(str, guid, changeFlags)); } else { this.folders[index].changeFlags = changeFlags; this.folders[index].guid = guid; } } else { string str1 = ParentViewFolder.MakeNiceName(FileUtil.DeleteLastPathNameComponent(pathName)); string str2 = pathName.Substring(pathName.LastIndexOf("/") + 1); int index1 = ParentViewState.IndexOf(this.folders, str1); ParentViewFolder parentViewFolder; if (index1 == -1) { parentViewFolder = new ParentViewFolder(str1, AssetServer.GetParentGUID(guid, changeset)); ArrayUtility.Add<ParentViewFolder>(ref this.folders, parentViewFolder); } else parentViewFolder = this.folders[index1]; int index2 = ParentViewState.IndexOf(parentViewFolder.files, str2); if (index2 != -1) { if ((parentViewFolder.files[index2].changeFlags & ChangeFlags.Deleted) != ChangeFlags.None) return; parentViewFolder.files[index2].guid = guid; parentViewFolder.files[index2].changeFlags = changeFlags; } else ArrayUtility.Add<ParentViewFile>(ref parentViewFolder.files, new ParentViewFile(str2, guid, changeFlags)); } }
public ASUpdateConflictResolveWindow(string[] conflicting) { float[] relativeSizes = new float[] { 20f, 80f }; int[] minSizes = new int[] { 100, 100 }; this.lvHeaderSplit1 = new SplitterState(relativeSizes, minSizes, null); float[] singleArray2 = new float[] { 20f, 80f }; int[] numArray2 = new int[] { 100, 100 }; this.lvHeaderSplit2 = new SplitterState(singleArray2, numArray2, null); this.dropDownMenuItems = new string[] { "Compare", "Compare Binary" }; this.downloadConflicts = new string[0]; this.nameConflicts = new string[0]; this.dConflictPaths = new string[0]; this.dNamingPaths = new string[0]; this.downloadResolutions = new DownloadResolution[0]; this.namingResolutions = new NameConflictResolution[0]; this.enableMergeButton = true; this.iconSize = new Vector2(16f, 16f); this.downloadResolutionString = new string[] { "Unresolved", "Skip Asset", "Discard My Changes", "Ignore Server Changes", "Merge" }; this.namingResolutionString = new string[] { "Unresolved", "Rename Local Asset", "Rename Server Asset" }; this.downloadConflictsToResolve = 0; ArrayList list = new ArrayList(); ArrayList list2 = new ArrayList(); ArrayList list3 = new ArrayList(); ArrayList list4 = new ArrayList(); for (int i = 0; i < conflicting.Length; i++) { AssetStatus statusGUID = AssetServer.GetStatusGUID(conflicting[i]); if (statusGUID == AssetStatus.Conflict) { list.Add(conflicting[i]); DownloadResolution downloadResolution = AssetServer.GetDownloadResolution(conflicting[i]); list2.Add(downloadResolution); if (downloadResolution == DownloadResolution.Unresolved) { this.downloadConflictsToResolve++; } } if ((AssetServer.GetPathNameConflict(conflicting[i]) != null) && (statusGUID != AssetStatus.ServerOnly)) { list4.Add(conflicting[i]); NameConflictResolution nameConflictResolution = AssetServer.GetNameConflictResolution(conflicting[i]); list3.Add(nameConflictResolution); if (nameConflictResolution == NameConflictResolution.Unresolved) { this.downloadConflictsToResolve++; } } } this.downloadConflicts = list.ToArray(typeof(string)) as string[]; this.downloadResolutions = list2.ToArray(typeof(DownloadResolution)) as DownloadResolution[]; this.namingResolutions = list3.ToArray(typeof(NameConflictResolution)) as NameConflictResolution[]; this.nameConflicts = list4.ToArray(typeof(string)) as string[]; this.enableContinueButton = this.downloadConflictsToResolve == 0; this.dConflictPaths = new string[this.downloadConflicts.Length]; this.deletionConflict = new bool[this.downloadConflicts.Length]; for (int j = 0; j < this.downloadConflicts.Length; j++) { if (AssetServer.HasDeletionConflict(this.downloadConflicts[j])) { this.dConflictPaths[j] = ParentViewFolder.MakeNiceName(AssetServer.GetDeletedItemPathAndName(this.downloadConflicts[j])); this.deletionConflict[j] = true; } else { this.dConflictPaths[j] = ParentViewFolder.MakeNiceName(AssetServer.GetAssetPathName(this.downloadConflicts[j])); this.deletionConflict[j] = false; } } this.dNamingPaths = new string[this.nameConflicts.Length]; for (int k = 0; k < this.nameConflicts.Length; k++) { this.dNamingPaths[k] = ParentViewFolder.MakeNiceName(AssetServer.GetAssetPathName(this.nameConflicts[k])); } this.showDownloadConflicts = this.downloadConflicts.Length > 0; this.showNamingConflicts = this.nameConflicts.Length > 0; this.lv1.totalRows = this.downloadConflicts.Length; this.lv2.totalRows = this.nameConflicts.Length; this.selectedLV1Items = new bool[this.downloadConflicts.Length]; this.selectedLV2Items = new bool[this.nameConflicts.Length]; this.DoSelectionChange(); }
public void UpdateGUI() { SplitterGUILayout.BeginHorizontalSplit(this.horSplit, new GUILayoutOption[0]); GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]); GUILayout.Label(this.totalUpdates, this.constants.title, new GUILayoutOption[0]); IEnumerator enumerator = ListViewGUILayout.ListView(this.lv, GUIStyle.none, new GUILayoutOption[0]).GetEnumerator(); try { while (enumerator.MoveNext()) { ListViewElement current = (ListViewElement)enumerator.Current; Rect position = current.position; position.x++; position.y++; if (Event.current.type == EventType.Repaint) { if ((current.row % 2) == 0) { this.constants.entryEven.Draw(position, false, false, false, false); } else { this.constants.entryOdd.Draw(position, false, false, false, false); } } GUILayout.BeginVertical((current.row != this.lv.row) ? this.constants.entryNormal : this.constants.entrySelected, new GUILayoutOption[0]); GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinWidth(50f) }; GUILayout.Label(this.messageFirstLines[current.row], this.constants.serverUpdateLog, options); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.MinWidth(100f) }; GUILayout.Label(this.changesets[current.row].changeset.ToString() + " " + this.changesets[current.row].date, this.constants.serverUpdateInfo, optionArray2); GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.Width((float)this.maxNickLength) }; GUILayout.Label(this.changesets[current.row].owner, this.constants.serverUpdateInfo, optionArray3); GUILayout.EndHorizontal(); GUILayout.EndVertical(); } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } if (this.lv.selectionChanged) { this.SetSelectedRevisionLine(this.lv.row); } GUILayout.EndVertical(); SplitterGUILayout.BeginVerticalSplit(this.vertSplit, new GUILayoutOption[0]); GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]); GUILayout.Label("Changeset", this.constants.title, new GUILayoutOption[0]); int num = -1; int file = -1; IEnumerator enumerator2 = ListViewGUILayout.ListView(this.pv.lv, GUIStyle.none, new GUILayoutOption[0]).GetEnumerator(); try { while (enumerator2.MoveNext()) { ChangeFlags changeFlags; ListViewElement element2 = (ListViewElement)enumerator2.Current; if ((num == -1) && !this.pv.IndexToFolderAndFile(element2.row, ref num, ref file)) { return; } ParentViewFolder folder = this.pv.folders[num]; if (ListViewGUILayout.HasMouseDown(element2.position)) { if (Event.current.clickCount == 2) { if (!this.isDirSelected && (this.selectedGUID != string.Empty)) { this.DoShowDiff(false); GUIUtility.ExitGUI(); } } else { this.pv.lv.scrollPos = ListViewShared.ListViewScrollToRow(this.pv.lv.ilvState, element2.row); this.DoSelect(num, file, element2.row); } } else if (ListViewGUILayout.HasMouseDown(element2.position, 1)) { if (this.lv.row != element2.row) { this.DoSelect(num, file, element2.row); } if (!this.isDirSelected && (this.selectedGUID != string.Empty)) { GUIUtility.hotControl = 0; Rect rect2 = new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 1f, 1f); EditorUtility.DisplayCustomMenu(rect2, this.dropDownMenuItems, null, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null); Event.current.Use(); } } if ((element2.row == this.pv.lv.row) && (Event.current.type == EventType.Repaint)) { this.constants.entrySelected.Draw(element2.position, false, false, false, false); } if (file != -1) { Texture2D cachedIcon = AssetDatabase.GetCachedIcon(folder.name + "/" + folder.files[file].name) as Texture2D; if (cachedIcon == null) { cachedIcon = InternalEditorUtility.GetIconForFile(folder.files[file].name); } GUILayout.Label(new GUIContent(folder.files[file].name, cachedIcon), this.constants.element, new GUILayoutOption[0]); changeFlags = folder.files[file].changeFlags; } else { GUILayout.Label(folder.name, this.constants.header, new GUILayoutOption[0]); changeFlags = folder.changeFlags; } GUIContent badgeNew = null; if (this.HasFlag(changeFlags, ChangeFlags.Undeleted) || this.HasFlag(changeFlags, ChangeFlags.Created)) { badgeNew = ASMainWindow.constants.badgeNew; } else if (this.HasFlag(changeFlags, ChangeFlags.Deleted)) { badgeNew = ASMainWindow.constants.badgeDelete; } else if (this.HasFlag(changeFlags, ChangeFlags.Renamed) || this.HasFlag(changeFlags, ChangeFlags.Moved)) { badgeNew = ASMainWindow.constants.badgeMove; } if ((badgeNew != null) && (Event.current.type == EventType.Repaint)) { Rect rect3 = new Rect(((element2.position.x + element2.position.width) - badgeNew.image.width) - 5f, (element2.position.y + (element2.position.height / 2f)) - (badgeNew.image.height / 2), (float)badgeNew.image.width, (float)badgeNew.image.height); EditorGUIUtility.SetIconSize(Vector2.zero); GUIStyle.none.Draw(rect3, badgeNew, false, false, false, false); EditorGUIUtility.SetIconSize(this.iconSize); } this.pv.NextFileFolder(ref num, ref file); } } finally { IDisposable disposable2 = enumerator2 as IDisposable; if (disposable2 != null) { disposable2.Dispose(); } } if (this.pv.lv.selectionChanged && (this.selectedGUID != string.Empty)) { if (this.selectedGUID != AssetServer.GetRootGUID()) { AssetServer.SetSelectionFromGUID(this.selectedGUID); } else { AssetServer.SetSelectionFromGUID(string.Empty); } } if ((GUIUtility.keyboardControl == this.pv.lv.ID) && (((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.Return)) && (!this.isDirSelected && (this.selectedGUID != string.Empty)))) { this.DoShowDiff(false); GUIUtility.ExitGUI(); } GUILayout.EndVertical(); GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]); GUILayout.Label("Update Message", this.constants.title, new GUILayoutOption[0]); GUILayout.TextArea((this.lv.row < 0) ? "" : this.changesets[this.lv.row].message, this.constants.wwText, new GUILayoutOption[0]); GUILayout.EndVertical(); SplitterGUILayout.EndVerticalSplit(); SplitterGUILayout.EndHorizontalSplit(); }
private static int IndexOfFolderWithGUID(ParentViewFolder[] folders, string guid) { for (int i = 0; i < folders.Length; i++) { if (folders[i].guid == guid) { return i; } } return -1; }