Esempio n. 1
0
 public void Write(Slice slice, StringBuilder sb)
 {
     foreach (var section in slice.Sections)
     {
         Write(section, sb);
     }
 }
Esempio n. 2
0
        public virtual void Write(Layer layer, string path, IFormatter formatter)
        {
            var lines = new List<string>();
            Write(layer, lines);

            var slice = new Slice(layer.SemName, lines);

            var sb = new StringBuilder();
            formatter.Write(slice, sb);

            using (var fs = File.OpenWrite(path))
            using (var swr = new StreamWriter(fs))
            {
                swr.WriteLine(sb.ToString());
                swr.Flush();
            }
        }
Esempio n. 3
0
        private static void ScanFiles(string dir, IList<Slice> list, string osName)
        {
            foreach (var path in Directory.EnumerateFiles(dir))
            {
                var fileName = Path.GetFileName(path);
                if (fileName == null || fileName.StartsWith("."))
                    continue;

                var ext = Path.GetExtension(path);
                if (ext == ".md" || ext == ".txt")
                    continue;

                var fi = new FileInfo(path);
                var nameParts = fi.Name.Split("_"); // handles names like debian-8.2_jekyll-3.0 and possibly with more underscores
                fileName = nameParts.Length == 1 ? nameParts[0] : nameParts[nameParts.Length - 1];
                var semName = new SemName(fileName);

                var lines = File.ReadAllLines(path);
                var slice = new Slice(semName, lines);

                if (slice.OsList.Contains(osName))
                    list.Add(slice);
            }
        }
Esempio n. 4
0
 public Layer(Slice slice)
 {
     _slice = slice;
 }