// Attempt to insert newComponent after refComponent, or at the end if
// refComponent is null
// Returns false if failed (refComponent doesn't exist or newComponent already
// exists in this file).
public bool InsertComponentAfter(FileComponent refComponent, FileComponent newComponent)
{
int i;
if (refComponent == null)
{
i = fileStructure.Count - 1;
}
else
{
i = fileStructure.IndexOf(refComponent);
if (i == -1)
{
return(false);
}
}
if (fileStructure.Contains(newComponent))
{
return(false);
}
if (newComponent is Label)
{
AddLabelToDictionaries(newComponent as Label);
}
fileStructure.Insert(i + 1, newComponent);
newComponent.SetFileParser(this);
Modified = true;
return(true);
}