getName() public method

Returns the friendly command name. The command as invoked from the command line.
public getName ( ) : String
return String
コード例 #1
0
ファイル: CommandCatalog.cs プロジェクト: kkl713/GitSharp
        /// <summary>
        /// Create and loads the command name into the command catalog.
        /// </summary>
        /// <param name="commandName">Specifies the command name to load.</param>
        /// <param name="commandHelp">Specifies the command's website for faster reference.</param>
        public void Load(String commandName, String commandHelp)
        {
            TextBuiltin clazz;

            Type commandType = Type.GetType(commandName);

            if (commandType == null)
            {
                return;
            }

            clazz = Activator.CreateInstance(commandType) as TextBuiltin;
            if (clazz == null)
            {
                return;
            }

            int    index   = clazz.ToString().LastIndexOf(".");
            string cmdName = clazz.ToString().Substring(index + 1).ToLower();

            clazz.setCommandName(cmdName);
            clazz.setCommandHelp(commandHelp);

            CommandRef cr = new CommandRef(clazz);

            if (cr != null)
            {
                commands.Add(cr.getName(), cr);
            }
        }
コード例 #2
0
ファイル: CommandCatalog.cs プロジェクト: stschake/GitSharp
        /// <summary>
        /// Create and loads the command name into the command catalog.
        /// </summary>
        /// <param name="commandName">Specifies the command name to load.</param>
        /// <param name="commandHelp">Specifies the command's website for faster reference.</param>
        public void Load(String commandName, String commandHelp)
        {
            TextBuiltin clazz;

            Type commandType = Type.GetType(commandName);
            if (commandType == null)
                return;

            clazz = Activator.CreateInstance(commandType) as TextBuiltin;
            if (clazz == null)
                return;

            int index = clazz.ToString().LastIndexOf(".");
            string cmdName = clazz.ToString().Substring(index + 1).ToLower();
            clazz.setCommandName(cmdName);
            clazz.setCommandHelp(commandHelp);

            CommandRef cr = new CommandRef(clazz);
            if (cr != null)
                commands.Add(cr.getName(), cr);
        }