Skip to content

Instantly share code, notes, and snippets.

@andyhuey
Created April 5, 2013 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andyhuey/5315547 to your computer and use it in GitHub Desktop.
Save andyhuey/5315547 to your computer and use it in GitHub Desktop.
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