Exemplo n.º 1
0
        /// <summary>
        ///     Invokes the SPV3 Compiler with the given arguments.
        /// </summary>
        /// <param name="args">
        ///     [0] = Source directory.
        ///     [1] = Target directory.
        /// </param>
        public static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                Exit("Not enough arguments!", 1);
            }

            var source = (Directory)args[0];
            var target = (Directory)args[1];

            if (!System.IO.Directory.Exists(source))
            {
                Exit("Source does not exist.", 2);
            }

            if (!System.IO.Directory.Exists(target))
            {
                Exit("Target does not exist.", 2);
            }

            try
            {
                Console.Clear();

                Task.Run(() =>
                {
                    var compress = new InternalCompressor();
                    var compiler = new MetaCompiler(compress, Status);

                    compiler.Compile(source, target);
                })
                .GetAwaiter().GetResult();

                Exit(Banner, 0);
            }
            catch (Exception exception)
            {
                Exit(exception.ToString(), 3);
            }
        }