예제 #1
0
        public string FindFileContent(string fileName)
        {
            Ensure.NotNullOrEmpty(fileName, "fileName");
            if (fileName.EndsWith(".log") && SequenceIsolatedFile.Exists(fileName))
            {
                SequenceIsolatedFile file = new SequenceIsolatedFile(fileName);
                return(String.Join(Environment.NewLine, file.Enumerate()));
            }

            return(null);
        }
예제 #2
0
        private IEnumerable <string[]> ReadLines()
        {
            foreach (string line in file.Enumerate())
            {
                string[] parts = line.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                if (parts.Length == 0)
                {
                    continue;
                }

                yield return(parts);
            }
        }
        public IEnumerable <FileModel> Enumerate()
        {
            if (files == null)
            {
                files = new HashSet <FileModel>();

                foreach (string path in storage.Enumerate())
                {
                    if (File.Exists(path))
                    {
                        files.Add(new FileModel(path));
                    }
                }

                storage.Clear();
                storage.Append(files.Select(f => f.Path));
            }

            return(files);
        }