CCNet.Common.ProjectHelper.GetProjectItem C# (CSharp) Method

GetProjectItem() private static method

Gets project item from an XML node.
private static GetProjectItem ( XmlNode node ) : CCNet.Common.ProjectItem
node System.Xml.XmlNode
return CCNet.Common.ProjectItem
		private static ProjectItem GetProjectItem(XmlNode node)
		{
			ProjectItemType type;
			switch (node.Name)
			{
				case "None":
					type = ProjectItemType.None;
					break;
				case "Compile":
					type = ProjectItemType.Compile;
					break;
				case "Content":
					type = ProjectItemType.Content;
					break;
				case "EmbeddedResource":
					type = ProjectItemType.EmbeddedResource;
					break;
				case "EntityDeploy":
					type = ProjectItemType.EntityDeploy;
					break;
				case "Resource":
					type = ProjectItemType.Resource;
					break;
				case "Shadow":
					type = ProjectItemType.Shadow;
					break;
				case "ApplicationDefinition":
					type = ProjectItemType.ApplicationDefinition;
					break;
				case "Page":
					type = ProjectItemType.Page;
					break;
				case "ServiceDefinition":
					type = ProjectItemType.ServiceDefinition;
					break;
				case "ServiceConfiguration":
					type = ProjectItemType.ServiceConfiguration;
					break;
				case "PublishProfile":
					type = ProjectItemType.PublishProfile;
					break;
				case "SplashScreen":
					type = ProjectItemType.SplashScreen;
					break;
				default:
					throw new InvalidOperationException(
						String.Format("Unknown project node name: {0}.", node.Name));
			}

			string fullName = node.Attributes["Include"].Value;

			CopyToOutputDirectory copyToOutput = CopyToOutputDirectory.None;

			if (node.HasChildNodes)
			{
				Dictionary<string, string> properties = PropertiesHelper.ParseFromXml(node);

				string copyToOutputKey = "/{0}/CopyToOutputDirectory".Display(node.Name);
				if (properties.ContainsKey(copyToOutputKey))
				{
					string copyToOutputValue = properties[copyToOutputKey];
					switch (copyToOutputValue)
					{
						case "PreserveNewest":
							copyToOutput = CopyToOutputDirectory.PreserveNewest;
							break;
						case "Always":
							copyToOutput = CopyToOutputDirectory.Always;
							break;
						default:
							throw new InvalidOperationException(
								String.Format("Unknown copying to output value: {0}.", copyToOutputValue));
					}
				}
			}

			return new ProjectItem
				{
					FullName = fullName,
					Type = type,
					CopyToOutput = copyToOutput
				};
		}