コード例 #1
0
ファイル: Program.cs プロジェクト: MarekPokornyOva/Jellequin2
        static void TestScripting(Assembly asm, string[] args)
        {
            //Do you remember Executor brings some possibilities? Let's explore those.
            Executor exe = new Executor(asm);

            exe.ResolveExternalLibrary += Executor.DefaultExternalLibraryResolver;
            exe.Execute(args);

            //Executing JS code from C# is one of them.
            Func <string, object> parseArg = exe.ExternalVariables.GetFunc <string, object>("parseArg");
            object    parsedArgRaw         = parseArg("ex=sf56");
            IJsObject parsedArg            = Executor.BridgeJsObject(parsedArgRaw);
            string    parsedArgValue       = parsedArg.GetValue("value") as string;
        }