public ConfigDirectory(string path)
        {
            var info = FileSystemInfoExtensions.FromPath(path);

            if (info == null || !info.Exists)
            {
                throw new DirectoryNotFoundException();
            }
            if (!IsValid(info))
            {
                throw new InvalidConfigDirectoryException();
            }
            Directory = info;
        }
        public byte[] GetIconBytes(string fullName, IconSize size)
        {
            Icon icon = null;

            if (FileExists(fullName))
            {
                icon = Icon.ExtractAssociatedIcon(fullName);//FileSystemInfoExtensions.GetIcon(fullName, size);
            }
            else if (DirectoryExists(fullName))
            {
                icon = FileSystemInfoExtensions.GetIcon(fullName, size);
            }
            using (MemoryStream stream = new MemoryStream())
            {
                if (icon != null)
                {
                    Bitmap bitmap = icon.ToBitmap();
                    bitmap.Save(stream, ImageFormat.Png);
                }
                return(stream.ToArray());
            }
        }
Esempio n. 3
0
 protected virtual FileSystemInfo GetExportPath(string fullPath)
 {
     return(FileSystemInfoExtensions.GetExportPath(fullPath));
 }
 public DirectoryInfo FetchGameFolder()
 {
     return(FileSystemInfoExtensions.FromPath(
                XmlRoot.Element("configuration")?.Element("gameFolder")?.Value
                ));
 }
Esempio n. 5
0
        //Static methods
        public static T Create <T>(string path) where T : FileSystemItem
        {
            var info = FileSystemInfoExtensions.GetInfo(path);

            return(Create <T>(info));
        }
Esempio n. 6
0
        public static FileSystemItem Create(Type itemType, string path)
        {
            var info = FileSystemInfoExtensions.GetInfo(path);

            return(Create(itemType, info));
        }