private static void RunHeatMapVideoBuilder(Options options, string arguments) { var processStartInfo = new ProcessStartInfo(); processStartInfo.FileName = options.HeatMapVideoBuilderPath; processStartInfo.Arguments = arguments; processStartInfo.CreateNoWindow = true; processStartInfo.UseShellExecute = false; //Console.WriteLine(" {0}", processStartInfo.Arguments); var process = Process.Start(processStartInfo); process.WaitForExit(); }
private static void ProcessData(string dataFile, Options options, ref Point mapOrigin, ref Size mapSize) { var spriteFile = options.NuetralTeamSprite; var match = teamRegex.Match(dataFile); if (match.Success) { var teamNumber = int.Parse(match.Groups[1].Value); switch (teamNumber) { case 100: spriteFile = options.BlueTeamSprite; break; case 200: spriteFile = options.RedTeamSprite; break; } } var outputFile = Path.Combine(options.OutputDirectory, Path.GetFileName(dataFile)); outputFile = Path.ChangeExtension(outputFile, (options.GenerateCompositeImage ? "png" : "mp4")); if (!options.Force && File.Exists(outputFile)) { return; } var argsBuilder = new StringBuilder(); argsBuilder.AppendFormat("-b \"{0}\" ", options.Map); argsBuilder.AppendFormat("-i \"{0}\" ", dataFile); argsBuilder.AppendFormat("-o \"{0}\" ", outputFile); argsBuilder.AppendFormat("-s \"{0}\" ", spriteFile); if (options.BitRate > 0) { argsBuilder.AppendFormat("--bit-rate {0} ", options.BitRate); } if (options.HasResidualImage) { argsBuilder.AppendFormat("--residual-sprite \"{0}\" ", options.ResidualSprite); } if (options.GenerateCompositeImage) { argsBuilder.AppendFormat("--generate-composite-image --composite-image-factor {0} ", options.CompositeImageFactor); } argsBuilder.AppendFormat("--map-origin {0},{1} ", mapOrigin.X, mapOrigin.Y); argsBuilder.AppendFormat("--map-size {0},{1} ", mapSize.Width, mapSize.Height); argsBuilder.Append("--data-origin 0,0 --data-size 14820,14881"); Console.WriteLine("Building {0}...", dataFile); RunHeatMapVideoBuilder(options, argsBuilder.ToString()); }
private static void ProcessTeamData(string blueDataFile, string redDataFile, Options options, ref Point mapOrigin, ref Size mapSize) { var spriteFile = options.NuetralTeamSprite; // Strip the team out of the filename. var outputFileName = teamRegex.Replace(blueDataFile, ""); var outputFile = Path.Combine(options.OutputDirectory, Path.GetFileName(outputFileName)); outputFile = Path.ChangeExtension(outputFile, (options.GenerateCompositeImage ? "png" : "mp4")); if (!options.Force && File.Exists(outputFile)) { return; } var argsBuilder = new StringBuilder(); argsBuilder.AppendFormat("-b \"{0}\" ", options.Map); argsBuilder.AppendFormat("-i \"{0}\",\"{1}\" ", blueDataFile, redDataFile); argsBuilder.AppendFormat("-o \"{0}\" ", outputFile); if (options.BitRate > 0) { argsBuilder.AppendFormat("--bit-rate {0} ", options.BitRate); } if (options.ForceNuetralSprite) { argsBuilder.AppendFormat("-s \"{0}\",\"{1}\" ", options.NuetralTeamSprite, options.NuetralTeamSprite); } else { argsBuilder.AppendFormat("-s \"{0}\",\"{1}\" ", options.BlueTeamSprite, options.RedTeamSprite); } if (options.HasResidualImage) { argsBuilder.AppendFormat("--residual-sprite \"{0}\" ", options.ResidualSprite); } if (options.GenerateCompositeImage) { argsBuilder.AppendFormat("--generate-composite-image --composite-image-factor {0} ", options.CompositeImageFactor); } argsBuilder.AppendFormat("--map-origin {0},{1} ", mapOrigin.X, mapOrigin.Y); argsBuilder.AppendFormat("--map-size {0},{1} ", mapSize.Width, mapSize.Height); argsBuilder.Append("--data-origin 0,0 --data-size 14820,14881"); Console.WriteLine("Building team data...\n\t{0}\n\t{1}", blueDataFile, redDataFile); RunHeatMapVideoBuilder(options, argsBuilder.ToString()); }