Exemplo n.º 1
0
        public void RescanProjectObjects()
        {
            // Re-queue all the files in the project for processing
            // First clear all the objects in the active files
            foreach (CProject.File file in this.FileList)
            {
                RemoveObjectsInFile(file);
            }

            // Now requeue all the files
            foreach (CProject.File file in this.FileList)
            {
                CProject.TokenizerQueue tq = new CProject.TokenizerQueue();
                tq.file     = file;
                tq.needFile = true;
                tq.code     = "";

                this._Queue(tq);
            }
        }
Exemplo n.º 2
0
 public void _Queue(CProject.TokenizerQueue tq)
 {
     g.LogDebug("CPROJECT::_Queue: Enqueing " + tq.file.RelativePath);
     this.__tokenizer_queue.Add(tq);
 }
Exemplo n.º 3
0
        public bool CommitSave(CProject.File file)
        {
            Directory.SetCurrentDirectory(g.Project.ProjectPath);
            try {
                // Set the isPendingReload flag
                g_curFile.isPendingReload = true;
                txtEditor.Document.SaveFile(file.RelativePath, LineEndStyle.CarriageReturnNewline);
            } catch (Exception exc) {
                MessageBox.Show("An error occurred while attempting to save your file:\n\n" + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                // Reset the pending reload
                g_curFile.isPendingReload = false;
                return false;
            }

            this.isDirty = false;

            // Tokenize file
            CProject.TokenizerQueue tq = new CProject.TokenizerQueue();
            tq.code = txtEditor.Document.Text;
            tq.file = this.g_curFile;

            g.Project._Queue(tq);

            DropdownMake();
            DropdownSelectCurrent();

            // PLUGINS
            foreach (CWPlugin plugin in g.Plugins) {
                try {
                    plugin.Plugin.CWFileAfterSave(g_curFile.ToCWFile());
                } catch (Exception exc) {
                    g.PluginException(exc, plugin);
                }
            }

            return true;
        }
Exemplo n.º 4
0
        public void TokenizerThread()
        {
            // Calls tokenization functions from
            Thread.CurrentThread.Priority = ThreadPriority.BelowNormal;
            XParser parser = new XParser();

            g.LogDebug("CPROJECT::TokenizerThread: INIT thread");
            while (Thread.CurrentThread.ThreadState == ThreadState.Running)
            {
                if (Thread.CurrentThread.ThreadState != ThreadState.Running)
                {
                    g.LogDebug("CPROJECT::TokenizerThread: Aborted; breaking");
                    break;
                }

                //Thread.Sleep(0);
                Thread.Sleep(1000);

                if (this.__tokenizer_queue.Count == 0)
                {
                    if (this.__needs_rehash)
                    {
                        g.LogDebug("CPROJECT::TokenizerThread: __needs_rehash");
                        this.__needs_rehash = false;
                        g.Main.InitExplorer();
                    }
                    continue;
                }

                while (this.__tokenizer_queue.Count != 0)
                {
                    CProject.TokenizerQueue tq = (CProject.TokenizerQueue) this.__tokenizer_queue[0];

                    g.LogDebug("CPROJECT::TokenizerThread: Got " + tq.file.RelativePath + " for tokenization");

                    // Do not deal with files that are "foreign" or "text"
                    if (tq.file.isForeign || tq.file.isText)
                    {
                        g.LogDebug("CPROJECT::TokenizerThread: Foreign/text; return");
                        this.__tokenizer_queue.RemoveAt(0);
                        continue;
                    }
                    Monitor.Enter(this.TokenObjList);
                    Monitor.Enter(tq.file);

                    foreach (CProject.TokenObject tokobj in this.TokenObjList.Values)
                    {
                        tokobj.RemoveFileRefs(tq.file);
                    }

                    if (tq.needFile)
                    {
                        System.IO.Directory.SetCurrentDirectory(this.ProjectPath);
                        tq.file.TokenList  = frmMain.parser.MakeTokenListingFromFile(tq.file.RelativePath);
                        this._TokenObjList = frmMain.parser.MakeObjectListingFromFile(tq.file.RelativePath, tq.file, this._TokenObjList);
                    }
                    else
                    {
                        tq.file.TokenList  = frmMain.parser.MakeTokenListing(tq.code);
                        this._TokenObjList = frmMain.parser.MakeObjectListing(tq.code, tq.file, this._TokenObjList);
                    }

                    Monitor.Exit(this.TokenObjList);
                    Monitor.Exit(tq.file);


                    RebuildVisibleTree();
                    //RefreshEditorDropdowns();


                    this.__tokenizer_queue.RemoveAt(0);
                    this.__needs_rehash = true;

                    //System.GC.Collect(System.GC.MaxGeneration);
                }
            }
        }
Exemplo n.º 5
0
        public void RescanProjectObjects()
        {
            // Re-queue all the files in the project for processing
            // First clear all the objects in the active files
            foreach (CProject.File file in this.FileList) {
                RemoveObjectsInFile(file);
            }

            // Now requeue all the files
            foreach(CProject.File file in this.FileList) {
                CProject.TokenizerQueue tq = new CProject.TokenizerQueue();
                tq.file = file;
                tq.needFile = true;
                tq.code = "";

                this._Queue(tq);
            }
        }