Ejemplo n.º 1
0
 public FavoritePath(string name, string path, FavoritePathType type, string iconPath = null)
 {
     Name     = name;
     Path     = path;
     Type     = type;
     IconPath = iconPath;
 }
Ejemplo n.º 2
0
            public FavoritePaths GetFavorites(FavoritePathType type)
            {
                switch (type)
                {
                case FavoritePathType.Folders:
                    return(FavoriteFolders);

                case FavoritePathType.Icons:
                    return(FavoriteIcons);

                default:
                    throw new ArgumentOutOfRangeException(nameof(type), type, null);
                }
            }
Ejemplo n.º 3
0
        public static bool IsFile(this FavoritePathType type)
        {
            switch (type)
            {
            case FavoritePathType.Folders:
                return(false);

            case FavoritePathType.Icons:
                return(true);

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
Ejemplo n.º 4
0
        public static string GetNameFromPath(string path, FavoritePathType type)
        {
            switch (type)
            {
            case FavoritePathType.Folders:
                return(Paths.GetFileName(path));

            case FavoritePathType.Icons:
                return(Paths.GetFileNameWithoutExtension(path));

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
Ejemplo n.º 5
0
 public static string GetNameFromPath(this FavoritePathType type, string path)
 => type.IsFile()
         ? Paths.GetFileNameWithoutExtension(path)
         : Paths.GetFileName(path);
Ejemplo n.º 6
0
 public FavoritePath(string path, FavoritePathType type, string iconPath = null)
     : this(type.GetNameFromPath(path), path, type, iconPath)
 {
 }