public void LoadState()
{
var filename = System.IO.Path.Combine (Paths.ApplicationData, "projectpad.dat");
if (!File.Exists (filename))
return;
var reader = new System.IO.StreamReader (filename);
string line;
List<int> allVisible = new List<int> ();
while (!String.IsNullOrEmpty (line = reader.ReadLine ()))
{
var parts = line.Split ('|');
if (parts.Length != 2)
continue;
int id = 0;
if (!Int32.TryParse (parts [0], out id))
continue;
bool visible = false;
if (!Boolean.TryParse (parts [1], out visible))
continue;
if (visible)
allVisible.Add (id);
}
m_projectStore.Foreach (delegate (TreeModel model, TreePath path, TreeIter iter) {
var project = (Project)model.GetValue (iter, 0);
if (project == null || project.Id < 0)
return false;
if (allVisible.Contains (project.Id))
m_projectsTreeView.ExpandToPath (path);
return false;
});
}