public override bool Load(bool forceReload) { try { FileInfo fileInfo = new FileInfo(this.Path); if ((!forceReload) && (fileInfo.LastWriteTime == this._packageFileLastWriteTime) && (fileInfo.Length == this._packageFileSize) && (fileInfo.CreationTime == this._packageFileCreationTime)) { return(true); } this._packageFileLastWriteTime = fileInfo.LastWriteTime; this._packageFileSize = fileInfo.Length; this._packageFileCreationTime = fileInfo.CreationTime; ALSymbolInfoPackageReader reader = new ALSymbolInfoPackageReader(this.ALExtensionProxy); this.Root = reader.ReadSymbols(this.Path); return(true); } catch (Exception) { return(false); } }
static void Main(string[] args) { //string extensionPath = "C:\\Users\\azwie\\.vscode\\extensions\\ms-dynamics-smb.al-5.0.329509"; //string extensionPath = "C:\\Users\\azwie\\Downloads\\VSCode-win32-x64-1.45.1\\data\\extensions\\microsoft.al-0.13.82793"; string extensionPath = "C:\\Projects\\MicrosoftALVersions\\LatestBC"; ALDevToolsServerHost host = new ALDevToolsServerHost(extensionPath); host.Initialize(); ALDevToolsServer alDevToolsServer = new ALDevToolsServer(extensionPath); //string filePath = "C:\\Projects\\Sandboxes\\al-test-projects\\small\\Pag50000.MySmallTableList.al"; string filePath = "C:\\Projects\\Sandboxes\\al-test-projects\\SmallBC16\\MyPage.al"; ALSymbolInfoSyntaxTreeReader syntaxTreeReader = new ALSymbolInfoSyntaxTreeReader(true); ALSymbolInformation symbols = syntaxTreeReader.ProcessSourceFile(filePath); ALFullSyntaxTree syntaxTree = new ALFullSyntaxTree(); syntaxTree.Load("", filePath); CodeAnalyzersLibrariesCollection caLibCol = new CodeAnalyzersLibrariesCollection(alDevToolsServer); CodeAnalyzersLibrary caLib = caLibCol.GetCodeAnalyzersLibrary("${CodeCop}"); filePath = "C:\\Projects\\Sandboxes\\al-test-projects\\SmallBC16\\AnZwDev_Small but great AZ AL Extension_1.0.0.0.app"; ALSymbolInfoPackageReader packageReader = new ALSymbolInfoPackageReader(); packageReader.ReadAppPackage(filePath); Console.WriteLine("Done"); }