SetFileParser() public method

public SetFileParser ( FileParser p ) : void
p FileParser
return void
コード例 #1
0
ファイル: FileParser.cs プロジェクト: turbo3001/LynnaLab
        // 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);
        }
コード例 #2
0
        // Insert at the beginning if refComponent is null.
        public bool InsertComponentBefore(FileComponent refComponent, FileComponent newComponent, string comment = "")
        {
            int i;

            if (refComponent == null)
            {
                i = 0;
            }
            else
            {
                i = fileStructure.IndexOf(refComponent);
                if (i == -1)
                {
                    return(false);
                }
            }

            if (newComponent is Label)
            {
                AddLabelToDictionaries(newComponent as Label);
            }

            fileStructure.Insert(i, newComponent);
            fileStructureComments.Insert(i, comment);
            newComponent.SetFileParser(this);

            Modified = true;

            return(true);
        }
コード例 #3
0
ファイル: FileParser.cs プロジェクト: Drenn1/LynnaLab
        // Insert at the beginning if refComponent is null.
        public bool InsertComponentBefore(FileComponent refComponent, FileComponent newComponent, string comment="")
        {
            int i;
            if (refComponent == null)
                i = 0;
            else {
                i = fileStructure.IndexOf(refComponent);
                if (i == -1)
                    return false;
            }

            if (newComponent is Label) {
                AddLabelToDictionaries(newComponent as Label);
            }

            fileStructure.Insert(i, newComponent);
            fileStructureComments.Insert(i, comment);
            newComponent.SetFileParser(this);

            Modified = true;

            return true;
        }