예제 #1
0
		private static Config LoadConfigPrivate()
		{
			Config LoadedConfig = new Config();

			string ExePath = Assembly.GetEntryAssembly().Location;
			string ExeFolder = Path.GetDirectoryName(ExePath);
			string ConfigPath = Path.Combine(ExeFolder, "CrashReportProcess.config");

			if (File.Exists(ConfigPath))
			{
				if (!string.IsNullOrEmpty(ConfigPath))
				{
					using (XmlReader Reader = XmlReader.Create(ConfigPath))
					{
						CrashReporterProcessServicer.WriteEvent("Loading config from " + ConfigPath);
						XmlSerializer Xml = new XmlSerializer(typeof (Config));
						LoadedConfig = Xml.Deserialize(Reader) as Config;
					}
				}
			}

#if DEBUG
			// Debug mode redirects to local folder in DebugTestingFolder
			LoadedConfig.ProcessedReports = Path.Combine(LoadedConfig.DebugTestingFolder, "ProcessedReports");
			LoadedConfig.ProcessedVideos = Path.Combine(LoadedConfig.DebugTestingFolder, "ProcessedVideos");
			LoadedConfig.DepotRoot = Path.Combine(LoadedConfig.DebugTestingFolder, "DepotRoot");
			LoadedConfig.InternalLandingZone = Path.Combine(LoadedConfig.DebugTestingFolder, "InternalLandingZone");
			LoadedConfig.ExternalLandingZone = Path.Combine(LoadedConfig.DebugTestingFolder, "ExternalLandingZone");
			LoadedConfig.DataRouterLandingZone = Path.Combine(LoadedConfig.DebugTestingFolder, "DataRouterLandingZone");
			LoadedConfig.InvalidReportsDirectory = Path.Combine(LoadedConfig.DebugTestingFolder, "InvalidReportsDirectory");
			LoadedConfig.VersionString += " debugbuild";
			LoadedConfig.AWSCredentialsFilepath = Path.Combine(LoadedConfig.DebugTestingFolder, "AWS", "credentials.ini");
			LoadedConfig.ProcessedReportsIndexPath = Path.Combine(LoadedConfig.DebugTestingFolder, "ProcessedReports.ini");

#if SLACKTESTING
			LoadedConfig.SlackUsername = "******";
			//LoadedConfig.SlackChannel = "OPTIONALTESTINGCHANNELHERE";
#else
			LoadedConfig.SlackWebhookUrl = string.Empty;	// no Slack in dbeug
#endif
#endif
			return LoadedConfig;
		}