Exemplo n.º 1
0
 public override void ErrorReceived(string s, bool force)
 {
     if (s != null && (force || TAPApp.Verbose > 0))
     {
         TAPApp.ELog(s);
     }
 }
Exemplo n.º 2
0
 public override void OutputReceived(string s, bool force)
 {
     if (s != null)
     {
         TAPApp.DLog(4, "received {0}.", s);
         if (force || TAPApp.Verbose > 0)
         {
             TAPApp.Log(s);
         }
     }
 }
Exemplo n.º 3
0
 internal IEnumerable <ScriptPath> Expand(ICollection <string> paths)
 {
     if (paths.Count == 0)
     {
         return(Directory.GetFiles("t", "*.cs", SearchOption.AllDirectories).Select(x => new ScriptPath(x, "t")));
     }
     else
     {
         return(from i in paths.Select(x => TAPApp.FixPathSep(x))
                from j in Directory.Exists(i)?GetScriptsInPath(i):GetByWildcard(i)
                select j);
     }
 }
Exemplo n.º 4
0
        bool CopyMe(string targetpath)
        {
            string me = GetMyImagePath();
            string to = Path.Combine(targetpath, Path.GetFileName(me));

            if (TAPApp.IsOutdated(to, me))
            {
                TAPApp.VLog(2, "copy from {0} to {1}", me, to);
                File.Copy(me, to, true);
                // this can be removed once all the bugs are fixed :-)
                string pdb   = TAPApp.PdbFromExe(me);
                string pdbto = TAPApp.PdbFromExe(to);
                File.Copy(pdb, pdbto, true);
                return(true);
            }
            return(false);
        }
Exemplo n.º 5
0
        static void ReadArgs(string[] args)
        {
            if (args.Length != 0 && args[0] == "-le")
            {
                Environment.Exit(0);
            }
            foreach (var i in args)
            {
                Match m = Regex.Match(i, @"^[/-](\w+)(?::(.+))?");
                if (m.Success)
                {
                    string key    = m.Groups[1].ToString().ToLower();
                    string val    = m.Groups[2].ToString();
                    bool   hasval = !string.IsNullOrEmpty(val);
                    switch (key)
                    {
                    case "r":
                    case "reference":
                        if (hasval)
                        {
                            Refs.Add(val);
                        }
                        break;

                    case "t":
                    case "template":
                        WriteTemplate(val);
                        Environment.Exit(0);
                        break;

                    case "s":
                    case "subject":
                        Subject = hasval?val:".";
                        break;

                    case "f":
                    case "format":
                        val = val.ToLowerInvariant();
                        if (hasval && SupportedFormats.Contains(val))
                        {
                            Format = val;
                        }
                        else
                        {
                            Log("unrecognized format.");
                            Environment.Exit(1);
                        }
                        break;

                    case "e":
                    case "elapsed":
                        Elapsed = true;
                        break;

                    case "p":
                    case "parallel":
                        if (hasval)
                        {
                            MaxTasks = int.Parse(val);
                        }
                        else
                        {
                            MaxTasks = Environment.ProcessorCount;
                        }
                        break;

                    case "u":
                    case "unordered":
                        Unordered = true;
                        break;

                    case "j":
                    case "horizontalthresh":
                        if (hasval)
                        {
                            HorizontalThreshold = int.Parse(val);
                        }
                        break;

                    case "z":
                    case "zero":
                        Zero = true;
                        break;

                    case "v":
                    case "verbose":
                        Verbose = hasval?int.Parse(val):2;
                        break;

                    case "d":
                    case "debugverbose":
                        DebugVerbose = hasval?int.Parse(val):0;
                        break;

                    case "h":
                    case "help":
                        OutputHelp();
                        Environment.Exit(1);
                        break;
                    }
                }
                else
                {
                    Paths.Add(i);
                }
            }
            Subject = TAPApp.FixPathSep(Subject);
        }