Exemplo n.º 1
0
        internal static string FormatMessage(string pathToExecutable, string arguments, ExecutableReturnValue returnValue)
        {
            string executableName = Path.GetFileName(pathToExecutable);
            string message        = KsuAdapter.GetErrorMessageFromReturnCode(returnValue);

            return(String.Format(CultureInfo.CurrentCulture, "{0} failed: {1}\n\t{2} {3}", executableName, message, pathToExecutable, arguments));
        }
 /// <summary>
 /// Runs this executable with the specified argument text.
 /// </summary>
 /// <param name="argumentText">The argument text.</param>
 public void Run(string argumentText)
 {
     try
     {
         KsuAdapter.RunExecutable(this.ExecutablePath, argumentText);
     }
     catch (SrcMLRuntimeException)
     {
         throw;
     }
 }
 /// <summary>
 /// Runs this executable with the specified argument text and additional input passed in on standard input.
 /// </summary>
 /// <param name="argumentText">The argument text.</param>
 /// <param name="standardInput">The standard input.</param>
 /// <returns></returns>
 public string Run(string argumentText, string standardInput)
 {
     try
     {
         var output = KsuAdapter.RunExecutable(this.ExecutablePath, argumentText, standardInput);
         return(output);
     }
     catch (SrcMLRuntimeException)
     {
         throw;
     }
 }
        /// <summary>
        /// Runs this executable with the specified arguments.
        /// </summary>
        /// <param name="arguments">The arguments.</param>
        public void Run(Collection <string> arguments)
        {
            var argumentString = KsuAdapter.MakeArgumentString(arguments);

            this.Run(argumentString);
        }
        /// <summary>
        /// Runs this executable with the specified arguments and additional input passed in on standard input.
        /// </summary>
        /// <param name="arguments">The arguments.</param>
        /// <param name="standardInput">The standard input.</param>
        /// <returns></returns>
        public string Run(Collection <string> arguments, string standardInput)
        {
            var argumentString = KsuAdapter.MakeArgumentString(arguments);

            return(this.Run(argumentString, standardInput));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Converts an extension mapping dictionary to a string that can be passed to src2srcml.exe.
        /// If the extensions begin with a dot, these are stripped to conform with src2srcml.exe's input format.
        /// </summary>
        /// <param name="extensionMapping">An extension mapping dictionary</param>
        /// <returns>A comma separated list of mappings of the form ("EXT=LANG").</returns>
        public static string ConvertMappingToString(IDictionary <string, Language> extensionMapping)
        {
            var mapping = from kvp in extensionMapping
                          select String.Format(CultureInfo.InvariantCulture, "{0}={1}", kvp.Key.TrimStart(new[] { '.' }), KsuAdapter.GetLanguage(kvp.Value));

            var result = String.Join(",", mapping.ToArray());

            return(result);
        }