コード例 #1
0
        /// <summary>
        /// Removes a custom folder using given data.
        /// </summary>
        internal static bool RemoveCustomFolder(FolderData data)
        {
            switch (data.DataType)
            {
            case FolderDataType.Path:
                return(pathBasedFoldersData.Remove(data.Path));

            case FolderDataType.Name:
                return(nameBasedFoldersData.Remove(data.Name));
            }

            return(false);
        }
コード例 #2
0
        /// <summary>
        /// Creates a custom folder using given data.
        /// </summary>
        internal static void CreateCustomFolder(FolderData data)
        {
            switch (data.DataType)
            {
            case FolderDataType.Path:
                pathBasedFoldersData[data.Path] = data;
                return;

            case FolderDataType.Name:
                nameBasedFoldersData[data.Name] = data;
                return;
            }
        }
コード例 #3
0
        /// <summary>
        /// Creates a custom folder using given data.
        /// </summary>
        /// <param name="data"></param>
        internal static void CreateCustomFolder(FolderData data)
        {
            //TODO: data overriding validation
            switch (data.DataType)
            {
            case FolderDataType.Path:
                //if (validationEnabled)
                pathBasedFoldersData[data.Path] = data;
                return;

            case FolderDataType.Name:
                nameBasedFoldersData[data.Name] = data;
                return;
            }
        }
コード例 #4
0
        /// <summary>
        /// Tries to retrive proper icon for given <see cref="FolderData"/> and <see cref="Rect"/>.
        /// </summary>
        private static bool TryGetFolderIcon(FolderData data, Rect labelRect, out Texture icon, out Rect rect)
        {
            var isSmallIcon = labelRect.width > labelRect.height;

            icon = isSmallIcon ? data.SmallIcon : data.LargeIcon;

            //skip rect-related calculations if there is no icon
            if (!icon)
            {
                rect = labelRect;
                return(false);
            }

            rect = isSmallIcon ? GetSmallIconRect(labelRect) : GetLargeIconRect(labelRect, true);
            return(true);
        }
コード例 #5
0
 public void RemoveCustomFolder(FolderData path)
 {
     customFolders?.Remove(path);
 }
コード例 #6
0
 public void RemoveCustomFolder(FolderData data)
 {
     customFolders?.Remove(data);
 }
コード例 #7
0
 /// <summary>
 /// Tries to retrive <see cref="FolderData"/> associated to given path.
 /// </summary>
 private static bool TryGetFolderData(string path, out FolderData data)
 {
     return(pathBasedFoldersData.TryGetValue(path, out data) || nameBasedFoldersData.TryGetValue(Path.GetFileName(path), out data));
 }