CCNet.ProjectAdapter.Program.UpdateHints C# (CSharp) Method

UpdateHints() private static method

Updates hint paths for resolved references.
private static UpdateHints ( XmlDocument doc, XmlNamespaceManager xnm, IEnumerable references, bool reportReferences ) : void
doc System.Xml.XmlDocument
xnm System.Xml.XmlNamespaceManager
references IEnumerable
reportReferences bool
return void
		private static void UpdateHints(
			XmlDocument doc,
			XmlNamespaceManager xnm,
			IEnumerable<ReferenceFile> references,
			bool reportReferences)
		{
			foreach (ReferenceFile reference in references)
			{
				XmlNode node = doc.SelectSingleNode(
					@"
						/ms:Project/ms:ItemGroup/ms:Reference[starts-with(@Include, '{0},')]
						| /ms:Project/ms:ItemGroup/ms:Reference[@Include = '{0}']
					"
					.Display(reference.AssemblyName),
					xnm);

				if (node == null)
					continue;

				XmlNode hint = node.SelectSingleNode("ms:HintPath", xnm);
				if (hint != null)
					node.RemoveChild(hint);

				// use pinned reference if needed
				bool pinned = false;
				string referencePath = reference.FilePath;
				if (!String.IsNullOrEmpty(Arguments.UsePinned))
				{
					string pinnedPath = Path.Combine(
						Paths.PinnedReferencesFolder,
						Path.GetFileName(referencePath));

					if (File.Exists(pinnedPath))
					{
						pinned = true;
						referencePath = pinnedPath;
					}
				}

				hint = doc.CreateElement("HintPath", xnm.LookupNamespace("ms"));
				hint.InnerXml = referencePath;

				node.AppendChild(hint);

				if (reportReferences)
				{
					Console.WriteLine(
						Resources.LogReferencesTo,
						reference.FileName,
						reference.ProjectName,
						pinned
							? String.Format("Pinned as {0}", Arguments.UsePinned)
							: reference.Version);
				}
			}
		}