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");
        }
示例#2
0
        static void Main(string[] args)
        {
            // The code provided will print ‘Hello World’ to the console.
            // Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app.

            ALDevToolsServer server = new ALDevToolsServer("C:\\Users\\azwie\\.vscode\\extensions\\ms-dynamics-smb.al-4.0.209944");

            ALExtensionProxy alExtensionProxy = server.ALExtensionProxy;
            //alExtensionProxy.Load();

            CodeAnalyzersLibrary library = server.CodeAnalyzersLibraries.GetCodeAnalyzersLibrary("${AppSourceCop}");


            //ALPackageSymbolsLibrary lib = new ALPackageSymbolsLibrary(alExtensionProxy,
            //    "C:\\Projects\\Sandboxes\\samplealprojects\\big\\.alpackages\\Microsoft_Application_11.0.20901.0.app");
            //lib.Load(false);

            ALSymbolInfoSyntaxTreeReader s = new ALSymbolInfoSyntaxTreeReader(alExtensionProxy);
            //ALSymbolInformation m = s.ProcessSourceFile("C:\\Projects\\Sandboxes\\ALProject5\\New Page.al");
            //ALSymbolInformation m = s.ProcessSourceFile(
            //    "C:\\Projects\\Sandboxes\\samplealprojects\\big\\ftest\\CardPageTest02.al");

            ALSymbolInformation m = s.ProcessSourceFile(
                "C:\\Projects\\Sandboxes\\samplealprojects\\small\\tt1.al");



            /*
             * DateTime t1 = DateTime.Now;
             * ALSymbolInfoPackageReader appPackageReader = new ALSymbolInfoPackageReader(alExtensionProxy);
             * ALAppPackage package = appPackageReader.ReadAppPackage("C:\\Projects\\Sandboxes\\samplealprojects\\big\\.alpackages\\Microsoft_Application_14.0.29581.0.app");
             * DateTime t2 = DateTime.Now;
             * TimeSpan t = t2 - t1;
             * Console.WriteLine(t.TotalMilliseconds.ToString() + "ms");
             * Console.WriteLine("Package " + package.Name);
             * if (package.Tables != null)
             *  Console.WriteLine("Tables: " + package.Tables.Count.ToString());
             *
             * ALSymbolInformation symbol = package.ToALSymbol();
             */

            ALPackageSymbolsCache   packagesCache  = new ALPackageSymbolsCache(alExtensionProxy);
            ALProjectSymbolsLibrary projectSymbols = new ALProjectSymbolsLibrary(packagesCache,
                                                                                 alExtensionProxy,
                                                                                 false,
                                                                                 "C:\\Projects\\Sandboxes\\samplealprojects\\big",
                                                                                 ".alpackages");

            projectSymbols.Load(false);



            Console.WriteLine("Hello World!");
            Console.ReadKey();

            // Go to http://aka.ms/dotnet-get-started-console to continue learning how to build a console app!
        }
        protected override async Task <GetCodeAnalyzersRulesResponse> HandleMessage(GetCodeAnalyzersRulesRequest parameters, RequestContext <GetCodeAnalyzersRulesResponse> context)
        {
            CodeAnalyzersLibrary library = this.Server.CodeAnalyzersLibraries.GetCodeAnalyzersLibrary(parameters.name);

            GetCodeAnalyzersRulesResponse response = new GetCodeAnalyzersRulesResponse();

            response.name = parameters.name;
            if (library != null)
            {
                response.rules = library.Rules;
            }

            return(response);
        }