public SpecialNgRepeatDirective(CompileService compileService)
 {
     this.compileService = compileService;
     restrict = "EA"; 
     replace = true; 
      link = LinkFn;
     scope = true;
 }
Example #2
0
        public CreatedUI <T> Create <T>(string ui, Action <T, jQueryObject> populateScope) where T : ManagedScope
        {
            var scope = myRootScopeService.New <T>();
            var html  =
                jQuery.FromHtml(string.Format("<div ng-include src=\"'{1}partials/UIs/{0}.html'\"></div>", ui, Constants.ContentAddress));

            populateScope(scope, html);
            var item = myCompileService(html)(scope);

            item.AppendTo(Window.Document.Body);

            if (scope.Phase == null)
            {
                scope.Apply();
            }

            scope = angular.Element(item.Children()[0]).Scope <T>() ?? scope;

            return(new CreatedUI <T>(scope, item));
        }
Example #3
0
        public void ConfigureServices(IServiceCollection services)
        {
            var schemaService    = new SchemaService();
            var compiler         = new CompileService(schemaService);
            var dbContextService = new DatabaseContextService(schemaService, compiler);
            var queryService     = new QueryService(compiler, dbContextService, schemaService);

            services.AddSingleton <QueryService>(queryService);
            services.AddSingleton <SchemaService>(schemaService);
            services.AddSingleton <CompileService>(compiler);
            services.AddSingleton <DatabaseContextService>(dbContextService);
        }
 public AcgSpacesDirective(CompileService compile, GameContentManagerService gameContentManagerService)
 {
     myCompile = compile;
     myGameContentManagerService = gameContentManagerService;
     restrict = "EA";
     template = @"<div></div>";
     replace = true;
     transclude = false;
     scope = new
             {
                 spaces = "=acgSpaces"
             };
     link = linkFn;
 }
Example #5
0
        protected override async Task OnInitializedAsync()
        {
            await CompileService.InitAsync();

            activeFile = new ProjectFile {
                Name = ConsoleConstants.DefaultConsoleName, Content = ConsoleConstants.DefaultSnippet, FileType = FileType.Class
            };
            AppState.ActiveProject ??= new UserProject {
                Name = "DefaultConsole", Files = new List <ProjectFile> {
                    activeFile
                }
            };
            AppState.ActiveProjectFile = activeFile;
            AppState.Language          = "csharp";
            AppState.PropertyChanged  += HandleCodePropertyChanged;
            await base.OnInitializedAsync();
        }
Example #6
0
        public object PutCodeToCompile([FromBody] JToken input)
        {
            CompiledFormDto        result        = new CompiledFormDto();
            CompileResultContainer compileResult = null;

            if (input["csharpCode"] == null)
            {
                result.ErrorMessages.Add("No Code!");
                return(result);
            }

            try
            {
                compileResult = CompileService.TryCompileAndSearchType(input["csharpCode"].ToString());

                result.CompilationSuccessfull = compileResult.CompilationSuccessfull;
                result.TypeName      = compileResult.TypeName;
                result.ErrorMessages = compileResult.ErrorMessages;

                if (compileResult.CompilationSuccessfull)
                {
                    DefaultSchemaFormBuilder builder        = new DefaultSchemaFormBuilder();
                    SchemaFormInfo           schemaFormInfo = builder.CreateSchemaForm(compileResult.Type);
                    result.Form   = schemaFormInfo.Form;
                    result.Schema = schemaFormInfo.Schema;
                }
            }
            catch (Exception e)
            {
                result.ErrorMessages.Add(e.ToString());
            }
            finally
            {
                if (compileResult != null)
                {
                    compileResult.ReleaseResources();
                }
            }

            return(result);
        }
Example #7
0
        private async Task CodeSubmit()
        {
            activeFile ??= new ProjectFile {
                Name = fileName, FileType = FileType.Class
            };
            AppState.SaveCode(AppState.ActiveProjectFile);
            List <ProjectFile> tempFiles = new();

            foreach (var file in AppState.ProjectFiles)
            {
                tempFiles.Add(new ProjectFile {
                    Name = file.Name, Content = await ReplaceConsoleInput(file.Content)
                });
            }
            await Task.Delay(20);

            AppState.CurrentOutput = await CompileService.CompileAndRun(tempFiles.ToArray());

            isCodeCompiling = false;
            await InvokeAsync(StateHasChanged);
        }
Example #8
0
        //[Test]
        public void IntegrationTest()
        {
            const string templatePath            = @"..\..\Test Templates\Modeled Basic Template.odt";
            const string reportPath              = @"..\..\Generated Reports\Very Basic Report.odt";
            const string expectedReportPath      = @"..\..\Expected Report Outputs\Very Basic Report.odt";
            var          templateFactory         = new TemplateFactory();
            var          zipFactory              = new ZipFactory();
            var          readerFactory           = new StreamReaderWrapperFactory();
            var          zipHandlerService       = new ZipHandlerService(readerFactory);
            var          buildOdfMetadataService = new BuildOdfMetadataService();
            var          xmlNamespaceService     = new XmlNamespaceService();
            var          xDocumentParserService  = new XDocumentParserService();
            var          odfHandlerService       = new OdfHandlerService(zipFactory, zipHandlerService, buildOdfMetadataService,
                                                                         xmlNamespaceService, xDocumentParserService);

            var templateService = new TemplateBuilderService(templateFactory, odfHandlerService,
                                                             xmlNamespaceService, xDocumentParserService);
            var document = File.ReadAllBytes(templatePath);

            var template             = templateService.BuildTemplate(document);
            var razorTemplateService = new TemplateService();
            var compileService       = new CompileService(razorTemplateService);

            compileService.Compile(template, "Template 1");

            var reportService = new ReportGeneratorService(new ZipFactory(), razorTemplateService);

            using (var report = new FileStream(reportPath, FileMode.Create))
            {
                reportService.BuildReport(template, new BasicModel {
                    Name = "Fancypants McSnooterson"
                }, report);
            }
            var diffs = GetDifferences(expectedReportPath, reportPath);
            var thereAreDifferences = diffs.HasDifferences();

            Assert.That(!thereAreDifferences);
        }
Example #9
0
        public Api(string node)
        {
            netnode = node;
            switch (netnode)
            {
            case "testnet":
                commonService = new CommonService
                {
                    mh = mh,
                    block_mongodbConnStr   = mh.block_mongodbConnStr_testnet,
                    block_mongodbDatabase  = mh.block_mongodbDatabase_testnet,
                    analy_mongodbConnStr   = mh.analy_mongodbConnStr_testnet,
                    analy_mongodbDatabase  = mh.analy_mongodbDatabase_testnet,
                    notify_mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    notify_mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    neoCliJsonRPCUrl       = mh.neoCliJsonRPCUrl_testnet,
                    debug_mongodbConnStr   = mh.debug_mongodbConnStr_testnet,
                    debug_mongodbDatabase  = mh.debug_mongodbDatabase_testnet,
                };
                compileService = new CompileService
                {
                    mh = mh,
                    notify_mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    notify_mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    ossClient = new OssFileService(mh.nelOssRPCUrl_testnet)
                };
                compileServiceNew = new CompileServiceNew
                {
                    mh = mh,
                    debug_mongodbConnStr  = mh.debug_mongodbConnStr_testnet,
                    debug_mongodbDatabase = mh.debug_mongodbDatabase_testnet,
                    ossClient             = new OssFileService(mh.nelOssRPCUrl_testnet),
                    debugger = new CompileFileService(mh.nelDebugRPCUrl_testnet),
                    py_path  = mh.py_path
                };
                claimService = new ClaimGasService
                {
                    assetid                = mh.id_gas,
                    accountInfo            = AccountInfo.getAccountInfoFromWif(mh.prikeywif_testnet),
                    mh                     = mh,
                    notify_mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    notify_mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    gasClaimCol            = mh.gasClaimCol_testnet,
                    maxClaimAmount         = int.Parse(mh.maxClaimAmount_testnet),
                };
                claimTx4testnet = new ClaimGasTransaction
                {
                    nelJsonRpcUrl          = mh.nelJsonRPCUrl_testnet,
                    assetid                = mh.id_gas,
                    accountInfo            = AccountInfo.getAccountInfoFromWif(mh.prikeywif_testnet),
                    mh                     = mh,
                    notify_mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    notify_mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    gasClaimCol            = mh.gasClaimCol_testnet,
                    block_mongodbConnStr   = mh.block_mongodbConnStr_testnet,
                    block_mongodbDatabase  = mh.block_mongodbDatabase_testnet,
                    batchSendInterval      = int.Parse(mh.batchSendInterval_testnet),
                    checkTxInterval        = int.Parse(mh.checkTxInterval_testnet),
                    checkTxCount           = int.Parse(mh.checkTxCount_testnet)
                };
                //
                new Task(() => claimTx4testnet.claimGasLoop()).Start();
                break;

            case "mainnet":
                break;
            }
        }
Example #10
0
 public DebugHandler(RequestDelegate next, SchemaService service, CompileService compileService, DatabaseContextService dbContextService) : base(next)
 {
     _schemaService    = service;
     _compileService   = compileService;
     _dbContextService = dbContextService;
 }
Example #11
0
 public CreateUIService(CompileService compileService, IRootScopeService rootScopeService)
 {
     myCompileService   = compileService;
     myRootScopeService = rootScopeService;
 }
Example #12
0
        public void CompileServiceTest()
        {
            var          compileService = new CompileService();
            var          source         = CompileServiceLanguageSourceCode.CPPCorrectSourceCode;
            const string Language       = "CPP8";
            var          input          = new string[0];
            var          output         = new string[0];
            var          inputStrings   = new[] { "1 2" };
            var          outputStrings  = new[] { "12" };

            string expected;

            // compile with incorrect language parameter
            try
            {
                expected = compileService.Compile(source, "IncorrectLanguageName", input, output, 100, 100);
                Assert.AreEqual(false, true);
            }
            catch (Exception)
            {
                Assert.AreEqual(true, true);
            }

            try
            {
                expected = compileService.Compile(source, string.Empty, input, output, 100, 100);
                Assert.AreEqual(false, true);
            }
            catch (Exception)
            {
                Assert.AreEqual(true, true);
            }

            // compile with incorrect timelimit parameter
            try
            {
                expected = compileService.Compile(source, Language, inputStrings, outputStrings, -5, 100);
                Assert.AreEqual(false, true);
            }
            catch (Exception)
            {
                Assert.AreEqual(true, true);
            }

            // compile with incorrect memorylimit parameter
            try
            {
                expected = compileService.Compile(source, Language, inputStrings, outputStrings, 100, -5);
                Assert.AreEqual(false, true);
            }
            catch (Exception)
            {
                Assert.AreEqual(true, true);
            }

            // compile with correct parameters
            try
            {
                input    = new[] { "2 5", "7 5" };
                output   = new[] { "25", "75" };
                expected = compileService.Compile(source, Language, input, output, 1000, 1000);
                Assert.AreEqual(expected, "Accepted");
            }
            catch (Exception)
            {
                Assert.AreEqual(false, true);
            }
        }
Example #13
0
        public void CompileServiceCheckTest()
        {
            var complieService = new CompileService();

            Assert.AreEqual(complieService.Check(), "Check");
        }