System.Collections.Generic.ICollection.Add(ValidationLog)

Here are the examples of the csharp api System.Collections.Generic.ICollection.Add(ValidationLog) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

19 Source : LogCache.cs
with MIT License
from jeffcampbellmakesgames

internal void OnLogCreated(ValidationLog log)
		{
			_logs.Add(log);
		}

19 Source : ValidationLogTreeViewTools.cs
with MIT License
from jeffcampbellmakesgames

private static TreeViewItem CreateTreeGroupedByArea(IReadOnlyList<ValidationLog> logs)
		{
			var id = -1;
			var rooreplacedem = new TreeViewItem(++id, -1);
			var sceneLogs = logs.Where(x => x.source == LogSource.Scene);
			var rootSceneItem = new ValidationLogTreeViewHeader(++id, 0, SceneArea);
			SetLogCounts(rootSceneItem, sceneLogs);

			var projLogs = logs.Where(x => x.source == LogSource.Project);
			var projRooreplacedem = new ValidationLogTreeViewHeader(++id, 0, ProjectArea);
			SetLogCounts(projRooreplacedem, projLogs);

			var miscLogs = logs.Where(x => x.source == LogSource.None);
			var miscRoot = new ValidationLogTreeViewHeader(++id, 0, NoneArea);
			SetLogCounts(miscRoot, miscLogs);

			// Create a lookup of all vLogs grouped by validator name
			var dict = new Dictionary<LogSource, List<ValidationLog>>();
			foreach (var vLog in logs)
			{
				if (!dict.ContainsKey(vLog.source))
				{
					dict[vLog.source] = new List<ValidationLog> {vLog};
				}
				else
				{
					dict[vLog.source].Add(vLog);
				}
			}

			// From the lookup and root item, create a child object for each validator
			// type and for each validator type add all logs of that type as children.
			foreach (var kvp in dict)
			{
				var kLogs = kvp.Value;

				switch (kvp.Key)
				{
					case LogSource.None:
						foreach (var kLog in kLogs)
						{
							miscRoot.AddChild(new ValidationLogTreeViewItem(kLog, ++id, 1, kLog.validatorName));
						}
						break;

					case LogSource.Scene:
						var sceneDict = new Dictionary<string, IList<ValidationLog>>();
						kLogs.Sort(new SortValidationLogOnScenePath());
						foreach (var kLog in kLogs)
						{
							if (sceneDict.ContainsKey(kLog.scenePath))
							{
								sceneDict[kLog.scenePath].Add(kLog);
							}
							else
							{
								sceneDict[kLog.scenePath] = new List<ValidationLog> {kLog};
							}
						}

						foreach (var sceneToLogsKvp in sceneDict)
						{
							var slogs = sceneToLogsKvp.Value;
							var sceneRooreplacedem = new ValidationLogTreeViewHeader(
								++id,
								1,
								sceneToLogsKvp.Key.Split(EditorConstants.ForwardSlashChar).Last());

							foreach (var slog in slogs)
							{
								sceneRooreplacedem.AddChild(new ValidationLogTreeViewItem(
									slog,
									++id,
									2,
									slog.objectPath.Split(EditorConstants.ForwardSlashChar).Last()));

							}

							SetLogCounts(sceneRooreplacedem, slogs);

							rootSceneItem.AddChild(sceneRooreplacedem);
						}

						break;

					case LogSource.Project:
						kLogs.Sort(new SortValidationLogOnObjectPath());
						foreach (var kLog in kLogs)
						{
							projRooreplacedem.AddChild(new ValidationLogTreeViewItem(
								kLog,
								++id,
								1,
								kLog.objectPath.Split(EditorConstants.ForwardSlashChar).Last()));
						}

						break;
				}
			}

			rooreplacedem.AddChild(projRooreplacedem);
			rooreplacedem.AddChild(rootSceneItem);
			rooreplacedem.AddChild(miscRoot);

			return rooreplacedem;
		}