Inheritance: MonoBehaviour
示例#1
0
文件: Program.cs 项目: acraven/saucy
        public static int Main(string[] args)
        {
            var consoleWriter = new ConsoleWriter();

             try
             {
            var settings = new SaucySettings();

            ILogger logger = new VerboseLogger();

            var restoreVerb = new SaucyCommandLine(
               new PackagesRestorer(
                  new JsonLoader(),
                  new ProviderMatcher(new GitHubProvider(new FolderSync(logger))),
                  consoleWriter,
                  settings),
               settings);

            var runner = new Runner();
            runner.Register(restoreVerb);

            var exitCode = runner.Run(args);
            return exitCode;
             }
             catch (Exception e)
             {
            consoleWriter.Write(e.Message);
            consoleWriter.Write(e.StackTrace);
            return -1;
             }
        }
示例#2
0
        public void InitializeTestEngineResult()
        {
            // Save the local directory - used by GetLocalPath
            Uri uri = new Uri(Assembly.GetExecutingAssembly().CodeBase);
            localDirectory = Path.GetDirectoryName(uri.LocalPath);

            AssemblyPath = GetLocalPath(AssemblyName);

            // Create a fresh copy of the engine, since we can't use the
            // one that is running this test.
            engine = TestEngineActivator.CreateInstance();
            engine.InternalTraceLevel = InternalTraceLevel.Off;

            // Create a new DefaultAssemblyRunner, which is actually a framework class,
            // because we can't use the one that's currently running this test.
            var runner = new Runner(new Builder());
            var settings = new Dictionary<string, object>();

            // Make sure the runner loaded the mock assembly.
            Assert.That(
                runner.Load(AssemblyPath, settings).RunState.ToString(),
                Is.EqualTo("Runnable"), 
                "Unable to load mock-nunit-assembly.exe");

            // Run the tests, saving the result as an XML string
            var xmlText = runner.Run(TestListener.NULL, TestFilter.Empty).ToXml(true).OuterXml;

            // Create a TestEngineResult from the string, just as the TestEngine does,
            // then add a test-run element to the result, wrapping the result so it
            // looks just like what the engine would return!
            this.EngineResult = new TestEngineResult(xmlText).Aggregate("test-run", AssemblyName, AssemblyPath);
        }
示例#3
0
        public void Execute()
        {
            var packagePath = Path.Combine(Environment.CurrentDirectory, "NugetPackageFiles");
            packagePath = Path.GetFullPath(packagePath);
            var runner = new Runner
                             {
                                 PackageDirectory = packagePath,
                                 MetadataAssembly="Standard.dll",
                                 WriteInfo = s => Debug.WriteLine(s)
                             };
            runner.Execute();

            var outputFile = Path.Combine(packagePath, "MyPackage.1.0.nupkg");
            var expectedFIle = Path.Combine(Environment.CurrentDirectory, "MyPackage.1.0.nupkg ");

            using (var package1 = Package.Open(expectedFIle))
            using (var package2 = Package.Open(outputFile))
            {
                foreach (var part1 in package1.GetParts())
                {
                    if (part1.Uri.OriginalString.EndsWith("psmdcp"))
                    {
                        continue;
                    }
                    if (part1.Uri.OriginalString.EndsWith("rels"))
                    {
                        continue;
                    }
                    var part2 = package2.GetPart(part1.Uri);
                    var hash1 = GetFileHash(part1);
                    var hash2 = GetFileHash(part2);
                    Assert.AreEqual(hash1,hash2, part1.Uri.OriginalString);
                }
            }
        }
示例#4
0
    void Update()
    {
        timeSinceStart = Time.time;

        if (!runnerReady)
        {
            runner = FindObjectOfType<Runner>() as Runner;
            if (runner != null)
            {
                runnerReady = true;
            }
        }
        else
        {
            credField.text = runner.credits.ToString();
            tagField.text = runner.tags.ToString();
            linksField.text = runner.links.ToString();
            memField.text = runner.mem.ToString();
            scoreField.text = runner.agendaPts.ToString();
        }

        switch (state)
        {
        case "menu":
            break;
        case "normal":
            break;
        case "run":
            break;
        }
    }
示例#5
0
        public void SetUp()
        {
            _runner = RunnerHelper.Create();
            _runner.RunInitializers(this);

            // consolidate data from initializers and execute batch process here
        }
示例#6
0
        /// <summary>
        /// Constructor for the form
        /// </summary>
        public BuildTools(Guid guid, Job job)
        {
            InitializeComponent();
            _job = job;
            _googleAnalytics = new GoogleAnalytics(guid);
            _runner = new Runner(this, _job, _googleAnalytics);
            undoBT.Visible = false;
            progress.Visible = false;

            versionBox.SelectedIndex = 0;
            GetVersions();

            // delegates
            _appendDelegate = AppendText;
            _appendRawDelegate = AppendRawText;
            _disableDelegate = Disable;
            _enableDelegate = Enable;
            _showProgressDelegate = ProgressShow;
            _hideProgressDelegate = ProgressHide;
            _indeterminateProgressDelegate = ProgressIndeterminate;
            _progressPercentDelegate = Progress;
            _updateVersionsDelegate = UpdateVersions;

            if (File.Exists(Program.CheckUpdate)) {
                string text = File.ReadAllText(Program.CheckUpdate);
                if (string.IsNullOrEmpty(text) || text.Trim().ToLower() == "false") {
                    autoUpdateCB.Checked = false;
                }
            }

            Console.WriteLine(guid.ToString());
            new Thread(delegate () {
                _googleAnalytics.SendEvent("Application", "Start");
            }).Start();
        }
示例#7
0
 public void Should_run_all_tests()
 {
     var settings = new RunSettings(new AssemblyOptions(Path.GetFullPath(@"AutoTest.TestRunners.MSTest.Tests.TestResource.dll")), new string[] {}, null);
     var runner = new Runner();
     var result = runner.Run(settings);
     Assert.That(result.Count(), Is.EqualTo(10));
 }
 public void Start()
 {
     _updateNextFrame = true;
     _buildMode = FindObjectOfType<BuildMode>();
     _imageSetter = GetComponent<ImageSetter>();
     _runner = FindObjectOfType<Runner>();
 }
示例#9
0
文件: Program.cs 项目: pjc0247/Panic
 static async void Bar()
 {
     Runner<HttpClient> a = new Runner<HttpClient>();
     FileSystemTemplateSource b = new FileSystemTemplateSource();
     
     await a.ExecuteSingle(await b.LoadTemplate("test.json"));
 }
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="id"></param>
 public RuleFired(Runner.Activation activation, acceptor.RulePriority priority)
     : base(activation.RuleCondition.Name, activation.RuleCondition, priority)
 {
     Activation = activation;
     Explanation = Activation.Explanation;
     Updates = new List<VariableUpdate>();
 }
示例#11
0
        public override bool Execute()
        {
            var stopwatch = Stopwatch.StartNew();
            BuildEngine.LogMessageEvent(new BuildMessageEventArgs(string.Format("Pepita (version {0}) Executing", GetType().Assembly.GetName().Version), "", "Pepita", MessageImportance.High));

            try
            {
                GetProjectPath(Console.Out);

                var runner = new Runner
                                 {
                                     ProjectDirectory = ProjectDirectory,
                                     SolutionDirectory = SolutionDirectory,
                                     WriteInfo = s => BuildEngine.LogMessageEvent(new BuildMessageEventArgs("\t" + s, "", "Pepita", MessageImportance.High)),
                                 };
                runner.Execute();
            }
            catch (ExpectedException expectedException)
            {
                BuildEngine.LogErrorEvent(new BuildErrorEventArgs("", "", "", 0, 0, 0, 0, string.Format("Pepita: {0}", expectedException.Message), "", "Pepita"));
                return false;
            }
            catch (Exception exception)
            {
                BuildEngine.LogErrorEvent(new BuildErrorEventArgs("", "", "", 0, 0, 0, 0, string.Format("Pepita: {0}", exception), "", "Pepita"));
                return false;
            }
            finally
            {
                stopwatch.Stop();
                BuildEngine.LogMessageEvent(new BuildMessageEventArgs(string.Format("\tFinished ({0}ms)", stopwatch.ElapsedMilliseconds), "", "Pepita", MessageImportance.High));
            }
            return true;
        }
示例#12
0
        public static void Run(Tree<string> tree, Tuple<double, Rect> seed)
        {
            Func<StateMonad<Tuple<double, Rect>, Tuple<double, Rect>>> leftUpdater = () =>
                new StateMonad<Tuple<double, Rect>, Tuple<double, Rect>>(m =>
                {
                    var depth = m.First;
                    var rect = m.Second;
                    var newDepth = depth + 1.0;
                    var multiplier = 2.0 * newDepth;
                    var nextRect = new Rect(rect.Height, rect.Width / multiplier, rect.Top, rect.Left + rect.Width / multiplier);
                    var currRect = new Rect(rect.Height, rect.Width / multiplier, rect.Top, rect.Left);
                    return Tuple.Create(Tuple.Create(newDepth, nextRect), Tuple.Create(newDepth, currRect));
                });

            Func<StateMonad<Tuple<double, Rect>, Tuple<double, Rect>>> rightUpdater = () =>
                new StateMonad<Tuple<double, Rect>, Tuple<double, Rect>>(m =>
                {
                    var depth = m.First;
                    var rect = m.Second;
                    var newDepth = depth - 1.0;
                    var nextRect = new Rect(rect.Height, rect.Width * 2, rect.Top, rect.Left + rect.Width);
                    return Tuple.Create(Tuple.Create(newDepth, nextRect), m);
                });

            var runner = new Runner<Tuple<double, Rect>, string>(leftUpdater, rightUpdater);

            Console.WriteLine();
            Console.WriteLine("Exercise 2: Tree within bounded rects:");
            var rectTree = runner.MLabel(tree, seed);
            rectTree.Show(2);
            Console.WriteLine();
        }
示例#13
0
 public void Should_identify_test_container()
 {
     var runner = new Runner();
     var assembly = getPath("AutoTest.TestRunners.XUnit.Tests.TestResource.dll");
     var cls = "AutoTest.TestRunners.XUnit.Tests.TestResource.Class1";
     Assert.That(runner.ContainsTestsFor(assembly, cls), Is.True);
 }
示例#14
0
 public void Should_identify_test()
 {
     var runner = new Runner();
     var assembly = getPath("AutoTest.TestRunners.XUnit.Tests.TestResource.dll");
     var method = "AutoTest.TestRunners.XUnit.Tests.TestResource.Class1.Should_pass";
     Assert.That(runner.IsTest(assembly, method), Is.True);
 }
示例#15
0
        public void Test1()
        {
            Runner r = new Runner();
            Thread[] threads = new Thread[50];

            Console.WriteLine("Creating threads...");
            for (int i = 0; i < threads.Length; ++i)
            {
                threads[i] = new Thread(new ThreadStart(r.ThreadProc));
            }
            Console.WriteLine("Starting threads...");
            for (int i = 0; i < threads.Length; ++i)
            {
                threads[i].Start();
            }
            Console.WriteLine("Waiting for threads to join...");
            for (int i = 0; i < threads.Length; ++i)
            {
                threads[i].Join();
            }
            Console.WriteLine("Joined. Got {0} keys", r.GeneratedKeys.Count);
            r.GeneratedKeys.Sort();
            for (int i = 0; i < r.GeneratedKeys.Count - 1; ++i)
            {
                Assert.IsTrue((int)r.GeneratedKeys[i] != (int)r.GeneratedKeys[i + 1]);
            }
            Console.WriteLine("Generated keys confirmed to be unique.", r.GeneratedKeys.Count);
        }
示例#16
0
        public override bool Execute()
        {
            var stopwatch = Stopwatch.StartNew();
            BuildEngine.LogMessageEvent(new BuildMessageEventArgs(string.Format("PepitaPackage (version {0}) Executing", GetType().Assembly.GetName().Version), "", "Pepita", MessageImportance.High));
            try
            {
                ValidatePackageDir();
                var runner = new Runner
                    {
                        PackageDirectory = NuGetBuildDirectory,
                        MetadataAssembly = MetadataAssembly,
                        Version = Version,
                        TargetDir = TargetDir,
                        WriteInfo = s => BuildEngine.LogMessageEvent(new BuildMessageEventArgs("\t" + s, "", "Pepita", MessageImportance.High)),
                    };
                    runner.Execute();
            }
            catch (ExpectedException expectedException)
            {
                BuildEngine.LogErrorEvent(new BuildErrorEventArgs("", "", "", 0, 0, 0, 0, string.Format("Pepita: {0}", expectedException.Message), "", "Pepita"));
                return false;
            }
            catch (Exception exception)
            {
                BuildEngine.LogErrorEvent(new BuildErrorEventArgs("", "", "", 0, 0, 0, 0, string.Format("Pepita: {0}", exception), "", "Pepita"));
                return false;
            }
            finally
            {
                stopwatch.Stop();
                BuildEngine.LogMessageEvent(new BuildMessageEventArgs(string.Format("\tFinished ({0}ms)", stopwatch.ElapsedMilliseconds), "", "Pepita", MessageImportance.High));
            }

            return true;
        }
示例#17
0
 public void CanGoToFavourites()
 {
     using (var runner = new Runner<FavouritesTask>())
     {
         runner.Execute();
     }
 }
示例#18
0
        static void Main(string[] args)
        {
            //var runner = new Runner(); //default settings

            var runner = new Runner(new CustomSettings()); //or override for custom settings
            runner.Run();
        }
 public void When_told_to_run_all_tests_it_reports_all_tests()
 {
     var runner = new Runner();
     var options = new AssemblyOptions(getAssembly());
     var settings = new RunSettings(options, new string[] { }, null);
     var result = runner.Run(settings);
     Assert.That(result.Count(), Is.EqualTo(5));
 }
示例#20
0
 public void Method_Scenario_Result()
 {
     var runner = new Runner();
     runner.Add("Simon");
     runner.Add("Bary");
     runner.Add("John");
     runner.Add("Scot");
 }
示例#21
0
 public void Description()
 {
     var runner = new Runner
     {
         MetadataAssembly = GetType().Assembly.Location
     };
     Assert.AreEqual("MyDescription", runner.GetDescription());
 }
示例#22
0
 public void Comany()
 {
     var runner = new Runner
     {
         MetadataAssembly = GetType().Assembly.Location
     };
     Assert.AreEqual("MyCompany", runner.GetCompany());
 }
示例#23
0
        static void Main()
        {
            ServiceManager.Initialize("MyService", "My Service", "This is my special service that doesn't do much of anything!");

            var config = new ConfigurationOptions("--");
            var runner = new Runner(new Service(), config);
            runner.Run();
        }
示例#24
0
 public void ShouldRunCode()
 {
     var runner = new Runner();
     string output;
     var success = runner.CompileAndRun(Properties.Resources.HelloWorld, out output);
     Assert.Equal("Hello World!" + Environment.NewLine, output);
     Assert.True(success);
 }
示例#25
0
 public void Copyright()
 {
     var runner = new Runner
     {
         MetadataAssembly = GetType().Assembly.Location
     };
     Assert.AreEqual("Copyright Foo ©  2014", runner.GetCopyright());
 }
示例#26
0
		private static void Main() {
			Runner<ExecutionContext> runner = new Runner<ExecutionContext>(new ExecutionContext(Console.In, new ConsoleTextWriter(new SqlStyleProvider())));
			try {
				runner.Run();
			} finally {
				Console.ResetColor();
			}
		}
        /// <summary>
        ///     Apply the reached expectation
        /// </summary>
        /// <param name="runner"></param>
        public override void Apply(Runner runner)
        {
            base.Apply(runner);

            Expect.State = Expect.EventState.Fullfilled;
            Expect.Explanation = Explanation;
            TimeLine.ActiveExpectations.Remove(Expect);
        }
示例#28
0
	void Start() {

		InstructionsScreen.showInstructions ();

		instance = this;
		numFood = 0;
		anim = instance.justin.GetComponent<Animator> ();
		script_manager = manager.GetComponent<Manager>();
	}
        public void MultipleAppDomainsAndCurrent()
        {
            using (var runner = new Runner())
            {
                runner.Run();

                RunThreads();
            }
        }
        public void Should_Exit_When_Exit_Command_Issued()
        {
            _console.Setup(c => c.ReadLine()).Returns("x");

            var runner = new Runner(_console.Object, _environment.Object);
            runner.Run();

            _environment.Verify(e => e.Exit(0), Times.Once());
        }
示例#31
0
 bool IRunHook.Prologue(Runner runner, FID id, MethodInfo method, RunAttribute attr, ref object[] args)
 {
     GC.Collect();
     return(false);
 }
示例#32
0
        public Int32 Main(string[] args)
        {
            var lTests = Discovery.DiscoverTests();

            Runner.RunTests(lTests) withListener(Runner.DefaultListener);
        }
示例#33
0
        private static void Main(string[] args)
        {
            var mediator = BuildMediator();

            Runner.Run(mediator, Console.Out, "SimpleInjector").Wait();
        }
 public int Execute(BoostTestRunnerCommandLineArgs args, BoostTestRunnerSettings settings, IProcessExecutionContext executionContext)
 {
     return(Runner.Execute(args, settings, executionContext));
 }
示例#35
0
        protected override void Because()
        {
            base.Because();

            TestReport = Runner.Run();
        }
示例#36
0
文件: PayPalTest.cs 项目: zhabis/nfx
        void IRunnableHook.Prologue(Runner runner, FID id)
        {
            var config = LACONF.AsLaconicConfig(handling: ConvertErrorHandling.Throw);

            m_App = new ServiceBaseApplication(null, config);
        }
示例#37
0
        public void Test_Runner_Jmp_11()
        {
            string programStr =
                "           cmp     al,         0               " + Environment.NewLine +
                "           jp      label1                      " + Environment.NewLine +
                "           mov     al,         1               " + Environment.NewLine +
                "           jz      label1                      " + Environment.NewLine +
                "           mov     al,         2               " + Environment.NewLine +
                "label1:                                        ";

            Tools tools = CreateTools();
            var   sFlow = new StaticFlow(tools);

            sFlow.Update(programStr);
            if (logToDisplay)
            {
                Console.WriteLine(sFlow.ToString());
            }
            tools.StateConfig = sFlow.Create_StateConfig();
            var dFlow = Runner.Construct_DynamicFlow_Backward(sFlow, tools);

            State state = dFlow.EndState;

            Assert.IsNotNull(state);

            if (logToDisplay)
            {
                Console.WriteLine("state:\n" + state);
            }
            TestTools.IsTrue(state.IsConsistent);

            var branch_Condition_jp = dFlow.Get_Branch_Condition(1);
            var branch_Condition_jz = dFlow.Get_Branch_Condition(3);

            if (true)
            {
                if (true)
                {
                    State state2 = new State(state);
                    state2.Add(new BranchInfo(branch_Condition_jp, true));
                    state2.Add(new BranchInfo(branch_Condition_jz, true));
                    TestTools.AreEqual(Rn.AL, "00000000", state2);
                }
                if (true)
                {
                    State state2 = new State(state);
                    state2.Add(new BranchInfo(branch_Condition_jp, true));
                    state2.Add(new BranchInfo(branch_Condition_jz, false));
                    TestTools.AreEqual(Rn.AL, "????????", state2);
                }
                if (true)
                {
                    State state2 = new State(state);
                    state2.Add(new BranchInfo(branch_Condition_jp, false));
                    state2.Add(new BranchInfo(branch_Condition_jz, true));
                    TestTools.AreEqual(Rn.AL, "XXXXXXXX", state2);
                }
                if (true)
                {
                    State state2 = new State(state);
                    state2.Add(new BranchInfo(branch_Condition_jp, false));
                    state2.Add(new BranchInfo(branch_Condition_jz, false));
                    TestTools.AreEqual(Rn.AL, "00000010", state2);
                }
            }
        }
示例#38
0
 public bool RemoveRunner(Runner runner)
 {
     RunnerDb.Remove(runner);
     return(true);
 }
示例#39
0
 public TestRunState RunNamespace(ITestListener testListener, Assembly assembly, string ns)
 {
     return(Run(testListener,
                Runner.Create("td-net", new[] { assembly }),
                new TestFilter(new[] { String.Format("T:{0}", ns) }, new string[] { })));
 }
示例#40
0
 public TestRunState RunAssembly(ITestListener testListener, Assembly assembly)
 {
     return(Run(testListener, Runner.Create("td-net", new[] { assembly }), null));
 }
示例#41
0
 public async Task Run()
 {
     Update(await Runner.Run(TestCase));
 }
示例#42
0
 static int Main(string[] args) => Runner.Run(args, rebuildCheck: false);
示例#43
0
        public static void Main(string[] args)
        {
            var mediator = BuildMediator();

            Runner.Run(mediator, Console.Out, "Autofac").Wait();
        }
示例#44
0
        /// <summary>
        ///     Provides the changes performed by this statement
        /// </summary>
        /// <param name="context">The context on which the changes should be computed</param>
        /// <param name="changes">The list to fill with the changes</param>
        /// <param name="explanation">The explanatino to fill, if any</param>
        /// <param name="apply">Indicates that the changes should be applied immediately</param>
        /// <param name="runner"></param>
        public override void GetChanges(InterpretationContext context, ChangeList changes, ExplanationPart explanation,
                                        bool apply, Runner runner)
        {
            // Explain what happens in this statement
            explanation = ExplanationPart.CreateSubExplanation(explanation, this);

            IVariable variable = ListExpression.GetVariable(context);

            if (variable != null)
            {
                // HacK : ensure that the value is a correct rigth side
                // and keep the result of the right side operation
                ListValue listValue = variable.Value.RightSide(variable, false, false) as ListValue;
                variable.Value = listValue;
                if (listValue != null)
                {
                    // Provide the state of the list before removing elements from it
                    ExplanationPart.CreateSubExplanation(explanation, "Input data = ", listValue);

                    ListValue newListValue = new ListValue(listValue.CollectionType, new List <IValue>());

                    int token = context.LocalScope.PushContext();
                    context.LocalScope.SetVariable(IteratorVariable);

                    int index = 0;
                    if (Position == PositionEnum.Last)
                    {
                        index = listValue.Val.Count - 1;
                    }

                    // Remove the element while required to do so
                    while (index >= 0 && index < listValue.Val.Count)
                    {
                        IValue value = listValue.Val[index];
                        index = NextIndex(index);

                        IteratorVariable.Value = value;
                        if (ConditionSatisfied(context, explanation))
                        {
                            if (Position != PositionEnum.All)
                            {
                                break;
                            }
                        }
                        else
                        {
                            InsertInResult(newListValue, value);
                        }
                    }

                    // Complete the list
                    while (index >= 0 && index < listValue.Val.Count)
                    {
                        IValue value = listValue.Val[index];

                        InsertInResult(newListValue, value);
                        index = NextIndex(index);
                    }

                    Change change = new Change(variable, variable.Value, newListValue);
                    changes.Add(change, apply, runner);
                    ExplanationPart.CreateSubExplanation(explanation, Root, change);

                    context.LocalScope.PopContext(token);
                }
            }
        }
示例#45
0
    private bool checkRunnerTrafficFree(Vector3 pos)
    {
        bool          free              = true;
        bool          contested         = false;
        bool          contestingWinner  = false;
        Runner        blockingRunner    = null;
        List <Runner> contestingRunners = new List <Runner>();

        foreach (var runner in base.getScene().Runners)
        {
            if (runner.getSyncId() == id)
            {
                continue;
            }
            if (runner.getCurrentPosition() == pos)
            {
                free           = false;
                blockingRunner = runner;
                break;
            }
            else if (runner.getGoalPosition() == pos)
            {
                contested = true;
                contestingRunners.Add(runner);
            }
        }

        //determine if contesting winner
        if (contested && free)
        {
            int?          opposingTicksBlocked = contestingRunners.Select(x => x.TicksBlocked).OrderByDescending(x => x).FirstOrDefault();
            List <Runner> opposers             = contestingRunners.Where(x => x.TicksBlocked == opposingTicksBlocked).ToList();
            if (TicksBlocked > opposingTicksBlocked)
            {
                //if((Guid?)id == contestingRunners.Where(x=>x.TicksBlocked == MaxTicksBlocked).OrderBy(x=>x.TimeCreated).Select(x=>x.id).FirstOrDefault()){
                contestingWinner = true;
            }
            else if (TicksBlocked == opposingTicksBlocked)              //go by birth date
            {
                DateTime timecreated = opposers.Select(x => x.TimeCreated).OrderBy(x => x).FirstOrDefault();
                opposers = opposers.Where(x => x.TimeCreated == timecreated).ToList();
                if (timecreated > TimeCreated)
                {
                    contestingWinner = true;
                }
                else if (timecreated == TimeCreated)                  //idunno just go by alphabetical getSyncId???
                {
                    var           winnerId = opposers.OrderBy(x => x.getSyncId().ToString()).FirstOrDefault().getSyncId().ToString();
                    List <string> list     = new List <string>();
                    list.Add(getSyncId().ToString());
                    list.Add(winnerId);
                    list.Sort(StringComparer.CurrentCulture);
                    if (id.ToString() == list[0])
                    {
                        contestingWinner = true;
                    }
                }
            }
        }

        //update ticksblocked by blocked by
        if (!free)
        {
            if (BlockedBy == blockingRunner.getSyncId())
            {
                TicksBlockedByBlockedBy += 1;
            }
            else
            {
                TicksBlockedByBlockedBy = 1;
            }
        }
        else
        {
            TicksBlockedByBlockedBy = 0;
        }

        //update blocked by
        if (!free)
        {
            BlockedBy = blockingRunner.getSyncId();
        }
        else
        {
            BlockedBy = null;
        }

        return(free && (!contested || (contested && contestingWinner)));
    }
示例#46
0
 private void Start()
 {
     runner = FindObjectOfType <Runner>();
 }
示例#47
0
文件: PayPalTest.cs 项目: zhabis/nfx
 bool IRunnableHook.Epilogue(Runner runner, FID id, Exception error)
 {
     DisposableObject.DisposeAndNull(ref m_App);
     return(false);
 }
示例#48
0
        public void RenderStreamMultiPrimitiveBatching()
        {
            var drawVariants = new List <Action <RenderComposer, Vector3> >
            {
                // Quads
                (c, loc) =>
                {
                    for (var i = 0; i < 10; i++)
                    {
                        c.RenderSprite(loc + new Vector3(i * 25, 0, 0), new Vector2(20, 20), Color.Red);
                    }
                },
                // Sequential triangles
                (c, loc) =>
                {
                    for (var i = 0; i < 10; i++)
                    {
                        c.RenderCircle(loc + new Vector3(i * 50, 0, 0), 20, Color.Green);
                    }
                },
                // Triangle fan
                (c, loc) =>
                {
                    Vector2 vec2Loc = loc.ToVec2();
                    var     poly    = new List <Vector2>
                    {
                        vec2Loc + new Vector2(19.4f, 5.4f),
                        vec2Loc + new Vector2(70.9f, 5.4f),
                        vec2Loc + new Vector2(45.1f, 66)
                    };

                    for (var i = 0; i < 10; i++)
                    {
                        c.RenderVertices(poly, Color.Blue);

                        // Offset vertices for the next draw.
                        for (var j = 0; j < poly.Count; j++)
                        {
                            poly[j] += new Vector2(55, 0);
                        }
                    }
                }
            };

            // Draw combinations of variants multiple times.
            var variantsTest = new[]
            {
                new[] { 0, 1, 2 },
                new[] { 2, 1, 0 },
                new[] { 0, 2, 1 },
                new[] { 2, 0, 1 }
            };
            const int drawsPerVariant = 10;

            Runner.ExecuteAsLoop(_ =>
            {
                for (var v = 0; v < variantsTest.Length; v++)
                {
                    int[] variant = variantsTest[v];

                    for (var c = 0; c < drawsPerVariant; c++)
                    {
                        RenderComposer composer = Engine.Renderer.StartFrame();
                        composer.SetUseViewMatrix(false);
                        var brush = new Vector3();
                        for (var i = 0; i < variant.Length; i++)
                        {
                            drawVariants[variant[i]](composer, brush);
                            brush.Y += 100;
                        }

                        composer.SetUseViewMatrix(true);
                        Engine.Renderer.EndFrame();

                        // Verify only on the last run of the variant.
                        if (c == drawsPerVariant - 1)
                        {
                            Runner.VerifyScreenshot(ResultDb.RenderComposerMultiBatchVariant + v);
                        }
                    }
                }
            }).WaitOne();
        }
示例#49
0
        public static void WriteCPlusPlusFileForStaticAOTModuleRegistration(BuildTarget buildTarget, string file, CrossCompileOptions crossCompileOptions, bool advancedLic, string targetDevice, bool stripping, RuntimeClassRegistry usedClassRegistry, AssemblyReferenceChecker checker, string stagingAreaDataManaged, IIl2CppPlatformProvider platformProvider)
        {
            string text = Path.Combine(stagingAreaDataManaged, "ICallSummary.txt");
            string exe  = Path.Combine(MonoInstallationFinder.GetFrameWorksFolder(), "Tools/InternalCallRegistrationWriter/InternalCallRegistrationWriter.exe");
            string args = string.Format("-assembly=\"{0}\" -summary=\"{1}\"", Path.Combine(stagingAreaDataManaged, "UnityEngine.dll"), text);

            Runner.RunManagedProgram(exe, args);
            HashSet <UnityType> hashSet;
            HashSet <string>    nativeModules;

            CodeStrippingUtils.GenerateDependencies(Path.GetDirectoryName(stagingAreaDataManaged), text, usedClassRegistry, stripping, out hashSet, out nativeModules, platformProvider);
            using (TextWriter textWriter = new StreamWriter(file))
            {
                string[]             assemblyFileNames   = checker.GetAssemblyFileNames();
                AssemblyDefinition[] assemblyDefinitions = checker.GetAssemblyDefinitions();
                bool      flag      = (crossCompileOptions & CrossCompileOptions.FastICall) != CrossCompileOptions.Dynamic;
                ArrayList arrayList = MonoAOTRegistration.BuildNativeMethodList(assemblyDefinitions);
                if (buildTarget == BuildTarget.iOS)
                {
                    textWriter.WriteLine("#include \"RegisterMonoModules.h\"");
                    textWriter.WriteLine("#include <stdio.h>");
                }
                textWriter.WriteLine("");
                textWriter.WriteLine("#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR");
                textWriter.WriteLine("    #define DECL_USER_FUNC(f) void f() __attribute__((weak_import))");
                textWriter.WriteLine("    #define REGISTER_USER_FUNC(f)\\");
                textWriter.WriteLine("        do {\\");
                textWriter.WriteLine("        if(f != NULL)\\");
                textWriter.WriteLine("            mono_dl_register_symbol(#f, (void*)f);\\");
                textWriter.WriteLine("        else\\");
                textWriter.WriteLine("            ::printf_console(\"Symbol '%s' not found. Maybe missing implementation for Simulator?\\n\", #f);\\");
                textWriter.WriteLine("        }while(0)");
                textWriter.WriteLine("#else");
                textWriter.WriteLine("    #define DECL_USER_FUNC(f) void f() ");
                textWriter.WriteLine("    #if !defined(__arm64__)");
                textWriter.WriteLine("    #define REGISTER_USER_FUNC(f) mono_dl_register_symbol(#f, (void*)&f)");
                textWriter.WriteLine("    #else");
                textWriter.WriteLine("        #define REGISTER_USER_FUNC(f)");
                textWriter.WriteLine("    #endif");
                textWriter.WriteLine("#endif");
                textWriter.WriteLine("extern \"C\"\n{");
                textWriter.WriteLine("    typedef void* gpointer;");
                textWriter.WriteLine("    typedef int gboolean;");
                if (buildTarget == BuildTarget.iOS)
                {
                    textWriter.WriteLine("    const char*         UnityIPhoneRuntimeVersion = \"{0}\";", Application.unityVersion);
                    textWriter.WriteLine("    void                mono_dl_register_symbol (const char* name, void *addr);");
                    textWriter.WriteLine("#if !defined(__arm64__)");
                    textWriter.WriteLine("    extern int          mono_ficall_flag;");
                    textWriter.WriteLine("#endif");
                }
                textWriter.WriteLine("    void                mono_aot_register_module(gpointer *aot_info);");
                textWriter.WriteLine("#if __ORBIS__ || SN_TARGET_PSP2");
                textWriter.WriteLine("#define DLL_EXPORT __declspec(dllexport)");
                textWriter.WriteLine("#else");
                textWriter.WriteLine("#define DLL_EXPORT");
                textWriter.WriteLine("#endif");
                textWriter.WriteLine("#if !(TARGET_IPHONE_SIMULATOR)");
                textWriter.WriteLine("    extern gboolean     mono_aot_only;");
                for (int i = 0; i < assemblyFileNames.Length; i++)
                {
                    string arg   = assemblyFileNames[i];
                    string text2 = assemblyDefinitions[i].Name.Name;
                    text2 = text2.Replace(".", "_");
                    text2 = text2.Replace("-", "_");
                    text2 = text2.Replace(" ", "_");
                    textWriter.WriteLine("    extern gpointer*    mono_aot_module_{0}_info; // {1}", text2, arg);
                }
                textWriter.WriteLine("#endif // !(TARGET_IPHONE_SIMULATOR)");
                IEnumerator enumerator = arrayList.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        string arg2 = (string)enumerator.Current;
                        textWriter.WriteLine("    DECL_USER_FUNC({0});", arg2);
                    }
                }
                finally
                {
                    IDisposable disposable;
                    if ((disposable = (enumerator as IDisposable)) != null)
                    {
                        disposable.Dispose();
                    }
                }
                textWriter.WriteLine("}");
                textWriter.WriteLine("DLL_EXPORT void RegisterMonoModules()");
                textWriter.WriteLine("{");
                textWriter.WriteLine("#if !(TARGET_IPHONE_SIMULATOR) && !defined(__arm64__)");
                textWriter.WriteLine("    mono_aot_only = true;");
                if (buildTarget == BuildTarget.iOS)
                {
                    textWriter.WriteLine("    mono_ficall_flag = {0};", (!flag) ? "false" : "true");
                }
                AssemblyDefinition[] array = assemblyDefinitions;
                for (int j = 0; j < array.Length; j++)
                {
                    AssemblyDefinition assemblyDefinition = array[j];
                    string             text3 = assemblyDefinition.Name.Name;
                    text3 = text3.Replace(".", "_");
                    text3 = text3.Replace("-", "_");
                    text3 = text3.Replace(" ", "_");
                    textWriter.WriteLine("    mono_aot_register_module(mono_aot_module_{0}_info);", text3);
                }
                textWriter.WriteLine("#endif // !(TARGET_IPHONE_SIMULATOR) && !defined(__arm64__)");
                textWriter.WriteLine("");
                if (buildTarget == BuildTarget.iOS)
                {
                    IEnumerator enumerator2 = arrayList.GetEnumerator();
                    try
                    {
                        while (enumerator2.MoveNext())
                        {
                            string arg3 = (string)enumerator2.Current;
                            textWriter.WriteLine("    REGISTER_USER_FUNC({0});", arg3);
                        }
                    }
                    finally
                    {
                        IDisposable disposable2;
                        if ((disposable2 = (enumerator2 as IDisposable)) != null)
                        {
                            disposable2.Dispose();
                        }
                    }
                }
                textWriter.WriteLine("}");
                textWriter.WriteLine("");
                AssemblyDefinition assemblyDefinition2 = null;
                for (int k = 0; k < assemblyFileNames.Length; k++)
                {
                    if (assemblyFileNames[k] == "UnityEngine.dll")
                    {
                        assemblyDefinition2 = assemblyDefinitions[k];
                    }
                }
                if (buildTarget == BuildTarget.iOS)
                {
                    AssemblyDefinition[] assemblies = new AssemblyDefinition[]
                    {
                        assemblyDefinition2
                    };
                    MonoAOTRegistration.GenerateRegisterInternalCalls(assemblies, textWriter);
                    MonoAOTRegistration.GenerateRegisterModules(hashSet, nativeModules, textWriter, stripping);
                    if (stripping && usedClassRegistry != null)
                    {
                        MonoAOTRegistration.GenerateRegisterClassesForStripping(hashSet, textWriter);
                    }
                    else
                    {
                        MonoAOTRegistration.GenerateRegisterClasses(hashSet, textWriter);
                    }
                }
                textWriter.Close();
            }
        }
示例#50
0
        public RuleResult CheckMethod(MethodDefinition method)
        {
            if (!method.HasBody || method.IsGeneratedCode())
            {
                return(RuleResult.DoesNotApply);
            }

            // exclude methods that don't store fields or arguments
            if (!mask.Intersect(OpCodeEngine.GetBitmask(method)))
            {
                return(RuleResult.DoesNotApply);
            }

            foreach (Instruction ins in method.Body.Instructions)
            {
                Instruction next = ins.Next;
                if (next == null)
                {
                    continue;
                }

                if (next.OpCode.Code == Code.Stfld)
                {
                    // is it the same (instance) field ?
                    CheckFields(ins, next, method, false);
                }
                else if (next.OpCode.Code == Code.Stsfld)
                {
                    // is it the same (static) field ?
                    CheckFields(ins, next, method, true);
// too much false positive because compilers add their own variables
// and don't always "play well" with them
#if false
                }
                else if (ins.IsLoadLocal() && next.IsStoreLocal())
                {
                    VariableDefinition variable = next.GetVariable(method);
                    if (variable == ins.GetVariable(method))
                    {
                        // the compiler often introduce it's own variable
                        if (!variable.Name.StartsWith("V_"))
                        {
                            msg = String.Format("Variable '{0}' of type '{1}'.", variable.Name, variable.VariableType.GetFullName());
                        }
                    }
#endif
                }
                else if (ins.IsLoadArgument() && next.IsStoreArgument())
                {
                    ParameterDefinition parameter = next.GetParameter(method);
                    if (parameter == ins.GetParameter(method))
                    {
                        string msg = String.Format(CultureInfo.InvariantCulture,
                                                   "Parameter '{0}' of type '{1}'.",
                                                   parameter.Name, parameter.ParameterType.GetFullName());
                        Runner.Report(method, ins, Severity.Medium, Confidence.Normal, msg);
                    }
                }
            }
            return(Runner.CurrentRuleResult);
        }
示例#51
0
 async static Task Main(string[] args) => await Runner.Run(new Handler());
示例#52
0
 bool IRunHook.Epilogue(Runner runner, FID id, MethodInfo method, RunAttribute attr, Exception error)
 {
     GC.Collect();
     return(false);
 }
示例#53
0
 public void SetUp()
 {
     runner = new RunnerBuilder(DevToken).AsIOS(DeviceUDID, DeviceName, BundleId).Build();
 }
示例#54
0
文件: Backup.cs 项目: twckr/duplicati
        private void Export(IBackup backup, RequestInfo info)
        {
            var cmdline         = Library.Utility.Utility.ParseBool(info.Request.QueryString["cmdline"].Value, false);
            var argsonly        = Library.Utility.Utility.ParseBool(info.Request.QueryString["argsonly"].Value, false);
            var exportPasswords = Library.Utility.Utility.ParseBool(info.Request.QueryString["export-passwords"].Value, false);

            if (!exportPasswords)
            {
                backup.SanitizeSettings();
                backup.SanitizeTargetUrl();
            }

            if (cmdline)
            {
                info.OutputOK(new { Command = Runner.GetCommandLine(Runner.CreateTask(DuplicatiOperation.Backup, backup)) });
            }
            else if (argsonly)
            {
                var parts = Runner.GetCommandLineParts(Runner.CreateTask(DuplicatiOperation.Backup, backup));

                info.OutputOK(new {
                    Backend   = parts.First(),
                    Arguments = parts.Skip(1).Where(x => !x.StartsWith("--", StringComparison.Ordinal)),
                    Options   = parts.Skip(1).Where(x => x.StartsWith("--", StringComparison.Ordinal))
                });
            }
            else
            {
                var passphrase = info.Request.QueryString["passphrase"].Value;
                var ipx        = Program.DataConnection.PrepareBackupForExport(backup);

                byte[] data;
                using (var ms = new System.IO.MemoryStream())
                    using (var sw = new System.IO.StreamWriter(ms))
                    {
                        Serializer.SerializeJson(sw, ipx, true);

                        if (!string.IsNullOrWhiteSpace(passphrase))
                        {
                            ms.Position = 0;
                            using (var ms2 = new System.IO.MemoryStream())
                                using (var m = new Duplicati.Library.Encryption.AESEncryption(passphrase, new Dictionary <string, string>()))
                                {
                                    m.Encrypt(ms, ms2);
                                    data = ms2.ToArray();
                                }
                        }
                        else
                        {
                            data = ms.ToArray();
                        }
                    }

                var filename = Library.Utility.Uri.UrlEncode(backup.Name) + "-duplicati-config.json";
                if (!string.IsNullOrWhiteSpace(passphrase))
                {
                    filename += ".aes";
                }

                info.Response.ContentLength = data.Length;
                info.Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}", filename));
                info.Response.ContentType = "application/octet-stream";

                info.BodyWriter.SetOK();
                info.Response.SendHeaders();
                info.Response.SendBody(data);
            }
        }
示例#55
0
文件: Backup.cs 项目: twckr/duplicati
        public void DELETE(string key, RequestInfo info)
        {
            var backup = Program.DataConnection.GetBackup(key);

            if (backup == null)
            {
                info.ReportClientError("Invalid or missing backup id", System.Net.HttpStatusCode.NotFound);
                return;
            }

            var delete_remote_files = Library.Utility.Utility.ParseBool(info.Request.Param["delete-remote-files"].Value, false);

            if (delete_remote_files)
            {
                var captcha_token  = info.Request.Param["captcha-token"].Value;
                var captcha_answer = info.Request.Param["captcha-answer"].Value;
                if (string.IsNullOrWhiteSpace(captcha_token) || string.IsNullOrWhiteSpace(captcha_answer))
                {
                    info.ReportClientError("Missing captcha", System.Net.HttpStatusCode.Unauthorized);
                    return;
                }

                if (!Captcha.SolvedCaptcha(captcha_token, "DELETE /backup/" + backup.ID, captcha_answer))
                {
                    info.ReportClientError("Invalid captcha", System.Net.HttpStatusCode.Forbidden);
                    return;
                }
            }

            if (Program.WorkThread.Active)
            {
                try
                {
                    //TODO: It's not safe to access the values like this,
                    //because the runner thread might interfere
                    var nt = Program.WorkThread.CurrentTask;
                    if (backup.Equals(nt == null ? null : nt.Backup))
                    {
                        bool force;
                        if (!bool.TryParse(info.Request.QueryString["force"].Value, out force))
                        {
                            force = false;
                        }

                        if (!force)
                        {
                            info.OutputError(new { status = "failed", reason = "backup-in-progress" });
                            return;
                        }

                        bool hasPaused = Program.LiveControl.State == LiveControls.LiveControlState.Paused;
                        Program.LiveControl.Pause();

                        try
                        {
                            for (int i = 0; i < 10; i++)
                            {
                                if (Program.WorkThread.Active)
                                {
                                    var t = Program.WorkThread.CurrentTask;
                                    if (backup.Equals(t == null ? null : t.Backup))
                                    {
                                        System.Threading.Thread.Sleep(1000);
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                                else
                                {
                                    break;
                                }
                            }
                        }
                        finally
                        {
                        }

                        if (Program.WorkThread.Active)
                        {
                            var t = Program.WorkThread.CurrentTask;
                            if (backup.Equals(t == null ? null : t.Backup))
                            {
                                if (hasPaused)
                                {
                                    Program.LiveControl.Resume();
                                }
                                info.OutputError(new { status = "failed", reason = "backup-unstoppable" });
                                return;
                            }
                        }

                        if (hasPaused)
                        {
                            Program.LiveControl.Resume();
                        }
                    }
                }
                catch (Exception ex)
                {
                    info.OutputError(new { status = "error", message = ex.Message });
                    return;
                }
            }

            var extra = new Dictionary <string, string>();

            if (!string.IsNullOrWhiteSpace(info.Request.Param["delete-local-db"].Value))
            {
                extra["delete-local-db"] = info.Request.Param["delete-local-db"].Value;
            }
            if (delete_remote_files)
            {
                extra["delete-remote-files"] = "true";
            }

            var task = Runner.CreateTask(DuplicatiOperation.Delete, backup, extra);

            Program.WorkThread.AddTask(task);
            Program.StatusEventNotifyer.SignalNewEvent();

            info.OutputOK(new { Status = "OK", ID = task.TaskID });
        }
示例#56
0
 public bool Prologue(Runner runner, FID id, MethodInfo method, RunAttribute attr, ref object[] args)
 {
     ArowSerializer.RegisterTypeSerializationCores(Assembly.GetCallingAssembly());
     return(false);
 }
示例#57
0
 private void StopRun(ICallbackEventHandler handler, bool force)
 {
     Runner.StopRun(force);
 }
示例#58
0
 public bool Epilogue(Runner runner, FID id, MethodInfo method, RunAttribute attr, Exception error)
 => false;
        static public void WriteCPlusPlusFileForStaticAOTModuleRegistration(BuildTarget buildTarget, string file,
                                                                            CrossCompileOptions crossCompileOptions,
                                                                            bool advancedLic, string targetDevice, bool stripping, RuntimeClassRegistry usedClassRegistry,
                                                                            AssemblyReferenceChecker checker, string stagingAreaDataManaged)
        {
            // generate the Interal Call Summary file
            var icallSummaryPath = Path.Combine(stagingAreaDataManaged, "ICallSummary.txt");
            var dlls             = Directory.GetFiles(stagingAreaDataManaged, "UnityEngine.*Module.dll").Concat(new[] { Path.Combine(stagingAreaDataManaged, "UnityEngine.dll") });
            var exe  = Path.Combine(MonoInstallationFinder.GetFrameWorksFolder(), "Tools/InternalCallRegistrationWriter/InternalCallRegistrationWriter.exe");
            var args = string.Format("-assembly=\"{0}\" -summary=\"{1}\"",
                                     dlls.Aggregate((dllArg, next) => dllArg + ";" + next), icallSummaryPath
                                     );

            Runner.RunManagedProgram(exe, args);

            HashSet <UnityType> nativeClasses;
            HashSet <string>    nativeModules;

            CodeStrippingUtils.GenerateDependencies(stagingAreaDataManaged, stripping, out nativeClasses, out nativeModules);

            using (TextWriter w = new StreamWriter(file))
            {
                string[]             fileNames  = checker.GetAssemblyFileNames();
                AssemblyDefinition[] assemblies = checker.GetAssemblyDefinitions();

                bool fastICall = (crossCompileOptions & CrossCompileOptions.FastICall) != 0;

                ArrayList nativeMethods = BuildNativeMethodList(assemblies);

                if (buildTarget == BuildTarget.iOS)
                {
                    w.WriteLine("#include \"RegisterMonoModules.h\"");
                    w.WriteLine("#include <stdio.h>");
                }

                w.WriteLine("");
                w.WriteLine("#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR");
                w.WriteLine("    #define DECL_USER_FUNC(f) void f() __attribute__((weak_import))");
                w.WriteLine("    #define REGISTER_USER_FUNC(f)\\");
                w.WriteLine("        do {\\");
                w.WriteLine("        if(f != NULL)\\");
                w.WriteLine("            mono_dl_register_symbol(#f, (void*)f);\\");
                w.WriteLine("        else\\");
                w.WriteLine("            ::printf_console(\"Symbol \'%s\' not found. Maybe missing implementation for Simulator?\\n\", #f);\\");
                w.WriteLine("        }while(0)");
                w.WriteLine("#else");
                w.WriteLine("    #define DECL_USER_FUNC(f) void f() ");
                w.WriteLine("    #if !defined(__arm64__)");
                w.WriteLine("    #define REGISTER_USER_FUNC(f) mono_dl_register_symbol(#f, (void*)&f)");
                w.WriteLine("    #else");
                w.WriteLine("        #define REGISTER_USER_FUNC(f)");
                w.WriteLine("    #endif");
                w.WriteLine("#endif");
                w.WriteLine("extern \"C\"\n{");

                w.WriteLine("    typedef void* gpointer;");
                w.WriteLine("    typedef int gboolean;");

                if (buildTarget == BuildTarget.iOS)
                {
                    w.WriteLine("    const char*         UnityIPhoneRuntimeVersion = \"{0}\";", Application.unityVersion);
                    w.WriteLine("    void                mono_dl_register_symbol (const char* name, void *addr);");

                    w.WriteLine("#if !defined(__arm64__)");
                    w.WriteLine("    extern int          mono_ficall_flag;");
                    w.WriteLine("#endif");
                }

                w.WriteLine("    void                mono_aot_register_module(gpointer *aot_info);");

                w.WriteLine("#if __ORBIS__");
                w.WriteLine("#define DLL_EXPORT __declspec(dllexport)"); // ps4 needs dllexport.
                w.WriteLine("#else");
                w.WriteLine("#define DLL_EXPORT");
                w.WriteLine("#endif");

                w.WriteLine("#if !(TARGET_IPHONE_SIMULATOR)");
                w.WriteLine("    extern gboolean     mono_aot_only;");

                for (int q = 0; q < fileNames.Length; ++q)
                {
                    string fileName     = fileNames[q];
                    string assemblyName = assemblies[q].Name.Name;
                    assemblyName = assemblyName.Replace(".", "_");
                    assemblyName = assemblyName.Replace("-", "_");
                    assemblyName = assemblyName.Replace(" ", "_");

                    w.WriteLine("    extern gpointer*    mono_aot_module_{0}_info; // {1}", assemblyName, fileName);
                }
                w.WriteLine("#endif // !(TARGET_IPHONE_SIMULATOR)");
                foreach (string nmethod in nativeMethods)
                {
                    w.WriteLine("    DECL_USER_FUNC({0});", nmethod);
                }
                w.WriteLine("}");

                w.WriteLine("DLL_EXPORT void RegisterMonoModules()");
                w.WriteLine("{");

                w.WriteLine("#if !(TARGET_IPHONE_SIMULATOR) && !defined(__arm64__)");
                w.WriteLine("    mono_aot_only = true;");

                if (buildTarget == BuildTarget.iOS)
                {
                    w.WriteLine("    mono_ficall_flag = {0};", fastICall ? "true" : "false");
                }

                foreach (AssemblyDefinition definition in assemblies)
                {
                    string assemblyName = definition.Name.Name;
                    assemblyName = assemblyName.Replace(".", "_");
                    assemblyName = assemblyName.Replace("-", "_");
                    assemblyName = assemblyName.Replace(" ", "_");
                    w.WriteLine("    mono_aot_register_module(mono_aot_module_{0}_info);", assemblyName);
                }

                w.WriteLine("#endif // !(TARGET_IPHONE_SIMULATOR) && !defined(__arm64__)");
                w.WriteLine("");

                if (buildTarget == BuildTarget.iOS)
                {
                    foreach (string nmethod in nativeMethods)
                    {
                        w.WriteLine("    REGISTER_USER_FUNC({0});", nmethod);
                    }
                }
                w.WriteLine("}");
                w.WriteLine("");


                if (buildTarget == BuildTarget.iOS)
                {
                    var inputAssemblies = new List <AssemblyDefinition>();

                    for (int i = 0; i < assemblies.Length; i++)
                    {
                        if (AssemblyHelper.IsUnityEngineModule(assemblies[i]))
                        {
                            inputAssemblies.Add(assemblies[i]);
                        }
                    }

                    GenerateRegisterInternalCalls(inputAssemblies.ToArray(), w);

                    GenerateRegisterModules(nativeClasses, nativeModules, w, stripping);

                    if (stripping && usedClassRegistry != null)
                    {
                        GenerateRegisterClassesForStripping(nativeClasses, w);
                    }
                    else
                    {
                        GenerateRegisterClasses(nativeClasses, w);
                    }
                }

                w.Close();
            }
        }
示例#60
0
 public void SetUp()
 {
     runner = RunnerFactory.Instance.CreateIOSWeb(DevToken, IOSDeviceUDID, IOSDeviceName);
 }