public PackageNativeImpl[] getLangNativeImpls(string langName)
        {
            var result = new List <PackageNativeImpl>();

            foreach (var pkg in this.implementationPkgs)
            {
                foreach (var pkgImpl in pkg.implementations.filter(x => x.language == langName))
                {
                    var fileNamePaths = new Dictionary <string, string> {
                    };
                    foreach (var fileName in pkgImpl.nativeIncludes)
                    {
                        fileNamePaths.set(fileName, $"native/{fileName}");
                    }

                    var incDir = pkgImpl.nativeIncludeDir;
                    if (incDir != null)
                    {
                        if (!incDir.endsWith("/"))
                        {
                            incDir += "/";
                        }
                        var prefix = $"native/{incDir}";
                        foreach (var fn in Object.keys(pkg.content.files).filter(x => x.startsWith(prefix)).map(x => x.substr(prefix.length())))
                        {
                            fileNamePaths.set(fn, $"{prefix}{fn}");
                        }
                    }

                    foreach (var fileName in Object.keys(fileNamePaths))
                    {
                        var path = fileNamePaths.get(fileName);
                        var code = pkg.content.files.get(path);
                        if (code == null)
                        {
                            throw new Error($"File '{fileName}' was not found for package '{pkg.implementationYaml.name}'");
                        }
                        var impl = new PackageNativeImpl();
                        impl.pkgName    = pkg.implementationYaml.name;
                        impl.pkgVendor  = pkg.implementationYaml.vendor;
                        impl.pkgVersion = pkg.implementationYaml.version;
                        impl.fileName   = fileName;
                        impl.code       = code;
                        result.push(impl);
                    }
                }
            }
            return(result.ToArray());
        }
示例#2
0
        public static Dictionary <string, string> processTrivia(string trivia)
        {
            var result = new Dictionary <string, string> {
            };

            if (trivia != null && trivia != "")
            {
                var regex = new RegExp("(?:\\n|^)\\s*(?://|#|/\\*\\*?)\\s*@([A-Za-z0-9_.-]+) ?((?!\\n|\\*/|$).+)?");
                while (true)
                {
                    var match = regex.exec(trivia);
                    if (match == null)
                    {
                        break;
                    }
                    if (result.hasKey(match.get(1)))
                    {
                        // @php $result[$match[1]] .= "\n" . $match[2];
                        // @python result[match[1]] += "\n" + match[2]
                        // @csharp result[match[1]] += "\n" + match[2];
                        // @java result.put(match[1], result.get(match[1]) + "\n" + match[2]);
                        result[match[1]] += "\n" + match[2];
                    }
                    else
                    {
                        result.set(match.get(1), (match.get(2) ?? "") == "" ? "true" : match.get(2) ?? "");
                    }
                }
            }
            return(result);
        }
示例#3
0
 protected override void OnBeforeInsert(ARACLAR item, ref bool cancel)
 {
     saseDict.set(item.SASENO.trim().ToUpper(), item, out cancel);
     if (!cancel)
     {
         dict.set(item.ID, item, out cancel);
     }
 }
示例#4
0
 protected override void OnBeforeInsert(RECETEMALZEMELER item, ref bool cancel)
 {
     malDict.check(item.RECETEID).set(item.MALZEMEID, item, out cancel);
     if (!cancel)
     {
         dict.set(item.ID, item, out cancel);
     }
 }
示例#5
0
 protected override void OnBeforeInsert(MALZEMELER item, ref bool cancel)
 {
     dict.set(item.ID, item, out cancel);
     if (!cancel)
     {
         kodDict.set(item.KOD, item);
     }
 }
 protected override void OnBeforeInsert(RECETEKONTROLTARIHLER item, ref bool cancel)
 {
     tarihDict.check(item.RECETEID).set(item.TARIH.toLongD(), item, out cancel);
     if (!cancel)
     {
         dict.set(item.ID, item, out cancel);
     }
 }
示例#7
0
 protected override void OnBeforeInsert(SERVISSTOKLAR_Short item, ref bool cancel)
 {
     kodDict.set(item.KOD.unformattedCode(), item);
     if (!cancel)
     {
         dict.set(item.ID, item, out cancel);
     }
 }
示例#8
0
 protected override void OnBeforeInsert(AKSIYONISLEMLER item, ref bool cancel)
 {
     aksIdNoDict.check(item.AKSIYONID).set(item.SIRANO, item, out cancel);
     if (!cancel)
     {
         dict.set(item.ID, item, out cancel);
     }
 }
示例#9
0
 protected override void OnBeforeInsert(AKSIYONISLEMISCILIKLER item, ref bool cancel)
 {
     gdict.check(item.AKSIYONISLEMID).set(item.ISCILIKID, item, out cancel);
     if (!cancel)
     {
         dict.set(item.ID, item, out cancel);
     }
 }
示例#10
0
 protected override void OnBeforeInsert(AKSIYONLAR item, ref bool cancel)
 {
     aksiyonNoDict.set(item.AKSIYONNO.trim().ToUpper(), item, out cancel);
     if (!cancel)
     {
         dict.set(item.ID, item, out cancel);
     }
 }
示例#11
0
 protected override void OnBeforeInsert(BAKIMGRUPLAR item, ref bool cancel)
 {
     kodDict.set(item.KOD, item, out cancel);
     if (!cancel)
     {
         dict.set(item.ID, item, out cancel);
     }
 }
示例#12
0
            //public VERGIDAIRELER GetFromNameEx2(string vergiDaireAdi)
            //{
            //    List<string> vdOpt = vergiDaireAdi.split(' ');
            //    return hasTable[vergiDaireAdi] as VERGIDAIRELER;
            //}


            protected override void OnBeforeInsert(VERGIDAIRELER item, ref bool cancel)
            {
                if (hasTable.ContainsKey(item.AD) == false)
                {
                    hasTable.Add(item.AD, item);
                }
                dict.set(item.ID, item, out cancel);
            }
示例#13
0
        private async Task startNodeKitRenderer(Dictionary<string, object> options)
        {
            string[] args = (string[])options["NKS.Args"];

            NKEventEmitter.isMainProcess = false;

            options.set("NKS.MainThreadScheduler", TaskScheduler.FromCurrentSynchronizationContext());
            options.set("NKS.MainThreadId", Environment.CurrentManagedThreadId);
            options.set("NKS.RemoteProcess", true);

            proxy = NKRemoting.NKRemotingProxy.registerAsClient(args[0]);
            context = await NKScripting.Engines.NKRemoting.NKSNKRemotingContext.createContext(proxy, options);

            // REMOTE SCRIPT ENGINE LOADED, ADD {NK} NODEKIT PROXY
            await NKElectro.Main.addElectroRemoteProxy(context, options);

            proxy.NKready();
        }
示例#14
0
        private async Task startNodeKitRenderer(Dictionary <string, object> options)
        {
            string[] args = (string[])options["NKS.Args"];

            NKEventEmitter.isMainProcess = false;

            options.set("NKS.MainThreadScheduler", TaskScheduler.FromCurrentSynchronizationContext());
            options.set("NKS.MainThreadId", Environment.CurrentManagedThreadId);
            options.set("NKS.RemoteProcess", true);

            proxy   = NKRemoting.NKRemotingProxy.registerAsClient(args[0]);
            context = await NKScripting.Engines.NKRemoting.NKSNKRemotingContext.createContext(proxy, options);

            // REMOTE SCRIPT ENGINE LOADED, ADD {NK} NODEKIT PROXY
            await NKElectro.Main.addElectroRemoteProxy(context, options);

            proxy.NKready();
        }
示例#15
0
 protected override void OnBeforeInsert(VARLIKLAR item, ref bool cancel)
 {
     cancel = item.VERGINO.isNullOrWhiteSpace();
     if (!cancel)
     {
         vnoDict.set(item.VERGINO, item, out cancel);
     }
     if (!cancel)
     {
         dict.set(item.ID, item, out cancel);
     }
 }
示例#16
0
        public Dictionary <string, string> parseAttributes()
        {
            var result = new Dictionary <string, string> {
            };

            while (this.reader.readToken(","))
            {
                var key   = this.reader.expectIdentifier();
                var value = this.reader.readToken("=") ? this.reader.expectString() : null;
                result.set(key, value);
            }
            return(result);
        }
示例#17
0
        private async Task startNodeKitMain(Dictionary<string, object> options)
        {
            NKEventEmitter.isMainProcess = true;

            options.set("NKS.MainThreadScheduler", TaskScheduler.FromCurrentSynchronizationContext());
            options.set("NKS.MainThreadId", Environment.CurrentManagedThreadId);
            var entryClass = options.itemOrDefault("NKS.Entry", typeof(NKC_NodeKit));
      
            context = await NKScriptContextFactory.createContext(options);
         
            // SCRIPT ENGINE LOADED, ADD {NK} NODEKIT
            await NKElectro.Main.addElectro(context, options);
            await NKCore.Main.addCorePlatform(context, options);
            await NKCore.Main.bootCore(context, options);

            // {NK} NODEKIT ADDED, START APPLICATION 
    //        var appjs = await NKStorage.getResourceAsync(entryClass, "index.js", "app");
   //         var script = "function loadapp(){\n" + appjs + "\n}\n" + "loadapp();" + "\n";
    //        await context.NKevaluateJavaScript(script, "io.nodekit.electro.main");

            NKEventEmitter.global.emit<string>("NK.AppReady");
        }
示例#18
0
        private async Task startNodeKitMain(Dictionary <string, object> options)
        {
            NKEventEmitter.isMainProcess = true;

            options.set("NKS.MainThreadScheduler", TaskScheduler.FromCurrentSynchronizationContext());
            options.set("NKS.MainThreadId", Environment.CurrentManagedThreadId);
            var entryClass = options.itemOrDefault("NKS.Entry", typeof(NKC_NodeKit));

            context = await NKScriptContextFactory.createContext(options);

            // SCRIPT ENGINE LOADED, ADD {NK} NODEKIT
            await NKElectro.Main.addElectro(context, options);

            await NKCore.Main.addCorePlatform(context, options);

            await NKCore.Main.bootCore(context, options);

            // {NK} NODEKIT ADDED, START APPLICATION
            //        var appjs = await NKStorage.getResourceAsync(entryClass, "index.js", "app");
            //         var script = "function loadapp(){\n" + appjs + "\n}\n" + "loadapp();" + "\n";
            //        await context.NKevaluateJavaScript(script, "io.nodekit.electro.main");

            NKEventEmitter.global.emit <string>("NK.AppReady");
        }
        public static ImplPackageYaml fromYaml(YamlValue obj)
        {
            var languages = new Dictionary <string, ImplPkgLanguage> {
            };
            var langDict  = obj.dict("languages");

            if (langDict != null)
            {
                foreach (var langName in Object.keys(langDict))
                {
                    languages.set(langName, ImplPkgLanguage.fromYaml(langDict.get(langName)));
                }
            }

            return(new ImplPackageYaml(obj.dbl("file-version"), obj.str("vendor"), obj.str("name"), obj.str("description"), obj.str("version"), obj.strArr("includes"), obj.arr("implements").map(impl => ImplPkgImplementation.fromYaml(impl)), languages));
        }
示例#20
0
        public async Task <PackageBundle> getAllCached()
        {
            var packages = new Dictionary <string, PackageContent> {
            };
            var allFiles = OneFile.listFiles(this.packagesDir, true);

            foreach (var fn in allFiles)
            {
                var pathParts = fn.split(new RegExp("/")).ToList();
                // [0]=implementations/interfaces, [1]=package-name, [2:]=path
                if (pathParts.length() < 3)
                {
                    continue;
                }
                var type   = pathParts.shift();
                var pkgDir = pathParts.shift();
                if (type != "implementations" && type != "interfaces")
                {
                    continue;
                }
                // skip e.g. bundle.json
                var pkgIdStr = $"{type}/{pkgDir}";
                var pkg      = packages.get(pkgIdStr);
                if (pkg == null)
                {
                    var pkgDirParts = pkgDir.split(new RegExp("-")).ToList();
                    var version     = pkgDirParts.pop().replace(new RegExp("^v"), "");
                    var pkgType     = type == "implementations" ? PackageType.Implementation : PackageType.Interface;
                    var pkgId       = new PackageId(pkgType, pkgDirParts.join("-"), version);
                    pkg = new PackageContent(pkgId, new Dictionary <string, string> {
                    }, true);
                    packages.set(pkgIdStr, pkg);
                }
                pkg.files.set(pathParts.join("/"), OneFile.readText($"{this.packagesDir}/{fn}"));
            }
            return(new PackageBundle(Object.values(packages)));
        }
示例#21
0
 protected override void OnBeforeInsert(WSGLBRCONT item, ref bool cancel)
 {
     dict.set(item.CONDITION, item, out cancel);
 }
示例#22
0
 protected override void OnBeforeInsert(SERVISRANDEVUTIPLER item, ref bool cancel)
 {
     dict.set(item.ID, item, out cancel);
 }
示例#23
0
 protected override void OnBeforeInsert(GUVENIRLIKDERECELER item, ref bool cancel)
 {
     dict.set(item.ID, item, out cancel);
 }
示例#24
0
 protected override void OnBeforeInsert(SERVISPAKETISCILIKLER item, ref bool cancel)
 {
     dict.set(item.ID, item, out cancel);
 }
示例#25
0
 protected override void OnBeforeInsert(SERVISTEKLIFSASELER item, ref bool cancel)
 {
     dict.set(item.ID, item, out cancel);
 }
 protected override void OnBeforeInsert(SERVISEKSISLEMDHIZMETLER item, ref bool cancel)
 {
     dict.set(item.ID, item, out cancel);
 }
示例#27
0
 protected override void OnBeforeInsert(ISORTAKKONTAKLAR item, ref bool cancel)
 {
     dict.set(item.ID, item, out cancel);
 }
示例#28
0
 protected override void OnBeforeInsert(RECETEEKSIKNEDENLER item, ref bool cancel)
 {
     dict.set(item.ID, item, out cancel);
 }
示例#29
0
 protected override void OnBeforeInsert(FORMLAR item, ref bool cancel)
 {
     dict.set(item.ID, item, out cancel);
 }
示例#30
0
 protected override void OnBeforeInsert(KONTAKTELEFONLAR item, ref bool cancel)
 {
     dict.set(item.ID, item, out cancel);
 }
示例#31
0
 protected override void OnBeforeInsert(ELBISEBEDENLER item, ref bool cancel)
 {
     dict.set(item.ID, item, out cancel);
 }
示例#32
0
 protected override void OnBeforeInsert(PARAMETRELER item, ref bool cancel)
 {
     dict.set(item.AD, item, out cancel);
 }