コード例 #1
0
ファイル: Program.cs プロジェクト: whosdatdev/BobTheBuilder
        static void Main(string[] args)
        {
            bool succ;
            var  res = Argus.Parse <Args>(args, out succ);

            if (!succ)
            {
                Argus.PrintUsage <Args>();
                return;
            }

            var error   = new List <string>();
            var warning = new List <string>();

            var exceptions = res?.Exceptions?.ToArray() ?? new string[0];
            var projs      = Directory.GetFiles(res.Path, "*", res.TopOnly ? SearchOption.TopDirectoryOnly : SearchOption.AllDirectories).Where(file => file.EndsWith("proj") && exceptions.All(item => !IsSubDirectoryOf(file, item))).ToArray();


            foreach (var proj in projs)
            {
                try
                {
                    var project = new Project(proj);
                    if (!project.Build(new ConsoleLogger(LoggerVerbosity.Quiet)))
                    {
                        error.Add(proj);
                    }
                }
                catch
                {
                    warning.Add(proj);
                }
            }
            Console.WriteLine();

            if (error.Count == 0 && warning.Count == 0)
            {
                var color = Console.ForegroundColor;
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("All " + projs.Length + " projects successful!");
                Console.ForegroundColor = color;
            }
            else
            {
                var color = Console.ForegroundColor;
                Console.ForegroundColor = ConsoleColor.Yellow;
                foreach (var s in warning)
                {
                    Console.WriteLine(s);
                }
                Console.ForegroundColor = ConsoleColor.Red;
                foreach (var s in error)
                {
                    Console.WriteLine(s);
                }
                Console.ForegroundColor = color;
            }
        }
コード例 #2
0
    public SeriesInfo GetSeriesFromTags(Argus.Recording recording)
    {
      SeriesInfo seriesInfo = new SeriesInfo { Series = recording.Title };

      if (recording.SeriesNumber.HasValue)
        seriesInfo.SeasonNumber = recording.SeriesNumber.Value;

      if (recording.EpisodeNumber.HasValue)
        seriesInfo.EpisodeNumbers.Add(recording.EpisodeNumber.Value);

      if (!seriesInfo.IsCompleteMatch)
      {
        // Check for formatted display value, i.e.:
        // <EpisodeNumberDisplay>1.4</EpisodeNumberDisplay>
        if (!string.IsNullOrWhiteSpace(recording.EpisodeNumberDisplay))
        {
          var parts = recording.EpisodeNumberDisplay.Split('.');
          if (parts.Length == 2)
          {
            int val;
            if (int.TryParse(parts[0], out val))
              seriesInfo.SeasonNumber = val;
            if (int.TryParse(parts[1], out val))
              seriesInfo.EpisodeNumbers.Add(val);
          }
        }
      }
      return seriesInfo;
    }