PatchworkLauncher.LaunchManager.GroupPatches C# (CSharp) Méthode

GroupPatches() private méthode

private GroupPatches ( IEnumerable instrs ) : IEnumerable
instrs IEnumerable
Résultat IEnumerable
		private IEnumerable<PatchGroup> GroupPatches(IEnumerable<PatchInstruction> instrs) {
			var dict = new Dictionary<string, List<PatchInstruction>>();

			foreach (var instr in instrs) {
				try {
					var canPatch = instr.Patch.PatchInfo.CanPatch(AppInfo);
					if (canPatch != null) {
						throw new PatchExecutionException(canPatch);
					}
					var targetFile = instr.Patch.PatchInfo.GetTargetFile(AppInfo).FullName;
					if (dict.ContainsKey(targetFile)) {
						dict[targetFile].Add(instr);
					} else {
						dict[targetFile] = new List<PatchInstruction>(new[] {
							instr
						});
					}
				}
				catch (Exception ex) {
					throw new PatchingProcessException(ex) {
						AssociatedInstruction = instr,
						TargetFile = null,
						Step = PatchProcessingStep.Grouping
					};
				}
			}
			var groups =
				from kvp in dict
				select new PatchGroup {
					Instructions = kvp.Value,
					TargetPath = kvp.Key
				};

			return groups.ToList();
		}