Example #1
0
 // Чтение графа из строк файла.
 private Graph ReadGraph(HttpPostedFileBase upload)
 {
     // выделение строк из входного потока
     string[] fileLines = ReadFile(upload.InputStream);
     // парсинг строк
     return(GraphParser.ParseTxtFormat(fileLines));
 }
Example #2
0
 // ������ ����� �� ����� �����.
 private Graph ReadGraph(HttpPostedFileBase upload)
 {
     // ��������� ����� �� �������� ������
     string[] fileLines = ReadFile(upload.InputStream);
     // ������� �����
     return(GraphParser.ParseTxtFormat(fileLines));
 }
        // �����, ������������ ��������� �������� ���� ������, �� ����
        // ����� ��������� ������ � ������
        protected override void Seed(GraphContext context)
        {
            string workPath = HostingEnvironment.MapPath("~");
            string folder   = "Graphs";

            foreach (var description in _graphDescriptions)
            {
                string   fullPath = Path.Combine(workPath, folder, description.FileName);
                string[] lines    = File.ReadAllLines(fullPath);
                Graph    graph    = GraphParser.ParseTxtFormat(lines);
                context.Graphs.Add(graph);
                graph.Name = description.GraphName;
                graph.R    = description.RealR;
                context.Graphs.Add(graph);
            }
            context.SaveChanges();
        }