示例#1
0
        private async Task RunProject(Project project, string expectedText)
        {
            try
            {
                File.WriteAllText(TestProjects.SourceTextFile, sourceText);

                var runner = new ProjectRunner();
                await runner.Run(project);

                var destText = File.ReadAllText(TestProjects.DestinationTextFile);

                Assert.Equal(expectedText, destText);
            }
            finally
            {
                if (File.Exists(TestProjects.SourceTextFile))
                {
                    File.Delete(TestProjects.SourceTextFile);
                }

                if (File.Exists(TestProjects.DestinationTextFile))
                {
                    File.Delete(TestProjects.DestinationTextFile);
                }
            }
        }
示例#2
0
    /*
     * Do test on Arcweave test project.
     */
    private IEnumerator Play()
    {
        ResourceRequest rr = Resources.LoadAsync("Arcweave/Project");

        yield return(rr);

        project = rr.asset as Project;

        if (project == null)
        {
            Debug.LogWarning("No project found. Please use the Arcweave Utility to import a project.");
            yield break;
        }

        // Create the walker
        runner = new ProjectRunner(project, this);
        runner.Play(OnElementTriggered);

        // Destroy the Loader
        const float loadOffDuration = 1.25f;
        float       accum           = 0.0f;

        while (accum < loadOffDuration)
        {
            accum       += Time.deltaTime;
            loader.alpha = Mathf.Lerp(1.0f, 0.0f, accum / loadOffDuration);
            yield return(null);
        }
        GameObject.Destroy(loader.gameObject);
    }
示例#3
0
        public void project_runner_smoke_tester()
        {
            var runner =
                new ProjectRunner(new[] { @"c:\svn\blue\RuleTests.xml", @"c:\svn\blue\SDKTests.xml", @"c:\svn\blue\Storyteller.xml" }, @"c:\svn\blue\results");

            runner.Execute();
        }
示例#4
0
        private void button1_Click(object sender, EventArgs e)
        {
            ProjectRunner projectRunner = new ProjectRunner("DefaultProject");

            if (projectRunner.Init())
            {
                projectRunner.Run();
            }
        }
示例#5
0
        private static int Main(string[] args)
        {
            if (args.Length < 2)
            {
                Console.WriteLine("Usage:");
                Console.WriteLine("StoryTellerRunner.exe ProjectFile1 ProjectFile2 ResultsFile");

                return(1);
            }

            string resultsFile  = args.Last();
            var    projectFiles = args.Take(args.Length - 1);
            var    runner       = new ProjectRunner(projectFiles, resultsFile);


            return(runner.Execute());
        }
示例#6
0
        // Returns PID
        public int Run(int id)
        {
            int pid = m_rand.Next(1, Int32.MaxValue);

            lock (m_Runners)
            {
                if (!m_ProjectsByID.ContainsKey(id))
                {
                    return(0);
                }

                ProjectRunner r = m_Builds[id].Copy();

                while (m_Runners.ContainsKey(pid) || m_Builds.ContainsKey(pid))
                {
                    pid = m_rand.Next(1, Int32.MaxValue);
                }

                m_Runners[pid] = r;

                m_ProjectsByPID[pid] = id;

                if (!m_RunnersByID.ContainsKey(id))
                {
                    m_RunnersByID[id] = new Dictionary <int, bool>();
                }
                m_RunnersByID[id].Add(pid, true);

                if (!m_ProcessResults.ContainsKey(pid))
                {
                    m_ProcessResults[pid] = new Queue();
                }

                r.SetPID(pid);
                r.SetGID(id);

                r.Run(callback, eventqueue);
            }

            Console.WriteLine("Executed project with id: " + id.ToString() + " and pid: " + pid.ToString());

            return(pid);
        }
示例#7
0
文件: Program.cs 项目: tbener/PicPick
        private static void RunOptionsAndReturnExitCode(Options opts)
        {
            if (string.IsNullOrWhiteSpace(opts.Project) && !string.IsNullOrWhiteSpace(opts.ProjectFallback))
            {
                opts.Project = opts.ProjectFallback;
            }

            if (opts.Project == null)
            {
                Application.Run(new MainForm());
            }
            else
            {
                ProjectRunner projectRunner = new ProjectRunner(opts.Project);
                if (projectRunner.Init())
                {
                    projectRunner.Run();
                }
            }
        }
        public override bool Execute(StoryTellerInput input)
        {
            StoryTellerEnvironment.Set(new SerenityEnvironment
            {
                Browser    = input.BrowserFlag,
                WorkingDir = AppDomain.CurrentDomain.BaseDirectory
            });

            Console.WriteLine("Using browser " + input.BrowserFlag);

            var runner = new ProjectRunner(new[] { Project.LoadFromFile(input.ProjectFile) }, input.ResultsFile);

            if (input.WorkspaceFlag.IsNotEmpty())
            {
                Console.WriteLine("Using workspace " + input.WorkspaceFlag);
                runner.Workspace = input.WorkspaceFlag;
            }

            return(runner.Execute() == 0);
        }
示例#9
0
        private async static Task RunProject(string path)
        {
            if (!File.Exists(path))
            {
                Console.WriteLine($"Project file not found: {path}");
                return;
            }

            Console.WriteLine($"Loading {path}...");

            var project = ProjectSerialization.LoadFromFile(path);

            var runner = new ProjectRunner();

            Console.WriteLine($"Running {path}...");

            await runner.Run(project);

            Console.WriteLine($"Finished running {path}");
            Console.WriteLine();
        }
示例#10
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to wdc console app!");
            Console.WriteLine("Current Arguments " + Json.Encode(args));
            var startWithNoParameters = !args.Any();

            do
            {
                if (startWithNoParameters)
                {
                    string command = "";
                    while (command.Trim().Length == 0)
                    {
                        Console.WriteLine("");
                        Console.WriteLine("Type a command:");
                        Console.Write("> ");
                        command = Console.ReadLine();
                    }


                    Regex argReg = new Regex(@"\w+|""[\\\/\.\w\s]*""");
                    args = new string[argReg.Matches(command).Count];
                    int i = 0;
                    foreach (var enumer in argReg.Matches(command))
                    {
                        args[i] = enumer.ToString();
                        i++;
                    }
                }

                switch (args[0])
                {
                case "run":
                    var projectFile = Path.Combine(Config.CurrentPath, args[1]);

                    var runner = new ProjectRunner(Json.Decode <WdcProject>(File.ReadAllText(projectFile)), args[2]);

                    runner.StartServer();
                    break;

                case "sc":
                    Console.WriteLine("Main Path: " + Config.MainPath);
                    Console.WriteLine("Current Path: " + Config.CurrentPath);
                    Console.WriteLine("Cache path: " + Config.CachePath);

                    break;

                case "create-sample-project":
                case "csp":
                    var path = args.Length >= 2 && !String.IsNullOrEmpty(args[1])
                            ? Path.Combine(Config.MainPath, args[1])
                            : Config.CurrentPath;


                    CreateSampleProject(path);
                    break;

                case "build-project-file":
                case "bpf":
                    BuildProjectFile();

                    break;

                case "exit":
                case "q":
                    startWithNoParameters = false;
                    break;

                default:
                    Console.WriteLine("Unrecognized command " + args[0]);
                    break;
                }
            } while (startWithNoParameters);
        }
示例#11
0
 /*
  * Restart game.
  */
 public void Restart()
 {
     // Create a fresh new runner
     runner = new ProjectRunner(project, this);
     runner.Play(OnElementTriggered);
 }
示例#12
0
 protected override void EstablishContext()
 {
     base.EstablishContext();
     ProjectRunner.Stop();
 }
示例#13
0
        static void Main(string[] args)
        {
            var showHelp = false;

            string outputPath  = null;
            string source      = null;
            string projectName = null;
            string filename    = null;
            var    author      = "";
            var    category    = "";
            var    version     = CurrentVersion;
            var    release     = CurrentRelease;

            var options = new OptionSet()
            {
                { "o|output=", "Output path", o => outputPath = o },
                { "s|source=", "source path", s => source = s },
                { "p|project=", "Project name", p => projectName = p },
                { "f|filename=", "Output file name", f => filename = f },
                { "a|author=", "Module author", a => author = a },
                { "c|category=", "Module category", c => category = c },
                { "v|version=", $"Fantasy Grounds version - defaults to {CurrentVersion}", v => version = v },
                { "r|release=", $"Fantasy Grounds release - defaults to {CurrentRelease}", r => release = r },
                { "h|help|?", "Show help message and exit", v => showHelp = v != null }
            };

            List <string> extra;

            try
            {
                extra = options.Parse(args);
            }
            catch (OptionException e)
            {
                Console.WriteLine($"Exception parsing arguments. ex: {e.Message}");
                Environment.Exit(0);
            }

            if (args.Length == 0 || showHelp)
            {
                ShowHelpScreen();
                Environment.Exit(0);
            }

            VerifyArgs(outputPath, source, projectName, filename);

            if (!Directory.Exists(source))
            {
                Console.WriteLine($"{source} directory does not exist");
                Environment.Exit(0);
            }

            var path = Path.Combine(outputPath, filename);

            if (!Directory.Exists(path))
            {
                try
                {
                    Directory.CreateDirectory(path);
                }
                catch (Exception e)
                {
                    Console.WriteLine($"Cannot create output folder {outputPath}. ex: {e.Message}");
                    Environment.Exit(0);
                }
            }

            var project = new Project
            {
                FileName = filename,
                Name     = projectName,
                Author   = author,
                Category = category,
                Version  = version,
                Release  = release
            };

            project = ProjectRunner.RunFileBasedProject(project, source);

            var result = FileWriter.WriteModFile(project, outputPath);

            Console.WriteLine($"Process complete.  File output: {result}");
        }