예제 #1
0
 /// <summary>
 /// Prints a compilation error.
 /// </summary>
 /// <param name="e">Compilation exception</param>
 /// <param name="script">Script which failed to compile.</param>
 public void CompilationError(Exception e, Kerboscript script)
 {
     StopWatch();
     NewLine();
     Error(Draw.PrefixAndColor, "in {0}", script.InputPath);
     Error(Draw.Color, e.Message);
 }
예제 #2
0
        /// <summary>
        /// Loads all Kerboscript from a directory.
        /// </summary>
        /// <param name="input">Directory to load from.</param>
        /// <param name="output">Directory to compile to.</param>
        /// <returns>List of loaded Kerboscripts.</returns>
        private static List <Kerboscript> LoadFromDirectory(string input, string output)
        {
            List <Kerboscript> result = new List <Kerboscript>();

            DirectoryInfo dirInfo = new DirectoryInfo(input);

            FileInfo[] filesInfos = dirInfo.GetFiles(Constants.KerboscriptSearchPattern, SearchOption.AllDirectories);
            foreach (FileInfo fileInfo in filesInfos)
            {
                string      outPath = fileInfo.FullName.Replace(input, output);
                Kerboscript script  = LoadFromFile(fileInfo.FullName, outPath);
                result.Add(script);
            }

            return(result);
        }
예제 #3
0
        /// <summary>
        /// Loads Kerboscripts from disc.
        /// </summary>
        /// <param name="input">Input path for a file or directory.</param>
        /// <param name="output">Output path for the compiled file or directory.</param>
        /// <returns>List of loaded Kerboscripts.</returns>
        public static List <Kerboscript> Load(string input, string output)
        {
            List <Kerboscript> result = null;

            input  = Path.GetFullPath(input);
            output = Path.GetFullPath(output);
            if (Directory.Exists(input) == true)
            {
                result = LoadFromDirectory(input, output);
            }
            else if (File.Exists(input) == true)
            {
                Kerboscript script = LoadFromFile(input, output);
                result = script != null ? new List <Kerboscript>() : null;
                if (result != null)
                {
                    result.Add(script);
                }
            }

            return(result);
        }
예제 #4
0
 /// <summary>
 /// Print the deploying script message.
 /// </summary>
 /// <param name="Script"></param>
 public void DeployingScript(Kerboscript Script)
 {
     Info(Draw.None, "Deploying {0}...", Script.InputPath);
 }