Esempio n. 1
0
        private static void run_program(Options options)
        {
            string out_dir = create_out_dir(options);
            var    token   = File.ReadAllText(UnityAccessTokenFile);

            if (string.IsNullOrWhiteSpace(token))
            {
                throw new Exception("The token file does not contain any token.");
            }
            var c = new UnityClient(token);

            Console.WriteLine("Gets latest successful builds...");
            List <Build> builds = get_latest_debug_builds(c, options.project_name, options.build_name);

            if (builds == null || builds.Count == 0)
            {
                throw new Exception(string.Format("Either there have not been any successful builds or the --build_name {0} does not exist", options.build_name));
            }
            var latest_build = get_latest(builds);

            Console.WriteLine("Got latest build with build number " + latest_build.build);

            switch (options.build_mode)
            {
            case BuildMode.Debug:
            {
                for (; ;)
                {
                    Thread.Sleep(1000 * 10);         //10 seconds
                    Console.WriteLine();
                    Console.WriteLine("Checks for a new build...");
                    builds = get_latest_debug_builds(c, options.project_name, options.build_name);
                    var new_latest_build = get_latest(builds);
                    if (new_latest_build.build > latest_build.build)
                    {
                        process_new_build(out_dir, new_latest_build);
                        break;
                    }
                    else
                    {
                        Console.WriteLine("Found no new build.");
                    }
                }
            }
            break;

            case BuildMode.Release:
            {
                process_new_build(out_dir, latest_build);
            }
            break;

            default:
                throw new Exception("Unhandled enum value " + options.build_mode);
            }
        }
Esempio n. 2
0
 private static List <Build> get_latest_debug_builds(UnityClient c, string project_name, string build_name)
 {
     return(c.GetLatestSuccessfulBuildOf("adapt-alliance-gamestudio", project_name, build_name));
 }