public BaseItem GetFileItem(string filename) { // A factory method to return a file item for a specific file, // for this plugin, which will be held as a reference in the UI. JSFileItem item = new JSFileItem(filename, null); return(item); }
public bool ReadItem(BaseItem item, bool unload) { lock (_lockObj) { JSFileItem jsFileItem = (JSFileItem)item; ReadJSFileItem(jsFileItem, unload); } return(true); }
private void ReadJSFileItem(JSFileItem item, bool unload) { try { // Check if we've already read this file. if (item.Block != null) { // Clear the caches. item.Classes.Clear(); item.Methods.Clear(); _classLookup.Clear(); _currentMethodStack.Clear(); // Remove structure from the IProjectBrowser lookup dictionary. _invert = true; ParseAstList(item.Block.src_elems.elems, string.Empty); } if (!unload) { //todo common // Clear the caches. item.Classes.Clear(); item.Methods.Clear(); _classLookup.Clear(); _currentMethodStack.Clear(); // Create the AST using our JS parser. string filename = item.ItemPath; string text = File.ReadAllText(filename); ScriptBlock block = (ScriptBlock)_parser.Parse(text, filename, 0); // Add structure to the IProjectBrowser lookup dictionary. _fileItem = item; _invert = false; ParseAstList(block.src_elems.elems, string.Empty); _fileItem.Block = block; } } catch (Exception exc) { _logView.LogExcStr(exc, "ReadJSFileItem failed :" + item.ItemPath); } }
public BaseItem GetFileItem(string filename) { // A factory method to return a file item for a specific file, // for this plugin, which will be held as a reference in the UI. JSFileItem item = new JSFileItem(filename, null); return item; }