Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
PackageBuilderOptions.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.Collections.Generic;
5 using System.IO;
6 
7 using SiliconStudio.Core;
8 using SiliconStudio.Core.Diagnostics;
9 
10 namespace SiliconStudio.Assets.CompilerApp
11 {
12  public class PackageBuilderOptions
13  {
14  public readonly Logger Logger;
15 
16  public bool Verbose = false;
17  public bool Debug = false;
18  // This should not be a list
19  public string BuildProfile;
20  public string ProjectConfiguration { get; set; }
21  public string OutputDirectory { get; set; }
22  public string BuildDirectory { get; set; }
23  public string SolutionFile { get; set; }
24  public Guid PackageId { get; set; }
25  public PlatformType Platform { get; set; }
27  public string PackageFile { get; set; }
28  public List<string> LogPipeNames = new List<string>();
29  public List<string> MonitorPipeNames = new List<string>();
30  public bool EnableFileLogging;
31  public string CustomLogFileName;
32  public string SlavePipe;
33  public Dictionary<string, string> Properties = new Dictionary<string, string>();
34  public Dictionary<string, string> ExtraCompileProperties;
35 
36 
37  public int ThreadCount = Environment.ProcessorCount;
38 
39  public string TestName;
40 
42  {
43  if (logger == null) throw new ArgumentNullException("logger");
44  Logger = logger;
45  }
46 
47  /// <summary>
48  /// Gets the logger messages type depending on the current options
49  /// </summary>
50  public LogMessageType LoggerType
51  {
52  get { return Debug ? LogMessageType.Debug : (Verbose ? LogMessageType.Verbose : LogMessageType.Info); }
53  }
54 
55  /// <summary>
56  /// This function indicate if the current builder options mean to execute a slave session
57  /// </summary>
58  /// <returns>true if the options mean to execute a slave session</returns>
59  public bool IsValidForSlave()
60  {
61  return !string.IsNullOrEmpty(SlavePipe) && !string.IsNullOrEmpty(BuildDirectory);
62  }
63 
64  /// <summary>
65  /// Ensure every parameter is correct for a master execution. Throw an OptionException if a parameter is wrong
66  /// </summary>
67  /// <exception cref="Mono.Options.OptionException">This tool requires one input file.;filename
68  /// or
69  /// The given working directory \ + workingDir + \ does not exist.;workingdir</exception>
70  public void ValidateOptions()
71  {
72  if (string.IsNullOrWhiteSpace(BuildDirectory))
73  throw new ArgumentException("This tool requires a build path.", "build-path");
74 
75  try
76  {
77  BuildDirectory = Path.GetFullPath(BuildDirectory);
78  }
79  catch (Exception)
80  {
81  throw new ArgumentException("The provided path is not a valid path name.", "build-path");
82  }
83 
84  if (SlavePipe == null)
85  {
86  if (string.IsNullOrWhiteSpace(BuildProfile))
87  throw new ArgumentException("This tool requires a selected profile.", "profile");
88 
89  if (string.IsNullOrWhiteSpace(PackageFile))
90  {
91  if (string.IsNullOrWhiteSpace(SolutionFile) || PackageId == Guid.Empty)
92  {
93  throw new ArgumentException("This tool requires either a --package-file, or a --solution-file and --package-id.", "inputPackageFile");
94  }
95  }
96  else if (!File.Exists(PackageFile))
97  {
98  throw new ArgumentException("Package file [{0}] doesn't exist".ToFormat(PackageFile), "inputPackageFile");
99  }
100  }
101  }
102 
104  {
105  switch (Platform)
106  {
107  case PlatformType.Windows:
108  case PlatformType.WindowsPhone:
109  case PlatformType.WindowsStore:
110  return Paradox.Graphics.GraphicsPlatform.Direct3D11;
111  case PlatformType.Android:
112  case PlatformType.iOS:
113  return Paradox.Graphics.GraphicsPlatform.OpenGLES;
114  default:
115  throw new ArgumentOutOfRangeException();
116  }
117  }
118  }
119 }
Paradox.Graphics.GraphicsPlatform GetDefaultGraphicsPlatform()
PlatformType
Describes the platform operating system.
Definition: PlatformType.cs:9
A debug message (level 0).
GraphicsPlatform
The graphics platform.
void ValidateOptions()
Ensure every parameter is correct for a master execution. Throw an OptionException if a parameter is ...
A verbose message (level 1).
Base implementation for ILogger.
Definition: Logger.cs:10
System.IO.File File
LogMessageType
Type of a LogMessage.
Platform specific queries and functions.
Definition: Platform.cs:15
bool IsValidForSlave()
This function indicate if the current builder options mean to execute a slave session ...