public override ExpandedPath.Action HandlePath(ExpandedPath ep) { LoadSpeciesList(); if (ep.Level == 0) { throw new ArgumentOutOfRangeException("ExpandedPath.Level cannot be 0 here"); } var requestedSpecies = species.Where(s => s.Name == ep.Components[ep.Level - 1]).FirstOrDefault(); if (requestedSpecies == null) { return(ExpandedPath.Action.NotFound); } if (ep.Level == ep.Components.Count) { return(ExpandedPath.Action.Handle); } else { return(ExpandedPath.Action.PassThrough); } }
/// <summary> /// Initializes a new instance of the <see cref="NugetPackageSource"/> class. /// </summary> /// <param name="name">The name of the package source.</param> /// <param name="path">The path to the package source.</param> public NugetPackageSource(string name, string path) { Name = name; SavedPath = path; IsLocalPath = !ExpandedPath.StartsWith("http"); IsEnabled = true; }
public override Errno OnGetPathStatus(ExpandedPath path, out NamedStat entry) { var result = base.OnGetPathStatus(path, out entry); var stat = entry.Stat; stat.st_size = Content.Length; entry.Stat = stat; return(result); }
public void DispatcherLocatesCorrectSpecificFileHandlingNode() { var ep = new ExpandedPath("/homo_sapiens_core_99_38/chromosomes/1/REF"); NodeProvider handlingNode; var res = dispatcher.LocateNodeByExpandedPath(ep, dispatcher.Root, out handlingNode); Assert.AreEqual(ExpandedPath.Action.Handle, res); Assert.AreEqual(typeof(RefSequenceFile), handlingNode.GetType()); }
public override Errno OnReadHandle(ExpandedPath file, PathInfo info, byte[] buf, long offset, out int bytesRead) { Trace.WriteLine($"*** StaticStringFile.OnReadHandle({file.FullPath}, offset={offset}, buf_len={buf.Length})"); var start = (int)offset; var length = Math.Min(buf.Length, Content.Length); var data = Content.Substring(start, length); bytesRead = CopyBuf(data, buf, length); return(0); }
public override sealed ExpandedPath.Action HandlePath(ExpandedPath ep) { if (ep.Components.Last() == Name) { return(ExpandedPath.Action.Handle); } else { return(ExpandedPath.Action.NotFound); } }
public override Errno OnReadDirectory(ExpandedPath directory, PathInfo info, out IEnumerable <NamedStat> paths) { if (directory.Components.Count < Level) { paths = subdirs; return(0); } else { return(Children[0].OnReadDirectory(directory, info, out paths)); } }
public override Errno OnReadDirectory(ExpandedPath directory, PathInfo info, out IEnumerable <NamedStat> paths) { LoadSpeciesList(); if (directory.Components.Count < Level) { paths = species; return(0); } else { return(Children[0].OnReadDirectory(directory.NextLevel(), info, out paths)); } }
public override Errno OnGetPathStatus(ExpandedPath path, out NamedStat entry) { var desiredFile = path.Components.Last(); if (sequenceFiles.TryGetValue(desiredFile, out var ns)) { entry = ns; return(0); } else { entry = new NamedStat(); return(Errno.ENOENT); } }
public override ExpandedPath.Action HandlePath(ExpandedPath ep) { if (ep.Level > ep.Components.Count) { return(ExpandedPath.Action.Unknown); } else if (ep.Level == ep.Components.Count) { return(ExpandedPath.Action.Handle); } else { return(ExpandedPath.Action.PassThrough); } }
public override Errno OnReadHandle(ExpandedPath file, PathInfo info, byte[] buf, long offset, out int bytesRead) { Trace.WriteLine($"*** RefSequenceFile.OnReadHandle({file.FullPath}, offset={offset}, buf_len={buf.Length})"); var species = file.Components[0]; var chromosome = file.Components[2]; var slice = new Slice(species, chromosome); var start = offset + 1; var end = start + buf.Length - 1; var data = slice.GetSequenceString((int)start, (int)end); int toBeReadCount = buf.Length; bytesRead = CopyBuf(data, buf, toBeReadCount); return(0); }
public override Errno OnGetPathStatus(ExpandedPath path, out NamedStat entry) { var desiredDir = path.Components.Last(); var selectedDir = subdirs.Where(s => s.Name == desiredDir).FirstOrDefault(); if (selectedDir != null) { entry = selectedDir; return(0); } else { entry = new NamedStat(); return(Errno.ENOENT); } }
public override Errno OnGetPathStatus(ExpandedPath path, out NamedStat entry) { if (!fileCache.ContainsKey(path.FullPath)) { var species = path.Components[0]; var chromosome = path.Components[2]; var slice = new Slice(species, chromosome); var stat = Extensions.StandardFile(); stat.st_size = slice.Length; var ns = new NamedStat(Name, stat); fileCache[path.FullPath] = ns; } entry = fileCache[path.FullPath]; return(0); }
public override Errno OnGetPathStatus(ExpandedPath path, out NamedStat entry) { LoadSpeciesList(); var dirname = path.Components.Last(); if (species.Where(ns => ns.Name == dirname).FirstOrDefault() != null) { entry = new NamedStat(dirname, Extensions.StandardDir()); return(0); } else { entry = new NamedStat(); return(Errno.ENOENT); } }
public override ExpandedPath.Action HandlePath(ExpandedPath ep) { var desiredFile = ep.Components.Last(); if (ep.Components.Count < Level) { return(ExpandedPath.Action.Handle); } else { // we're asking about files in the dir foreach (var child in Children) { var action = child.HandlePath(ep); if (action == ExpandedPath.Action.Handle) { return(ExpandedPath.Action.PassThrough); } } return(ExpandedPath.Action.NotFound); } }
public override Errno OnReadHandle(ExpandedPath file, PathInfo info, byte[] buf, long offset, out int bytesRead) { throw new NotImplementedException(); }
public override Errno OnReadDirectory(ExpandedPath directory, PathInfo info, out IEnumerable <NamedStat> paths) { paths = sequenceFiles.Values; return(0); }
public override Errno OnReadDirectory(ExpandedPath directory, PathInfo info, out IEnumerable <NamedStat> paths) { return(Children[0].OnReadDirectory(directory.NextLevel(), info, out paths)); }
public override Errno OnGetPathStatus(ExpandedPath path, out NamedStat entry) { entry = rootDirEntry; return(0); }
public override ExpandedPath.Action HandlePath(ExpandedPath ep) { return(ep.Level == ep.Components.Count ? ExpandedPath.Action.Handle : ExpandedPath.Action.PassThrough); }