public void ListFiles(FileSystemInfo fileinfo) { if (!fileinfo.Exists) return; DirectoryInfo dirinfo = fileinfo as DirectoryInfo; //if (dirinfo == null) return; //����Ŀ¼ FileSystemInfo[] files = dirinfo.GetFileSystemInfos(); for (int i = 0; i < files.Length; i++) //����Ŀ¼�������ļ�����Ŀ¼ { FileInfo file = files[i] as FileInfo; if (file != null) // ���ļ� { Document dot = new Document();//����һ���ĵ��������������� dot.Add(new Lucene.Net.Documents.Field("title", files[i].Name, Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.TOKENIZED));//���ĵ����ӽ�һ��field��,�ļ�����title�����ɷִʣ�TOKENIZED�� dot.Add(new Lucene.Net.Documents.Field("path", files[i].FullName, Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.UN_TOKENIZED));//���ĵ����ӽ�һ��field������·����path�������ɷִʣ�UN_TOKENIZED�� //����һ���洢�����ݡ�[contens]���� dot.Add(new Lucene.Net.Documents.Field("contents", new System.IO.StreamReader(files[i].FullName, System.Text.Encoding.Default))); writer.AddDocument(dot); Response.Write("<script type='text/javascript'>window.alert("+"��ǰд�������ĵ����ļ�Ϊ�� " + file.Name +")</script>"); } else //��Ŀ¼ { ListFiles(files[i]); //����Ŀ¼���еݹ���� } } }
public static void DeleteFileSystemInfo(FileSystemInfo fsi) { fsi.Attributes = FileAttributes.Normal; var di = fsi as DirectoryInfo; if (di != null) { foreach (var dirInfo in di.GetFileSystemInfos()) { DeleteFileSystemInfo(dirInfo); } } fsi.Delete(); }
///FILE SYSTEM INFO public TextRanker(Dictionary<int, List<string>> block_CSV_line_mapping, string dict_path, string pre_pop_path, string offset_map_path) { _blocks = block_CSV_line_mapping; _sorted_blocks = new Dictionary<int, List<string>>(); _dict_path = dict_path; _pre_pop_path = pre_pop_path; _dict_words = new Dictionary<string, int>(); _bad_block_features = new Dictionary<string, double>(); Read_dictionary(); Read_Prepop_image(); _chars_to_split_on = new string[] { "@", "!", "#", "$", "%", "&", "*", "(", ")", "-", "[", "]", ":", ";", "'", "?", ".", ",", " ", "\"" }; _bad_token_indicators = new string[] { "+", "=", "`", "~", "<", ">", "{", "}", "*", "\\", "_", "^", "/", "|" }; _block_scores = new Dictionary<int, double>(); _chunk_offset_filename_map_path = offset_map_path; _fso = new FileSystemInfo(_chunk_offset_filename_map_path); _fso.Get_filename_block_map(_blocks); }
public DxInfo(String p) { path = Path.GetFullPath(p); if( File.Exists(path) ) { type = FILE; info = new FileInfo(path); } else if( Directory.Exists(path) ) { info = new DirectoryInfo(path); type = DIRECTORY; /* Check wheather it is a DRIVE */ String[] drvs = Directory.GetLogicalDrives(); int pos = Array.BinarySearch(drvs,path.ToUpper()); if( pos >= 0 ) type = DRIVE; } else type = INVALID; }
public bool NameMatch([NotNull] FileSystemInfo file, bool useFullPath) => NameMatch(useFullPath ? file.FullName: file.Name);
private static void SetBlobMetadata(CloudBlob pageBlob, FileSystemInfo file) { Console.WriteLine("INFO: Reading metadata for file: " + file.Name); var headerFile = file.FullName.Replace("bin", "hdr"); var nullvalue = GetNullValue(file); foreach (var record in GetMetadata(file)) { if (record.Value == null) { continue; } pageBlob.Metadata[record.Key] = Uri.EscapeDataString(record.Value); } if (nullvalue != string.Empty) { pageBlob.Metadata["nullvalue"] = nullvalue; } foreach (var line in File.ReadLines(headerFile)) { var lineSplit = line.Split("="); switch (lineSplit[0].Trim()) { case "samples": pageBlob.Metadata["rowlength"] = lineSplit[1].Trim(); break; case "lines": pageBlob.Metadata["columnlength"] = lineSplit[1].Trim(); break; case "header offset": pageBlob.Metadata["headeroffset"] = lineSplit[1].Trim(); break; case "map info": var mapinfoSplit = lineSplit[1].Trim().Split(","); pageBlob.Metadata["minx"] = mapinfoSplit[3].Trim(); pageBlob.Metadata["maxy"] = mapinfoSplit[4].Trim(); pageBlob.Metadata["resolution"] = mapinfoSplit[5].Trim(); pageBlob.Metadata["crs"] = mapinfoSplit[7].Replace("{", "").Replace("}", ""); break; case "data type": switch (lineSplit[1].Trim()) { case "1": case "2": case "4": pageBlob.Metadata["valuelength"] = lineSplit[1].Trim(); break; case "5": pageBlob.Metadata["valuelength"] = "8"; break; } break; } } pageBlob.Metadata["maxx"] = (ParseHeaderDouble(pageBlob.Metadata["minx"]) + ParseHeaderDouble(pageBlob.Metadata["resolution"]) * ParseHeaderDouble(pageBlob.Metadata["rowlength"])).ToString(CultureInfo.InvariantCulture); pageBlob.Metadata["miny"] = (ParseHeaderDouble(pageBlob.Metadata["maxy"]) - ParseHeaderDouble(pageBlob.Metadata["resolution"]) * ParseHeaderDouble(pageBlob.Metadata["columnlength"])).ToString(CultureInfo.InvariantCulture); var description = PagesFetcher.Get(pageBlob.Name); if (description != null) { pageBlob.Metadata["article"] = description; } pageBlob.SetMetadataAsync().Wait(); }
public static bool IsFile(this FileSystemInfo fileOrFolder) { return(fileOrFolder is FileInfo); }
void IFileSystemInfo.Delete() { FileSystemInfo.Delete(); }
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, Dictionary <string, string> options, string @namespace) { Encoding = Encoding.GetEncoding("iso-8859-15"); _littleEndian = true; options ??= GetDefaultOptions(); if (options.TryGetValue("debug", out string debugString)) { bool.TryParse(debugString, out _debug); } if (imagePlugin.Info.SectorSize < 512) { return(Errno.InvalidArgument); } AaruConsole.DebugWriteLine("Xbox FAT plugin", "Reading superblock"); byte[] sector = imagePlugin.ReadSector(partition.Start); _superblock = Marshal.ByteArrayToStructureLittleEndian <Superblock>(sector); if (_superblock.magic == FATX_CIGAM) { _superblock = Marshal.ByteArrayToStructureBigEndian <Superblock>(sector); _littleEndian = false; } if (_superblock.magic != FATX_MAGIC) { return(Errno.InvalidArgument); } AaruConsole.DebugWriteLine("Xbox FAT plugin", _littleEndian ? "Filesystem is little endian" : "Filesystem is big endian"); int logicalSectorsPerPhysicalSectors = partition.Offset == 0 && _littleEndian ? 8 : 1; AaruConsole.DebugWriteLine("Xbox FAT plugin", "logicalSectorsPerPhysicalSectors = {0}", logicalSectorsPerPhysicalSectors); string volumeLabel = StringHandlers.CToString(_superblock.volumeLabel, !_littleEndian ? Encoding.BigEndianUnicode : Encoding.Unicode, true); XmlFsType = new FileSystemType { Type = "FATX filesystem", ClusterSize = (uint)(_superblock.sectorsPerCluster * logicalSectorsPerPhysicalSectors * imagePlugin.Info.SectorSize), VolumeName = volumeLabel, VolumeSerial = $"{_superblock.id:X8}" }; XmlFsType.Clusters = (((partition.End - partition.Start) + 1) * imagePlugin.Info.SectorSize) / XmlFsType.ClusterSize; _statfs = new FileSystemInfo { Blocks = XmlFsType.Clusters, FilenameLength = MAX_FILENAME, Files = 0, // Requires traversing all directories FreeFiles = 0, Id = { IsInt = true, Serial32 = _superblock.magic }, PluginId = Id, Type = _littleEndian ? "Xbox FAT" : "Xbox 360 FAT", FreeBlocks = 0 // Requires traversing the FAT }; AaruConsole.DebugWriteLine("Xbox FAT plugin", "XmlFsType.ClusterSize: {0}", XmlFsType.ClusterSize); AaruConsole.DebugWriteLine("Xbox FAT plugin", "XmlFsType.VolumeName: {0}", XmlFsType.VolumeName); AaruConsole.DebugWriteLine("Xbox FAT plugin", "XmlFsType.VolumeSerial: {0}", XmlFsType.VolumeSerial); AaruConsole.DebugWriteLine("Xbox FAT plugin", "stat.Blocks: {0}", _statfs.Blocks); AaruConsole.DebugWriteLine("Xbox FAT plugin", "stat.FilenameLength: {0}", _statfs.FilenameLength); AaruConsole.DebugWriteLine("Xbox FAT plugin", "stat.Id: {0}", _statfs.Id.Serial32); AaruConsole.DebugWriteLine("Xbox FAT plugin", "stat.Type: {0}", _statfs.Type); byte[] buffer; _fatStartSector = (FAT_START / imagePlugin.Info.SectorSize) + partition.Start; uint fatSize; AaruConsole.DebugWriteLine("Xbox FAT plugin", "fatStartSector: {0}", _fatStartSector); if (_statfs.Blocks > MAX_XFAT16_CLUSTERS) { AaruConsole.DebugWriteLine("Xbox FAT plugin", "Reading FAT32"); fatSize = (uint)(((_statfs.Blocks + 1) * sizeof(uint)) / imagePlugin.Info.SectorSize); if ((uint)(((_statfs.Blocks + 1) * sizeof(uint)) % imagePlugin.Info.SectorSize) > 0) { fatSize++; } long fatClusters = (fatSize * imagePlugin.Info.SectorSize) / 4096; if ((fatSize * imagePlugin.Info.SectorSize) % 4096 > 0) { fatClusters++; } fatSize = (uint)((fatClusters * 4096) / imagePlugin.Info.SectorSize); AaruConsole.DebugWriteLine("Xbox FAT plugin", "FAT is {0} sectors", fatSize); buffer = imagePlugin.ReadSectors(_fatStartSector, fatSize); AaruConsole.DebugWriteLine("Xbox FAT plugin", "Casting FAT"); _fat32 = MemoryMarshal.Cast <byte, uint>(buffer).ToArray(); if (!_littleEndian) { for (int i = 0; i < _fat32.Length; i++) { _fat32[i] = Swapping.Swap(_fat32[i]); } } AaruConsole.DebugWriteLine("Xbox FAT plugin", "fat32[0] == FATX32_ID = {0}", _fat32[0] == FATX32_ID); if (_fat32[0] != FATX32_ID) { return(Errno.InvalidArgument); } } else { AaruConsole.DebugWriteLine("Xbox FAT plugin", "Reading FAT16"); fatSize = (uint)(((_statfs.Blocks + 1) * sizeof(ushort)) / imagePlugin.Info.SectorSize); if ((uint)(((_statfs.Blocks + 1) * sizeof(ushort)) % imagePlugin.Info.SectorSize) > 0) { fatSize++; } long fatClusters = (fatSize * imagePlugin.Info.SectorSize) / 4096; if ((fatSize * imagePlugin.Info.SectorSize) % 4096 > 0) { fatClusters++; } fatSize = (uint)((fatClusters * 4096) / imagePlugin.Info.SectorSize); AaruConsole.DebugWriteLine("Xbox FAT plugin", "FAT is {0} sectors", fatSize); buffer = imagePlugin.ReadSectors(_fatStartSector, fatSize); AaruConsole.DebugWriteLine("Xbox FAT plugin", "Casting FAT"); _fat16 = MemoryMarshal.Cast <byte, ushort>(buffer).ToArray(); if (!_littleEndian) { for (int i = 0; i < _fat16.Length; i++) { _fat16[i] = Swapping.Swap(_fat16[i]); } } AaruConsole.DebugWriteLine("Xbox FAT plugin", "fat16[0] == FATX16_ID = {0}", _fat16[0] == FATX16_ID); if (_fat16[0] != FATX16_ID) { return(Errno.InvalidArgument); } } _sectorsPerCluster = (uint)(_superblock.sectorsPerCluster * logicalSectorsPerPhysicalSectors); _imagePlugin = imagePlugin; _firstClusterSector = _fatStartSector + fatSize; _bytesPerCluster = _sectorsPerCluster * imagePlugin.Info.SectorSize; AaruConsole.DebugWriteLine("Xbox FAT plugin", "sectorsPerCluster = {0}", _sectorsPerCluster); AaruConsole.DebugWriteLine("Xbox FAT plugin", "bytesPerCluster = {0}", _bytesPerCluster); AaruConsole.DebugWriteLine("Xbox FAT plugin", "firstClusterSector = {0}", _firstClusterSector); uint[] rootDirectoryClusters = GetClusters(_superblock.rootDirectoryCluster); if (rootDirectoryClusters is null) { return(Errno.InvalidArgument); } byte[] rootDirectoryBuffer = new byte[_bytesPerCluster * rootDirectoryClusters.Length]; AaruConsole.DebugWriteLine("Xbox FAT plugin", "Reading root directory"); for (int i = 0; i < rootDirectoryClusters.Length; i++) { buffer = imagePlugin.ReadSectors(_firstClusterSector + ((rootDirectoryClusters[i] - 1) * _sectorsPerCluster), _sectorsPerCluster); Array.Copy(buffer, 0, rootDirectoryBuffer, i * _bytesPerCluster, _bytesPerCluster); } _rootDirectory = new Dictionary <string, DirectoryEntry>(); int pos = 0; while (pos < rootDirectoryBuffer.Length) { DirectoryEntry entry = _littleEndian ? Marshal. ByteArrayToStructureLittleEndian <DirectoryEntry >(rootDirectoryBuffer, pos, Marshal.SizeOf <DirectoryEntry>()) : Marshal.ByteArrayToStructureBigEndian <DirectoryEntry>(rootDirectoryBuffer, pos, Marshal. SizeOf < DirectoryEntry >()); pos += Marshal.SizeOf <DirectoryEntry>(); if (entry.filenameSize == UNUSED_DIRENTRY || entry.filenameSize == FINISHED_DIRENTRY) { break; } if (entry.filenameSize == DELETED_DIRENTRY || entry.filenameSize > MAX_FILENAME) { continue; } string filename = Encoding.GetString(entry.filename, 0, entry.filenameSize); _rootDirectory.Add(filename, entry); } _cultureInfo = new CultureInfo("en-US", false); _directoryCache = new Dictionary <string, Dictionary <string, DirectoryEntry> >(); _mounted = true; return(Errno.NoError); }
private void ScanFilesInDirectory(DirectoryInfo directoryInfo, ref IList <ScannedFileInfo> searchedFiles) { if (null == directoryInfo || !directoryInfo.Exists) { return; } NewFoldersToMonitor.Add(directoryInfo); IList <ScannedFileInfo> fileList = new List <ScannedFileInfo>(); try { FileSystemInfo[] fileSystemInfos = directoryInfo.GetFileSystemInfos(); for (int i = 0; i < fileSystemInfos.Length; i++) { if (IsCancel) { break; } FileSystemInfo fileSystemInfo = fileSystemInfos[i]; if (null == fileSystemInfo) { continue; } if (fileSystemInfo is DirectoryInfo) { ScanFilesInDirectory(fileSystemInfo as DirectoryInfo, ref searchedFiles); } else { FileInfo fileInfo = fileSystemInfo as FileInfo; if (null != fileInfo) { ScannedFileInfo scannedFileInfo = new ScannedFileInfo() { File = fileInfo }; if (CheckMediaType(scannedFileInfo)) { //searchedFiles.Add(scannedFileInfo); fileList.Add(scannedFileInfo); NotifyEvent(new FileScannerProcessEventArgs(ProcessType.InProcess, InnerType.OneFileScanned) { CurrentFile = scannedFileInfo }); } } } } } catch (Exception e) { NLogger.LogHelper.UILogger.Debug("ScanFilesInDirectory", e); } finally { ((List <ScannedFileInfo>)searchedFiles).AddRange(fileList); NotifyEvent(new FileScannerProcessEventArgs(ProcessType.InProcess, InnerType.OneDirectoryScanned) { CurrentDir = directoryInfo, Files = fileList }); } }
public WriteDeniedException(FileSystemInfo info, Exception e) : base(info, e) { }
/// <summary> /// FileSystemInfo.Delete throws access denied if file or dir is read only. /// </summary> private static void ClearReadOnlyFlag(FileSystemInfo info) { info.Attributes = info.Attributes & ~FileAttributes.ReadOnly; }
//list files that are almost expired => antique - threshold public void RebuildCandidateList() { lock (locker) { try { if (Service.Break) { return; } EventLogger.Info("rebuilding list of old temp files"); long total_length = 0, candidate_length = 0; CandidateFiles.Clear(); CandidateDirectories.Clear(); DateTime now = DateTime.UtcNow; for (int i = 0; i < Profiles.Count; ++i) { if (Service.Break) { return; } DirectoryInfo di = new DirectoryInfo(Profiles[i]); if (!di.Exists) { continue; } try { foreach (var item in di.EnumerateFileSystemInfos("*", SearchOption.AllDirectories)) { if (Service.Break) { return; } try { long item_length = 0; string name = item.FullName; FileSystemInfo temp = null; bool isDir = item.IsDirectory(); if (isDir) { try { temp = new DirectoryInfo(name); } catch (PathTooLongException) { name = item.FullName.PrefixForLongNames(); } } else { try { item_length = new FileInfo(name).Length; } catch (PathTooLongException) { name = item.FullName.PrefixForLongNames(); try { item_length = new FileInfo(name).Length; } catch { } } } if (temp != null && !temp.Exists) { //use it just to avoid compiler optimizations on that code EventLogger.Warning("item does not exist: " + temp.FullName); } total_length += item_length; var span0 = now - item.CreationTimeUtc; var span1 = now - item.LastAccessTimeUtc; var span2 = now - item.LastWriteTimeUtc; if (span0 >= antique && span1 >= antique && span2 >= antique) { if (isDir) { CandidateDirectories.Add(name); } else { candidate_length += item_length; CandidateFiles.Add(name); } } } catch (Exception e) { EventLogger.Warning("exception when enumerating temporary files (item will be ignored)", e); } } } catch (Exception e) { EventLogger.Warning("exception when enumerating temporary folder (profile will be ignored)", e); } } CandidateDirectories.Sort((x, y) => { return(y.Length.CompareTo(x.Length)); }); EventLogger.Info( string.Format( "can potentially save {0} of a total of {1} in temporary files", ByteSuffixes.GetString(candidate_length), ByteSuffixes.GetString(total_length) )); } catch (Exception e) { EventLogger.Error("unexpected exception (enumerating)", e); } } }
public WriteDeniedException(FileSystemInfo info) : this(info, null) { }
/// <summary>Get whether a file or folder is relevant when deciding how to process a mod folder.</summary> /// <param name="entry">The file or folder.</param> private bool IsRelevant(FileSystemInfo entry) { return(!this.IgnoreFilesystemEntries.Any(p => p.IsMatch(entry.Name))); }
public static void Delete(FileSystemInfo file, bool b) { file.Delete(); }
private static string normalizePath_nocache(string requestPath, bool presumedDirectory) { try { string rc; string childName = Path.GetFileName(requestPath); if (string.IsNullOrEmpty(childName)) { // absPath was a "root" (MSDOS drive letter) // by fiat, drive letters are uppercase. rc = requestPath.ToUpper(CultureInfo.InvariantCulture) + Path.DirectorySeparatorChar; } else { string parentPath = Path.GetDirectoryName(requestPath); // Recurse to handle parent prefix: string normalizedParent = normalizePath_nocache(parentPath, true); DirectoryInfo parentDirectoryInfo = new DirectoryInfo(normalizedParent); FileSystemInfo[] childrenFileSystemInfos = null; string normalizedPath; try { childrenFileSystemInfos = parentDirectoryInfo.GetFileSystemInfos(childName); } catch (System.IO.DirectoryNotFoundException) { // Fall through and assume we're to create it. } if (childrenFileSystemInfos == null || childrenFileSystemInfos.Length == 0) { // Looks like a nonexistent path. I guess the caller gets to decide the // capitalization. NB this is fraught with danger, since we're not actually // creating the path in the filesystem, so someone else might try to create // a path with a different capitalization. However, if we memorize our // results, we should end up canonicalizing to the first capitalization // we see. normalizedPath = Path.Combine(normalizedParent, childName); if (!Directory.Exists(normalizedPath) && !File.Exists(normalizedPath) && !childName.Contains(".")) { // Console.WriteLine("normalized + child (pathNorm 90) " + normalizedPath ); Directory.CreateDirectory(normalizedPath); } // Unfortunately, we can't tell whether we should add a path separator here! if (presumedDirectory) { normalizedPath += Path.DirectorySeparatorChar; } } else { FileSystemInfo childFileSystemInfo = childrenFileSystemInfos.First(); // Since we passed a normalized path into DirectoryInfo, we'll get // the normalized path back out, plus the filesystem's idea of the // child name's case. normalizedPath = childFileSystemInfo.FullName; if ((childFileSystemInfo.Attributes & FileAttributes.Directory) == FileAttributes.Directory) { normalizedPath += Path.DirectorySeparatorChar; } } rc = normalizedPath; } ////Logger.WriteLine(string.Format("{0}\n => {1}", requestPath, rc)); return(rc); } catch (Exception ex) { Trace.TraceError(ex.Message); throw new ArgumentException("invalid path " + requestPath + " :: " + ex.Message + "\n"); } }
public static void ToCsv(this DataTable table, string delimiter, bool includeHeader, FileSystemInfo file) { file.ShouldNotBeNull(); StringBuilder result = new StringBuilder(); if (includeHeader) { foreach (DataColumn column in table.Columns) { result.Append(column.ColumnName); result.Append(delimiter); } result.Remove(--result.Length, 0); result.Append(Environment.NewLine); } foreach (DataRow row in table.Rows) { foreach (object item in row.ItemArray) { if (item is DBNull) { result.Append(delimiter); } else { string itemAsString = item.ToString(); // Double up all embedded double quotes itemAsString = itemAsString.Replace("\"", "\"\""); // To keep things simple, always delimit with double-quotes // so we don't have to determine in which cases they're necessary // and which cases they're not. itemAsString = "\"" + itemAsString + "\""; result.Append(itemAsString + delimiter); } } result.Remove(--result.Length, 0); result.Append(Environment.NewLine); } using (StreamWriter writer = new StreamWriter(file.FullName, true)) { writer.Write(result.ToString()); } }
public static FileAdapter ShouldBeAFile(this FileSystemInfo fileSystemInfo, FileSystemRunner runner) { return(new FileAdapter(fileSystemInfo.FullName, runner)); }
public NfsDirectory(FileSystemInfo fsInfo) { _fsInfo = fsInfo; }
public static DirectoryAdapter ShouldBeADirectory(this FileSystemInfo fileSystemInfo, FileSystemRunner runner) { return(new DirectoryAdapter(fileSystemInfo.FullName, runner)); }
/// <summary> /// Default consrtructor that gives full control over the tree srtucture /// </summary> /// <param name="parentFileSystemTreeElement">Parent FileSystemTreeElement</param> /// <param name="node">A elementInfo object in the directory tree that describes a folder and its associated files</param> /// <param name="childElements">A collection of <see cref="FileSystemTreeElement"/>s describing the subdirectories contained by this elementInfo object</param> public FileSystemTreeElement(FileSystemTreeElement parentFileSystemTreeElement, FileSystemInfo fileSystemElementInfo, IEnumerable <FileSystemTreeElement> childElements) : this() { this.ParentFileSystemTreeElement = parentFileSystemTreeElement; this.ElementInfo = fileSystemElementInfo; this.ChildFileSystemTreeElements = new ObservableCollection <FileSystemTreeElement>(childElements); this.isExpanded = false; this.isSelected = false; }
static void far() { //for(int i = 0;i < ) Console.CursorVisible = false; Stack<FileSystemInfo[]> parent = new Stack<FileSystemInfo[]>(); Stack<int> indexhist = new Stack<int>(); string[] drives = Environment.GetLogicalDrives(); FileSystemInfo[] cur = new FileSystemInfo[drives.Length]; for (int i = 0; i < cur.Length; i++) cur[i] = new DirectoryInfo(drives[i]); int index = 0; Show(cur, index); String moveString = "", moveName = "", moveStringTo = "", copyName = "", copyString = "", copyStringTo = ""; int k = 1; ConsoleKeyInfo pressed = Console.ReadKey(true); while (pressed.Key != ConsoleKey.Escape) { switch (pressed.Key) { case ConsoleKey.F2: { String pathString = cur[index].FullName; pathString = pathString.Substring(0, pathString.Length - cur[index].Name.Length); Console.Clear(); Console.WriteLine("Write the new File or Directory name"); string newName = Console.ReadLine(); try { Directory.Move(cur[index].FullName, pathString + newName); } catch { File.Move(cur[index].FullName, pathString + newName); } DirectoryInfo dir = parent.First()[indexhist.First()] as DirectoryInfo; cur = dir.GetFileSystemInfos(); } break; case ConsoleKey.F4: { Console.Clear(); Console.WriteLine("Write Directory Name: "); Console.CursorVisible = true; String newDirectory = Console.ReadLine(); String pathCreate = cur[index].FullName; pathCreate = pathCreate.Substring(0, pathCreate.Length - cur[index].Name.Length); string pathString = Path.Combine(pathCreate, newDirectory); Directory.CreateDirectory(pathString); DirectoryInfo dir = parent.First()[indexhist.First()] as DirectoryInfo; cur = dir.GetFileSystemInfos(); } break; case ConsoleKey.F5: { Console.Clear(); Console.WriteLine("Write File Name: "); Console.CursorVisible = true; String newFile = Console.ReadLine(); String pathCreate = cur[index].FullName; pathCreate = pathCreate.Substring(0, pathCreate.Length - cur[index].Name.Length); string pathString = Path.Combine(pathCreate, newFile); File.Create(pathString); DirectoryInfo dir = parent.First()[indexhist.First()] as DirectoryInfo; cur = dir.GetFileSystemInfos(); } break; case ConsoleKey.M: { moveString = cur[index].FullName; moveName = cur[index].Name; } break; case ConsoleKey.T: if (moveString.Length != 0) { moveStringTo = cur[index].FullName; moveStringTo = moveStringTo.Substring(0, moveStringTo.Length - cur[index].Name.Length); moveStringTo += moveName; try { Directory.Move(moveString, moveStringTo); } catch { File.Move(moveString, moveStringTo); } moveString = ""; moveStringTo = ""; DirectoryInfo dir = parent.First()[indexhist.First()] as DirectoryInfo; cur = dir.GetFileSystemInfos(); } break; case ConsoleKey.C: { copyName = cur[index].Name; copyString = cur[index].FullName; } break; case ConsoleKey.V: { copyStringTo = cur[index].FullName; copyStringTo = copyStringTo.Substring(0, copyStringTo.Length - cur[index].Name.Length); copyStringTo += copyName; if (copyString != copyStringTo) { File.Copy(copyString, copyStringTo); } else { copyStringTo += " (" + k + ")"; k++; File.Copy(copyString, copyStringTo); } //Show(cur, index); DirectoryInfo dir = parent.First()[indexhist.First()] as DirectoryInfo; cur = dir.GetFileSystemInfos(); } break; case ConsoleKey.Delete: { try { File.Delete(cur[index].FullName); } catch { Directory.Delete(cur[index].FullName); } DirectoryInfo dir = parent.First()[indexhist.First()] as DirectoryInfo; cur = dir.GetFileSystemInfos(); //File.Delete(cur[index].FullName) || Directory.Delete(cur[index].FullName); k = 1; } break; case ConsoleKey.DownArrow: if (cur.Length > index + 1) index++; else index = 0; break; case ConsoleKey.UpArrow: if (index > 0) { index--; } else index = cur.Length - 1; break; case ConsoleKey.LeftArrow: if (parent.Count > 0) { index = indexhist.Pop(); cur = parent.Pop(); } break; case ConsoleKey.O: { try { Bitmap m = new Bitmap(cur[index].FullName); ConsoleWriteImage(m); Console.ReadKey(); Console.WriteLine("Graphics in console window!"); Point location = new Point(10, 10); Size imageSize = new Size(20, 10); } catch (Exception e) { } } break; case ConsoleKey.RightArrow: if (cur[index] is DirectoryInfo) { try { DirectoryInfo dire = cur[index] as DirectoryInfo; indexhist.Push(index); parent.Push(cur); index = 0; cur = dire.GetFileSystemInfos(); } catch (Exception e) { } } else Process.Start(cur[index].FullName); break; case ConsoleKey.Enter: Process.Start(cur[index].FullName); break; } Show(cur, index); pressed = Console.ReadKey(true); } }
/// <summary> /// Create a list of tree nodes to display in the folderTreeView /// It recursive track all files and folders stored in CodesPath /// </summary> /// <param name="background">True to run the loading process as a separate thread</param> public void LoadCodeFolder(object background) { //go to background if (!IsReady) { return; } if ((bool)background) { System.Threading.ThreadPool.QueueUserWorkItem(LoadCodeFolder, false); return; } IsReady = false; try { //get code path string path = RegistryAccess.CodesPath; if (path == null || !Directory.Exists(path)) { return; } this.BeginInvoke((MethodInvoker) delegate { selectDirectoryPanel.Visible = false; folderTreeView.UseWaitCursor = true; }); //list of new tree nodes List <TreeNode> parent = new List <TreeNode>(); //top level folders foreach (string folder in Directory.GetDirectories(path)) { DirectoryInfo difo = new DirectoryInfo(folder); //if (difo.Name.StartsWith(".")) continue; TreeNode nod = AddTreeNode(difo); if (nod != null) { AddChildNodes(nod); parent.Add(nod); } } //top level files foreach (string file in Directory.GetFiles(path)) { FileInfo fifo = new FileInfo(file); //if (fifo.Name.StartsWith(".")) continue; TreeNode nod = AddTreeNode(fifo); if (nod != null) { parent.Add(nod); } } //add codes if (this.IsDisposed || folderTreeView.IsDisposed) { return; } this.BeginInvoke((MethodInvoker) delegate { FileSystemInfo last = null; if (folderTreeView.SelectedNode != null) { last = (FileSystemInfo)folderTreeView.SelectedNode.Tag; } folderTreeView.BeginUpdate(); folderTreeView.Sort(); folderTreeView.Nodes.Clear(); folderTreeView.Nodes.AddRange(parent.ToArray()); folderTreeView.EndUpdate(); folderTreeView.UseWaitCursor = false; fileSystemWatcher1.Path = path; fileSystemWatcher1.EnableRaisingEvents = true; if (last != null) //restore last selection { ExpandAndSelect(GetNode(last)); } else if (parent.Count > 0) { folderTreeView.Nodes[0].Expand(); folderTreeView.Nodes[0].Collapse(); } }); } catch (Exception ex) { Logger.Add(ex.Message, "Codes | LoadCodeFolder"); } finally { IsReady = true; Interactivity.SetStatus("Code directory loaded."); } }
/// <summary>Reads the album and artist data from specified media file or folder, and adds it to the <see cref="mAlbums"/> collection.</summary> /// <param name="filePathPattern">Use null to use the ID3 tags instead</param> /// <returns>The <see cref="Album"/> that was added to <see cref="mAlbums"/>, or <c>null</c> if none could be read.</returns> private Album ReadMediaFile(FileSystemInfo file, Regex filePathPattern) { if (file is DirectoryInfo && filePathPattern == null) //If a DirectoryInfo is used, then the filePathPattern must have ended in \. { throw new ArgumentException("Directories are only supported for pattern matching, not ID3 tags", "file"); } Dispatcher.BeginInvoke(DispatcherPriority.DataBind, new ThreadStart(delegate { ProgressText = "Searching... " + file.Name; })); string artistName = null; string albumName = null; int? embeddedArtIndex = null; //Read ID3 Tags TagLib.File fileTags = null; if (filePathPattern == null) { try { fileTags = TagLib.File.Create(file.FullName, TagLib.ReadStyle.None); if (fileTags.Tag.AlbumArtists.Length == 0) { artistName = String.Join(" / ", fileTags.Tag.Performers); } else { artistName = String.Join(" / ", fileTags.Tag.AlbumArtists); } albumName = fileTags.Tag.Album; var embeddedPictures = fileTags.Tag.Pictures; if (embeddedPictures.Length > 0) { //There's an embedded picture //Check to see if there's a picture described as the front cover, to use in preference for (int i = 0; i < embeddedPictures.Length; i++) { if (embeddedPictures[i].Type == TagLib.PictureType.FrontCover) { embeddedArtIndex = i; break; } } if (!embeddedArtIndex.HasValue) { //None of the embedded pictures were tagged as "FrontCover", so just use the first picture embeddedArtIndex = 0; } } } catch (Exception e) { System.Diagnostics.Trace.WriteLine("TagLib# could not get artist and album information for file: " + file.FullName); System.Diagnostics.Trace.Indent(); System.Diagnostics.Trace.WriteLine(e.Message); System.Diagnostics.Trace.Unindent(); return(null); //If this media file couldn't be read, just go on to the next one. } finally { if (fileTags != null) { fileTags.Mode = TagLib.File.AccessMode.Closed; } } } else { //Read from file path Match match = filePathPattern.Match(file.FullName); if (match.Success) { artistName = match.Groups["artist"].Value; albumName = match.Groups["album"].Value; } } if (!(String.IsNullOrEmpty(artistName) && String.IsNullOrEmpty(albumName))) //No point adding it if no artist or album could be found. { string basePath; bool addTracks = false; if (file is FileInfo) { basePath = ((FileInfo)file).DirectoryName; addTracks = true; } else { System.Diagnostics.Debug.Assert(file is DirectoryInfo, "Expecting file to be one of FileInfo or DirectoryInfo"); basePath = ((DirectoryInfo)file).FullName; } Album album = findInAlbums(basePath, artistName, albumName); if (addTracks) { album.AddTrack(fileTags); } if (embeddedArtIndex.HasValue) { //Read the picture from the data album.SetArtFile(EmbeddedArtHelpers.GetEmbeddedFilePath(file.FullName, embeddedArtIndex.Value)); } Dispatcher.Invoke(DispatcherPriority.DataBind, new ThreadStart(delegate { mAlbums.Add(album); })); return(album); } return(null); }
public static bool IsDirectory(this FileSystemInfo fsInfo) => fsInfo.Attributes.HasFlag(FileAttributes.Directory);
private static bool IsHidden(FileSystemInfo di) { return((di.Attributes & FileAttributes.Hidden) != 0); }
internal PhysicalSystemStoreEntry(string path, FileSystemInfo directoryInfo) { _directoryInfo = directoryInfo ?? throw new ArgumentNullException(nameof(directoryInfo)); _path = path ?? throw new ArgumentNullException(nameof(path)); }
private void GetAllFiles(FileSystemInfo info) { if (!info.Exists) return; DirectoryInfo dir = info as DirectoryInfo; if (dir == null || dir.Name.ToLower() == ".svn") return; FileSystemInfo[] files = dir.GetFileSystemInfos(); for (int i = 0; i < files.Length; i++) { if (files[i].FullName.Contains("Plugins")) { continue; } FileInfo file = files[i] as FileInfo; if (null != file) { string fileExtension = file.Extension.ToLower(); if ((fileExtension == ".png" || fileExtension == ".jpg" || fileExtension == ".tga" || fileExtension == ".psd") && checkType == CheckType.TEXTURE) { allFiles.Add(file); } if (fileExtension == ".fbx" && (checkType == CheckType.VERTEX_AND_FACE || checkType == CheckType.TANGENT || checkType == CheckType.BONE_AMOUNT)) { allFiles.Add(file); } if (fileExtension == ".prefab") { if (checkType == CheckType.BONE_QUALITY) { GameObject go = AssetDatabase.LoadMainAssetAtPath(file.FullName.Substring(file.FullName.IndexOf("Assets"))) as GameObject; if (go != null) { if (go.GetComponent<SkinnedMeshRenderer>() != null) { allFiles.Add(file); } else { SkinnedMeshRenderer[] smrs = go.GetComponentsInChildren<SkinnedMeshRenderer>(); if (smrs != null || smrs.Length > 0) { allFiles.Add(file); } } } } } } else { GetAllFiles(files[i]); } } }
static void Main(string[] args) { DirectoryInfo dir = new DirectoryInfo(@"C:\Users\Адлет\Desktop\PP2Labs\week3\Folder"); //declaring a directory for a given path Folder folder = new Folder(dir); //calling a class Folder and giving the current directory to it Stack <Folder> dirs = new Stack <Folder>(); //creating a stack with a type of the class Folder dirs.Push(folder); //pushing directory into the stack bool run = true; //declaring a boolean variable and giving it a value "true" Mode mode = Mode.Directory; //giving the value of a first state to the enumerator while (run) //starting a while loop { if (mode == Mode.Directory) //printing upper layer of a stack if its a directory { dirs.Peek().PrintFolder(); } ConsoleKeyInfo pressedkey = Console.ReadKey(); //waiting for user to press the key button switch (pressedkey.Key) //starting a "switch" for the pressed key { case ConsoleKey.UpArrow: //if pressed key is UpArrow calling the Up() function dirs.Peek().Up(); break; case ConsoleKey.DownArrow: //if pressed key is DownArrow calling the Down() function dirs.Peek().Down(); break; case ConsoleKey.Enter: //if pressed key is Enter FileSystemInfo selected = dirs.Peek().GetSelectedObj(); //taking a filesysteminfo of a current object if (selected.GetType() == typeof(DirectoryInfo)) //if the object is directory then push to the stack { dirs.Push(new Folder(selected as DirectoryInfo)); } else { string fullPath = (selected as FileInfo).FullName; //in other cases(for files) taking the fullname of a file FileStream fs = new FileStream(fullPath, FileMode.Open, FileAccess.Read); //starting a filestream for the path of a fullname of a file with an access to read StreamReader sr = new StreamReader(fs); //starting a streamreader for the filestream Console.BackgroundColor = ConsoleColor.Black; //making the background colour black and the foreground colour yellow Console.ForegroundColor = ConsoleColor.Yellow; Console.Clear(); Console.Write(sr.ReadToEnd()); //output the containings of a file on console mode = Mode.File; //changing enumerator state to file sr.Close(); fs.Close(); } break; case ConsoleKey.Escape: //if pressed key is Escape if (mode == Mode.Directory) // if enumerator state is directory than stopping switch by changing the boolean variable to "false" { run = false; } else { mode = Mode.Directory; //in other cases changing the enumerator state to directory } break; case ConsoleKey.Backspace: //if pressed key is Backspace if (dirs.Count > 1) { dirs.Pop(); //if stack is not empty deleting the upper layer } break; default: break; case ConsoleKey.D: //if pressed key is D string currentPath = dirs.Peek().FullPath; //declaring the current path by calling the getter FullPath FileSystemInfo selected2 = dirs.Peek().GetSelectedObj(); //taking filesysteminfo of a selected object if (selected2.GetType() == typeof(FileInfo)) { File.Delete(selected2.FullName); } else { Directory.Delete(selected2.FullName); //deleting the object } if (dirs.Count > 1) { Folder currentFolder = dirs.Pop(); //if stack is not empty then deleting the upper layer to "refresh" the page if (currentFolder.GetSelectedIndex() != 0) { dirs.Push(new Folder(new DirectoryInfo(currentPath), currentFolder.GetSelectedIndex() - 1)); //if index is not 0 then decrease index by one after deleting object } else { dirs.Push(new Folder(new DirectoryInfo(currentPath), currentFolder.GetSelectedIndex())); } } break; case ConsoleKey.R: //if pressed key is R FileSystemInfo selected3 = dirs.Peek().GetSelectedObj(); //getting filesysteminfo on the selected object string currentPath2 = dirs.Peek().FullPath; //declaring the current path by calling the getter of an upper layer of a stack if (selected3.GetType() == typeof(FileInfo)) //if the object is file { Console.WriteLine("Please enter a new file name:"); string oldname = selected3.FullName; //creating a string of a fullname of a file string newname = Console.ReadLine(); //entering the new name of a file string newpath = oldname.Replace(selected3.Name, newname); //creating a new path of a file by replacing the old name in an old path by the new name File.Move(oldname, newpath); //moving file from old path to new path File.Delete(oldname); //deleting old file } if (selected3.GetType() == typeof(DirectoryInfo)) //if the objest is directory { Console.WriteLine("Please enter a new directory name:"); string oldpath = selected3.FullName; //declaring an old path by using a getter to take a full name of a directory string newname = Console.ReadLine(); //entering the new name of a directory string newpath = oldpath.Replace(selected3.Name, newname); //changing the path of a directory by replacing the old name in its' full name by the new name Directory.Move(oldpath, newpath); //move the directory from old path to new path } if (dirs.Count > 1) { Folder currentFolder = dirs.Pop(); dirs.Push(new Folder(new DirectoryInfo(currentPath2), currentFolder.GetSelectedIndex())); //to "refresh" the page if stack is not empty delete the upper layer of it and push the current one } break; } } }
private string[] GetNames (FileSystemInfo[] afsi) { string[] r = new string[afsi.Length]; for (int i = 0; i != afsi.Length; ++i) r[i] = afsi[i].Name; return r; }
private static Dictionary <string, string> GetMetadata(FileSystemInfo file) { var metadataFile = file.FullName.Replace(".bin", ".md.json"); return(!File.Exists(metadataFile) ? null : JsonConvert.DeserializeObject <Dictionary <string, string> >(File.ReadAllText(metadataFile).Trim())); }
static string[] getFileSystemsName(FileSystemInfo[] pFileSystem) { string[] lOut = new string[pFileSystem.Length]; for (int i = 0; i < pFileSystem.Length; ++i) { if (pFileSystem[i] is DirectoryInfo) lOut[i] = "//"+pFileSystem[i].Name; else lOut[i] = pFileSystem[i].Name; } return lOut; }
public ЭлементДереваКаталогов(DirectoryInfo Каталог) { объектФайловойСистемы = Каталог; типЭлемента = ТипЭлементаДереваКаталогов.Каталог; }
internal static bool IsNotNullButDoesNotExist(this FileSystemInfo fileInfo) => fileInfo != null && !fileInfo.Exists;
private void Load_Block_Offset_Mapping() { _block_CSV_line_mapping = new Dictionary<int, List<string>>(); StreamReader reader = new StreamReader(_input_CSV_path); string[] dels2 = { "\t" }; string line = reader.ReadLine(); while (line != null && line != "") { if (!line.StartsWith("#")) { string field = line.Split(dels2, StringSplitOptions.RemoveEmptyEntries)[1]; string[] parts = line.Split(dels2, StringSplitOptions.RemoveEmptyEntries); int block = int.Parse(parts[0]); string field_line = string.Empty; for (int ind = 1; ind < 6; ind++) { field_line += parts[ind] + "\t"; } if (!_block_CSV_line_mapping.ContainsKey(block)) { List<string> block_lines = new List<string>(); block_lines.Add(field_line); _block_CSV_line_mapping.Add(block, block_lines); } else { _block_CSV_line_mapping[block].Add(field_line); } } line = reader.ReadLine(); } reader.Close(); /// sort blocks using unsupervised/initial sorting algorithm _sorted_blocks = new Dictionary<int, List<string>>(); #if _BASE_LINE _bse = new TextRanker(_block_CSV_line_mapping, _dictionary_path, _pre_pop_path); _baseline = _bse._baseline; _baseline.Rank_Blocks(); _sorted_blocks = _baseline._sorted_blocks; _block_scores = _baseline._block_scores; #else #if _FILE_SYSTEM_INFO _bse = new TextRanker(_block_CSV_line_mapping, _dictionary_path, _pre_pop_path, _offset_map_path); _fso = _bse._fso; #else #if _HYBRID _bse = new TextRanker(_block_CSV_line_mapping, _dictionary_path, _pre_pop_path, _ground_truth_token_file_path, _input_CSV_path, _offset_map_path); _fso = _bse._fso; _investigator_input = _bse._investigator_input; #else _bse = new TextRanker(_block_CSV_line_mapping, _dictionary_path, _pre_pop_path, _ground_truth_token_file_path, _input_CSV_path); _investigator_input = _bse._investigator_input; #endif #endif _bse.Rank_Blocks(); _bad_block_features = new Dictionary<string, double>(_bse._bad_block_features); _sorted_blocks = _bse._sorted_blocks; _block_scores = _bse._block_scores; #endif //Write_Initial_Sorting_To_File(sorted_blocks); foreach (KeyValuePair<int, List<string>> pair in _sorted_blocks) { int curr_block = pair.Key; List<string> block_lines = pair.Value; for (int i = 0; i < block_lines.Count; i++) { string curr_line = block_lines[i]; long Offset = long.Parse(curr_line.Split(dels2, StringSplitOptions.RemoveEmptyEntries)[1]); string field = curr_line.Split(dels2, StringSplitOptions.RemoveEmptyEntries)[0]; if (Offset != 0 && (field.StartsWith("Text_") || field.StartsWith("PhoneNumber_"))) { if (!_block_offset_mapping_initial_sorted.ContainsKey(curr_block)) { List<long> Offset_list = new List<long>(); Offset_list.Add(Offset); _block_offset_mapping_initial_sorted.Add(curr_block, Offset_list); } else { _block_offset_mapping_initial_sorted[curr_block].Add(Offset); } } } } }
public ЭлементДереваКаталогов(FileInfo Файл) { объектФайловойСистемы = Файл; типЭлемента = ТипЭлементаДереваКаталогов.Файл; }
public bool FileBrowser() { UpdateIsDoubleClick(); bool complete; DirectoryInfo directoryInfo; //DirectoryInfo directorySelection; FileInfo fileSelection; int contentWidth; // Our return state - altered by the "Select" button complete = false; // Get the directory info of the current location //fileSelection = new FileInfo(location); if (location is DirectoryInfo) { directoryInfo = (DirectoryInfo)location; } else { directoryInfo = ((FileInfo)location).Directory; } GUILayout.BeginVertical(); { var lParentDirectories = new List<DirectoryInfo>(); { var lDirectory = directoryInfo; lParentDirectories.Add(lDirectory); while (lDirectory.Parent != null) { lDirectory = lDirectory.Parent; lParentDirectories.Add(lDirectory); } } bool lIsChangeDirectory = false; //创建父路径按钮 GUILayout.BeginHorizontal(); { if (directoryInfo.Parent!=null && GUILayout.Button("up", GUILayout.Width(30.0f)) && canChangeLayout) { location = directoryInfo.Parent; lIsChangeDirectory = true; } GUILayout.Space(5.0f); for (int i = lParentDirectories.Count-1; i >= 0;--i ) { if (GUILayout.Button(lParentDirectories[i].Name) && canChangeLayout ) { location = lParentDirectories[i]; lIsChangeDirectory = true; } } } GUILayout.EndHorizontal(); if (lIsChangeDirectory) return false; bool isChoose = false; GUILayout.BeginHorizontal(); { GUILayout.Space(10); var lDirectories = directoryInfo.GetDirectories(); List<FileInfo> lFiles = new List<FileInfo>(); { foreach (var lFilter in extensionFilters[extensionFilteIndex].filters) { lFiles.AddRange(directoryInfo.GetFiles(lFilter)); } } var lPathFile = new List<FileSystemInfo>(lDirectories); lPathFile.AddRange(lFiles.ToArray()); pathFiles = lPathFile.ToArray(); //pathFiles = (FileSystemInfo[])lDirectories + (FileSystemInfo[])lFiles; // Handle the files list GUILayout.BeginVertical(); { //GUILayout.Label("Files:"); fileScroll = GUILayout.BeginScrollView(fileScroll); isChoose = SelectList(getFileSystemsName(pathFiles), ref fileSelectedIndex); //fileSelectedIndex = SelectList(new string[]{"aaa","bbbb"}, fileSelectedIndex); GUILayout.EndScrollView(); } GUILayout.EndVertical(); if (isChoose && canChangeLayout) // If a file was selected, update our location to it { location = pathFiles[fileSelectedIndex]; } } GUILayout.EndHorizontal(); if (lastLocation != location) { locationTextArea = selectedLocation; lastLocationTextArea = locationTextArea; } // The manual location box and the select button GUILayout.BeginHorizontal(); { locationTextArea = GUILayout.TextArea(lastLocationTextArea); if (lastLocationTextArea != locationTextArea) selectedLocation = locationTextArea; contentWidth = (int)GUI.skin.GetStyle("Button").CalcSize(new GUIContent("Select")).x; if ( (GUILayout.Button("Select", GUILayout.Width(contentWidth)) || isChoose) && location is FileInfo) { isSelect = true; complete = true; } if (GUILayout.Button("Cancel", GUILayout.Width(contentWidth))) { isSelect = false; complete = true; } lastLocation = location; lastLocationTextArea = locationTextArea; } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); return complete; }
public AFileSystemException(FileSystemInfo info, Exception e) : base(info.FullName, e) { this.info = info; }
void Start() { lastLocation = _location; locationTextArea = selectedLocation; lastLocationTextArea = locationTextArea; }
public AFileSystemException(FileSystemInfo info) : this(info, null) { }