コード例 #1
0
        static bool GenerateApp(TestCase test, TestDriverSettings tds)
        {
            test.VM         = VM.AVM;
            test.OutputPath = Path.Combine(test.Root, "test." + tds.OutputExtension);

            if (tds.IsJavaScript)
            {
                try
                {
                    var compiler = new JsCompiler(new FileInfo(test.ExePath));
                    compiler.Compile(new FileInfo(test.OutputPath));
                    return(true);
                }
                catch (Exception e)
                {
                    test.Error = string.Format("Unable to generate {0} file.\nException: {1}", tds.OutputFormat, e);
                    return(false);
                }
            }

            bool refl = test.FullName.Contains("Reflection");

            GlobalSettings.ReflectionSupport = refl;

            if (test.UsePfc)
            {
                var options = new PfxCompilerOptions
                {
                    Nologo     = true,
                    Input      = test.ExePath,
                    Output     = test.OutputPath,
                    Reflection = refl
                };
                string err = PfxCompiler.Run(options);
                if (CompilerConsole.HasErrors(err))
                {
                    throw new InvalidOperationException("Unable to compile " + test.Name + ".\n" + err);
                }
            }
            else
            {
                IAssembly asm;
                if (!LoadAssembly(test, tds, out asm))
                {
                    return(false);
                }

                try
                {
                    string cl = string.Format("/format:{0}", tds.OutputFormat);

                    if (tds.IsSWF)
                    {
                        cl += " /framesize:100 /fp:10 /nohtml /exception-break";
                    }

                    FlashLanguageInfrastructure.Serialize(asm, test.OutputPath, cl);
                }
                catch (Exception e)
                {
                    test.Error = string.Format("Unable to generate {0} file.\nException: {1}", tds.OutputFormat, e);
                    return(false);
                }
            }

            return(true);
        }
コード例 #2
0
 /// <summary>
 /// Starts the js runtime, binding all currently included js modules / assemblies (.js files),
 /// this function can be called from javascript using this code:
 /// <code>JsRuntime.Start();</code>
 /// </summary>
 public static void Start()
 {
     JsCompiler.Compile();
 }
コード例 #3
0
 public static string GetHashKey(object key)
 {
     return(JsCompiler.GetHashKey(key));
 }
コード例 #4
0
 public static object CreateInstance(JsImplType type)
 {
     return(JsCompiler.NewByFunc(type._JsType.ctor));
 }
コード例 #5
0
ファイル: Delegate.cs プロジェクト: mustang2247/SharpKit-SDK
 public static JsImplDelegate Remove(JsImplDelegate delegate1, JsImplDelegate delegate2)
 {
     return(JsCompiler.RemoveDelegate(delegate1.As <JsDelegateFunction>(), delegate2.As <JsDelegateFunction>()).As <JsImplDelegate>());
 }
コード例 #6
0
ファイル: Delegate.cs プロジェクト: mustang2247/SharpKit-SDK
 public static JsImplDelegate Combine(JsImplDelegate delegate1, JsImplDelegate delegate2)
 {
     return(JsCompiler.CombineDelegates(delegate1.As <JsDelegateFunction>(), delegate2.As <JsDelegateFunction>()).As <JsImplDelegate>());
 }