void GraphBase::BaseLoad(wxString path, wxString tag, wxTextCtrl *textbox) { int i, index; TextFile infile; wxString readline, filename, filetag; wxString text, numstring, namestring, basestring; wxString gtag, gname; double numdat; GraphDat *graph; int version; filename = "gbase-" + tag + ".dat"; //if(!infile.Open(initpath + "/Graphs/" + filename)) return; if(!infile.Open(path + "/" + filename)) return; if(textbox) textbox->AppendText(text.Format("Loading %d graphs\n", numgraphs)); i = 0; readline = infile.ReadLine(); // Version check //fileversion = ParseLong(&vstring, 'v'); //textbox->AppendText(text.Format("Base file version %d\n", fileversion)); //if(fileversion < version) textbox->AppendText(text.Format("Create base index\n")); while(!readline.IsEmpty()) { if(readline.GetChar(0) == 'v') version = ParseLong(&readline, 'v'); // check file version for backwards compatability else version = 0; //textbox->AppendText(text.Format("Base file version %d\n", version)); //textbox->AppendText(text.Format("Readline %s\n", readline)); if(version >= 2) { // Modern, reference by tag gtag = ParseString(&readline, 'g'); graph = GetGraph(gtag); if(graph) graph->LoadDat(readline, version); } else { //GetGraphFromName(gname)->LoadDat(readline, version); // Should add code to chop off any tag first //int ndex = readline.Find("name"); //textbox->AppendText(text.Format("Base file version %d\n", version)); //textbox->AppendText(text.Format("Readline %s\n", readline)); namestring = readline.Mid(readline.Find("name")); //textbox->AppendText(text.Format("Name string %s\n", namestring)); gname = ParseString(&namestring, 'e'); gname.Replace("_", " "); if(textbox) textbox->AppendText(text.Format("gname %s\n", gname)); graph = GetGraphFromName(gname); if(graph) graph->LoadDat(readline, version); } //graphstore[i].LoadDat(readline, version); if(infile.End()) break; readline = infile.ReadLine(); i++; } infile.Close(); // Read graphbase entries /* while(!readline.IsEmpty()) { graphstore[i].diagbox = mainwin->diagbox; graphstore[i].LoadDat(readline, version); if(infile.End()) break; readline = infile.ReadLine(); i++; } infile.Close(); */ }