BlogEngine.Core.Providers.BlogService.GetDirectory C# (CSharp) Méthode

GetDirectory() public static méthode

gets a directory by a basedirectory and a string array of sub path tree
public static GetDirectory ( Directory BaseDirectory ) : Directory
BaseDirectory Directory the base directory object
Résultat Directory
        public static Directory GetDirectory(Directory BaseDirectory, params string[] SubPath)
        {
            return FileSystemProvider.GetDirectory(BaseDirectory, SubPath);
        }

Same methods

BlogService::GetDirectory ( string VirtualPath ) : Directory

Usage Example

        /// <summary>
        /// The delete profile.
        /// </summary>
        /// <param name="profile">
        /// The profile.
        /// </param>
        public override void DeleteProfile(AuthorProfile profile)
        {
            var fileName = string.Format("{0}profiles{1}{2}.xml", GetFolder(profile.Blog), Path.DirectorySeparatorChar, profile.Id);

            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }

            if (AuthorProfile.Profiles.Contains(profile))
            {
                AuthorProfile.Profiles.Remove(profile);
            }

            // remove profile picture
            var dir = BlogService.GetDirectory("/avatars");

            foreach (var f in dir.Files)
            {
                var dot = f.Name.IndexOf(".");
                var img = dot > 0 ? f.Name.Substring(0, dot) : f.Name;
                if (profile.UserName == img)
                {
                    f.Delete();
                }
            }
        }