Ejemplo n.º 1
0
        public static BheProject FromFile(string fileName)
        {
            string directory = Path.GetDirectoryName(fileName);

            var project = new BheProject();

            project.FileName      = fileName;
            project.DirectoryName = directory;

            project.ProjectText = File.ReadAllText(Path.Combine(directory, "Project.txt"), Encoding.Default);
            project.Summary     = BheSummary.FromFile(Path.Combine(directory, "Summary.txt"));
            project.Sections.AddRange(BheSection.ListFromFile(Path.Combine(directory, "Sections.csv")));

            foreach (string pattern in project.Summary.Patterns)
            {
                string path = Path.Combine(directory, "pat_" + pattern + ".csv");
                project.Patterns.Add(BhePatternItem.ListFromFile(path));
            }

            project.Comments.Add(string.Empty);

            foreach (string comment in project.Summary.Comments.Skip(1))
            {
                string path = Path.Combine(directory, "com_" + comment + ".txt");
                project.Comments.Add(File.ReadAllText(path, Encoding.Default));
            }

            return(project);
        }
Ejemplo n.º 2
0
        public static BheSummary FromFile(string fileName)
        {
            var sum = new BheSummary();

            using (var file = new StreamReader(fileName, Encoding.Default))
            {
                sum.ProjectName = BheSummary.ReadString(file, "[Project]");
                sum.IconPath    = BheSummary.ReadString(file, "[Icon]");
                sum.BinFilePath = BheSummary.ReadString(file, "[File]");
                sum.Patterns.AddRange(BheSummary.ReadStringList(file, "[Patterns]"));
                sum.Comments.AddRange(BheSummary.ReadStringList(file, "[Comments]"));
            }

            return(sum);
        }