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()); } }
protected virtual FileSystemInfo GetExportPath(string fullPath) { return(FileSystemInfoExtensions.GetExportPath(fullPath)); }
public DirectoryInfo FetchGameFolder() { return(FileSystemInfoExtensions.FromPath( XmlRoot.Element("configuration")?.Element("gameFolder")?.Value )); }
//Static methods public static T Create <T>(string path) where T : FileSystemItem { var info = FileSystemInfoExtensions.GetInfo(path); return(Create <T>(info)); }
public static FileSystemItem Create(Type itemType, string path) { var info = FileSystemInfoExtensions.GetInfo(path); return(Create(itemType, info)); }