Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private void addProject(str newProject)
{
// add a new project to the list.
Array projects;
int i;
projects = this.getProjectList();
// make sure it's not already there...
for (i=1; i <= projects.lastIndex(); i++)
{
if (projects.value(i) == newProject)
return;
}
// add it and save.
projects.value(projects.lastIndex()+1, newProject);
this.writeProjectList(projects);
}
private void removeProject(str projectToRemove)
{
// remove a project from the list.
Array projectsIn, projectsOut;
int i, j;
projectsIn = this.getProjectList();
projectsOut = new Array(Types::String);
j=1;
for (i=1; i <= projectsIn.lastIndex(); i++)
{
if (projectsIn.value(i) != projectToRemove)
{
projectsOut.value(j, projectsIn.value(i));
j++;
}
}
this.writeProjectList(projectsOut);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment