示例#1
0
        /// <summary>
        /// Gets the script in another <see cref="commandLineFormat"/>
        /// </summary>
        /// <param name="console">The console.</param>
        /// <param name="format">The format.</param>
        /// <param name="newPath">The new path.</param>
        /// <returns></returns>
        public aceConsoleScript GetScriptInForm(IAceCommandConsole console, commandLineFormat format, String newPath = null)
        {
            String p = newPath;

            if (p.isNullOrEmpty())
            {
                p = path;
            }

            //if (File.Exists(p))
            aceConsoleScript output = new aceConsoleScript(p, false);

            foreach (String st in this)
            {
                aceCommandEntry entry = new aceCommandEntry(console, st);
                try
                {
                    if (!entry.isSyntaxError)
                    {
                        output.Append(entry.GetScriptLine(format));
                    }
                    else
                    {
                        output.Append(commandLineEntry.commentPrefix + " line: " + entry.inputLine + " - error: " + entry.errorMessage);
                    }
                }
                catch (Exception ex)
                {
                    output.Append("// error in line transformation: " + entry.inputLine);
                    output.Append("// " + ex.toStringSafe());
                    output.Append("// " + ex.Message);
                }
            }
            if (!newPath.isNullOrEmpty())
            {
                output.SaveAs(newPath, getWritableFileMode.overwrite, console.output);
            }
            return(output);
        }
        /// <summary>
        /// Gets a new instance of plug-in, specified by type name of sub directory.name path
        /// </summary>
        /// <param name="pluginName">Name of the plugin.</param>
        /// <param name="console">The console.</param>
        /// <param name="deployer">The deployer.</param>
        /// <param name="application">The application.</param>
        /// <param name="output">The output.</param>
        /// <returns></returns>
        public IAcePluginBase GetPluginInstance(String pluginName, IAceCommandConsole console, IAcePluginDeployerBase deployer, IAceApplicationBase application, ILogBuilder output = null)
        {
            if (output == null)
            {
                if (console != null)
                {
                    output = console.output;
                }
            }

            Type resolution = resolvePlugin(pluginName, output);

            if (resolution == null)
            {
                return(null);
            }

            IAcePluginBase plugin = Activator.CreateInstance(resolution, new Object[] { }) as IAcePluginBase;

            return(plugin);

            // resolution.getInstance();
        }
示例#3
0
 IAceConsoleScript IAceConsoleScript.GetScriptInForm(IAceCommandConsole console, commandLineFormat format, string newPath) => GetScriptInForm(console, format, newPath);
示例#4
0
        public aceCommandEntry(IAceCommandConsole __console, string input) : base(input)
        {
            console = __console as aceCommandConsole;

            validate();
        }
 protected override void StartUp()
 {
     mainConsole = new T();
 }