Exemple #1
0
        public async Task <bool> HasResult(string data)
        {
            string path = LeakSaver.GetFilePath(basePath, data, layers);

            try
            {
                using (StreamReader sr = new StreamReader(new FileStream(path, FileMode.Open, FileAccess.Read)))
                {
                    while (!sr.EndOfStream)
                    {
                        string line = await sr.ReadLineAsync();

                        if (line.StartsWith(data))
                        {
                            return(true);
                        }
                    }
                }
                return(false);
            }
            catch (DirectoryNotFoundException)
            {
                return(false);
            }
        }
Exemple #2
0
        public async Task <IEnumerable <string> > Lookup(string data)
        {
            string path = LeakSaver.GetFilePath(basePath, data, layers);
            LinkedList <string> items = new LinkedList <string>();

            try
            {
                using (StreamReader sr = new StreamReader(new FileStream(path, FileMode.Open, FileAccess.Read)))
                {
                    while (!sr.EndOfStream)
                    {
                        string line = await sr.ReadLineAsync();

                        if (line.StartsWith(data, true, null))
                        {
                            items.AddLast(line);
                        }
                    }
                }
                return(items);
            }
            catch (DirectoryNotFoundException)
            {
                return(new LinkedList <string>());
            }
        }