Ejemplo n.º 1
0
        /// <summary>
        /// Create a new TccCommand spec, defining all options available. When this method is used, 
        /// the parser can automatically resolve paths starting with a forward slash.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="winApiCmd"></param>
        /// <param name="options"></param>
        public TccCommand(string name, TccLib.TCAction winApiCmd, IEnumerable<TccArg> options)
        {
            Name = name.ToUpper();
            var defaultOpts = EnumerableHelper.Enumerate(new TccArg("?"));

            _Options = new HashSet<TccArg>((options ?? defaultOpts).Concat(defaultOpts) );
            WinApiCmd = winApiCmd;
        }
Ejemplo n.º 2
0
        public void WriteStdout(string text)
        {
            var chars = GetBuffer(text);

            fixed(char *textPtr = chars)
            {
                TccLib.TC_QPuts(textPtr);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// TODO Do I really need a separate signature for each variation? How to encapsulate with unsafe code? Func<char*> no work
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="action"></param>
        /// <param name="text"></param>
        /// <returns></returns>
        public uint Execute(TccLib.TCAction2 action, string text, int parm)
        {
            uint result;
            fixed (char* textPtr = TccCommands.GetBuffer(text))
            {
                result = action(textPtr, parm);
            }

            return result;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Expand all variables, aliases and functions in a string
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static string ExpandVariables(string text)
        {
            var chars = GetBuffer(text);

            fixed(char *textPtr = chars)
            {
                TccLib.TC_ExpandVariables(textPtr, 0);

                return(chars.ToStringSafe());
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Take a file name and expand to full path
        /// </summary>
        public string MakeFullName(string fileName)
        {
            var chars = GetBuffer(MapPath(fileName));

            string fullPath;

            fixed(char *textPtr = chars)
            {
                fullPath = new string(TccLib.TC_MakeFullName(textPtr, 0));
            }

            return(fullPath);
        }
Ejemplo n.º 6
0
 public TccCommand(string name, TccLib.TCAction winApiCmd)
     : this(name, winApiCmd, null)
 {
     CreatedWithoutOptions = true;
 }