/*
		 * Check for warnings and errors
		 */
		public void checkWarningsAndErrors(ErrorReporter errorReporter)
		{
			/*
			 * If multiple distribution platform share the same name
			 */
			int duplicateCount = m_distributionPlatformList.GroupBy(x => x.name).Where(x => x.Count() > 1).Count();
			if (duplicateCount != 0)
			{
				errorReporter.addError("Each distribution platform must have a distinct name.");
			}

			/*
			 * If a distribution platform name is Default
			 */
			bool hasDefault = m_distributionPlatformList.Where(x => x.name.Equals("Default")).Count() != 0;
			if (hasDefault)
			{
				errorReporter.addError("A distribution platform can't have the name 'Default'. It is reserved for Advanced Builder, sorry...");
			}

			/*
			 * If a distribution platform name is Default
			 */
			bool isNameIncorrect = m_distributionPlatformList.Where(x => !x.isNameValid()).Count() != 0;
			if (isNameIncorrect)
			{
				errorReporter.addError("A distribution platform name can only have letters, numbers and spaces.");
			}
		}
		/*
		 * Return specific platform errors
		 */
		public void checkWarningsAndErrors(ErrorReporter errorReporter)
		{
			AdvancedBuilder advancedBuilder = (AdvancedBuilder)AssetDatabase.LoadAssetAtPath("Assets/PygmyMonkey/AdvancedBuilder/Editor/AdvancedBuilder.asset", typeof(AdvancedBuilder));
			
			if (advancedBuilder.getAdvancedSettings().checkAndroidKeystorePasswords)
			{
				if (PlayerSettings.keystorePass.Length == 0)
				{
					errorReporter.addError("You need to define your Android Keystore password in Edit -> Project Settings -> Player -> Android -> Publishing Settings.");
				}
				else if (PlayerSettings.keyaliasPass.Length == 0)
				{
					errorReporter.addError("You need to define your Android Alias password in Edit -> Project Settings -> Player -> Android -> Publishing Settings.");
				}
			}
		}
		/*
		 * Check for warnings and errors
		 */
		public void checkWarningsAndErrors(ErrorReporter errorReporter)
		{
			if (!isBundleVersionFormatValid())
			{
				errorReporter.addError("Bundle Version has bad format\nMust be xx.xx or xx.xx.xx\n(x can be 1 or 2 digits)");
			}
		}
		/*
		 * Check for warnings and errors
		 */
		public void checkWarningsAndErrors(ErrorReporter errorReporter)
		{
			if (!m_releaseType.isActive)
			{
				return;
			}

			if (!isNameValid())
			{
				errorReporter.addError("You must specify a name for each release type.");
			}
			
			if (!isBundleIdentifierValid())
			{
				errorReporter.addError("You must specify a bundleIndentifier for the release type '" + m_releaseType.name + "'.");
			}
			
			if (!isProductNameValid())
			{
				errorReporter.addError("You must specify a product name for the release type '" + m_releaseType.name + "'.");
			}
		}
		/*
		 * Check for warnings and errors
		 */
		public void checkWarningsAndErrors(ErrorReporter errorReporter)
		{
			foreach (ReleaseType releaseType in m_releaseTypes.getReleaseTypeList())
			{
				ReleaseTypeRenderer releaseTypeRenderer = new ReleaseTypeRenderer(releaseType);
				releaseTypeRenderer.checkWarningsAndErrors(errorReporter);
			}

			/*
			 * If no release type is added
			 */
			if (m_releaseTypes.getReleaseTypeList().Count == 0)
			{
				errorReporter.addError("You need to have at least one release type.");
			}
			else
			{
				/*
				 * If no release type is active
				 */
				if (!m_releaseTypes.getReleaseTypeList().Any(x => x.isActive))
				{
					errorReporter.addError("You need to have at least one release type selected.");
				}


				/*
				 * If multiple release type share the same name
				 */
				int duplicateCount = m_releaseTypes.getReleaseTypeList().GroupBy(x => x.name).Where(x => x.Count() > 1).Count();
				if (duplicateCount != 0)
				{
					errorReporter.addError("Each release type must have a distinct name.");
				}
			}
		}
		/*
		 * Check for warnings and errors
		 */
		public void checkWarningsAndErrors(ErrorReporter errorReporter)
		{
			if (!isCustomPathValid())
			{
				errorReporter.addError("Custom Path in AdvancedSettings has bad format. It must not contain $ (except for the AdvancedBuilder constants).");
			}

			if (!isCustomFileNameValid())
			{
				errorReporter.addError("Custom File Name in AdvancedSettings has bad format. It must not contain $ (except for the AdvancedBuilder constants), / or \\.");
			}

			if (!isCustomBuildMonoScriptValid())
			{
				errorReporter.addError("Your custom build script must implements the interface IAdvancedCustomBuild.");
			}
		}
		/*
		 * Check for warnings and errors
		 */
		public void checkWarningsAndErrors(ErrorReporter errorReporter)
		{
			IEnumerable<KeyValuePair<IPlatform, PlatformRenderer>> supportedPlatformList = getSupportedPlatformRenderers();

			foreach (KeyValuePair<IPlatform, PlatformRenderer> supportedPlatform in supportedPlatformList)
			{
				PlatformRenderer platformRenderer = supportedPlatform.Value;
				platformRenderer.checkWarningsAndErrors(errorReporter);
			}

			/*
			 * If no platform is selected at all
			 */
			if (supportedPlatformList.Count() == 0)
			{
				errorReporter.addError("You need to add at least on platform in the 'Platforms' section.");
			}
			else
			{
				/*
				 * If no distributionplatform is activated at all
				 */
				int totalDistributionPlatformUsedCount = m_platforms.platformDictionary.Values.Where(x => x.getPlatformProperties().isSupported()).Sum(x => x.getPlatformProperties().getActiveDistributionPlatformList().Count);
				if (totalDistributionPlatformUsedCount == 0)
				{
					errorReporter.addError("No batch build will be performed\nYou must have at least one distribution platform selected.");
				}


				/*
				 * If no platform architecture is activated at all
				 */
				int totalPlatformArchitectureUsedCount = m_platforms.platformDictionary.Values.Where(x => x.getPlatformProperties().isSupported()).Sum(x => x.getPlatformProperties().getActivePlatformArchitectureList().Count);
				
				if (totalPlatformArchitectureUsedCount == 0)
				{
					errorReporter.addError("No batch build will be performed\nYou must have at least one platform architecture selected, see warnings.");
				}


				/*
				 * If no textureCompression is activated at all
				 */
				int totalTextureCompressionUsedCount = m_platforms.platformDictionary.Values.Where(x => x.getPlatformProperties().isSupported()).Sum(x => x.getPlatformProperties().getActiveTextureCompressionList().Count);

				if (totalTextureCompressionUsedCount == 0)
				{
					errorReporter.addError("No batch build will be performed\nYou must have at least one texture compression selected, see warnings.");
				}
			}
		}
		/*
		 * Check for warnings and errors
		 */
		public void checkWarningsAndErrors(ErrorReporter errorReporter)
		{
			if (m_advancedBuilder.getAdvancedSettings().overwriteScenes)
			{
				foreach (Configuration configuration in m_projectConfigurations.configurationList)
				{
					if (configuration.scenePathList == null || configuration.scenePathList.Count == 0)
					{
						errorReporter.addError("The configuration " + configuration.ToString() + " has no scene defined");
					}
				}
			}
			else
			{
				if (Utils.GetActiveScenePathArray() == null || Utils.GetActiveScenePathArray().Length == 0)
				{
					errorReporter.addError("You need at least one active scene for your project. Check File -> Build Settings");
				}
			}

			#if !UNITY_EDITOR_OSX
			if (m_projectConfigurations.configurationList.Count(x => x.platformType.Equals(PlatformType.iOS) && x.shouldAutoRunPlayer) != 0)
			{
				errorReporter.addError("You can't autorun an iOS build because you're not using a Mac. You can still build for iOS, but can't autorun. Please uncheck the 'Autorun Build' box in your build configuration");
			}
			#endif

			List<ReleaseType> activeReleaseTypeList = m_advancedBuilder.getReleaseTypes().getReleaseTypeList().Where(x => x.isActive).ToList();
			
			if (activeReleaseTypeList.Count == 0)
			{
				errorReporter.addWarning("You need to select at least one release type in the 'Release Type' window.");
			}

			if (m_projectConfigurations.configurationList.Count == 0)
			{
				errorReporter.addWarning("You need to add at least one configuration in order to build multiple configurations.");
			}
			else
			{
				if (m_projectConfigurations.configurationList.Count(x => x.isEnabled) == 0)
				{
					errorReporter.addWarning("You need to enable at least one configuration in order to build multiple configurations.");
				}

				if (m_projectConfigurations.configurationList.GroupBy(x => x.getBuildPath(m_advancedBuilder.getAdvancedSettings(), System.DateTime.Now, m_advancedBuilder.getProductParameters().bundleVersion)).SelectMany(group => group.Skip(1)).Count() != 0)
				{
					errorReporter.addError("Be careful. You have some build path that are exactly the same for some configuration. So one configuration build will erase the other! Please modify the build path in the 'Build folder path' section to avoid this!");
				}

				foreach (Configuration configuration in m_projectConfigurations.configurationList)
				{
					string finalBuildPath = Application.dataPath.Replace("/Assets", string.Empty) + configuration.getBuildPath(m_advancedBuilder.getAdvancedSettings(), System.DateTime.Now, m_advancedBuilder.getProductParameters().bundleVersion);
					if (File.Exists(finalBuildPath) || Directory.Exists(finalBuildPath))
					{
						errorReporter.addWarning("There is already a build at path " + finalBuildPath + " for the configuration " + configuration.getDescription() + ". If you build, it will overwrite it.");
					}
				}
			}

			foreach (Configuration configuration in m_projectConfigurations.configurationList)
			{
				if (m_advancedBuilder.getReleaseTypes().getReleaseTypeList().Where(x => x.name.Equals(configuration.releaseType.name)).Count() == 0)
				{
					errorReporter.addWarning("Be careful, it seems you changed a release type name, and your configuration " + configuration.getDescription() + " still uses the old one (" + (configuration.releaseType == null ? "N/A" : configuration.releaseType.name) + "). To update, please delete the configuration and add it back again (remember to save your custom defines)");
				}

				if (m_advancedBuilder.getReleaseTypes().getReleaseTypeList().Where(x => x.bundleIdentifier.Equals(configuration.releaseType.bundleIdentifier)).Count() == 0)
				{
					errorReporter.addWarning("Be careful, it seems you changed a release type bundle identifier, and your configuration " + configuration.getDescription() + " still uses the old one (" + (configuration.releaseType == null ? "N/A" : configuration.releaseType.bundleIdentifier) + "). To update, please delete the configuration and add it back again (remember to save your custom defines)");
				}
				
				if (m_advancedBuilder.getReleaseTypes().getReleaseTypeList().Where(x => x.productName.Equals(configuration.releaseType.productName)).Count() == 0)
				{
					errorReporter.addWarning("Be careful, it seems you changed a release type product name, and your configuration " + configuration.getDescription() + " still uses the old one (" + (configuration.releaseType == null ? "N/A" : configuration.releaseType.productName) + "). To update, please delete the configuration and add it back again (remember to save your custom defines)");
				}

				if (!configuration.distributionPlatform.name.Equals("Default"))
				{
					if (configuration.platform.getPlatformProperties().getDistributionPlatformList().Where(x => x.name.Equals(configuration.distributionPlatform.name)).Count() == 0)
					{
						errorReporter.addWarning("Be careful, it seems you changed a distribution platform name, and your configuration " + configuration.getDescription() + " still uses the old one (" + (configuration.distributionPlatform == null ? "N/A" : configuration.distributionPlatform.name) + "). To update, please delete the configuration and add it back again (remember to save your custom defines)");
					}
				}
			}
		}