UnityEditor.ASMainWindow.DoCommitParentView C# (CSharp) Method

DoCommitParentView() private method

private DoCommitParentView ( ) : void
return void
        private void DoCommitParentView()
        {
            bool shift = Event.current.shift;
            bool actionKey = EditorGUI.actionKey;
            int row = this.pv.lv.row;
            int num2 = -1;
            int file = -1;
            bool flag3 = false;
            IEnumerator enumerator = ListViewGUILayout.ListView(this.pv.lv, constants.background, new GUILayoutOption[0]).GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    ChangeFlags changeFlags;
                    ListViewElement current = (ListViewElement) enumerator.Current;
                    if (((GUIUtility.keyboardControl == this.pv.lv.ID) && (Event.current.type == EventType.KeyDown)) && actionKey)
                    {
                        Event.current.Use();
                    }
                    if ((num2 == -1) && !this.pv.IndexToFolderAndFile(current.row, ref num2, ref file))
                    {
                        goto Label_0554;
                    }
                    ParentViewFolder folder = this.pv.folders[num2];
                    if (this.pv.selectedItems[current.row] && (Event.current.type == EventType.Repaint))
                    {
                        constants.entrySelected.Draw(current.position, false, false, false, false);
                    }
                    if (!this.committing)
                    {
                        if (ListViewGUILayout.HasMouseUp(current.position))
                        {
                            if (!shift && !actionKey)
                            {
                                flag3 |= ListViewGUILayout.MultiSelection(row, this.pv.lv.row, ref this.pv.initialSelectedItem, ref this.pv.selectedItems);
                            }
                        }
                        else if (ListViewGUILayout.HasMouseDown(current.position))
                        {
                            if (Event.current.clickCount == 2)
                            {
                                ASCommitWindow.DoShowDiff(ASCommitWindow.GetParentViewSelectedItems(this.pv, false, false), false);
                                GUIUtility.ExitGUI();
                            }
                            else
                            {
                                if ((!this.pv.selectedItems[current.row] || shift) || actionKey)
                                {
                                    flag3 |= ListViewGUILayout.MultiSelection(row, current.row, ref this.pv.initialSelectedItem, ref this.pv.selectedItems);
                                }
                                this.pv.selectedFile = file;
                                this.pv.selectedFolder = num2;
                                this.pv.lv.row = current.row;
                            }
                        }
                        else if (ListViewGUILayout.HasMouseDown(current.position, 1))
                        {
                            if (!this.pv.selectedItems[current.row])
                            {
                                flag3 = true;
                                this.pv.ClearSelection();
                                this.pv.selectedItems[current.row] = true;
                                this.pv.selectedFile = file;
                                this.pv.selectedFolder = num2;
                                this.pv.lv.row = current.row;
                            }
                            GUIUtility.hotControl = 0;
                            Rect position = new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 1f, 1f);
                            EditorUtility.DisplayCustomMenu(position, this.commitDropDownMenuItems, null, new EditorUtility.SelectMenuItemFunction(this.CommitContextMenuClick), null);
                            Event.current.Use();
                        }
                    }
                    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), constants.element, new GUILayoutOption[0]);
                        changeFlags = folder.files[file].changeFlags;
                    }
                    else
                    {
                        GUILayout.Label(folder.name, constants.header, new GUILayoutOption[0]);
                        changeFlags = folder.changeFlags;
                    }
                    GUIContent badgeNew = null;
                    if (this.HasFlag(changeFlags, ChangeFlags.Undeleted) || this.HasFlag(changeFlags, ChangeFlags.Created))
                    {
                        badgeNew = constants.badgeNew;
                    }
                    else if (this.HasFlag(changeFlags, ChangeFlags.Deleted))
                    {
                        badgeNew = constants.badgeDelete;
                    }
                    else if (this.HasFlag(changeFlags, ChangeFlags.Renamed) || this.HasFlag(changeFlags, ChangeFlags.Moved))
                    {
                        badgeNew = constants.badgeMove;
                    }
                    if ((badgeNew != null) && (Event.current.type == EventType.Repaint))
                    {
                        Rect rect2 = new Rect(((current.position.x + current.position.width) - badgeNew.image.width) - 5f, (current.position.y + (current.position.height / 2f)) - (badgeNew.image.height / 2), (float) badgeNew.image.width, (float) badgeNew.image.height);
                        EditorGUIUtility.SetIconSize(Vector2.zero);
                        GUIStyle.none.Draw(rect2, badgeNew, false, false, false, false);
                        EditorGUIUtility.SetIconSize(this.iconSize);
                    }
                    this.pv.NextFileFolder(ref num2, ref file);
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        Label_0554:
            if (!this.committing)
            {
                if (GUIUtility.keyboardControl == this.pv.lv.ID)
                {
                    if ((Event.current.type == EventType.ValidateCommand) && (Event.current.commandName == "SelectAll"))
                    {
                        Event.current.Use();
                    }
                    else if ((Event.current.type == EventType.ExecuteCommand) && (Event.current.commandName == "SelectAll"))
                    {
                        for (int i = 0; i < this.pv.selectedItems.Length; i++)
                        {
                            this.pv.selectedItems[i] = true;
                        }
                        flag3 = true;
                        Event.current.Use();
                    }
                }
                if (((GUIUtility.keyboardControl == this.pv.lv.ID) && !actionKey) && this.pv.lv.selectionChanged)
                {
                    flag3 |= ListViewGUILayout.MultiSelection(row, this.pv.lv.row, ref this.pv.initialSelectedItem, ref this.pv.selectedItems);
                    this.pv.IndexToFolderAndFile(this.pv.lv.row, ref this.pv.selectedFolder, ref this.pv.selectedFile);
                }
                if (this.pv.lv.selectionChanged || flag3)
                {
                    this.MySelectionToGlobalSelection();
                }
            }
        }