It loads all the scripts in the Scripts and Tools folders into the TreeView.
474 {
475 Gtk.TreeViewColumn typeCol = new Gtk.TreeViewColumn();
476 typeCol.Title = "Script";
477 Gtk.CellRendererText typeCell = new Gtk.CellRendererText();
478 typeCol.PackStart(typeCell, true);
479 scriptView.AppendColumn(typeCol);
480 typeCol.AddAttribute(typeCell, "text", 0);
481
482 Gtk.TreeViewColumn statCol = new Gtk.TreeViewColumn();
483 statCol.Title = "Status";
484 Gtk.CellRendererText statCell = new Gtk.CellRendererText();
485 statCol.PackStart(statCell, true);
486 scriptView.AppendColumn(statCol);
487 statCol.AddAttribute(statCell, "text", 1);
488
489 Gtk.TreeStore store = new Gtk.TreeStore(typeof(string), typeof(string));
490 scriptView.Model = store;
492 string st = System.IO.Path.GetDirectoryName(Environment.ProcessPath);
493 foreach (string file in Directory.GetFiles(st + "/Scripts"))
494 {
495 if (!
scripts.ContainsKey(System.IO.Path.GetFileName(file)))
496 {
497 Script sc = new Script(file, File.ReadAllText(file));
498 if(sc.thread == null)
499 store.AppendValues(sc.name, ThreadState.Unstarted.ToString());
500 else
501 store.AppendValues(sc.name, sc.thread.ThreadState.ToString());
503 }
504 }
505 foreach (string file in Directory.GetFiles(st + "/Tools"))
506 {
507 if (file.EndsWith(".cs"))
508 {
509 if (!
scripts.ContainsKey(System.IO.Path.GetFileName(file)))
510 {
511 Script sc = new Script(file, File.ReadAllText(file));
512 if (sc.thread == null)
513 store.AppendValues(sc.name, ThreadState.Unstarted.ToString());
514 else
515 store.AppendValues(sc.name, sc.thread.ThreadState.ToString());
517 }
518 }
519 }
520 }