<?xml version="1.0"?>
<assets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/Crownpeak/Content-Xcelerator/master/Crownpeak%20Content%20Xcelerator%20Migrator/Content-Xcelerator.xsd">
  <folder>
    <id>261049</id>
    <label>Component Project</label>
    <model_id>
    </model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <path>/Component Project</path>
    <folder_id>261046</folder_id>
    <subType>32</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Project</intendedType>
    <type>4</type>
  </folder>
  <folder>
    <id>261055</id>
    <label>Component Library</label>
    <model_id>
    </model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <path>/Component Project/Component Library</path>
    <folder_id>261049</folder_id>
    <subType>8192</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Folder</intendedType>
    <type>4</type>
  </folder>
  <folder>
    <id>261102</id>
    <label>Component Definitions</label>
    <model_id>261107</model_id>
    <model_path>/Component Project/Models/Component Definition Folder/</model_path>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <path>/Component Project/Component Library/Component Definitions</path>
    <folder_id>261055</folder_id>
    <subType>0</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Folder</intendedType>
    <type>4</type>
  </folder>
  <folder>
    <id>261180</id>
    <label>core</label>
    <model_id>261107</model_id>
    <model_path>/Component Project/Models/Component Definition Folder/</model_path>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <path>/Component Project/Component Library/Component Definitions/core</path>
    <folder_id>261102</folder_id>
    <subType>0</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Folder</intendedType>
    <type>4</type>
  </folder>
  <asset>
    <id>261344</id>
    <label>Date</label>
    <template_id>261485</template_id>
    <template_path>/Component Project/Templates/Component Framework/Enhanced/Component Definition/</template_path>
    <template_language>1</template_language>
    <model_id>261191</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Component Library/Component Definitions/core/Date</path>
    <folder_id>261180</folder_id>
    <subType>0</subType>
    <templateSubType>512</templateSubType>
    <intendedType>ContentAsset</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>class_name</name>
        <value>Date</value>
      </field>
      <field>
        <name>content_block_hide</name>
        <value>yes</value>
      </field>
      <field>
        <name>json_component</name>
        <value>yes</value>
      </field>
      <field>
        <name>markup</name>
        <value>
        </value>
      </field>
      <field>
        <name>read_only</name>
        <value>
        </value>
      </field>
      <field>
        <name>sanitized_class_name</name>
        <value>Date</value>
      </field>
      <field>
        <name>upload#snapshot</name>
        <value>
        </value>
      </field>
      <field>
        <name>upload_name#snapshot</name>
        <value>
        </value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>263532</id>
    <label>Document</label>
    <template_id>261485</template_id>
    <template_path>/Component Project/Templates/Component Framework/Enhanced/Component Definition/</template_path>
    <template_language>1</template_language>
    <model_id>261191</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Component Library/Component Definitions/core/Document</path>
    <folder_id>261180</folder_id>
    <subType>0</subType>
    <templateSubType>512</templateSubType>
    <intendedType>ContentAsset</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>class_name</name>
        <value>Document</value>
      </field>
      <field>
        <name>content_block_hide</name>
        <value>yes</value>
      </field>
      <field>
        <name>json_component</name>
        <value>yes</value>
      </field>
      <field>
        <name>markup</name>
        <value>
        </value>
      </field>
      <field>
        <name>read_only</name>
        <value>
        </value>
      </field>
      <field>
        <name>sanitized_class_name</name>
        <value>Document</value>
      </field>
      <field>
        <name>upload#snapshot</name>
        <value>
        </value>
      </field>
      <field>
        <name>upload_name#snapshot</name>
        <value>
        </value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261201</id>
    <label>Image</label>
    <template_id>261485</template_id>
    <template_path>/Component Project/Templates/Component Framework/Enhanced/Component Definition/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Component Library/Component Definitions/core/Image</path>
    <folder_id>261180</folder_id>
    <subType>0</subType>
    <templateSubType>512</templateSubType>
    <intendedType>ContentAsset</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>class_name</name>
        <value>Image</value>
      </field>
      <field>
        <name>component_category</name>
        <value>component</value>
      </field>
      <field>
        <name>component_component_form_override_type</name>
        <value>
        </value>
      </field>
      <field>
        <name>component_component_hardcoded_snippet</name>
        <value>
        </value>
      </field>
      <field>
        <name>component_component_input_label</name>
        <value>
        </value>
      </field>
      <field>
        <name>component_component_label</name>
        <value>my_image</value>
      </field>
      <field>
        <name>component_component_message_content</name>
        <value>
        </value>
      </field>
      <field>
        <name>component_component_message_type</name>
        <value>basic</value>
      </field>
      <field>
        <name>component_component_required</name>
        <value>
        </value>
      </field>
      <field>
        <name>component_component_required_message</name>
        <value>
        </value>
      </field>
      <field>
        <name>component_component_type</name>
        <value>Src</value>
      </field>
      <field>
        <name>component_component_type_in_markup</name>
        <value>true</value>
      </field>
      <field>
        <name>component_panel</name>
        <value>0</value>
      </field>
      <field>
        <name>content_block_hide</name>
        <value>yes</value>
      </field>
      <field>
        <name>json_component</name>
        <value>yes</value>
      </field>
      <field>
        <name>markup</name>
        <value>&lt;img src="{my_image : Src}" /&gt;</value>
      </field>
      <field>
        <name>read_only</name>
        <value>
        </value>
      </field>
      <field>
        <name>sanitized_class_name</name>
        <value>Image</value>
      </field>
      <field>
        <name>upload#preview_my_image</name>
        <value>
        </value>
      </field>
      <field>
        <name>upload#snapshot</name>
        <value>
        </value>
      </field>
      <field>
        <name>upload_name#preview_my_image</name>
        <value>
        </value>
      </field>
      <field>
        <name>upload_name#snapshot</name>
        <value>
        </value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261197</id>
    <label>Src</label>
    <template_id>261485</template_id>
    <template_path>/Component Project/Templates/Component Framework/Enhanced/Component Definition/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Component Library/Component Definitions/core/Src</path>
    <folder_id>261180</folder_id>
    <subType>0</subType>
    <templateSubType>512</templateSubType>
    <intendedType>ContentAsset</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>class_name</name>
        <value>Src</value>
      </field>
      <field>
        <name>content_block_hide</name>
        <value>yes</value>
      </field>
      <field>
        <name>json_component</name>
        <value>yes</value>
      </field>
      <field>
        <name>markup</name>
        <value>
        </value>
      </field>
      <field>
        <name>read_only</name>
        <value>
        </value>
      </field>
      <field>
        <name>sanitized_class_name</name>
        <value>Src</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261196</id>
    <label>Text</label>
    <template_id>261485</template_id>
    <template_path>/Component Project/Templates/Component Framework/Enhanced/Component Definition/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Component Library/Component Definitions/core/Text</path>
    <folder_id>261180</folder_id>
    <subType>0</subType>
    <templateSubType>512</templateSubType>
    <intendedType>ContentAsset</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>class_name</name>
        <value>Text</value>
      </field>
      <field>
        <name>content_block_hide</name>
        <value>yes</value>
      </field>
      <field>
        <name>json_component</name>
        <value>yes</value>
      </field>
      <field>
        <name>markup</name>
        <value>
        </value>
      </field>
      <field>
        <name>read_only</name>
        <value>
        </value>
      </field>
      <field>
        <name>sanitized_class_name</name>
        <value>Text</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261195</id>
    <label>Widget</label>
    <template_id>261485</template_id>
    <template_path>/Component Project/Templates/Component Framework/Enhanced/Component Definition/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Component Library/Component Definitions/core/Widget</path>
    <folder_id>261180</folder_id>
    <subType>0</subType>
    <templateSubType>512</templateSubType>
    <intendedType>ContentAsset</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>class_name</name>
        <value>Widget</value>
      </field>
      <field>
        <name>content_block_hide</name>
        <value>yes</value>
      </field>
      <field>
        <name>json_component</name>
        <value>yes</value>
      </field>
      <field>
        <name>markup</name>
        <value>
        </value>
      </field>
      <field>
        <name>read_only</name>
        <value>
        </value>
      </field>
      <field>
        <name>sanitized_class_name</name>
        <value>Widget</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261194</id>
    <label>Wysiwyg</label>
    <template_id>261485</template_id>
    <template_path>/Component Project/Templates/Component Framework/Enhanced/Component Definition/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Component Library/Component Definitions/core/Wysiwyg</path>
    <folder_id>261180</folder_id>
    <subType>0</subType>
    <templateSubType>512</templateSubType>
    <intendedType>ContentAsset</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>class_name</name>
        <value>Wysiwyg</value>
      </field>
      <field>
        <name>content_block_hide</name>
        <value>yes</value>
      </field>
      <field>
        <name>json_component</name>
        <value>yes</value>
      </field>
      <field>
        <name>markup</name>
        <value>
        </value>
      </field>
      <field>
        <name>read_only</name>
        <value>
        </value>
      </field>
      <field>
        <name>sanitized_class_name</name>
        <value>Wysiwyg</value>
      </field>
    </fields>
  </asset>
  <folder>
    <id>261059</id>
    <label>Library</label>
    <model_id>
    </model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <path>/Component Project/Library</path>
    <folder_id>261049</folder_id>
    <subType>64</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryFolder</intendedType>
    <type>4</type>
  </folder>
  <asset>
    <id>261475</id>
    <label>ComponentBase.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/ComponentBase.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Experimental;
using CrownPeak.CMSAPI.Services;
using System.Text.RegularExpressions;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public abstract class ComponentBase : CrownPeak.CMSAPI.ComponentBase
	{
		private String contentNodeName = "cp-content";
		private String repeatableNodeName = "cp-list";

		//neccessary evil for now
		Dictionary&lt;String, String&gt; componentMarkupDictionary = new Dictionary&lt;string, string&gt;();

		public String ComponentMarkup { get; set; }

		public String componentLabel { get; set; }

		public bool isRequired { get; set; }

		public String validationError { get; set; }

		public ComponentBase()
		{
		}

		public ComponentBase(Asset componentAsset, String componentMarkup, String componentLabel, bool isRequired = false, String validationError = "")
		{
			this.ComponentMarkup = componentMarkup;

			this.componentLabel = componentLabel;

			this.isRequired = isRequired;

			this.validationError = validationError;
		}

		public override void ComponentInput(Asset asset, InputContext context, string label, string name)
		{
			//generateInput_old(label, name);
		}

		public override void ComponentPostInput(Asset asset, PostInputContext context, string name, string index = "")
		{
			//code
		}

		public override String ComponentOutput(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			return "&lt;p&gt;Output does not exist&lt;/p&gt;";
			//return generateOutput(asset, name, index);
		}

		/*********************HELPER FUNCITONS*********************/
		protected String getComponentMarkup(String componentPath)
		{
			componentPath = componentPath.ToLower();

			//if the dictionary does not contain the component add the component markup to the dictionary and return it.
			if (!componentMarkupDictionary.ContainsKey(componentPath))
			{
				Asset component = Asset.Load(componentPath);

				if (component.IsLoaded)
				{
					String componentMarkup = component.Raw["markup"];
					componentMarkupDictionary.Add(componentPath, componentMarkup);
					return componentMarkup;
				}
				else
				{
					return "";
				}
			}
			else
			{
				return componentMarkupDictionary[componentPath];
			}
		}

		public void PanelInput(Asset asset, InputContext context, String label, String name, Dictionary&lt;List&lt;String&gt;, Action&lt;Asset, InputContext, string, string&gt;&gt; fields, int? minPanels = null, int? maxPanels = null)
		{
			while (Input.NextPanel(name, ListPanelType.Regular, minPanels, maxPanels, displayName: label))
			{
				foreach (KeyValuePair&lt;List&lt;string&gt;, Action&lt;Asset, InputContext, string, string&gt;&gt; entry in fields)
				{
					var fieldName = entry.Key[0];
					var fieldLabel = (entry.Key.Count &gt; 1 ? entry.Key[1] : String.Empty);
					var isInControlPanel = (entry.Key.Count &gt; 2 ? entry.Key[2] : String.Empty);
					var method = entry.Value;
					String messageContent = (entry.Key.Count &gt; 3 ? entry.Key[3] : String.Empty);
					String messageType = (entry.Key.Count &gt; 4 ? entry.Key[4] : String.Empty); ;

					Out.DebugWriteLine("messageType: " + messageType);

					if (isInControlPanel == "control_group")
					{
						Input.StartControlPanel(fieldLabel);
						if (!String.IsNullOrWhiteSpace(messageContent))
						{
							Input.ShowMessage(messageContent, messageType == "basic" ? MessageType.Basic : MessageType.Warning);
						}
						method(asset, context, "", name + fieldName);
						Input.EndControlPanel();
					}
					else
					{
						if (!String.IsNullOrWhiteSpace(messageContent))
						{
							Input.ShowMessage(messageContent, messageType == "basic" ? MessageType.Basic : MessageType.Warning);
						}
						method(asset, context, fieldLabel, name + fieldName);
					}


				}
			}
		}

		public void PanelPostInput(Asset asset, PostInputContext context, String name, Dictionary&lt;List&lt;String&gt;, Action&lt;Asset, PostInputContext, string, string&gt;&gt; fields, String index = "")
		{
			Int32 i = 1;
			//while (!String.IsNullOrEmpty(context.InputForm[name + Index(i) + index]))
			//{
			//    foreach (KeyValuePair&lt;List&lt;string&gt;, Action&lt;PostInputContext, string, string&gt;&gt; entry in fields)
			//    {
			//        var fieldParams = entry.Key;
			//        var method = entry.Value;
			//        method(context, name + fieldParams[0], Index(i) + index);
			//    }
			//    i++;
			//}


			if (!String.IsNullOrEmpty(context.InputForm[name + Index(i) + index]))
			{
				while (!String.IsNullOrEmpty(context.InputForm[name + Index(i) + index]))
				{
					Out.DebugWriteLine("context.InputForm[" + name + Index(i) + index + "] = " + context.InputForm[name + Index(i) + index]);
					foreach (KeyValuePair&lt;List&lt;string&gt;, Action&lt;Asset, PostInputContext, string, string&gt;&gt; entry in fields)
					{
						var fieldParams = entry.Key;
						var contentName = fieldParams.Count &gt; 0 ? fieldParams[0] : "";
						var contentType = fieldParams.Count &gt; 1 ? fieldParams[1] : "";
						var contentValidationMessage = fieldParams.Count &gt; 1 ? fieldParams[2] : "";
						var method = entry.Value;

						if (contentType != "")
						{
							if (contentType == "Href")
							{
								if (context.InputForm[name + contentName + "_link_type" + Index(i) + index] == "Internal")
								{
									if (String.IsNullOrWhiteSpace(context.InputForm[name + contentName + "_link_internal" + Index(i) + index])) { context.ValidationErrorFields.Add(name + contentName + "_link_internal" + Index(i) + index, contentValidationMessage); }
								}
								else if (context.InputForm[name + contentName + "_link_type" + Index(i) + index] == "External")
								{
									if (String.IsNullOrWhiteSpace(context.InputForm[name + contentName + "_link_external" + Index(i) + index])) { context.ValidationErrorFields.Add(name + contentName + "_link_external" + Index(i) + index, contentValidationMessage); }
								}
							}
							else if (contentType == "Src")
							{
								if (String.IsNullOrWhiteSpace(context.InputForm[name + contentName + "_image" + Index(i) + index])) { context.ValidationErrorFields.Add(name + contentName + "_image" + Index(i) + index, contentValidationMessage); }
							}
							else
							{
								if (String.IsNullOrWhiteSpace(context.InputForm[name + contentName + Index(i) + index])) { context.ValidationErrorFields.Add(name + contentName + Index(i) + index, contentValidationMessage); }
							}
						}
						else
						{
							method(asset, context, name + fieldParams[0], Index(i) + index);
							//pattern = pattern.Replace(fieldParams[0], method(asset, context, name + fieldParams[1], Index(i) + index));
						}
					}
					i++;
					//output += pattern;
				}
			}
			else if (!String.IsNullOrEmpty(context.InputForm[name + index]))
			{
				////String pattern = markup;
				//Out.DebugWriteLine("context.InputForm[" + name + index + "] = " + context.InputForm[name + index]);
				//foreach (KeyValuePair&lt;List&lt;string&gt;, Action&lt;PostInputContext, string, string&gt;&gt; entry in fields)
				//{
				//    var fieldParams = entry.Key;
				//    var method = entry.Value;
				//    method(context, name + fieldParams[0], index);
				//    //pattern = pattern.Replace(fieldParams[0], method(asset, context, name + fieldParams[1], index));
				//}
				//i++;

				//while (!String.IsNullOrEmpty(context.InputForm[name + index]))
				//{
				Out.DebugWriteLine("context.InputForm[" + name + index + "] = " + context.InputForm[name + index]);
				foreach (KeyValuePair&lt;List&lt;string&gt;, Action&lt;Asset, PostInputContext, string, string&gt;&gt; entry in fields)
				{
					var fieldParams = entry.Key;
					var contentName = fieldParams.Count &gt; 0 ? fieldParams[0] : "";
					var contentType = fieldParams.Count &gt; 1 ? fieldParams[1] : "";
					var contentValidationMessage = fieldParams.Count &gt; 1 ? fieldParams[2] : "";
					var method = entry.Value;

					if (contentType != "")
					{
						if (contentType == "Href")
						{
							if (context.InputForm[name + contentName + "_link_type" + index] == "Internal")
							{
								if (String.IsNullOrWhiteSpace(context.InputForm[name + contentName + "_link_internal" + index])) { context.ValidationErrorFields.Add(name + contentName + "_link_internal" + index, contentValidationMessage); }
							}
							else if (context.InputForm[name + contentName + "_link_type" + index] == "External")
							{
								if (String.IsNullOrWhiteSpace(context.InputForm[name + contentName + "_link_external" + index])) { context.ValidationErrorFields.Add(name + contentName + "_link_external" + index, contentValidationMessage); }
							}
						}
						else if (contentType == "Src")
						{
							if (String.IsNullOrWhiteSpace(context.InputForm[name + contentName + "_image" + index])) { context.ValidationErrorFields.Add(name + contentName + "_image" + index, contentValidationMessage); }
						}
						else
						{
							if (String.IsNullOrWhiteSpace(context.InputForm[name + contentName + index])) { context.ValidationErrorFields.Add(name + contentName + index, contentValidationMessage); }
						}
					}
					else
					{
						method(asset, context, name + fieldParams[0], index);
						//pattern = pattern.Replace(fieldParams[0], method(asset, context, name + fieldParams[1], Index(i) + index));
					}
				}
				i++;
				//output += pattern;
				//}
			}
			else if (!String.IsNullOrEmpty(context.InputForm[name + Index(i) + ":1"]))
			{
				while (!String.IsNullOrEmpty(context.InputForm[name + Index(i) + ":1"]))
				{
					Out.DebugWriteLine("context.InputForm[" + name + Index(i) + ":1" + "] = " + context.InputForm[name + Index(i) + ":1"]);
					foreach (KeyValuePair&lt;List&lt;string&gt;, Action&lt;Asset, PostInputContext, string, string&gt;&gt; entry in fields)
					{
						var fieldParams = entry.Key;
						var method = entry.Value;
						method(asset, context, name + fieldParams[0], Index(i) + ":1");
						//pattern = pattern.Replace(fieldParams[0], method(asset, context, name + fieldParams[1], Index(i) + ":1"));
					}
					i++;
				}
			}
		}

		public String PanelOutput(Asset asset, OutputContext context, String name, String markup, String listName, Dictionary&lt;List&lt;String&gt;, Func&lt;Asset, OutputContext, String, String, bool, String&gt;&gt; fields, String index = "")
		{
			Out.DebugWriteLine("Entered panel_output with name: {0}, markup: {1}, listName: {2}", name, Util.HtmlEncode(markup), listName);
			//Regex rx = new Regex(@"\[" + listName + @":.*\]", RegexOptions.Compiled | RegexOptions.IgnoreCase);
			// MatchCollection matches = rx.Matches(markup);

			//foreach (Match match in matches)
			//{
			//String pattern = markup;
			String output = "";
			Int32 i = 1;
			Out.DebugWriteLine("checking asset[" + name + Index(i) + index + "]...");

			if (!String.IsNullOrEmpty(asset[name + Index(i) + index]))
			{
				while (!String.IsNullOrEmpty(asset[name + Index(i) + index]))
				{
					String pattern = markup;
					//Out.DebugWriteLine("asset[" + name + Index(i) + index + "] = " + asset[name + Index(i) + index]);
					foreach (KeyValuePair&lt;List&lt;string&gt;, Func&lt;Asset, OutputContext, String, String, bool, String&gt;&gt; entry in fields)
					{
						var fieldParams = entry.Key;
						var method = entry.Value;
						Out.DebugWriteLine(fieldParams[0] + " = " + method(asset, context, name + fieldParams[1], Index(i) + index, false));
						pattern = pattern.Replace(fieldParams[0], method(asset, context, name + fieldParams[1], Index(i) + index, false));
					}
					i++;
					output += pattern;
				}

			}
			else if (!String.IsNullOrEmpty(asset[name + index]))
			{
				String pattern = markup;
				Out.DebugWriteLine("asset[" + name + index + "] = " + asset[name + index]);
				foreach (KeyValuePair&lt;List&lt;string&gt;, Func&lt;Asset, OutputContext, String, String, bool, String&gt;&gt; entry in fields)
				{
					var fieldParams = entry.Key;
					var method = entry.Value;
					pattern = pattern.Replace(fieldParams[0], method(asset, context, name + fieldParams[1], index, false));
				}
				i++;
				output += pattern;
			}
			else if (!String.IsNullOrEmpty(asset[name + Index(i) + ":1"]))
			{
				while (!String.IsNullOrEmpty(asset[name + Index(i) + ":1"]))
				{
					String pattern = markup;
					Out.DebugWriteLine("asset[" + name + Index(i) + ":1" + "] = " + asset[name + Index(i) + ":1"]);
					foreach (KeyValuePair&lt;List&lt;string&gt;, Func&lt;Asset, OutputContext, String, String, bool, String&gt;&gt; entry in fields)
					{
						var fieldParams = entry.Key;
						var method = entry.Value;
						pattern = pattern.Replace(fieldParams[0], method(asset, context, name + fieldParams[1], Index(i) + ":1", false));
					}
					i++;
					output += pattern;
				}
			}

			return output;
			//markup = markup.Replace(match.Value, output);
			//return markup;
		}

		public String PanelOutput(Asset asset, OutputContext context, String markup, Dictionary&lt;List&lt;String&gt;, Func&lt;Asset, OutputContext, String, String, bool, String&gt;&gt; fields, String index = "", List&lt;Asset&gt; overrideAssetList = null)
		{
			String contentToReplace = fields.First().Key[0];
			Func&lt;Asset, OutputContext, String, String, bool, String&gt; method = fields.First().Value;

			return PanelOutput(asset, context, markup, contentToReplace, method, overrideAssetList: overrideAssetList);
		}

		public String PanelOutput(Asset asset, OutputContext context, String markup, String contentToReplace, Func&lt;Asset, OutputContext, String, String, bool, String&gt; method, String index = "", List&lt;Asset&gt; overrideAssetList = null)
		{
			String output = "";
			Int32 i = 1;

			if (overrideAssetList != null)
			{
				foreach (Asset overrideAsset in overrideAssetList)
				{
					String pattern = markup;

					pattern = pattern.Replace(contentToReplace, method(overrideAsset, context, "", Index(i), false));
					i++;
					output += pattern;
				}
			}

			return output;
		}

		public static String Index(Int32 i)
		{
			return ":" + i.ToString();
		}

		public static int Index(String i)
		{
			Regex rx = new Regex("^(:)*[0-9]+");

			Match m = rx.Match(i);

			Out.DebugWriteLine("i: " + i);

			Out.DebugWriteLine("index match value: " + m.Value);

			if (m != null &amp;&amp; !String.IsNullOrWhiteSpace(m.Value))
			{
				return Convert.ToInt32(m.Value.Substring(1));
			}
			else
			{
				return -1;
			}
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261476</id>
    <label>ComponentBuilderHelper.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/ComponentBuilderHelper.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public class ComponentBuilderHelper
	{
		public static void InputHelper(Asset asset, InputContext context)
		{
			Dictionary&lt;String, String&gt; labelOverrideTypeOptions = new Dictionary&lt;string, string&gt;() { { "Control Group", "control_group" }, { "Prepend to Label", "prepend" } };
			Dictionary&lt;String, String&gt; messageTypeOptions = new Dictionary&lt;string, string&gt;() { { "Basic", "basic" }, { "Warning", "warning" } };

			Input.StartTabbedPanel("Pattern", "Preview Content", "Governance", "Advanced");
			//Input.ShowCheckBox("Update pattern content?", "save_pattern", "yes", "Yes", helpMessage: "Check this box to save the pattern content", defaultChecked: false);
			Input.StartControlPanel("Pattern");

			if (!String.IsNullOrWhiteSpace(asset["post_save_error"]))
			{
				Input.ShowMessage(asset["post_save_error"], MessageType.Warning);
			}

			if (asset["read_only"] == "yes")
			{
				Input.ShowTextBox("Markup", "markup", width: 800, height: 30, readOnly: true, helpMessage: "This component is marked as \"read only\"");
			}
			else
			{
				Input.ShowTextBox("Markup", "markup", width: 800, height: 30);
			}

			Dictionary&lt;String, String&gt; componentTypeOptions = ComponentLibraryHelper.getAllComponentTypesForDropdown(asset);

			ComponentBuilderHelper.ComponentDetailsHelper(asset, context, "component_panel", 1);

			Input.EndControlPanel();
			Input.NextTabbedPanel();
			{
				//Input.ShowCheckBox("Update Preview Content?", "save_preview_content", "yes", "Yes", defaultChecked: false, helpMessage: "Check this box to update the preview content.");
				ComponentLibraryHelper.generateComponentPreviewContentInput(asset);
			}
			Input.NextTabbedPanel();
			{
				Input.ShowTextBox("Governance Tags", "component_zones", helpMessage: "Comma separated zone tags for drag and drop governance.");
			}
			Input.NextTabbedPanel();
			{
				string className = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(asset.Label.ToLower()).Replace(" ", "");
				Input.ShowTextBox("Class Name", "class_name", className, width: className.Length + 3, readOnly: true);
				Input.ShowAcquireImage("Component Snapshot", "snapshot", "If specified, this image will be used instead of a real time rendering of the component");
				Input.ShowCheckBox("Hide From Content Block Panel?", "content_block_hide", "yes", "Yes");
				Input.ShowCheckBox("Regenerate Component?", "regenerate", "yes", "Yes", helpMessage: "Checking this and saving the asset will regenerate the component's library files.");
				Input.ShowCheckBox("Read Only Component?", "read_only", "yes", "Yes", helpMessage: "When checked it will prevent the user from changing the markup of the component. Must save before changes take effect.");
				Input.ShowCheckBox("Delete AssetContent", "delete_asset_content", "yes", "Yes", helpMessage: "When checked all content fields except for the markup, class name and read only fields will be deleted." );
				Input.ShowCheckBox("JSON Component?", "json_component", "yes", "Yes", helpMessage: "When checked, the generated component will include JSON output.");
				Asset baseCodeFileAsset = ComponentLibraryHelper.getComponentCodeFileAsset(asset["class_name"], asset, ComponentLibraryHelper.ComponentClassNameType.Base);
				if (baseCodeFileAsset != null &amp;&amp; baseCodeFileAsset.IsLoaded)
				{
					Input.ShowLink(baseCodeFileAsset, null, InputLinkType.EditForm);
				}

				Asset overrideCodeFileAsset = ComponentLibraryHelper.getComponentCodeFileAsset(asset["class_name"], asset, ComponentLibraryHelper.ComponentClassNameType.Override);
				if (overrideCodeFileAsset != null &amp;&amp; overrideCodeFileAsset.IsLoaded)
				{
					Input.ShowLink(overrideCodeFileAsset, null, InputLinkType.EditForm);
				}
			}
			Input.EndTabbedPanel();
		}

		public static void CopyHelper(Asset asset, CopyContext context)
		{
			//asset.SaveContentField("class_name", System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(asset.Label.ToLower() + asset.Id).Replace(" ", ""));

			//if (asset["read_only"] != "yes")
			//{
			//    //if (asset["save_pattern"] == "yes")
			//    //{
			//    /***Functions should be unneccessary when cloning / branching***/
			//    //ComponentLibraryHelper.deleteExistingContentFieldsForComponents(ref asset);
			//    //int count = ComponentLibraryHelper.consolidateCurrentContentFields(ref asset);
			//    //ComponentLibraryHelper.updateExistingContentFields(ref asset);
			//    /***************************************************************/
			//    List&lt;ComponentContentPlaceholder&gt; markupContentPlaceholders = ComponentLibraryHelper.buildComponentContentPlaceholderFromMarkup(asset["markup"]);
			//    List&lt;PanelEntry&gt; componentPanels = asset.GetPanels("component_panel");
			//    List&lt;ComponentContentPlaceholder&gt; assetContentPlaceholders = ComponentContentPlaceholder.ConvertPanelEntryList(componentPanels, "component_panel");
			//    List&lt;ComponentContentPlaceholder&gt; flattenedAssetcontentPlaceholders = ComponentLibraryHelper.flattenComponentContentPlaceholderList(assetContentPlaceholders);
			//    ComponentLibraryHelper.createContentFieldsForComponents(ref assetContentPlaceholders, markupContentPlaceholders, flattenedAssetcontentPlaceholders);
			//    Dictionary&lt;String, String&gt; content = ComponentContentPlaceholder.ConvertToContentDictionary(assetContentPlaceholders);
			//    ComponentLibraryHelper.deleteComponentContent(asset);
			//    asset.SaveContent(content);
			//    //ComponentLibraryHelper.deleteCodeFile(asset);
			//    bool recompileSuccessful = false;
			//    Asset codeFile = ComponentLibraryHelper.createCodeFile(asset, ref recompileSuccessful);
			//    Asset wysiwygTemplateFile = ComponentLibraryHelper.createWysiwygTemplate(asset, "/System/CMS Snippets/Default");

			//    if (wysiwygTemplateFile == null || !wysiwygTemplateFile.IsLoaded)
			//    {
			//        Util.Email(String.Format("wysiwygTemplateFile {0} creation unsuccessful.", asset["class_name"]),
			//                   String.Format("Creation failed for they wysiwyg template file {0}", asset["class_name"]),
			//                   "corey.casado@crownpeak.com");
			//    }
			//}
		}

		public static void DeleteHelper(Asset asset, DeleteContext context)
		{
			Asset codeFile = ComponentLibraryHelper.getComponentCodeFileAsset(asset["class_name"], asset, ComponentLibraryHelper.ComponentClassNameType.Base);

			if (codeFile != null &amp;&amp; codeFile.IsLoaded &amp;&amp; codeFile["componentAsset"] == asset.GetLink(LinkType.Internal))
			{
				codeFile.DeleteContentField("componentAsset");
			}
		}

		public static OutputContext FilenameHelper(Asset asset, OutputContext context)
		{
			context.PublishPath = string.Empty;

			return context;
		}

		public static void OutputHelper(Asset asset, OutputContext context)
		{
			Out.WriteLine(ComponentLibraryHelper.generateComponentPreview(asset, context));
		}

		public static void PostInputHelper(Asset asset, PostInputContext context)
		{
			context.InputForm.Remove("regenerate");

			if (asset["read_only"] != "yes")
			{
				//if (context.InputForm["save_pattern"] == "yes")
				//{
				context = ComponentLibraryHelper.validateComponentPlaceholderNames(asset, context);
				//}
				//else
				//{
				//    List&lt;String&gt; componentContentFields = new List&lt;string&gt;();
				//    componentContentFields.Add("markup");
				//    componentContentFields.Add("class_name");
				//    componentContentFields.AddRange(context.InputForm.Where(x =&gt; x.Key.StartsWith("component_")).ToDictionary(x =&gt; x.Key, x =&gt; x.Value).Keys.ToList());
				//    context.InputForm.Remove(componentContentFields);
				//}

				//if (context.InputForm["save_preview_content"] == "yes")
				//{

				if (String.IsNullOrWhiteSpace(context.Error) &amp;&amp;
						String.IsNullOrWhiteSpace(context.ValidationError) &amp;&amp;
						(context.ValidationErrorFields == null || context.ValidationErrorFields.Count &lt; 1))
				{
					context = ComponentLibraryHelper.generateComponentPreviewPostInput(asset, context);
				}
				//}
				//else
				//{
				//    List&lt;String&gt; previewContentFields = context.InputForm.Where(x =&gt; x.Key.StartsWith("preview_")).ToDictionary(x =&gt; x.Key, x =&gt; x.Value).Keys.ToList();
				//    context.InputForm.Remove(previewContentFields);
				//}

				String className = (!String.IsNullOrWhiteSpace(context.InputForm["class_name"]) ? context.InputForm["class_name"] : asset.Raw["class_name"]);


				//if the class name has changed
				if (context.InputForm["class_name"] != asset["class_name"])
				{
					Asset baseCodeFile = ComponentLibraryHelper.getComponentCodeFileAsset(asset["class_name"], asset, ComponentLibraryHelper.ComponentClassNameType.Base);
					//if the codeFile exists and is actually associated with this asset. Prevents issue where we're chaing the name to one that already exists.
					if (baseCodeFile != null &amp;&amp; baseCodeFile["componentAsset"] == asset.GetLink(LinkType.Internal))
					{
						baseCodeFile.Rename(ComponentLibraryHelper.createComponentClassFileName(context.InputForm["class_name"], ComponentLibraryHelper.ComponentClassNameType.Base));
					}

					Asset overrideCodeFile = ComponentLibraryHelper.getComponentCodeFileAsset(asset["class_name"], asset, ComponentLibraryHelper.ComponentClassNameType.Override);
					//if the codeFile exists and is actually associated with this asset. Prevents issue where we're chaing the name to one that already exists.
					if (overrideCodeFile != null &amp;&amp; overrideCodeFile["componentAsset"] == asset.GetLink(LinkType.Internal))
					{
						overrideCodeFile.Rename(ComponentLibraryHelper.createComponentClassFileName(context.InputForm["class_name"], ComponentLibraryHelper.ComponentClassNameType.Override));
					}
				}

				Asset existingCodeFile = ComponentLibraryHelper.getComponentCodeFileAsset(className, asset, ComponentLibraryHelper.ComponentClassNameType.Base);
				if (existingCodeFile != null &amp;&amp; existingCodeFile.IsLoaded)
				{
					String componentAsset = existingCodeFile["componentAsset"];
					if (!String.IsNullOrWhiteSpace(componentAsset) &amp;&amp; componentAsset.Substring(componentAsset.LastIndexOf("/") + 1) != asset.Id.ToString())
					{
						// Try again with a path mapped to this branch
						var branchVersion = ComponentLibraryHelper.getAssetForBranch(Asset.Load(componentAsset), asset);
						if (branchVersion.Id != asset.Id)
							context.ValidationError = "A component with this name already exists.";
					}
				}
			}
			context.InputForm.Remove("save_preview_content");
		}

		public static void PostSaveHelper(Asset asset, PostSaveContext context)
		{
			var deferCompilation = asset["defer_compilation"] == "yes";
			if (asset["delete_asset_content"] == "yes")
			{
				List&lt;String&gt; keys = asset.GetContent().Keys.ToList();
				keys.Remove("markup");
				keys.Remove("delete_asset_content");
				keys.Remove("class_name");
				keys.Remove("read_only");
				keys.Remove("json_component");
				keys.Remove("component_zones");
				keys.Remove("content_block_hide");
				asset.DeleteContentFields(keys);
				Out.DebugWriteLine("asset content deleted");
			}
			else
			{
				asset.DeleteContentField("defer_compilation");
			}

			Out.DebugWriteLine("Were in the post-save");
			if (asset["read_only"] != "yes" &amp;&amp; asset["delete_asset_content"] != "yes")
			{
				List&lt;ComponentContentPlaceholder&gt; markupContentPlaceholders = ComponentLibraryHelper.buildComponentContentPlaceholderFromMarkup(asset["markup"]);
				List&lt;PanelEntry&gt; componentPanels = asset.GetPanels("component_panel");
				List&lt;ComponentContentPlaceholder&gt; assetContentPlaceholders = ComponentContentPlaceholder.ConvertPanelEntryList(componentPanels, "component_panel");
				List&lt;ComponentContentPlaceholder&gt; flattenedAssetcontentPlaceholders = ComponentLibraryHelper.flattenComponentContentPlaceholderList(assetContentPlaceholders);

				ComponentLibraryHelper.deleteExistingContentFieldsForComponents(ref assetContentPlaceholders, markupContentPlaceholders);
				ComponentLibraryHelper.updateExistingContentFields(ref assetContentPlaceholders, markupContentPlaceholders);
				ComponentLibraryHelper.createContentFieldsForComponents(ref assetContentPlaceholders, markupContentPlaceholders, flattenedAssetcontentPlaceholders);

				Dictionary&lt;String, String&gt; content = ComponentContentPlaceholder.ConvertToContentDictionary(assetContentPlaceholders);

				ComponentLibraryHelper.deleteComponentContent(asset);
				asset.SaveContent(content);

				//foreach (KeyValuePair&lt;String, String&gt; kvp in content)
				//{
				//    Out.DebugWriteLine(kvp.Key + " = " + kvp.Value);
				//}

				bool recompileSuccessful = false;
				Asset codeFile = ComponentLibraryHelper.createCodeFile(asset, deferCompilation, ref recompileSuccessful);
				//Asset wysiwygTemplateFile = ComponentLibraryHelper.createWysiwygTemplate(asset, "/System/CMS Snippets/Default");

				if (!recompileSuccessful)
				{
					asset.SaveContentField("post_save_error", "The following errors occured when attempting to compile the generated code file:\r\n" + context.Error);
				}
				else
				{
					asset.DeleteContentField("post_save_error");
				}

				//if (wysiwygTemplateFile == null || !wysiwygTemplateFile.IsLoaded)
				//{
				//    Util.Email(String.Format("wysiwygTemplateFile {0} creation unsuccessful.", asset["class_name"]),
				//               String.Format("Creation failed for they wysiwyg template file {0}", asset["class_name"]),
				//               "corey.casado@crownpeak.com");
				//}
			}
		}

		public static void UrlHelper(Asset asset, OutputContext context)
		{
			context.PublishUrl = string.Empty;
		}

		public static void ComponentDetailsHelper(Asset asset, InputContext context, String panelName, int panelDepth, String index = "", List&lt;PanelEntry&gt; currentPanelEntries = null, string listName = "")
		{
			int currentComponentCount = 2;

			//List&lt;PanelEntry&gt; currentPanelsEntries = null;

			if (currentPanelEntries == null)
			{
				currentPanelEntries = asset.GetPanels(panelName);
			}

			Out.DebugWriteLine("# of panels for\"" + panelName + "\" is: " + (currentPanelEntries == null ? "null" : currentPanelEntries.Count.ToString()));
			if (currentPanelEntries != null)
			{
				currentComponentCount = currentPanelEntries != null ? currentPanelEntries.Count : 2;
			}

			Out.DebugWriteLine("Current Panel entries count: " + currentComponentCount);

			Dictionary&lt;String, String&gt; labelOverrideTypeOptions = new Dictionary&lt;string, string&gt;() { { "Control Group", "control_group" }, { "Prepend to Label", "prepend" } };
			Dictionary&lt;String, String&gt; messageTypeOptions = new Dictionary&lt;string, string&gt;() { { "Basic", "basic" }, { "Warning", "warning" } };
			Dictionary&lt;String, String&gt; componentTypeOptions = ComponentLibraryHelper.getAllComponentTypesForDropdown(asset);
			int i = 1;

			if (currentComponentCount &gt; 0)
			{
				String panelLabel = (panelName == "component_panel" ? "Component Details List" : listName + " sub components");
				bool isOnlyPanel = currentPanelEntries.Count &lt;= 1 &amp;&amp; panelName == "component_panel";
				//while (Input.NextPanel(panelName))
				while (Input.NextPanel(panelName, min: currentComponentCount, max: currentComponentCount, displayName: panelLabel))
				{
					#region old code for single item situations
					//if (currentComponentCount == 1)
					//{
					//    if (asset["component_category"] == "component")
					//    {
					//        #region Component Logic
					//        Input.AddHiddenField("component_category", "component");

					//        Input.ShowMessage("Is Component");
					//        Input.ShowTextBox("Component Name: ", "component_component_label", readOnly: true);
					//        if (asset["component_component_type_in_markup"] == "true")
					//        {
					//            Input.ShowTextBox("Component Type: ", "component_component_type", readOnly: true);
					//        }
					//        else
					//        {
					//            Input.ShowDropDown("Component Type", "component_component_type", componentTypeOptions);
					//        }

					//        if (ComponentLibraryHelper.getCoreComponentTypes(asset).Contains(asset["component_component_type"]))
					//        {
					//            Input.ShowCheckBox("Is this component required?", "component_component_required", "yes", "Yes");
					//            Input.ShowTextBox("Validation error message", "component_component_required_message", helpMessage: "This message will show if the field is required but not populated");
					//        }

					//        Input.StartHorizontalWrapContainer();
					//        Input.ShowTextBox("Label Override", "component_component_input_label");
					//        if (!ComponentLibraryHelper.getCoreComponentTypes(asset).Contains(asset["component_component_type"]))
					//        {
					//            Input.ShowDropDown("Label Override Type", "component_component_form_override_type", labelOverrideTypeOptions, Util.MakeList("prepend"));
					//        }
					//        Input.EndHorizontalWrapContainer();

					//        Input.StartHorizontalWrapContainer();
					//        Input.ShowTextBox("Message Field", "component_component_message_content", helpMessage: "The message will be placed above the associated component");
					//        Input.ShowDropDown("Message Type", "component_component_message_type", messageTypeOptions, defaultValue: Util.MakeList("basic"));
					//        Input.EndHorizontalWrapContainer();

					//        #endregion
					//    }
					//    else
					//    {
					//    #region List Logic
					//    Input.AddHiddenField("component_category", "list");

					//    Input.ShowMessage("Is List");
					//    Input.ShowTextBox("List Name: ", "component_list_label", readOnly: true);
					//    Input.ShowTextBox("List Content: ", "component_list_content", readOnly: true);
					//    Input.ShowTextBox("List Components: ", "component_list_components", readOnly: true);
					//    Input.StartHorizontalWrapContainer();
					//    Input.ShowTextBox("Minimum Number of Panels:", "min_panels", width: 5);
					//    //Input.ShowTextBox("(Copy Here) Minimum Number of Panels:", "component_list_min_panels", width: 5);
					//    Input.ShowTextBox("Maximum Number of Panels:", "max_panels", width: 5);
					//    //Input.ShowTextBox("(Copy Here) Maximum Number of Panels:", "component_list_max_panels", width: 5);
					//    Input.EndHorizontalWrapContainer();
					//    Input.StartHorizontalWrapContainer();
					//    Input.ShowTextBox("Message Field", "component_list_message_content", helpMessage: "The message will be placed above the associated component");
					//    Input.ShowDropDown("Message Type", "component_list_message_type", messageTypeOptions, defaultValue: Util.MakeList("basic"));
					//    Input.EndHorizontalWrapContainer();
					//    String nextPanelName = ComponentLibraryHelper.getNextComponentPanelDepth(panelName);
					//    List&lt;PanelEntry&gt; nextPanelEntries = currentPanelEntries[(i - 1)].GetPanels(nextPanelName);
					//    ComponentDetailsHelper(asset, context, nextPanelName, ++panelDepth, ComponentBase.Index(i) + index, nextPanelEntries);

					//    #endregion
					//}
					//}
					//else
					//{   
					#endregion
					String myIndex = isOnlyPanel ? "" : ComponentBase.Index(i);
					if (asset["component_category" + myIndex + index] == "component")
					{
						#region Component Logic
						Input.StartControlPanel(asset["component_component_label" + myIndex + index] + " " + asset["component_component_type" + myIndex + index] + " Component");
						Input.AddHiddenField("component_category", "component");
						Input.ShowMessage("Is Component");
						//Input.ShowMessage(String.Format("Panel's name &amp; index: {0} , {1}. Panel's content field name: {2}", panelName, (i - 1), currentPanelEntries[(i - 1)]["component_component_name"], panelName));
						Input.ShowTextBox("Component Name: ", "component_component_label", readOnly: true);
						if (asset["component_component_type_in_markup" + myIndex + index] == "true")
						{
							Input.ShowTextBox("Component Type: ", "component_component_type", readOnly: true);
						}
						else
						{
							Input.ShowDropDown("Component Type", "component_component_type", componentTypeOptions);
						}

						if (ComponentLibraryHelper.getCoreComponentTypes(asset).Contains(asset["component_component_type" + myIndex + index]))
						{
							if (asset["component_component_type" + myIndex + index] == "Code")
							{
								Input.ShowTextBox("Code snippet", "component_component_hardcoded_snippet", helpMessage: "This snippet will be baked into the component code, must evaluate to a string and not end with a \";\"");
							}
							else
							{
								Input.ShowCheckBox("Is this component required?", "component_component_required", "yes", "Yes");
								Input.ShowTextBox("Validation error message", "component_component_required_message", helpMessage: "This message will show if the field is required but not populated");
							}
						}

						Input.StartHorizontalWrapContainer();
						if (asset["component_component_type" + myIndex + index] != "Code")
						{
							Input.ShowTextBox("Label Override", "component_component_input_label");
						}
						if (!ComponentLibraryHelper.getCoreComponentTypes(asset).Contains(asset["component_component_type" + myIndex + index]))
						{
							Input.ShowDropDown("Label Override Type", "component_component_form_override_type", labelOverrideTypeOptions, Util.MakeList("prepend"));
						}
						Input.EndHorizontalWrapContainer();

						if (asset["component_component_type" + myIndex + index] != "Code")
						{
							Input.StartHorizontalWrapContainer();
							Input.ShowTextBox("Message Field", "component_component_message_content", helpMessage: "The message will be placed above the associated component");
							Input.ShowDropDown("Message Type", "component_component_message_type", messageTypeOptions, defaultValue: Util.MakeList("basic"));
							Input.EndHorizontalWrapContainer();
						}

						Input.EndControlPanel();

						#endregion
					}
					else
					{
						#region List Logic
						Input.StartControlPanel(asset["component_list_label" + myIndex + index] + " List");
						Input.AddHiddenField("component_category", "list");
						Input.ShowMessage("Is List");
						//Input.ShowMessage(String.Format("Panel's name &amp; index: {0} , {1}. Panel's content field name: {2}", panelName, (i - 1), currentPanelEntries[(i - 1)]["component_list_name"], panelName));
						Input.ShowTextBox("List Name: ", "component_list_label", readOnly: true);
						Input.ShowTextBox("List Content: ", "component_list_content", readOnly: true);
						Input.ShowTextBox("List Components: ", "component_list_components", readOnly: true);
						Input.StartHorizontalWrapContainer();
						Input.ShowTextBox("Minimum Number of Panels:", "min_panels", width: 5);
						//Input.ShowTextBox("(Copy here) Minimum Number of Panels:", "component_list_min_panels", width: 5);
						Input.ShowTextBox("Maximum Number of Panels:", "max_panels", width: 5);
						//Input.ShowTextBox("(Copy Here) Maximum Number of Panels:", "component_list_max_panels", width: 5);
						Input.EndHorizontalWrapContainer();
						Input.StartHorizontalWrapContainer();
						Input.ShowTextBox("Message Field", "component_list_message_content", helpMessage: "The message will be placed above the associated component");
						Input.ShowDropDown("Message Type", "component_list_message_type", messageTypeOptions, defaultValue: Util.MakeList("basic"));
						Input.EndHorizontalWrapContainer();
						String nextPanelName = ComponentLibraryHelper.getNextComponentPanelDepth(panelName);
						List&lt;PanelEntry&gt; nextPanelEntries = currentPanelEntries[(i - 1)].GetPanels(nextPanelName);
						ComponentDetailsHelper(asset, context, nextPanelName, ++panelDepth, ComponentBase.Index(i) + index, nextPanelEntries, asset["component_list_label" + ComponentBase.Index(i) + index]);
						Input.EndControlPanel();
						#endregion
					}
					i++;
				}
			}
		}
	}
}
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261477</id>
    <label>ComponentContentPlaceholder.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/ComponentContentPlaceholder.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public class ComponentContentPlaceholder
	{
		/***BOTH***/
		public String name { get; set; }
		public ComponentLibraryHelper.ContentPlaceholderCategory category { get; set; }
		public String message { get; set; }
		public String messageType { get; set; }
		/***COMPONENTS &amp; CORE***/
		public String type { get; set; }
		public bool typeInMarkup { get; set; }
		public String inputLabel { get; set; }
		public String inputLabelType { get; set; }
		public String isRequired { get; set; }
		public String isRequiredMessage { get; set; }
		public String fieldIndexed { get; set; }
		public String hardcodedSnippet { get; set; }
		/****LIST***/
		public String content { get; set; }
		public String minPanels { get; set; }
		public String maxPanels { get; set; }
		public String components { get; set; }
		public List&lt;ComponentContentPlaceholder&gt; subComponents { get; set; }


		public ComponentContentPlaceholder(PanelEntry contentPlaceholderPanel, String panelName)
		{
			category = contentPlaceholderPanel["component_category"] == "list" ? ComponentLibraryHelper.ContentPlaceholderCategory.List : ComponentLibraryHelper.ContentPlaceholderCategory.Component;

			if (contentPlaceholderPanel["component_category"] == "list")
			{
				name = contentPlaceholderPanel["component_list_label"];
				category = ComponentLibraryHelper.ContentPlaceholderCategory.List;
				message = contentPlaceholderPanel["component_list_message_content"];
				messageType = contentPlaceholderPanel["component_list_message_type"];
				content = contentPlaceholderPanel["component_list_content"];
				minPanels = contentPlaceholderPanel["min_panels"];
				maxPanels = contentPlaceholderPanel["max_panels"];
				components = contentPlaceholderPanel["component_list_components"];

				String nextPanelDepthName = ComponentLibraryHelper.getNextComponentPanelDepth(panelName);
				if (!nextPanelDepthName.StartsWith("ERROR:"))
				{
					subComponents = ConvertPanelEntryList(contentPlaceholderPanel.GetPanels(nextPanelDepthName), nextPanelDepthName);
				}
			}
			else if (contentPlaceholderPanel["component_category"] == "component")
			{
				name = contentPlaceholderPanel["component_component_label"];
				category = ComponentLibraryHelper.ContentPlaceholderCategory.Component;
				message = contentPlaceholderPanel["component_component_message_content"];
				messageType = contentPlaceholderPanel["component_component_message_type"];
				type = contentPlaceholderPanel["component_component_type"];
				inputLabel = contentPlaceholderPanel["component_component_input_label"];
				inputLabelType = contentPlaceholderPanel["component_component_form_override_type"];
				typeInMarkup = contentPlaceholderPanel["component_component_type_in_markup"].Trim().ToLower() == "true";
				isRequired = contentPlaceholderPanel["component_component_required"];
				isRequiredMessage = contentPlaceholderPanel["component_component_required_message"];
				fieldIndexed = contentPlaceholderPanel["component_component_indexed"];
				hardcodedSnippet = contentPlaceholderPanel["component_component_hardcoded_snippet"];
			}

			Out.DebugWriteLine("CCP \"" + name + "\" created");
		}

		public ComponentContentPlaceholder(Match contentPlaceholderMatch, String category)
		{
			if (category == "list")
			{
				name = ComponentLibraryHelper.getAttribValueFromComponentMarkup(contentPlaceholderMatch.Value, "name");
				this.category = ComponentLibraryHelper.ContentPlaceholderCategory.List;
				content = ComponentLibraryHelper.getListNodeContent(contentPlaceholderMatch.Value);
				components = ComponentLibraryHelper.getListNodeComponents(contentPlaceholderMatch.Value);
			}
			else if (category == "component")
			{
				name = ComponentLibraryHelper.getContentPlaceholderName(contentPlaceholderMatch.Value);
				this.category = ComponentLibraryHelper.ContentPlaceholderCategory.Component;
				type = ComponentLibraryHelper.getContentPlaceholderTypeFromMarkup(contentPlaceholderMatch.Value);
				typeInMarkup = true;

				if (type == String.Empty)
				{
					type = ComponentLibraryHelper.getDefaultContentPlaceholderType();
					typeInMarkup = false;
				}
				fieldIndexed = ComponentLibraryHelper.getContentPlaceholderIndexedFieldFromMarkup(contentPlaceholderMatch.Value);
			}
			else if (category == "template")
			{
				name = ComponentLibraryHelper.getContentPlaceholderName(contentPlaceholderMatch.Value);
				this.category = ComponentLibraryHelper.ContentPlaceholderCategory.Component;
				type = ComponentLibraryHelper.getContentPlaceholderTypeFromMarkup(contentPlaceholderMatch.Value);
				typeInMarkup = true;

				if (type == String.Empty)
				{
					type = name;
				}
			}
		}

		public ComponentContentPlaceholder()
		{

		}

		public static List&lt;ComponentContentPlaceholder&gt; ConvertPanelEntryList(List&lt;PanelEntry&gt; panelEntryList, String panelName)
		{
			List&lt;ComponentContentPlaceholder&gt; contentPlaceholderList = new List&lt;ComponentContentPlaceholder&gt;();

			foreach (PanelEntry pe in panelEntryList)
			{
				contentPlaceholderList.Add(new ComponentContentPlaceholder(pe, panelName));
			}

			return contentPlaceholderList;
		}

		public static List&lt;ComponentContentPlaceholder&gt; ConvertMatchCollection(MatchCollection contentPlaceholderMatches, String category)
		{
			List&lt;ComponentContentPlaceholder&gt; contentPlaceholderList = new List&lt;ComponentContentPlaceholder&gt;();

			foreach (Match m in contentPlaceholderMatches)
			{
				contentPlaceholderList.Add(new ComponentContentPlaceholder(m, category));
			}

			return contentPlaceholderList;
		}

		public static Dictionary&lt;String, String&gt; ConvertToContentDictionary(List&lt;ComponentContentPlaceholder&gt; componentContentPlaceholderList, String currentPanel = "", String index = "")
		{
			if (currentPanel == "")
				currentPanel = "component_panel";

			Dictionary&lt;String, String&gt; contentDictionary = new Dictionary&lt;string, string&gt;();

			bool isOnlyPanel = componentContentPlaceholderList.Count &lt;= 1 &amp;&amp; currentPanel == "component_panel";

			int i = 1;

			foreach (ComponentContentPlaceholder componentContentPlaceholder in componentContentPlaceholderList)
			{
				String myIndex = isOnlyPanel ? "" : ComponentBase.Index(i);
				contentDictionary.Add(currentPanel + myIndex + index, (i - 1).ToString());

				if (componentContentPlaceholder.category == ComponentLibraryHelper.ContentPlaceholderCategory.Component)
				{
					contentDictionary.Add("component_component_label" + myIndex + index, componentContentPlaceholder.name);
					contentDictionary.Add("component_category" + myIndex + index, "component");
					contentDictionary.Add("component_component_message_content" + myIndex + index, componentContentPlaceholder.message);
					contentDictionary.Add("component_component_message_type" + myIndex + index, componentContentPlaceholder.messageType);
					contentDictionary.Add("component_component_type" + myIndex + index, componentContentPlaceholder.type);
					contentDictionary.Add("component_component_type_in_markup" + myIndex + index, componentContentPlaceholder.typeInMarkup ? "true" : "false");
					contentDictionary.Add("component_component_input_label" + myIndex + index, componentContentPlaceholder.inputLabel);
					contentDictionary.Add("component_component_form_override_type" + myIndex + index, componentContentPlaceholder.inputLabelType);
					contentDictionary.Add("component_component_required" + myIndex + index, componentContentPlaceholder.isRequired);
					contentDictionary.Add("component_component_required_message" + myIndex + index, componentContentPlaceholder.isRequiredMessage);
					contentDictionary.Add("component_component_indexed" + myIndex + index, componentContentPlaceholder.fieldIndexed);
					contentDictionary.Add("component_component_hardcoded_snippet" + myIndex + index, componentContentPlaceholder.hardcodedSnippet);
				}
				else if (componentContentPlaceholder.category == ComponentLibraryHelper.ContentPlaceholderCategory.List)
				{
					contentDictionary.Add("component_list_label" + myIndex + index, componentContentPlaceholder.name);
					contentDictionary.Add("component_category" + myIndex + index, "list");
					contentDictionary.Add("component_list_message_content" + myIndex + index, componentContentPlaceholder.message);
					contentDictionary.Add("component_list_message_type" + myIndex + index, componentContentPlaceholder.messageType);
					contentDictionary.Add("component_list_content" + myIndex + index, componentContentPlaceholder.content);
					contentDictionary.Add("min_panels" + myIndex + index, componentContentPlaceholder.minPanels);
					contentDictionary.Add("max_panels" + myIndex + index, componentContentPlaceholder.maxPanels);
					contentDictionary.Add("component_list_components" + myIndex + index, componentContentPlaceholder.components);

					String nextPanel = ComponentLibraryHelper.getNextComponentPanelDepth(currentPanel);
					//contentDictionary.Add(nextPanel + (isOnlyPanel ? ""  : ComponentBase.Index(i)) + index, (--i).ToString());
					Dictionary&lt;String, String&gt; subComponents = ConvertToContentDictionary(componentContentPlaceholder.subComponents, nextPanel, ComponentBase.Index(i) + index);
					contentDictionary = contentDictionary.Concat(subComponents).ToDictionary(x =&gt; x.Key, x =&gt; x.Value);
				}

				i++;
			}

			return contentDictionary;
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261478</id>
    <label>ComponentLibraryConfigHelper.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/ComponentLibraryConfigHelper.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public class ComponentLibraryConfigHelper
	{
		public static void FilenameHelper(Asset asset, OutputContext context)
		{
			context.PublishPath = string.Empty;
		}

		public static void InputHelper(Asset asset, InputContext context)
		{
			Input.StartTabbedPanel(/*"Version Config",*/ "Component Class Config");
			//{
			//    Dictionary&lt;String, String&gt; versionOptions = new Dictionary&lt;string, string&gt;();

			//    FilterParams fParams = new FilterParams();
			//    fParams.Add(AssetPropertyNames.Label, Comparison.StartsWith, "ComponentLibrary_");
			//    fParams.ExcludeProjectTypes = false;

			//    List&lt;Asset&gt; versionList = Asset.Load("/System/Library").GetFilterList(fParams);

			//    Out.DebugWriteLine("Number of ComponentLibrary_ files: " + versionList.Count);

			//    foreach (Asset version in versionList)
			//    {
			//        versionOptions.Add(version.Label.Replace(".cs", ""), version.Label.Replace(".cs", ""));
			//    }

			//    Input.ShowDropDown("Live State", "live_version", versionOptions);
			//    Input.ShowDropDown("Stage State", "stage_version", versionOptions);
			//    Input.ShowDropDown("Draft State", "draft_version", versionOptions);
			//}
			//Input.NextTabbedPanel();

			Input.ShowSelectFolder("Component Library Root Folder", "component_library_root_folder", defaultFolder: asset.Parent.AssetPath, helpMessage: "this is the root folder for the component library framework");

			Input.ShowSelectFolder("Component Library Project Folder", "component_library_project_folder", defaultFolder: asset.Parent.AssetPath + "/Component_Project", helpMessage: "this is the project folder");

			Input.ShowSelectFolder("Component Library Code File Folder", "component_class_folder", defaultFolder: asset.Parent.AssetPath + "/Component_Project/Components", helpMessage: "this is the folder where all the component classes will be created");

			Input.ShowSelectFolder("Component Library Component Assets Folder", "component_library_components_folder", defaultFolder: asset.Parent.AssetPath + "/_Components", helpMessage: "this is the folder where all the component assets are kept");

			Input.ShowSelectFolder("Component Library Models Folder", "component_library_models_folder", helpMessage: "this is the folder where all the component library models are kept");

			Input.ShowSelectFolder("Site Root Folder", "site_root", helpMessage: "this is the root of the site the component library is being used in");

			Input.ShowAcquireDocument("Site Config", "site_config", helpMessage: "this is the site configuration file");

			Input.ShowTextBox("Component Library Namespace", "component_library_namespace");

			Input.EndTabbedPanel();
		}

		public static void OutputHelper(Asset asset, OutputContext context)
		{

		}
	}
}
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261548</id>
    <label>ComponentLibraryEnhancedTemplateBuilderHelper.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/ComponentLibraryEnhancedTemplateBuilderHelper.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public class ComponentLibraryEnhancedTemplateBuilderHelper
	{
		public static void InputHelper(Asset asset, InputContext context)
		{
			Asset componentLibraryProjectTemplatesFolder = InitializeTemplateFolder(asset);
			String SiteRootFolderPath = ComponentLibraryHelper.getcomponentLibraryRootFolder(asset).AssetPath.ToString();
			String ComponentsFolderPath = ComponentLibraryHelper.getComponentLibraryComponentsFolder(asset).ToString();
			string libraryPath = ComponentLibraryHelper.getComponentLibraryComponentsFolder(asset).AssetPath.ToString();

			if (String.IsNullOrEmpty(asset["inputBody"]))
			{
				Input.StartTabbedPanel("Pattern", "Wrapper", "Settings");
			}
			else
			{
				Input.StartTabbedPanel("Pattern", "Wrapper", "Settings", "Code");
			}

			Input.StartControlPanel("Pattern");

			Input.ShowTextBox("Markup", "markup", width: 800, height: 30);

			Dictionary&lt;String, String&gt; componentTypeOptions = ComponentLibraryHelper.getAllComponentTypesForDropdown(asset);

			ComponentBuilderHelper.ComponentDetailsHelper(asset, context, "component_panel", 1);

			Input.EndControlPanel();

			Input.NextTabbedPanel();
			//Dictionary&lt;String, String&gt; wrapperOptions = new Dictionary&lt;string, string&gt;() { { "Default", "default" }, { "Landing Page", "landing" }, { "None", "none" } };
			//Input.ShowRadioButton("Content Wrapper", "wrapper", wrapperOptions);
			ShowAcquireParams wrapperAcquireParams = new ShowAcquireParams { DefaultFolder = asset.Parent.AssetPath.ToString() + "/Site Wrappers" };

			Dictionary&lt;String, String&gt; wrapperTypeOptions = new Dictionary&lt;string, string&gt;();
			wrapperTypeOptions.Add("Built With Wrapper Builder", "template_builder");
			wrapperTypeOptions.Add("Custom Built Wrapper", "custom");

			Input.StartDropDownContainer("Wrapper Selection Type", "wrapper_type", wrapperTypeOptions, defaultValue: "template_builder");
			Input.ShowMessage("This options lets you select a wrapper built via a wrapper builder asset");
			Input.ShowAcquireDocument("Wrapper", "wrapper", wrapperAcquireParams);
			Input.NextDropDownContainer();
			Input.ShowMessage("This option lets you select a custom built wrapper");
			Input.ShowSelectFolder("Wrapper Template", "custom_wrapper");
			Input.EndDropDownContainer();

			Input.NextTabbedPanel();
			Input.ShowCheckBox("Create", "create", "yes", "yes");
			Input.ShowTextBox("Template Name", "template_name", asset.Label.Replace(" Template", "") + " Template");
			Input.StartExpandPanel("Template File Settings");
			Input.ShowCheckBox("", "do_not_overwrite_post_save", "do_not_overwrite", "Do not overwrite the post_save.aspx template file");
			Input.EndExpandPanel();
			Input.ShowSelectFolder("Template Folder", "template_folder", componentLibraryProjectTemplatesFolder.AssetPath);
			Input.ShowAcquireDocument("Select preview asset", "previewAsset", SiteRootFolderPath + "/_templates");
			Input.ShowCheckBox("JSON Template?", "json_template", "yes", "Yes", helpMessage: "When checked, the generated template will include JSON output and Search G2.");
			Input.ShowCheckBox("Enable Page Metadata", "meta", "yes", "yes");
			Input.ShowCheckBox("Enable Page specific JavaScript and CSS", "custom_js_css", "yes", "yes");
			Input.ShowCheckBox("Enable Advanced Capabilities", "advanced", "yes", "yes", helpMessage: "This option adds an \"Advanced\" tab to the input form which contains a link to directly edit this template builder template.");
			Input.ShowCheckBox("Enable TMF", "enable_tmf", "yes", "Yes");
			Input.StartExpandPanel("TMF Settings");
			Input.ShowCheckBox("Create a output_translate_xml.aspx file?", "create_output_translate_xml", "yes", "Yes", helpMessage: "When custom code is required to package the content being translated you will need to enter the custom function in the text box below");
			Input.ShowTextBox("TMF output_translate_xml.aspx code", "output_translate_xml_body", width: 100, height: 5);
			Input.EndExpandPanel();

			if (!String.IsNullOrEmpty(asset["inputBody"]))
			{
				Input.NextTabbedPanel();
				Input.ShowTextBox("Input", "inputBody", width: 100, readOnly: true);
				Input.ShowTextBox("Post Input", "postinputBody", width: 100, readOnly: true);
				Input.ShowTextBox("Output", "outputBody", width: 100, readOnly: true);
				if (asset["json_template"] == "yes")
				{
					Input.ShowTextBox("Output JSON", "outputJsonBody", width: 100, readOnly: true);
					Input.ShowTextBox("Search G2 Delete", "searchG2DeleteBody", width: 100, readOnly: true);
					Input.ShowTextBox("Search G2 Insert", "searchG2InsertBody", width: 100, readOnly: true);
					Input.ShowTextBox("Search G2 Update", "searchG2UpdateBody", width: 100, readOnly: true);
				}
				if (asset["enable_tmf"] == "yes")
				{
					Input.ShowTextBox("Output Post Save (TMF)", "postSaveBody", width: 100, readOnly: true);
					Input.ShowTextBox("Output Changes (TMF)", "outputChangesBody", width: 100, readOnly: true);
					if (asset["create_output_translate_xml"] == "yes")
					{
						Input.ShowTextBox("Output Translate Xml (TMF)", "outputTranslateXmlBody", width: 100, readOnly: true);
					}
				}
			}

			Input.EndTabbedPanel();
		}

		private static Asset InitializeTemplateFolder(Asset asset)
		{
			Asset componentLibraryProjectTemplatesFolder = Asset.Load(ComponentLibraryHelper.getComponentLibraryProjectFolder(asset).AssetPath + "/Templates");
			if (string.IsNullOrEmpty(asset["template_folder"]) &amp;&amp; componentLibraryProjectTemplatesFolder != null &amp;&amp; componentLibraryProjectTemplatesFolder.IsLoaded)
			{
				asset["template_folder"] = componentLibraryProjectTemplatesFolder.GetLink(LinkType.Internal);
			}

			return componentLibraryProjectTemplatesFolder;
		}

		public static void OutputHelper(Asset asset, OutputContext context)
		{
			Component_Layout layout = new Component_Layout();
			context.IsGeneratingDependencies = false;
			String componentColumn = "";
			String componentOutput = "";
			String wrapperType = asset["wrapper_type"];
			String SiteRootFolderPath = ComponentLibraryHelper.getcomponentLibraryRootFolder(asset).AssetPath.ToString();
			Asset globalConfig = Asset.Load(SiteRootFolderPath + "/_Global/Global Config");
			//dictionary to allow for multiple columns based on ComponentLibrary Config
			Dictionary&lt;int, StringBuilder&gt; columnDictionary = new Dictionary&lt;int, StringBuilder&gt;();
			Dictionary&lt;String, StringBuilder&gt; rowContent = new Dictionary&lt;string, StringBuilder&gt;();
			StringBuilder sbCol1 = new StringBuilder();
			StringBuilder sbCol2 = new StringBuilder();

			if (String.IsNullOrWhiteSpace(wrapperType))
			{
				wrapperType = asset["wrapper_type"];
			}

			if (wrapperType == "custom")
			{
				Asset wrapperAsset = Asset.Load(asset["custom_wrapper"]);

				if (wrapperAsset.IsLoaded)
				{
					ComponentLibraryHelper.startWrap(asset, context, wrapperAsset.AssetPath.ToString(), wrapperType);
				}
			}
			else
			{
				Asset wrapperAsset = Asset.Load(asset["wrapper"]);

				if (!string.IsNullOrEmpty(wrapperAsset.Raw["template_name"]))
				{
					ComponentLibraryHelper.startWrap(asset, context, wrapperAsset.Raw["template_name"]);
				}
			}

			foreach (PanelEntry entry in asset.GetPanels("layouts"))
			{
				sbCol1.Clear();
				sbCol2.Clear();
				foreach (PanelEntry subEntry in entry.GetPanels("components"))
				{
					componentOutput = "";
					componentColumn = "";
					if (String.IsNullOrEmpty(subEntry.Raw["custom_code"]))
					{
						Asset aComponent = ComponentLibraryHelper.getComponentAsset(asset, subEntry["component"]);
						if (aComponent != null &amp;&amp; aComponent.IsLoaded)
						{
							componentOutput = ComponentLibraryHelper.generateComponentPreview(aComponent, context);
						}
						componentColumn = subEntry["column"];
					}
					else
					{
						componentOutput = subEntry["custom_code"];
						componentColumn = subEntry["custom_column"];
					}

					switch (componentColumn)
					{
						case "col1":
							sbCol1.Append(componentOutput);
							break;
						case "col2":
							sbCol2.Append(componentOutput);
							break;
					}
				}

				rowContent.Add("{col1}", sbCol1);
				rowContent.Add("{col2}", sbCol2);

				Out.Write(layout.output(asset, entry.GetFieldName("layout"), rowContent, entry["layout"]));
				rowContent.Clear();
			}

			if (asset["wrapper"] == "yes")
			{
				ComponentLibraryHelper.endWrap(asset, context);
			}
		}

		public static void OutputCodeHelper(Asset asset, OutputContext context)
		{
			context.IsGeneratingDependencies = false;

			string SiteRootFolderPath = ComponentLibraryHelper.getcomponentLibraryRootFolder(asset).AssetPath.ToString();
			//Root Assets folders
			string cssFolder = SiteRootFolderPath + "/_Assets/css/";
			string jsFolder = SiteRootFolderPath + "/_Assets/js/";

			Out.DebugWriteLine("&lt;!DOCTYPE html&gt;");
			Out.WriteLine("&lt;html lang=\"en\"&gt;");
			Out.WriteLine("&lt;head&gt;");
			Out.WriteLine("    &lt;link rel=\"stylesheet\" href=\"" + Asset.Load(cssFolder + "/bootstrap.css").GetLink(LinkType.Include) + "\" media=\"all\" /&gt;");

			Out.WriteLine("    &lt;script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js\"&gt;&lt;/script&gt;");
			Out.WriteLine("&lt;/head&gt;");
			Out.WriteLine("&lt;body&gt;");
			Out.WriteLine("    &lt;div class=\"container\"&gt;");
			Out.WriteLine("        &lt;div id=\"content\"&gt;");
			Out.WriteLine("            &lt;ul id=\"tabs\" class=\"nav nav-tabs\" data-tabs=\"tabs\"&gt;");
			Out.WriteLine("                &lt;li class=\"active\"&gt;&lt;a href=\"#input\" data-toggle=\"tab\"&gt;Input&lt;/a&gt;&lt;/li&gt;");
			Out.WriteLine("                &lt;li&gt;&lt;a href=\"#postinput\" data-toggle=\"tab\"&gt;PostInput&lt;/a&gt;&lt;/li&gt;");
			Out.WriteLine("                &lt;li&gt;&lt;a href=\"#output\" data-toggle=\"tab\"&gt;Output&lt;/a&gt;&lt;/li&gt;");
			Out.WriteLine("            &lt;/ul&gt;");
			Out.WriteLine("            &lt;div id=\"my-tab-content\" class=\"tab-content\"&gt;");
			Out.WriteLine("                &lt;div class=\"tab-pane active\" id=\"input\"&gt;");
			Out.WriteLine("                    &lt;h1&gt;Input&lt;/h1&gt;");
			Out.WriteLine("                    " + Util.ConvertTextToHtml(asset["inputBody"]).Replace("&lt;dd&gt;", "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"));
			Out.WriteLine("                &lt;/div&gt;");
			Out.WriteLine("                &lt;div class=\"tab-pane\" id=\"postinput\"&gt;");
			Out.WriteLine("                    &lt;h1&gt;PostInput&lt;/h1&gt;");
			Out.WriteLine("                    " + Util.ConvertTextToHtml(asset["postinputBody"]).Replace("&lt;dd&gt;", "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"));
			Out.WriteLine("                &lt;/div&gt;");
			Out.WriteLine("                &lt;div class=\"tab-pane\" id=\"output\"&gt;");
			Out.WriteLine("                    &lt;h1&gt;Output&lt;/h1&gt;");
			Out.WriteLine("                    " + Util.ConvertTextToHtml(asset["outputBody"]).Replace("&lt;dd&gt;", "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"));
			Out.WriteLine("                &lt;/div&gt;");
			Out.WriteLine("            &lt;/div&gt;");
			Out.WriteLine("        &lt;/div&gt;");
			Out.WriteLine("        &lt;script type=\"text/javascript\"&gt;");
			Out.WriteLine("            jQuery(document).ready(function ($) {");
			Out.WriteLine("                $('#tabs').tab();");
			Out.WriteLine("            });");
			Out.WriteLine("        &lt;/script&gt;");
			Out.WriteLine("    &lt;/div&gt;");
			Out.WriteLine("    &lt;!-- container --&gt;");
			Out.WriteLine("    &lt;script type=\"text/javascript\" src=\"" + Asset.Load(jsFolder + "/bootstrap.js").GetLink(LinkType.Include) + "\"&gt;&lt;/script&gt;");
			Out.WriteLine("&lt;/body&gt;");
			Out.WriteLine("&lt;/html&gt;");
		}

		public static void OutputComponentsHelper(Asset asset, OutputContext context)
		{
			Component_Layout layout = new Component_Layout();
			Dictionary&lt;String, StringBuilder&gt; rowContent = new Dictionary&lt;string, StringBuilder&gt;();

			context.IsGeneratingDependencies = false;
			String SiteRootFolderPath = ComponentLibraryHelper.getcomponentLibraryRootFolder(asset).AssetPath.ToString();
			//Out.WriteLine(SiteRootFolderPath);
			Asset globalConfig = Asset.Load(SiteRootFolderPath + "/_Global/Global Config");

			//Root Assets folders
			string imageFolder = SiteRootFolderPath + "/_Assets/images/";
			string cssFolder = SiteRootFolderPath + "/_Assets/css/";
			string jsFolder = SiteRootFolderPath + "/_Assets/js/";
			string componentName = "";
			string componentThumbnail = "";
			string componentType = "";
			string componentPath = "";
			string componentId = "";
			string componentColumn = "";
			//  Asset aComponent;



			string componentOutput = "";

			StringBuilder sbCol1 = new StringBuilder();
			StringBuilder sbCol2 = new StringBuilder();

			String wrapperType = asset["wrapper_type"];

			if (String.IsNullOrWhiteSpace(wrapperType))
			{
				wrapperType = asset["wrapper_type"];
			}

			if (wrapperType == "custom")
			{
				Asset wrapperAsset = Asset.Load(asset["custom_wrapper"]);

				if (wrapperAsset.IsLoaded)
				{
					ComponentLibraryHelper.startWrap(asset, context, wrapperAsset.AssetPath.ToString(), wrapperType);
				}
			}
			else
			{
				Asset wrapperAsset = Asset.Load(asset["wrapper"]);

				if (!string.IsNullOrEmpty(wrapperAsset.Raw["template_name"]))
				{
					ComponentLibraryHelper.startWrap(asset, context, wrapperAsset.Raw["template_name"]);
				}
			}

			foreach (PanelEntry entry in asset.GetPanels("layouts"))
			{
				sbCol1.Clear();
				sbCol2.Clear();
				foreach (PanelEntry subEntry in entry.GetPanels("components"))
				{
					componentOutput = "";
					componentThumbnail = "";
					componentColumn = "";
					if (String.IsNullOrEmpty(subEntry.Raw["custom_code"]))
					{
						Asset aComponent = ComponentLibraryHelper.getComponentAsset(asset, subEntry["component"]);
						if (aComponent != null &amp;&amp; aComponent.IsLoaded)
						{
							componentOutput = "&lt;span " + Util.Editable("component", subEntry) + "&gt; " + makeRaw(ComponentLibraryHelper.generateComponentPreview(aComponent, context)) + "&lt;/span&gt;";
						}
						componentColumn = subEntry["column"];
					}
					else
					{
						componentOutput = subEntry["custom_code"];
						componentColumn = subEntry["custom_column"];
					}

					switch (componentColumn)
					{
						case "col1":
							sbCol1.Append(componentOutput);
							break;
						case "col2":
							sbCol2.Append(componentOutput);
							break;
					}
				}

				rowContent.Add("{col1}", sbCol1);
				rowContent.Add("{col2}", sbCol2);

				Out.Write(layout.output(asset, entry.GetFieldName("layout"), rowContent, entry["layout"]));
				rowContent.Clear();
			}

			if (asset["wrapper"] == "yes")
			{
				ComponentLibraryHelper.endWrap(asset, context);
			}
		}

		public static void OutputContentHelper(Asset asset, OutputContext context)
		{
			/***Commented out because no longer serves a purpose***/
			//Component_Layout layout = new Component_Layout();
			//Dictionary&lt;String, StringBuilder&gt; rowContent = new Dictionary&lt;string, StringBuilder&gt;();

			//context.IsGeneratingDependencies = false;
			//string SiteRootFolderPath = "/" + asset.AssetPath[0]; //"/Utility.GetSiteRootPathReg(asset);
			////Out.WriteLine(SiteRootFolderPath);
			//Asset globalConfig = Asset.Load(SiteRootFolderPath + "/_Global/Global Config");

			////Root Assets folders
			//string imageFolder = SiteRootFolderPath + "/_Assets/images/";
			//string cssFolder = SiteRootFolderPath + "/_Assets/css/";
			//string jsFolder = SiteRootFolderPath + "/_Assets/js/";
			//string componentName = "";
			//string componentThumbnail = "";
			//string componentType = "";
			//string componentPath = "";
			//string componentId = "";
			//string componentColumn = "";
			////  Asset aComponent;



			//string componentOutput = "";

			//StringBuilder sbCol1 = new StringBuilder();
			//StringBuilder sbCol2 = new StringBuilder();

			//if (!string.IsNullOrEmpty(Asset.Load(asset["wrapper"]).Raw["template_name"])) ComponentLibraryHelper.startWrap(asset, context, Asset.Load(asset["wrapper"]).Raw["template_name"]);

			//foreach (PanelEntry entry in asset.GetPanels("layouts"))
			//{
			//    sbCol1.Clear();
			//    sbCol2.Clear();
			//    foreach (PanelEntry subEntry in entry.GetPanels("components"))
			//    {
			//        componentOutput = "";
			//        componentThumbnail = "";
			//        componentColumn = "";
			//        if (String.IsNullOrEmpty(subEntry.Raw["custom_code"]))
			//        {
			//            componentPath = subEntry["component"];

			//            //componentPath = subEntry["component"];
			//            Asset aComponent = Asset.Load(componentPath);
			//            if (aComponent.IsLoaded)
			//            {
			//                componentOutput = ComponentLibraryHelper.generateComponentPreview(aComponent, context);
			//            }
			//            componentColumn = subEntry["column"];
			//        }
			//        else
			//        {
			//            componentOutput = subEntry["custom_code"];
			//            componentColumn = subEntry["custom_column"];
			//        }

			//        switch (componentColumn)
			//        {
			//            case "col1":
			//                sbCol1.Append(componentOutput);
			//                break;
			//            case "col2":
			//                sbCol2.Append(componentOutput);
			//                Console.WriteLine("Case 2");
			//                break;
			//        }
			//    }

			//    rowContent.Add("{col1}", sbCol1);
			//    rowContent.Add("{col2}", sbCol2);

			//    Out.Write(layout.output(asset, entry.GetFieldName("layout"), rowContent, entry["layout"]));
			//    rowContent.Clear();
			//}

			//if (asset["wrapper"] == "yes")
			//{
			//    ComponentLibraryHelper.endWrap(asset, context);
			//}
		}

		public static void PostInputHelper(Asset asset, PostInputContext context)
		{
			context = ComponentLibraryHelper.validateComponentPlaceholderNames(asset, context);

			List&lt;ComponentContentPlaceholder&gt; markupContentPlaceholders = ComponentLibraryHelper.buildComponentContentPlaceholderForTemplateFromMarkup(context.InputForm["markup"]);
			List&lt;PanelEntry&gt; componentPanels = context.InputForm.GetPanels("component_panel");
			List&lt;ComponentContentPlaceholder&gt; assetContentPlaceholders = ComponentContentPlaceholder.ConvertPanelEntryList(componentPanels, "component_panel");
			List&lt;ComponentContentPlaceholder&gt; flattenedAssetcontentPlaceholders = ComponentLibraryHelper.flattenComponentContentPlaceholderList(assetContentPlaceholders);

			ComponentLibraryHelper.deleteExistingContentFieldsForComponents(ref assetContentPlaceholders, markupContentPlaceholders);
			ComponentLibraryHelper.updateExistingContentFields(ref assetContentPlaceholders, markupContentPlaceholders);
			ComponentLibraryHelper.createContentFieldsForComponents(ref assetContentPlaceholders, markupContentPlaceholders, flattenedAssetcontentPlaceholders);

			Dictionary&lt;String, String&gt; content = ComponentContentPlaceholder.ConvertToContentDictionary(assetContentPlaceholders);

			ComponentLibraryHelper.deleteTemplateContent(context);
			foreach (var kvp in content)
			{
				context.InputForm[kvp.Key] = kvp.Value;
			}
			// Truly delete unused panels
			foreach (PanelEntry entry in context.InputForm.GetPanels("component_panel"))
			{
				if (entry["component_component_type"].Length == 0 &amp;&amp; entry["component_component_label"].Length == 0)
				{
					var fields = new List&lt;string&gt;
					{
						entry.GetFieldName("component_category"),
						entry.GetFieldName("component_component_form_override_type"),
						entry.GetFieldName("component_component_hardcoded_snippet"),
						entry.GetFieldName("component_component_input_label"),
						entry.GetFieldName("component_component_label"),
						entry.GetFieldName("component_component_message_content"),
						entry.GetFieldName("component_component_message_type"),
						entry.GetFieldName("component_component_required"),
						entry.GetFieldName("component_component_required_message"),
						entry.GetFieldName("component_component_type"),
						entry.GetFieldName("component_component_type_in_markup"),
						entry.GetFieldName("component_list_components"),
						entry.GetFieldName("component_list_content"),
						entry.GetFieldName("component_list_label"),
						entry.GetFieldName("component_list_message_content"),
						entry.GetFieldName("component_list_message_type"),
						entry.GetFieldName("component_panel"),
					};
					context.InputForm.Remove(fields);
				}
			}

			string ComponentLibraryComponentFolder = ComponentLibraryHelper.getComponentLibraryComponentsFolder(asset).AssetPath.ToString();
			string nameSpace = ""; //"CrownPeak.CMSAPI.CustomLibrary.Components.";
			string componentLibraryClassName = "ComponentLibraryHelper";
			string layoutClassName = "layout";
			string openTag = "&lt;" + "%";
			string closeTag = "%" + "&gt;";
			string tab = "\t";
			string componentClassName = "";
			string componentName = "";
			string componentLabel = "";
			string componentMessage = "";
			string componentFieldName = "";
			string componentThumbnail = "";
			string componentType = "";
			Asset aComponent;

			StringBuilder sbDeclare = new StringBuilder();
			StringBuilder sbImportNamespaces = new StringBuilder();
			StringBuilder sbInput = new StringBuilder();
			StringBuilder sbInputContent = new StringBuilder();
			StringBuilder sbPostInput = new StringBuilder();
			StringBuilder sbPostInputContent = new StringBuilder();
			StringBuilder sbOutput = new StringBuilder();
			StringBuilder sbOutputContent = new StringBuilder();
			StringBuilder sbOutputChanges = new StringBuilder();
			StringBuilder sbOutputChangesContent = new StringBuilder();
			StringBuilder sbOutputTranslateXml = new StringBuilder();
			StringBuilder sbOutputTranslateXmlContent = new StringBuilder();
			StringBuilder sbOutputJson = new StringBuilder();
			StringBuilder sbOutputJsonContent = new StringBuilder();
			StringBuilder sbPostSave = new StringBuilder();
			StringBuilder sbPostSaveContent = new StringBuilder();
			StringBuilder sbSearchG2Delete = new StringBuilder();
			StringBuilder sbSearchG2DeleteContent = new StringBuilder();
			StringBuilder sbSearchG2Insert = new StringBuilder();
			StringBuilder sbSearchG2InsertContent = new StringBuilder();
			StringBuilder sbSearchG2Update = new StringBuilder();
			StringBuilder sbSearchG2UpdateContent = new StringBuilder();
			StringBuilder sbSearchG2IndexedFieldsContent = new StringBuilder();

			PanelEntry firstPe = context.InputForm.GetPanels("layouts").FirstOrDefault();

			Dictionary&lt;string, int&gt; components = new Dictionary&lt;string, int&gt;();

			sbDeclare.Append(openTag + "@ Import Namespace=\"CrownPeak.CMSAPI\" " + closeTag).AppendLine();
			sbImportNamespaces.Append(openTag + "@ Import Namespace=\"CrownPeak.CMSAPI\" " + closeTag).AppendLine();
			sbDeclare.Append(openTag + "@ Import Namespace=\"CrownPeak.CMSAPI.Services\" " + closeTag).AppendLine();
			sbImportNamespaces.Append(openTag + "@ Import Namespace=\"CrownPeak.CMSAPI.Services\" " + closeTag).AppendLine();
			sbDeclare.Append(openTag + "@ Import Namespace=\"CrownPeak.CMSAPI.CustomLibrary\" " + closeTag).AppendLine();
			sbImportNamespaces.Append(openTag + "@ Import Namespace=\"CrownPeak.CMSAPI.CustomLibrary\" " + closeTag).AppendLine();
			sbDeclare.Append(openTag + "@ Import Namespace=\"" + ComponentLibraryHelper.getComponentLibraryNamespace(asset) + "\"" + closeTag).AppendLine();
			sbImportNamespaces.Append(openTag + "@ Import Namespace=\"" + ComponentLibraryHelper.getComponentLibraryNamespace(asset) + "\"" + closeTag).AppendLine();

			MatchCollection dropZoneMatches = new Regex("&lt;DropZone([^&gt;]*\\s+)name=(['\"])([^'\"]+)\\2([^&gt;]*?)((/&gt;)|(&gt;(?:.|\\s)*?&lt;/DropZone&gt;))").Matches(context.InputForm["markup"]);

			sbDeclare.Append("&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;").AppendLine();
			sbImportNamespaces.Append("&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;").AppendLine();
			sbDeclare.Append(openTag).AppendLine();
			if (context.InputForm["meta"] == "yes")
			{
				sbDeclare.Append(tab + nameSpace + "MetaData metaData = new " + nameSpace + "MetaData();").AppendLine();
			}

			if (context.InputForm["custom_js_css"] == "yes")
			{
				sbDeclare.Append(tab + nameSpace + "HeaderJavascriptAndCss headerAndJavascriptCSS = new " + nameSpace + "HeaderJavascriptAndCss();").AppendLine();
			}

			sbInputContent.Append(tab + "Input.StartTabbedPanel(");

			String dlm = "";
			foreach (PanelEntry entry in context.InputForm.GetPanels("component_panel"))
			{
				//if (entry["consolidate_section_tab"] != "yes")
				{
					sbInputContent.Append(dlm + "\"" + entry["component_component_label"] + "\"");
					dlm = ", ";
				}
			}
			foreach (Match match in dropZoneMatches)
			{
				sbInputContent.Append(dlm + "\"" + match.Groups[3] + "\"");
			}
			if (context.InputForm["meta"] == "yes") sbInputContent.Append(", \"Metadata &amp; Header Content\"");
			if (context.InputForm["advanced"] == "yes") sbInputContent.Append(", \"Advanced\"");
			if (context.InputForm["enable_tmf"] == "yes") sbInputContent.Append(", \"TMF\"");
			sbInputContent.Append(");").AppendLine();

			String wrapperType = context.InputForm["wrapper_type"];

			if (String.IsNullOrWhiteSpace(wrapperType))
			{
				wrapperType = asset["wrapper_type"];
			}

			if (wrapperType == "custom")
			{
				Asset wrapperAsset = Asset.Load(context.InputForm["custom_wrapper"]);

				if (!wrapperAsset.IsLoaded)
				{
					wrapperAsset = Asset.Load(asset["custom_wrapper"]);
				}

				if (wrapperAsset.IsLoaded)
				{
					sbOutputContent.AppendLine(openTag);
					sbOutputContent.Append(tab + "//Begin Wrapper").AppendLine();
					sbOutputContent.Append(tab + componentLibraryClassName + ".startWrap(asset,context,\"" + wrapperAsset.AssetPath + "\", \"" + wrapperType + "\");").AppendLine();
					sbOutputContent.AppendLine(closeTag);
				}
			}
			else
			{
				Asset wrapperAsset = Asset.Load(context.InputForm["wrapper"]);

				if (!wrapperAsset.IsLoaded)
				{
					wrapperAsset = Asset.Load(asset["wrapper"]);
				}

				if (!string.IsNullOrEmpty(wrapperAsset.Raw["template_name"]) &amp;&amp; !string.IsNullOrEmpty(wrapperAsset.Raw["template_folder"]))
				{
					String wrapperAssetPath = Asset.Load(wrapperAsset["template_folder"]).AssetPath + "/" + wrapperAsset.Raw["template_name"];
					sbOutputContent.AppendLine(openTag);
					sbOutputContent.Append(tab + "//Begin Wrapper").AppendLine();
					sbOutputContent.Append(tab + componentLibraryClassName + ".startWrap(asset,context,\"" + wrapperAssetPath + "\", \"" + wrapperType + "\");").AppendLine();
					sbOutputContent.AppendLine(closeTag);
				}
			}

			sbOutputContent.AppendLine();

			String nextTab = "";
			Int32 unique = 0;

			bool isFirstPe = true;

			/************BEGIN BUILDING INPUT &amp; POST-INPUT************/
			foreach (PanelEntry entry in context.InputForm.GetPanels("component_panel"))
			{
				if (!(isFirstPe &amp;&amp; entry["consolidate_section_tab"] == "yes"))
				{
					if (entry["consolidate_section_tab"] != "yes")
					{
						sbInputContent.Append(nextTab).AppendLine();
					}

					if (!(isFirstPe &amp;&amp; entry["consolidate_section_tab"] == "yes"))
					{
						sbInputContent.Append(tab + tab + "// Capture content").AppendLine();
					}

					componentClassName = entry["component_component_type"].Trim();
					componentLabel = entry["component_component_label"].Trim();
					componentName = componentClassName[0].ToString().ToLowerInvariant() + componentClassName.Substring(1);

					if (!components.ContainsKey(componentName))
					{
						components.Add(componentName, 0);
						sbDeclare.Append(tab + nameSpace + componentClassName + " " + componentName + " = new " + nameSpace + componentClassName + "();").AppendLine();
					}
					else components[componentName]++;

					componentFieldName = entry["component_component_label"];

					//if (!(isFirstPe &amp;&amp; entry["consolidate_section_tab"] == "yes"))
					{
						sbInputContent.Append(tab + tab + componentName + ".ComponentInput(asset, context, \"" + componentLabel + "\", \"" + componentFieldName + "\");").AppendLine();
						sbPostInputContent.Append(tab + componentName + ".ComponentPostInput(asset, context, \"" + componentFieldName + "\");").AppendLine();
						sbSearchG2IndexedFieldsContent.Append(tab + "indexedFields.AddRange(" + componentName + ".ComponentIndexedFields(asset, context, \"" + componentFieldName + "\"));").AppendLine();
					}
					if (!(isFirstPe &amp;&amp; entry["consolidate_section_tab"] == "yes"))
					{
						sbInputContent.AppendLine();
					}

					nextTab = tab + "Input.NextTabbedPanel();";
				}
				isFirstPe = false;
			}
			foreach (Match match in dropZoneMatches)
			{
				if (!isFirstPe)
				{
					sbInputContent.Append(nextTab).AppendLine();
				}
				var zone = match.Groups[3];
				sbInputContent.Append(tab + tab + "// DropZone " + zone).AppendLine();
				sbInputContent.Append(tab + tab + "Input.ShowDragDrop(\"" + zone + "\", \"" + zone + "\");").AppendLine();
				sbInputContent.AppendLine();

				nextTab = tab + "Input.NextTabbedPanel();";
				isFirstPe = false;
			}
			/************END BUILDING INPUT &amp; POST-INPUT************/

			/*****************BEGIN BUILDING OUTPUT &amp; OUTPUT-JSON***/
			sbOutputJsonContent.AppendLine(tab + "var sbJson = new StringBuilder(1024);");
			sbOutputJsonContent.AppendLine(tab + "sbJson.Append(\"{\");");
			var markup = context.InputForm["markup"];
			var first = true;
			foreach (PanelEntry entry in context.InputForm.GetPanels("component_panel"))
			{
				var name = entry["component_component_label"];
				var type = entry["component_component_type"];
				var variableName = type[0].ToString().ToLowerInvariant() + type.Substring(1);
				var lookfor = "{" + (name == type ? name : (name + ":" + type)) + "}";
				var replacement = openTag + "= " + variableName + ".ComponentOutput(asset, context, \"" + name + "\") " + closeTag;
				markup = markup.Replace(lookfor, replacement);

				if (entry["component_processed"] == "yes") continue;
				if (!first) sbOutputJsonContent.AppendLine(tab + "sbJson.Append(\",\");");

				var otherFields = context.InputForm.GetPanels("component_panel")
					.Where(p =&gt; p["component_component_type"] == type 
					            &amp;&amp; p["component_component_label"] != name 
					            &amp;&amp; p["component_processed"] != "yes").ToArray();
				if (otherFields.Any())
				{
					sbOutputJsonContent.AppendLine(tab + "sbJson.AppendFormat(\"\\\"{0}\\\":[\", JsonHelper.StringToJson(\"" + name + "\"));");
					sbOutputJsonContent.AppendLine(tab + tab + "sbJson.Append(" + variableName + ".ComponentJson(asset, context, \"" + name + "\"));");
					foreach (PanelEntry subEntry in otherFields)
					{
						sbOutputJsonContent.AppendLine(tab + tab + "sbJson.Append(\",\");");
						var arrayName = subEntry["component_component_label"];
						sbOutputJsonContent.AppendLine(tab + tab + "sbJson.Append(" + variableName + ".ComponentJson(asset, context, \"" + arrayName + "\"));");
						subEntry["component_processed"] = "yes";
					}
					sbOutputJsonContent.AppendLine(tab + "sbJson.Append(\"]\");");
				}
				else
				{
					sbOutputJsonContent.AppendLine(tab + "sbJson.AppendFormat(\"\\\"{0}\\\":{1}\", JsonHelper.StringToJson(\"" + name + "\"), " + variableName + ".ComponentJson(asset, context, \"" + name + "\"));");
				}

				entry["component_processed"] = "yes";
				first = false;
			}

			if (dropZoneMatches.Count &gt; 0)
			{
				if (!first) sbOutputJsonContent.AppendLine(tab + "sbJson.Append(\",\");");
				sbOutputJsonContent.AppendLine(tab + "sbJson.Append(\"\\\"DropZones\\\":{\");");
				var firstZone = true;
				foreach (Match match in dropZoneMatches)
				{
					if (!firstZone) sbOutputJsonContent.AppendLine(tab + "sbJson.Append(\",\");");
					sbOutputJsonContent.AppendLine(tab + "sbJson.Append(JsonHelper.DragAndDropZoneToJson(asset, context, \"" + match.Groups[3] + "\"));");
					markup = markup.Replace(match.Groups[0].Value, "&lt;% Out.ShowDragDropIncludeList(\"" + match.Groups[3] + "\", new [] { \"All\", \"" + match.Groups[3] + "\" }); %&gt;");
					firstZone = false;
				}
				sbOutputJsonContent.AppendLine(tab + "sbJson.Append(\"}\");");
				first = false;
			}

			if (context.InputForm["meta"] == "yes")
			{
				if (!first) sbOutputJsonContent.AppendLine(tab + "sbJson.Append(\",\");");
				sbOutputJsonContent.AppendLine(tab + "sbJson.AppendFormat(\"\\\"{0}\\\":{1}\", JsonHelper.StringToJson(\"MetaData\"), metaData.ComponentJson(asset, context, \"meta\"));");
				sbSearchG2IndexedFieldsContent.Append(tab + "indexedFields.AddRange(metaData.ComponentIndexedFields(asset, context, \"meta\"));").AppendLine();
			}

			// Tidy up
			foreach (PanelEntry entry in context.InputForm.GetPanels("component_panel"))
			{
				context.InputForm.Remove(entry.GetFieldName("component_processed"));
			}
			sbOutputContent.AppendLine(markup);
			sbOutputJsonContent.AppendLine(tab + "sbJson.Append(\"}\");");
			sbOutputJsonContent.AppendLine(tab + "Out.Write(sbJson.ToString());");
			/*****************END BUILDING OUTPUT &amp; OUTPUT-JSON*****/

			/*****************BEGIN BUILDING SEARCH G2**************/
			sbSearchG2DeleteContent.AppendLine(tab + "var doc = new SearchG2JsonParams");
			sbSearchG2DeleteContent.AppendLine(tab + "{");
			sbSearchG2DeleteContent.AppendLine(tab + tab + "Id = asset.BranchId.ToString(),");
			sbSearchG2DeleteContent.AppendLine(tab + tab + "Operation = SearchG2JsonParams.OperationType.Delete,");
			sbSearchG2DeleteContent.AppendLine(tab + tab + "Overwrite = true");
			sbSearchG2DeleteContent.AppendLine(tab + "};");
			sbSearchG2DeleteContent.AppendLine(tab + "context.JsonParams.Add(doc);");

			sbSearchG2InsertContent.AppendLine(tab + "var doc = new SearchG2JsonParams");
			sbSearchG2InsertContent.AppendLine(tab + "{");
			sbSearchG2InsertContent.AppendLine(tab + tab + "Id = asset.BranchId.ToString(),");
			sbSearchG2InsertContent.AppendLine(tab + tab + "Operation = SearchG2JsonParams.OperationType.Create,");
			sbSearchG2InsertContent.AppendLine(tab + tab + "Overwrite = true");
			sbSearchG2InsertContent.AppendLine(tab + "};");

			sbSearchG2UpdateContent.AppendLine(tab + "var doc = new SearchG2JsonParams");
			sbSearchG2UpdateContent.AppendLine(tab + "{");
			sbSearchG2UpdateContent.AppendLine(tab + tab + "Id = asset.BranchId.ToString(),");
			sbSearchG2UpdateContent.AppendLine(tab + tab + "Operation = SearchG2JsonParams.OperationType.Update,");
			sbSearchG2UpdateContent.AppendLine(tab + tab + "Overwrite = true");
			sbSearchG2UpdateContent.AppendLine(tab + "};");

			// Insert and Update are the same content
			StringBuilder sbInsertAndUpdateContent = new StringBuilder(1024);
			sbInsertAndUpdateContent.AppendLine(tab + "doc.Add(\"custom_i_asset_id\", AssetPropertyNames.Id);");
			sbInsertAndUpdateContent.AppendLine(tab + "doc.Add(\"custom_i_template_id\", AssetPropertyNames.TemplateId);");
			sbInsertAndUpdateContent.AppendLine(tab + "doc.Add(\"custom_s_template_label\", AssetPropertyNames.TemplateLabel);");
			sbInsertAndUpdateContent.AppendLine(tab + "doc.Add(\"custom_dt_created\", AssetPropertyNames.CreateDate);");
			sbInsertAndUpdateContent.AppendLine(tab + "doc.Add(\"custom_dt_modified\", AssetPropertyNames.ModifiedDate);");
			sbInsertAndUpdateContent.AppendLine(tab + "doc.AddFixed(\"custom_dt_published\", DateTime.UtcNow.ToString(\"o\"));");
			sbInsertAndUpdateContent.AppendLine(tab + "doc.Add(\"title\", AssetPropertyNames.Label);");
			sbInsertAndUpdateContent.AppendLine(tab + "doc.AddFixed(\"content\", Utils.StripHtml(asset.Show()));");
			sbInsertAndUpdateContent.AppendLine(tab + "doc.AddFixed(\"custom_s_slug\", asset.GetLink());");
			sbInsertAndUpdateContent.AppendLine(tab + "var siteRoot = Asset.GetSiteRoot(asset);");
			sbInsertAndUpdateContent.AppendLine(tab + "var siteRootId = siteRoot.IsLoaded ? siteRoot.Id : 0;");
			sbInsertAndUpdateContent.AppendLine(tab + "var parents = new List&lt;Asset&gt;();");
			sbInsertAndUpdateContent.AppendLine(tab + "var a = asset.Parent;");
			sbInsertAndUpdateContent.AppendLine(tab + "while (true)");
			sbInsertAndUpdateContent.AppendLine(tab + "{");
			sbInsertAndUpdateContent.AppendLine(tab + tab + "parents.Add(a);");
			sbInsertAndUpdateContent.AppendLine(tab + tab + "if (a.Id == siteRootId || a.FolderId == siteRootId &amp;&amp; a.FolderId == 0) break;");
			sbInsertAndUpdateContent.AppendLine(tab + tab + "a = a.Parent;");
			sbInsertAndUpdateContent.AppendLine(tab + "}");
			sbInsertAndUpdateContent.AppendLine(tab + "if (parents.Any())");
			sbInsertAndUpdateContent.AppendLine(tab + "{");
			sbInsertAndUpdateContent.AppendLine(tab + tab + "doc.AddFixed(\"custom_i_parent_cms_folder_id\", parents.First().Id.ToString());");
			sbInsertAndUpdateContent.AppendLine(tab + tab + "doc.AddFixed(\"custom_is_cms_folder_id\", parents.Select(p =&gt; p.Id.ToString()));");
			sbInsertAndUpdateContent.AppendLine(tab + "}");
			sbInsertAndUpdateContent.AppendLine();
			sbInsertAndUpdateContent.AppendLine(tab + "doc.AddFixed(\"custom_s_type\", \"" + asset.Label.Replace(" Template", "") + "\");");
			sbInsertAndUpdateContent.AppendLine(tab + "doc.AddFixed(\"custom_t_json\", asset.Show(\"output_json\"));");
			sbInsertAndUpdateContent.AppendLine();
			sbInsertAndUpdateContent.AppendLine(tab + "var indexedFields = new List&lt;IndexedField&gt;();");
			sbInsertAndUpdateContent.AppendLine(sbSearchG2IndexedFieldsContent.ToString());
			sbInsertAndUpdateContent.AppendLine(tab + "indexedFields.ForEach(f =&gt; doc.AddFixed(f.Name, Util.ReplaceAttachments(Util.ReplaceCptInternals(asset.Raw[f.FieldName.ToLowerInvariant()]))));");
			sbInsertAndUpdateContent.AppendLine();
			sbInsertAndUpdateContent.AppendLine(tab + "context.JsonParams.Add(doc);");
			/*****************END BUILDING SEARCH G2****************/

			sbDeclare.Append(closeTag).AppendLine();
			//sbImportNamespaces.Append(closeTag).AppendLine();

			if (context.InputForm["meta"] == "yes" || context.InputForm["custom_js_css"] == "yes")
			{
				sbInputContent.Append(tab + "Input.NextTabbedPanel();").AppendLine();


				if (context.InputForm["meta"] == "yes")
				{
					sbInputContent.Append(tab + tab + "Input.StartExpandPanel(\"Metadata\");").AppendLine();
					sbInputContent.Append(tab + tab + "metaData.ComponentInput(asset, context, \"Metadata\", \"meta\");").AppendLine();
					sbInputContent.Append(tab + tab + "Input.EndExpandPanel();").AppendLine();
					sbPostInputContent.Append(tab + "metaData.ComponentPostInput(asset, context, \"meta\");").AppendLine();
					sbOutputContent.AppendLine();
				}

				if (context.InputForm["custom_js_css"] == "yes")
				{
					sbInputContent.Append(tab + tab + "Input.StartExpandPanel(\"Javascript and CSS references\");").AppendLine();
					sbInputContent.Append(tab + tab + "headerAndJavascriptCSS.ComponentInput(asset, context, \"Metadata\", \"meta\");").AppendLine();
					sbInputContent.Append(tab + tab + "Input.EndExpandPanel();").AppendLine();
					sbOutputContent.AppendLine();
				}
			}


			if (context.InputForm["advanced"] == "yes")
			{
				sbInputContent.Append(tab + "Input.NextTabbedPanel();").AppendLine();
				//site root not configurable via the site config yet.
				//sbInputContent.Append(tab + tab + "Input.ShowLink(Asset.Load(\"" + siteConfig.AssetPath.ToString() + "\"), \"Edit Theme\", InputLinkType.EditTab);").AppendLine();
				sbInputContent.Append(tab + tab + "Input.ShowLink(Asset.Load(\"" + asset.AssetPath.ToString() + "\"), \"Edit Template\", InputLinkType.EditTab);").AppendLine();
			}

			if (context.InputForm["enable_tmf"] == "yes")
			{
				sbInputContent.Append(tab + "Input.NextTabbedPanel();").AppendLine();
				sbInputContent.AppendLine().Append(tab + "try { ServicesTMF.Input.LoadInput(asset, context); } catch (Exception ex){}").AppendLine().AppendLine();
				sbOutputContent.Append(openTag).AppendLine();
				sbOutputContent.Append(tab + "try { ServicesTMF.Output.LoadOutput(asset, context); } catch (Exception ex){}").AppendLine();
				sbOutputContent.Append(closeTag).AppendLine();
				sbOutputChangesContent.Append(tab + "try { ServicesTMF.Output.LoadMasterAssetChanges(asset); } catch (Exception ex){}").AppendLine();
				sbOutputTranslateXmlContent.Append(tab + "try { " + context.InputForm["output_translate_xml_body"] + " } catch (Exception ex){}").AppendLine();
				sbPostSaveContent.Append(tab + "try { ServicesTMF.PostSave.LoadPostSave(asset, context); } catch (Exception ex){}").AppendLine();
			}

			sbInputContent.Append(tab + "Input.EndTabbedPanel();").AppendLine();

			sbInput.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.InputInit\" " + closeTag).AppendLine();
			sbInput.Append(sbDeclare.ToString()).AppendLine();
			sbInput.Append(openTag).AppendLine();
			sbInput.Append(sbInputContent.ToString());
			sbInput.Append(closeTag).AppendLine();

			sbPostInput.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.PostInputInit\" " + closeTag).AppendLine();
			sbPostInput.Append(sbDeclare.ToString()).AppendLine();
			sbPostInput.Append(openTag).AppendLine();
			sbPostInput.Append(sbPostInputContent.ToString());
			sbPostInput.Append(closeTag).AppendLine();

			sbOutput.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.OutputInit\" " + closeTag).AppendLine();
			sbOutput.Append(sbDeclare.ToString()).AppendLine();
			sbOutput.Append(sbOutputContent.ToString());

			if (context.InputForm["json_template"] == "yes")
			{
				sbOutputJson.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.OutputInit\" " + closeTag).AppendLine();
				sbOutputJson.Append(sbDeclare.ToString()).AppendLine();
				sbOutputJson.Append(openTag).AppendLine();
				sbOutputJson.Append(sbOutputJsonContent.ToString());
				sbOutputJson.Append(closeTag).AppendLine();

				sbSearchG2Delete.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.SearchG2Init\" " + closeTag).AppendLine();
				sbSearchG2Delete.Append(sbDeclare.ToString()).AppendLine();
				sbSearchG2Delete.Append(openTag).AppendLine();
				sbSearchG2Delete.Append(sbSearchG2DeleteContent.ToString());
				sbSearchG2Delete.Append(closeTag).AppendLine();

				sbSearchG2Insert.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.SearchG2Init\" " + closeTag).AppendLine();
				sbSearchG2Insert.Append(sbDeclare.ToString()).AppendLine();
				sbSearchG2Insert.Append(openTag).AppendLine();
				sbSearchG2Insert.Append(sbSearchG2InsertContent.ToString());
				sbSearchG2Insert.Append(sbInsertAndUpdateContent.ToString());
				sbSearchG2Insert.Append(closeTag).AppendLine();

				sbSearchG2Update.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.SearchG2Init\" " + closeTag).AppendLine();
				sbSearchG2Update.Append(sbDeclare.ToString()).AppendLine();
				sbSearchG2Update.Append(openTag).AppendLine();
				sbSearchG2Update.Append(sbSearchG2UpdateContent.ToString());
				sbSearchG2Update.Append(sbInsertAndUpdateContent.ToString());
				sbSearchG2Update.Append(closeTag).AppendLine();
			}
			else
			{
				sbOutputJson.Clear();
				sbSearchG2Delete.Clear();
				sbSearchG2Insert.Clear();
				sbSearchG2Update.Clear();
			}

			if (context.InputForm["enable_tmf"] == "yes")
			{
				sbOutputChanges.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.OutputInit\" " + closeTag).AppendLine();
				sbOutputChanges.Append(sbImportNamespaces.ToString()).AppendLine();
				sbOutputChanges.Append(openTag).AppendLine();
				sbOutputChanges.Append(sbOutputChangesContent.ToString());
				sbOutputChanges.Append(closeTag).AppendLine();

				sbOutputTranslateXml.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.OutputInit\" " + closeTag).AppendLine();
				sbOutputTranslateXml.Append(sbImportNamespaces.ToString()).AppendLine();
				sbOutputTranslateXml.Append(openTag).AppendLine();
				sbOutputTranslateXml.Append(sbOutputTranslateXmlContent.ToString());
				sbOutputTranslateXml.Append(closeTag).AppendLine();

				sbPostSave.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.PostSaveInit\" " + closeTag).AppendLine();
				sbPostSave.Append(sbDeclare.ToString()).AppendLine();
				sbPostSave.Append(openTag).AppendLine();
				sbPostSave.Append(sbPostSaveContent.ToString());
				sbPostSave.Append(closeTag).AppendLine();
			}
			else
			{
				sbOutputChanges.Clear();
				sbOutputTranslateXml.Clear();
				sbPostSave.Clear();
			}


			context.InputForm["inputBody"] = sbInput.ToString();
			context.InputForm["postinputBody"] = sbPostInput.ToString();
			context.InputForm["outputBody"] = sbOutput.ToString();
			context.InputForm["outputChangesBody"] = sbOutputChanges.ToString();
			context.InputForm["outputTranslateXmlBody"] = sbOutputTranslateXml.ToString();
			context.InputForm["postSaveBody"] = sbPostSave.ToString();
			context.InputForm["outputJsonBody"] = sbOutputJson.ToString();
			context.InputForm["searchG2DeleteBody"] = sbSearchG2Delete.ToString();
			context.InputForm["searchG2InsertBody"] = sbSearchG2Insert.ToString();
			context.InputForm["searchG2UpdateBody"] = sbSearchG2Update.ToString();

			if (context.InputForm["create"] == "yes")
			{
				Asset folderAsset = Asset.Load(context.InputForm["template_folder"]);
				Asset templateAsset = Asset.Load(folderAsset.AssetPath + "/" + context.InputForm["template_name"]);

				//        if(templateAsset.IsLoaded &amp;&amp; String.IsNullOrEmpty(context.InputForm["override"]))
				//        {
				//           context.ValidationErrorFields.Add("override", "Please check this box to override existing template");
				//        }

				if (!folderAsset.IsLoaded)
				{
					context.ValidationErrorFields.Add("template_folder", "Please specify a folder to generate the template in");
				}
			}
		}

		public static void PostSaveHelper(Asset asset, PostSaveContext context)
		{
			if (asset["create"] == "yes")
			{
				Asset folderAsset = Asset.Load(asset["template_folder"]);
				Asset templateAsset = Asset.Load(folderAsset.AssetPath + "/" + asset.Raw["template_name"]);
				Asset modelAsset = Asset.LoadDirect("/System/Templates/Basis/Template/Template C#");
				Dictionary&lt;string, string&gt; contentFields = new Dictionary&lt;string, string&gt; { { "Auto created by", asset.Id.ToString() } };

				if (!templateAsset.IsLoaded)
				{
					templateAsset = Asset.CreateNewAsset(asset.Raw["template_name"], folderAsset, modelAsset, contentFields);
					asset["templateId"] = templateAsset.Id.ToString();
					asset.SaveContentField("templateId", templateAsset.Id.ToString());

					var defaultTemplateFolder = Asset.Load(ComponentLibraryHelper.getComponentLibraryProjectFolder(asset).AssetPath + "/Templates/Component Framework/Template Builder Default");
					if (defaultTemplateFolder.IsLoaded)
					{
						var ap = new AssetParams { ExcludeProjectTypes = false };
						var defaultTemplateFiles = defaultTemplateFolder.GetFileList(ap);
						defaultTemplateFiles.ForEach(f =&gt; Asset.CopyAsset(f.Label, templateAsset, f));
					}
				}

				if (templateAsset.IsLoaded)
				{
					folderAsset = templateAsset;

					modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/input.aspx");
					contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["inputBody"] } };
					Asset inputAsset = Asset.Load(folderAsset.AssetPath + "/input.aspx");
					if (inputAsset.IsLoaded)
					{
						//inputAsset.Delete();
						inputAsset.SaveContent(contentFields);
					}
					else
					{
						inputAsset = Asset.CreateNewAsset("input.aspx", folderAsset, modelAsset, contentFields);
					}

					modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/post_input.aspx");
					contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["postinputBody"] } };
					Asset postinputAsset = Asset.Load(folderAsset.AssetPath + "/post_input.aspx");
					if (postinputAsset.IsLoaded)
					{
						postinputAsset.SaveContent(contentFields);
						//postinputAsset.Delete();
					}
					else
					{
						postinputAsset = Asset.CreateNewAsset("post_input.aspx", folderAsset, modelAsset, contentFields);
					}

					modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/output.aspx");
					contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["outputBody"] } };
					Asset outputAsset = Asset.Load(folderAsset.AssetPath + "/output.aspx");
					if (outputAsset.IsLoaded)
					{
						outputAsset.SaveContent(contentFields);
						outputAsset.SaveSource(asset.Raw["outputBody"]);
						//outputAsset.Delete();
					}
					else
					{
						outputAsset = Asset.CreateNewAsset("output.aspx", folderAsset, modelAsset, contentFields);
					}

					modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/output.aspx");
					contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["outputJsonBody"] } };
					Asset outputJsonAsset = Asset.Load(folderAsset.AssetPath + "/output_json.aspx");
					if (outputJsonAsset.IsLoaded) outputJsonAsset.Delete();
					if (asset["json_template"] == "yes")
					{
						outputJsonAsset = Asset.CreateNewAsset("output_json.aspx", folderAsset, modelAsset, contentFields);
					}

					modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/search_g2_delete.aspx");
					if (!modelAsset.IsLoaded) modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/output.aspx"); // DEBUG
					contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["searchG2DeleteBody"] } };
					Asset searchG2DeleteAsset = Asset.Load(folderAsset.AssetPath + "/search_g2_delete.aspx");
					if (searchG2DeleteAsset.IsLoaded) searchG2DeleteAsset.Delete();
					if (asset["json_template"] == "yes")
					{
						searchG2DeleteAsset = Asset.CreateNewAsset("search_g2_delete.aspx", folderAsset, modelAsset, contentFields);
					}

					modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/search_g2_insert.aspx");
					if (!modelAsset.IsLoaded) modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/output.aspx"); // DEBUG
					contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["searchG2InsertBody"] } };
					Asset searchG2InsertAsset = Asset.Load(folderAsset.AssetPath + "/search_g2_insert.aspx");
					if (searchG2InsertAsset.IsLoaded) searchG2InsertAsset.Delete();
					if (asset["json_template"] == "yes")
					{
						searchG2InsertAsset = Asset.CreateNewAsset("search_g2_insert.aspx", folderAsset, modelAsset, contentFields);
					}

					modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/search_g2_update.aspx");
					if (!modelAsset.IsLoaded) modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/output.aspx"); // DEBUG
					contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["searchG2UpdateBody"] } };
					Asset searchG2UpdateAsset = Asset.Load(folderAsset.AssetPath + "/search_g2_update.aspx");
					if (searchG2UpdateAsset.IsLoaded) searchG2UpdateAsset.Delete();
					if (asset["json_template"] == "yes")
					{
						searchG2UpdateAsset = Asset.CreateNewAsset("search_g2_update.aspx", folderAsset, modelAsset, contentFields);
					}

					if (asset["do_not_overwrite_post_save"] != "do_not_overwrite")
					{
						//Post save currently in "enable_tmf" because only used for TMF currently, should be moved out eventually
						modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/post_save.aspx");
						contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["postSaveBody"] } };
						Asset postSaveAsset = Asset.Load(folderAsset.AssetPath + "/post_save.aspx");
						if (postSaveAsset.IsLoaded) postSaveAsset.Delete();
						if (asset["enable_tmf"] == "yes")
						{
							postSaveAsset = Asset.CreateNewAsset("post_save.aspx", folderAsset, modelAsset, contentFields);
						}
					}

					modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/output.aspx");
					contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["outputChangesBody"] } };
					Asset outputChangesAsset = Asset.Load(folderAsset.AssetPath + "/output_changes.aspx");
					if (outputChangesAsset.IsLoaded) outputChangesAsset.Delete();
					if (asset["enable_tmf"] == "yes")
					{
						outputChangesAsset = Asset.CreateNewAsset("output_changes.aspx", folderAsset, modelAsset, contentFields);
					}

					modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/output.aspx");
					contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["outputTranslateXmlBody"] } };
					Asset outputTranslateXmlAsset = Asset.Load(folderAsset.AssetPath + "/output_translate_xml.aspx");
					if (outputTranslateXmlAsset.IsLoaded) outputTranslateXmlAsset.Delete();
					if (asset["enable_tmf"] == "yes" &amp;&amp; asset["create_output_translate_xml"] == "yes")
					{
						outputTranslateXmlAsset = Asset.CreateNewAsset("output_translate_xml.aspx", folderAsset, modelAsset, contentFields);
					}

				}

				if (!String.IsNullOrEmpty(asset[asset["previewAsset"]]))
				{
					Asset previewAsset = Asset.Load(asset["previewAsset"]);
					previewAsset.SetTemplate(templateAsset.Id);
					foreach (PanelEntry entry in asset.GetPanels("layouts"))
					{
						previewAsset[entry.GetFieldName("layout")] = entry["layout"];
					}
					previewAsset.SaveContent();
				}

			}
			asset.SaveContentField("override", "");
			asset.Rename(asset["template_name"]);
			//asset.SaveContent();
		}

		private static string makeRaw(string content)
		{
			foreach (Match mc in Regex.Matches(content, @"~\$CPIL\$\d+\$[\w:]+\$\w+\$"))
			{
				content = content.Replace(mc.Value, "").Replace("$/CPIL$~", "");
			}
			foreach (Match mc in Regex.Matches(content, @"%\$CPIL\$\d+\$[\w:]+\$\w+\$"))
			{
				content = content.Replace(mc.Value, "").Replace("$/CPIL$%", "");
			}
			return content;
		}
	}
}
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261479</id>
    <label>ComponentLibraryHelper.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/ComponentLibraryHelper.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Experimental;
using CrownPeak.CMSAPI.Services;
using System.Text.RegularExpressions;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public class ComponentLibraryHelper
	{
		/// &lt;summary&gt;
		/// Class variable contains the namespace for components. Is also used to specify the prefix of the .cs library file name
		/// &lt;/summary&gt;
		public static readonly String xComponentNamespace = "Components";

		/// &lt;summary&gt;
		/// Class variable contains the name of html element which encompases repeatable content.
		/// &lt;/summary&gt;
		private static String repeatableNodeName = "cp-list";

		/// &lt;summary&gt;
		/// Class variable contains the name of html element which encompases content which is only rendered in preview in the CMS.
		/// &lt;/summary&gt;
		private static String previewOnlyNodeName = "cp-preview";

		/// &lt;summary&gt;
		/// Class variable contains the name of html element which encompases content which is only rendered for output / publish purposes.
		/// &lt;/summary&gt;
		private static String publishOnlyNodeName = "cp-publish";

		/// &lt;summary&gt;
		/// Private class variable contains the newLineChars used when creating a .cs library file
		/// &lt;/summary&gt;
		private static String newLineChar = "\r\n";

		/// &lt;summary&gt;
		/// Private class variable contains the tab character used when creating a .cs library file
		/// &lt;/summary&gt;
		private static String tabChar = "\t";

		private static String defaultContentPlaceholderType = "Text";

		public static String getDefaultContentPlaceholderType()
		{
			return defaultContentPlaceholderType;
		}

		private static Asset GlobalLibraryConfig;

		private static String[] depthList = new string[] { "component_panel", "component_panel_depth_a", "component_panel_depth_b", "component_panel_depth_c", "component_panel_depth_d" };

		/// &lt;summary&gt;
		/// Private class variable which contains a list of all base component types which do not have physical assets in the CMS.
		/// &lt;/summary&gt;
		//Now is built by retrieving the components in the base componnet folder
		//private static List&lt;String&gt; CoreComponentTypes = new List&lt;String&gt;() { "Wysiwyg", "Text", "Href", "Src", "Image", "Color", "Widget" };

		/// &lt;summary&gt;
		/// Accessor function for the list of base component types
		/// &lt;/summary&gt;
		/// &lt;returns&gt;the list of base components&lt;/returns&gt;
		public static List&lt;String&gt; getCoreComponentTypes(Asset asset)
		{
			List&lt;String&gt; componentAssetTypes = new List&lt;string&gt;();

			FilterParams fParams = new FilterParams();
			fParams.ExcludeProjectTypes = false;
			fParams.Add(AssetPropertyNames.TemplateLabel, Comparison.IsInSet, new List&lt;string&gt; { "Component Definition", "Enhanced Component Definition" });

			List&lt;Asset&gt; coreComponents = Asset.Load(componentsPath(asset) + "/core/").GetFilterList(fParams);

			foreach (Asset componentAsset in coreComponents)
			{
				if (!String.IsNullOrWhiteSpace(componentAsset["class_name"]))
				{
					//Out.DebugWriteLine("adding " + componentAsset["class_name"] + " to base types");
					componentAssetTypes.Add(componentAsset["class_name"]);
				}
			}

			return componentAssetTypes;
		}

		/// &lt;summary&gt;
		/// Function returns all components in the corresponding asset's _Components folder
		/// &lt;/summary&gt;
		/// &lt;param name="asset"&gt;the asset for which you want to get all the available components for&lt;/param&gt;
		/// &lt;returns&gt;a list of components available for the current asset&lt;/returns&gt;
		public static List&lt;String&gt; getAllComponentTypes(Asset asset)
		{
			FilterParams fParams = new FilterParams();
			fParams.ExcludeProjectTypes = false;
			fParams.Add(AssetPropertyNames.TemplateLabel, Comparison.IsInSet, new List&lt;string&gt; { "Component Definition", "Enhanced Component Definition" });
			List&lt;Asset&gt; componentAssetList = Asset.Load(componentsPath(asset)).GetFilterList(fParams);
			List&lt;String&gt; componentAssetTypes = new List&lt;string&gt;();

			foreach (Asset componentAsset in componentAssetList)
			{
				if (!String.IsNullOrWhiteSpace(componentAsset["class_name"]) /*&amp;&amp; !componentAssetTypes.Contains(componentAsset["class_name"])*/)
				{
					componentAssetTypes.Add(componentAsset["class_name"]);
				}
			}

			return componentAssetTypes;
		}

		public static Dictionary&lt;String, String&gt; getAllComponentTypesForDropdown(Asset asset)
		{
			FilterParams fParams = new FilterParams();
			fParams.ExcludeProjectTypes = false;
			fParams.Add(AssetPropertyNames.TemplateLabel, Comparison.IsInSet, new List&lt;string&gt; { "Component Definition", "Enhanced Component Definition" });
			List&lt;Asset&gt; componentAssetList = Asset.Load(componentsPath(asset)).GetFilterList(fParams);
			Dictionary&lt;String, String&gt; componentAssetTypes = new Dictionary&lt;String, String&gt;();

			foreach (Asset componentAsset in componentAssetList)
			{
				if (!String.IsNullOrWhiteSpace(componentAsset["class_name"]) /*&amp;&amp; !componentAssetTypes.Contains(componentAsset["class_name"])*/)
				{
					componentAssetTypes.Add(componentAsset.Parent.Label + ": " + componentAsset["class_name"], componentAsset["class_name"]);
				}
			}

			componentAssetTypes = componentAssetTypes.OrderBy(x =&gt; x.Key).ToDictionary(x =&gt; x.Key, x =&gt; x.Value);

			return componentAssetTypes;
		}

		/// &lt;summary&gt;
		/// Validates the components types for a given component asset
		/// &lt;/summary&gt;
		/// &lt;param name="asset"&gt;the component asset to validate&lt;/param&gt;
		/// &lt;param name="context"&gt;the context of the asset to validate&lt;/param&gt;
		/// &lt;returns&gt;an updated version of the context parameter with any applicable errors&lt;/returns&gt;
		public static PostInputContext validateComponentPlaceholderNames(Asset asset, PostInputContext context)
		{
			String componentMarkup = "";

			if (!String.IsNullOrWhiteSpace(context.InputForm["markup"]) &amp;&amp; context.InputForm["markup"] != asset["markup"])
			{
				componentMarkup = context.InputForm["markup"];
				//should only be used for debugging    
				//componentMarkup = asset["markup"];    

				//List&lt;String&gt; names = new List&lt;string&gt;();

				List&lt;String&gt; validTypes = getAllComponentTypes(asset);

				Regex contentPlaceholderRx = getContentFieldRegex(ContentNodeType.Content); //new Regex(@"{[^=|&gt;|&lt;|\n|""]*}", RegexOptions.Compiled | RegexOptions.IgnoreCase);

				Regex listPlaceholderRx = getContentFieldRegex(ContentNodeType.ListNode);

				MatchCollection contentPlaceholderMatches = contentPlaceholderRx.Matches(componentMarkup);

				MatchCollection listPlaceholderMatches = listPlaceholderRx.Matches(componentMarkup);

				foreach (Match match in contentPlaceholderMatches)
				{
					//verify that content field names are not the same as list names
					if (listPlaceholderMatches.Cast&lt;Match&gt;().Any(x =&gt; getAttribValueFromComponentMarkup(x.Value, "name") == getContentPlaceholderName(match.Value)))
					{
						context.ValidationError = "The content field \"" + match.Value + "\" has the same name as a repeatable node placeholder";
					}
					//verify that if a content type is specified it is a valid content type
					else if (getContentPlaceholderTypeFromMarkup(match.Value) != String.Empty &amp;&amp; !validTypes.Contains(getContentPlaceholderTypeFromMarkup(match.Value)))
					{
						context.ValidationError = match.Value + " is of an unrecognized type. Types are case sensitive and must match the component class name exactly";
					}
					//Verify that if a content placeholder has the same name as another content placeholder that it also has the same type
					//might be tricky for content placesholder without a type specified in the markup because I might not have the type at the time of this execution
					{ }
				}
			}
			return context;
		}

		public static String getNextComponentPanelDepth(String currentPanel)
		{
			for (int i = 0; i &lt; depthList.Length; i++)
			{
				if (depthList[i] == currentPanel &amp;&amp; i &lt; depthList.Length)
				{
					return depthList[++i];
				}
				else if (i &gt;= depthList.Length)
				{
					return "ERROR: Depth exceeds maximum allowable depth";
				}
			}

			return "ERROR: Depth not found";
		}

		public static void deleteExistingContentFieldsForComponents(ref List&lt;ComponentContentPlaceholder&gt; assetContentPlaceholdersList, List&lt;ComponentContentPlaceholder&gt; markupContentPlaceholdersList)
		{
			List&lt;ComponentContentPlaceholder&gt; updatedAssetContentPlaceholderList = new List&lt;ComponentContentPlaceholder&gt;();

			//GO THROUGH ASSET AND IF A COMPONENT WITH THAT LABEL AND CATEGORY DOES NOT EXIST IN MARKUP DELETE IT
			foreach (ComponentContentPlaceholder assetContentPlaceholder in assetContentPlaceholdersList)
			{
				String name = assetContentPlaceholder.name;
				ContentPlaceholderCategory category = assetContentPlaceholder.category;

				//if (existsInComponentContentPlaceholderList(name, category, markupContentPlaceholdersList))
				ComponentContentPlaceholder markupMatch = markupContentPlaceholdersList.FirstOrDefault(x =&gt; x.name == name &amp;&amp; x.category == category);
				if (markupMatch != null)
				{
					ComponentContentPlaceholder tempNewComponentContentPlaceholder = assetContentPlaceholder;
					if (tempNewComponentContentPlaceholder.category == ContentPlaceholderCategory.List)
					{
						tempNewComponentContentPlaceholder.subComponents = deleteExistingContentFieldsForComponentsHelper(assetContentPlaceholder.subComponents, markupMatch.subComponents);
					}

					updatedAssetContentPlaceholderList.Add(tempNewComponentContentPlaceholder);
				}
			}

			assetContentPlaceholdersList = updatedAssetContentPlaceholderList;
		}

		public static List&lt;ComponentContentPlaceholder&gt; deleteExistingContentFieldsForComponentsHelper(List&lt;ComponentContentPlaceholder&gt; assetContentPlaceholdersList, List&lt;ComponentContentPlaceholder&gt; markupContentPlaceholdersList)
		{
			List&lt;ComponentContentPlaceholder&gt; updatedAssetContentPlaceholderList = new List&lt;ComponentContentPlaceholder&gt;();

			//GO THROUGH ASSET AND IF A COMPONENT WITH THAT LABEL AND CATEGORY DOES NOT EXIST IN MARKUP DELETE IT
			foreach (ComponentContentPlaceholder assetContentPlaceholder in assetContentPlaceholdersList)
			{
				String name = assetContentPlaceholder.name;
				ContentPlaceholderCategory category = assetContentPlaceholder.category;
				//if (existsInComponentContentPlaceholderList(name, category, markupContentPlaceholdersList))
				ComponentContentPlaceholder markupMatch = markupContentPlaceholdersList.FirstOrDefault(x =&gt; x.name == assetContentPlaceholder.name &amp;&amp; x.category == assetContentPlaceholder.category);
				if (markupMatch != null)
				{
					ComponentContentPlaceholder tempNewComponentContentPlaceholder = assetContentPlaceholder;
					if (tempNewComponentContentPlaceholder.category == ContentPlaceholderCategory.List)
					{
						tempNewComponentContentPlaceholder.subComponents = deleteExistingContentFieldsForComponentsHelper(assetContentPlaceholder.subComponents, markupMatch.subComponents);
					}

					updatedAssetContentPlaceholderList.Add(tempNewComponentContentPlaceholder);
				}
			}

			return updatedAssetContentPlaceholderList;
		}

		public static bool existsInComponentContentPlaceholderList(String name, ContentPlaceholderCategory category, List&lt;ComponentContentPlaceholder&gt; componentContentPlaceholderList)
		{
			return findInComponentContentPlaceholderList(name, category, componentContentPlaceholderList) != null;
		}

		public static ComponentContentPlaceholder findInComponentContentPlaceholderList(String name, ContentPlaceholderCategory category, List&lt;ComponentContentPlaceholder&gt; componentContentPlaceholderList)
		{
			ComponentContentPlaceholder match = null;

			List&lt;ComponentContentPlaceholder&gt; flattenedList = flattenComponentContentPlaceholderList(componentContentPlaceholderList);

			return flattenedList.FirstOrDefault(x =&gt; x.name == name &amp;&amp; x.category == category);

			//if (componentContentPlaceholderList != null)
			//{
			//    foreach (ComponentContentPlaceholder ccp in componentContentPlaceholderList)
			//    {
			//        if (ccp.name == name &amp;&amp; category == ccp.category)
			//        {
			//            return ccp;
			//        }
			//        else if(ccp.category == ContentPlaceholderCategory.List)
			//        {
			//            match = findInComponentContentPlaceholderList(name, category, ccp.subComponents);
			//        }
			//    }
			//}

			//return match;
		}

		public static List&lt;ComponentContentPlaceholder&gt; flattenComponentContentPlaceholderList(List&lt;ComponentContentPlaceholder&gt; componentContentPlaceholderList)
		{
			List&lt;ComponentContentPlaceholder&gt; newList = new List&lt;ComponentContentPlaceholder&gt;();

			foreach (ComponentContentPlaceholder ccp in componentContentPlaceholderList)
			{
				newList.Add(ccp);

				if (ccp.category == ContentPlaceholderCategory.List)
				{
					newList.AddRange(flattenComponentContentPlaceholderList(ccp.subComponents));
				}
			}

			return newList;
		}

		public static void updateExistingContentFields(ref List&lt;ComponentContentPlaceholder&gt; assetContentPlaceholdersList, List&lt;ComponentContentPlaceholder&gt; markupContentPlaceholdersList)
		{
			foreach (ComponentContentPlaceholder assetContentPlaceholder in assetContentPlaceholdersList)
			{
				String name = assetContentPlaceholder.name;
				ContentPlaceholderCategory category = assetContentPlaceholder.category;

				ComponentContentPlaceholder markupMatch = findInComponentContentPlaceholderList(name, category, markupContentPlaceholdersList);

				if (markupMatch != null)
				{
					if (markupMatch.category == ContentPlaceholderCategory.Component)
					{
						if (markupMatch.typeInMarkup)
						{
							assetContentPlaceholder.typeInMarkup = markupMatch.typeInMarkup;
							assetContentPlaceholder.type = markupMatch.type;
						}
						else
						{
							assetContentPlaceholder.typeInMarkup = false;
							//if there is no type currently specified in the asset's content then set as default type
							if (String.IsNullOrWhiteSpace(assetContentPlaceholder.type))
							{
								assetContentPlaceholder.type = getDefaultContentPlaceholderType();
							}
						}
						assetContentPlaceholder.fieldIndexed = markupMatch.fieldIndexed;
					}
					else if (markupMatch.category == ContentPlaceholderCategory.List)
					{
						assetContentPlaceholder.content = markupMatch.content;
						assetContentPlaceholder.components = markupMatch.components;
						assetContentPlaceholder.subComponents = updateExistingContentFieldsHelper(assetContentPlaceholder.subComponents, markupContentPlaceholdersList);
					}
				}
			}
		}

		public static List&lt;ComponentContentPlaceholder&gt; updateExistingContentFieldsHelper(List&lt;ComponentContentPlaceholder&gt; assetContentPlaceholdersList, List&lt;ComponentContentPlaceholder&gt; markupContentPlaceholdersList)
		{
			foreach (ComponentContentPlaceholder assetContentPlaceholder in assetContentPlaceholdersList)
			{
				String name = assetContentPlaceholder.name;
				ContentPlaceholderCategory category = assetContentPlaceholder.category;

				ComponentContentPlaceholder markupMatch = findInComponentContentPlaceholderList(name, category, markupContentPlaceholdersList);

				if (markupMatch != null)
				{
					if (markupMatch.category == ContentPlaceholderCategory.Component)
					{
						if (markupMatch.typeInMarkup)
						{
							assetContentPlaceholder.typeInMarkup = markupMatch.typeInMarkup;
							assetContentPlaceholder.type = markupMatch.type;
						}
						else
						{
							assetContentPlaceholder.typeInMarkup = false;
							//if there is no type currently specified in the asset's content then set as default type
							if (String.IsNullOrWhiteSpace(assetContentPlaceholder.type))
							{
								assetContentPlaceholder.type = getDefaultContentPlaceholderType();
							}
						}
					}
					else if (markupMatch.category == ContentPlaceholderCategory.List)
					{
						assetContentPlaceholder.content = markupMatch.content;
						assetContentPlaceholder.components = markupMatch.components;
						assetContentPlaceholder.subComponents = updateExistingContentFieldsHelper(assetContentPlaceholder.subComponents, markupContentPlaceholdersList);
					}
				}
			}

			return assetContentPlaceholdersList;
		}

		public static void createContentFieldsForComponents(ref List&lt;ComponentContentPlaceholder&gt; assetContentPlaceholdersList, List&lt;ComponentContentPlaceholder&gt; markupContentPlaceholdersList, List&lt;ComponentContentPlaceholder&gt; flattenedAssetcontentPlaceholders)
		{
			foreach (ComponentContentPlaceholder markupPlaceholder in markupContentPlaceholdersList)
			{
				if (!assetContentPlaceholdersList.Any(x =&gt; x.name == markupPlaceholder.name &amp;&amp; x.category == markupPlaceholder.category))
				{
					ComponentContentPlaceholder contentPlaceholderToAdd = markupPlaceholder;

					ComponentContentPlaceholder flattenedAssetContentPlaceholderMatch = flattenedAssetcontentPlaceholders.FirstOrDefault(x =&gt; x.name == contentPlaceholderToAdd.name &amp;&amp; x.category == contentPlaceholderToAdd.category);
					if (flattenedAssetContentPlaceholderMatch != null)
					{
						contentPlaceholderToAdd.message = flattenedAssetContentPlaceholderMatch.message;
						contentPlaceholderToAdd.messageType = flattenedAssetContentPlaceholderMatch.messageType;
						contentPlaceholderToAdd.inputLabel = flattenedAssetContentPlaceholderMatch.inputLabel;
						contentPlaceholderToAdd.inputLabelType = flattenedAssetContentPlaceholderMatch.inputLabelType;

						if (contentPlaceholderToAdd.category == ContentPlaceholderCategory.List)
						{
							contentPlaceholderToAdd.maxPanels = flattenedAssetContentPlaceholderMatch.maxPanels;
							contentPlaceholderToAdd.minPanels = flattenedAssetContentPlaceholderMatch.minPanels;
							contentPlaceholderToAdd.subComponents = createContentFieldsForComponentsSubListHelper(contentPlaceholderToAdd.subComponents, flattenedAssetcontentPlaceholders);
						}
						else
						{
							contentPlaceholderToAdd.isRequired = flattenedAssetContentPlaceholderMatch.isRequired;
							contentPlaceholderToAdd.isRequiredMessage = flattenedAssetContentPlaceholderMatch.isRequiredMessage;
							contentPlaceholderToAdd.hardcodedSnippet = flattenedAssetContentPlaceholderMatch.hardcodedSnippet;
							contentPlaceholderToAdd.fieldIndexed = flattenedAssetContentPlaceholderMatch.fieldIndexed;
						}
					}

					assetContentPlaceholdersList.Add(markupPlaceholder);
				}
				else
				{
					if (markupPlaceholder.category == ContentPlaceholderCategory.List)
					{
						for (int x = 0; x &lt; assetContentPlaceholdersList.Count; x++)
						{
							if (assetContentPlaceholdersList[x].name == markupPlaceholder.name &amp;&amp; assetContentPlaceholdersList[x].category == markupPlaceholder.category)
							{
								assetContentPlaceholdersList[x].subComponents = createContentFieldsForComponentsHelper(assetContentPlaceholdersList[x].subComponents, markupPlaceholder.subComponents, flattenedAssetcontentPlaceholders);
							}
						}
					}
				}
			}
		}

		public static List&lt;ComponentContentPlaceholder&gt; createContentFieldsForComponentsSubListHelper(List&lt;ComponentContentPlaceholder&gt; contentPlaceholderSubList, List&lt;ComponentContentPlaceholder&gt; flattenedAssetcontentPlaceholders)
		{
			foreach (ComponentContentPlaceholder subItem in contentPlaceholderSubList)
			{
				ComponentContentPlaceholder flattenedAssetContentPlaceholderMatch = flattenedAssetcontentPlaceholders.FirstOrDefault(x =&gt; x.name == subItem.name &amp;&amp; x.category == subItem.category);
				if (flattenedAssetContentPlaceholderMatch != null)
				{
					subItem.message = flattenedAssetContentPlaceholderMatch.message;
					subItem.messageType = flattenedAssetContentPlaceholderMatch.messageType;
					subItem.inputLabel = flattenedAssetContentPlaceholderMatch.inputLabel;
					subItem.inputLabelType = flattenedAssetContentPlaceholderMatch.inputLabelType;

					if (subItem.category == ContentPlaceholderCategory.List)
					{
						subItem.maxPanels = flattenedAssetContentPlaceholderMatch.maxPanels;
						subItem.minPanels = flattenedAssetContentPlaceholderMatch.minPanels;
						subItem.subComponents = createContentFieldsForComponentsSubListHelper(subItem.subComponents, flattenedAssetcontentPlaceholders);
					}
					else
					{
						subItem.isRequired = flattenedAssetContentPlaceholderMatch.isRequired;
						subItem.isRequiredMessage = flattenedAssetContentPlaceholderMatch.isRequiredMessage;
						subItem.fieldIndexed = flattenedAssetContentPlaceholderMatch.fieldIndexed;
					}
				}
			}

			return contentPlaceholderSubList;
		}

		public static List&lt;ComponentContentPlaceholder&gt; createContentFieldsForComponentsHelper(List&lt;ComponentContentPlaceholder&gt; assetContentPlaceholdersList, List&lt;ComponentContentPlaceholder&gt; markupContentPlaceholdersList, List&lt;ComponentContentPlaceholder&gt; flattenedAssetcontentPlaceholders)
		{
			foreach (ComponentContentPlaceholder markupPlaceholder in markupContentPlaceholdersList)
			{
				if (!assetContentPlaceholdersList.Any(x =&gt; x.name == markupPlaceholder.name &amp;&amp; x.category == markupPlaceholder.category))
				{
					ComponentContentPlaceholder contentPlaceholderToAdd = markupPlaceholder;

					ComponentContentPlaceholder flattenedAssetContentPlaceholderMatch = flattenedAssetcontentPlaceholders.FirstOrDefault(x =&gt; x.name == contentPlaceholderToAdd.name &amp;&amp; x.category == contentPlaceholderToAdd.category);
					if (flattenedAssetContentPlaceholderMatch != null)
					{
						contentPlaceholderToAdd.message = flattenedAssetContentPlaceholderMatch.message;
						contentPlaceholderToAdd.messageType = flattenedAssetContentPlaceholderMatch.messageType;
						contentPlaceholderToAdd.inputLabel = flattenedAssetContentPlaceholderMatch.inputLabel;
						contentPlaceholderToAdd.inputLabelType = flattenedAssetContentPlaceholderMatch.inputLabelType;

						if (contentPlaceholderToAdd.category == ContentPlaceholderCategory.List)
						{
							contentPlaceholderToAdd.maxPanels = flattenedAssetContentPlaceholderMatch.maxPanels;
							contentPlaceholderToAdd.minPanels = flattenedAssetContentPlaceholderMatch.minPanels;
							contentPlaceholderToAdd.subComponents = createContentFieldsForComponentsSubListHelper(contentPlaceholderToAdd.subComponents, flattenedAssetcontentPlaceholders);
						}
						else
						{
							contentPlaceholderToAdd.isRequired = flattenedAssetContentPlaceholderMatch.isRequired;
							contentPlaceholderToAdd.isRequiredMessage = flattenedAssetContentPlaceholderMatch.isRequiredMessage;
							contentPlaceholderToAdd.hardcodedSnippet = flattenedAssetContentPlaceholderMatch.hardcodedSnippet;
							contentPlaceholderToAdd.fieldIndexed = flattenedAssetContentPlaceholderMatch.fieldIndexed;
						}
					}

					assetContentPlaceholdersList.Add(markupPlaceholder);
				}
				else
				{
					if (markupPlaceholder.category == ContentPlaceholderCategory.List)
					{
						for (int x = 0; x &lt; assetContentPlaceholdersList.Count; x++)
						{
							if (assetContentPlaceholdersList[x].name == markupPlaceholder.name &amp;&amp;
									assetContentPlaceholdersList[x].category == markupPlaceholder.category)
							{
								assetContentPlaceholdersList[x].subComponents = createContentFieldsForComponentsHelper(assetContentPlaceholdersList[x].subComponents, markupPlaceholder.subComponents, flattenedAssetcontentPlaceholders);
							}
						}
					}
				}
			}

			return assetContentPlaceholdersList;
		}

		/// &lt;summary&gt;
		/// Delets any content fields that no longer exist in the markup of the component asset.
		/// &lt;/summary&gt;
		/// &lt;param name="asset"&gt;The component asset&lt;/param&gt;
		public static void old_deleteExistingContentFieldsForComponents(ref Asset asset)
		{
			Out.DebugWriteLine("Begin deleteExistingContentFieldsForComponents()...");

			Dictionary&lt;String, String&gt; currentContentFieldLabels = asset.GetContent().Where(x =&gt; x.Key.StartsWith("component_component_label") || x.Key.StartsWith("component_list_label")).ToDictionary(x =&gt; x.Key, x =&gt; x.Value);

			List&lt;String&gt; contentFieldsToDelete = new List&lt;string&gt;();

			Regex rxContent = getContentFieldRegex(ContentNodeType.Content);

			Regex rxList = getContentFieldRegex(ContentNodeType.ListNode);

			MatchCollection contentMatches = rxContent.Matches(asset["markup"]);

			List&lt;String&gt; matches = new List&lt;string&gt;();

			foreach (Match cm in contentMatches)
			{
				matches.Add(getContentPlaceholderName(cm.Value));
			}

			MatchCollection listMatches = rxList.Matches(asset["markup"]);

			foreach (Match lm in listMatches)
			{
				matches.Add(getAttribValueFromComponentMarkup(lm.Value, "name"));
			}

			Out.DebugWriteLine("{0} matches found....", matches.Count);
			//FOR EACH CONTENT FIELD...
			foreach (String fieldLabelKey in currentContentFieldLabels.Keys)
			{
				//IF NO CONENT FIELD IN THE MARKUP MATCHES THE CURRENT CONTENT FIELD VALUE...
				if (!matches.Any(x =&gt; x == currentContentFieldLabels[fieldLabelKey]))
				{
					//Out.DebugWriteLine(fieldLabelKey);
					if (fieldLabelKey.Contains(":"))
					{
						int componentIndex = getContentFieldIndex(fieldLabelKey);
						//Out.DebugWriteLine("componentIndex: " + componentIndex);                                                
						List&lt;String&gt; temp = asset.GetContent().Where(x =&gt; x.Key.StartsWith("component_") &amp;&amp; getContentFieldIndex(x.Key) == componentIndex).Select(x =&gt; x.Key).ToList();

						Out.DebugWriteLine("Deleting Content Fields...");
						foreach (String s in temp)
						{
							Out.DebugWriteLine(s);
						}
						Out.DebugWriteLine("End deleted content fields");

						asset.DeleteContentFields(temp);
					}
					else
					{
						//case for where it is the only content field.
						List&lt;String&gt; temp = asset.GetContent().Where(x =&gt; x.Key.StartsWith("component_")).Select(x =&gt; x.Key).ToList();
						asset.DeleteContentFields(temp);
					}
				}
			}

			Out.DebugWriteLine("deleteExistingContentFieldsForComponents()... COMPLETED!");
		}

		/// &lt;summary&gt;
		/// Consildates the remaining content fields after the deleteExistingContentFieldsForComponents function is called. 
		/// &lt;/summary&gt;
		/// &lt;param name="asset"&gt;The component asset&lt;/param&gt;
		/// &lt;returns&gt;returns the index of the panel that was last created during consolidation&lt;/returns&gt;
		public static int old_consolidateCurrentContentFields(ref Asset asset)
		{
			Out.DebugWriteLine("Begin consolidateCurrentContentFields()...");

			int count = 1;

			Dictionary&lt;String, String&gt; currentContentFieldLabels = asset.GetContent().Where(x =&gt; x.Key.StartsWith("component_panel")).ToDictionary(x =&gt; x.Key, x =&gt; x.Value);

			if (currentContentFieldLabels.Keys.Count == 1)
			{
				String panelKey = currentContentFieldLabels.Keys.First();

				Out.DebugWriteLine("Only one existing content field found= " + panelKey + " : " + currentContentFieldLabels[panelKey]);

				bool moreThenOneComponentInMarkup = (getTotalComponentCount(asset["markup"]) &gt; 1);

				if (panelKey.Contains(":"))
				{
					if (moreThenOneComponentInMarkup)
					{
						Dictionary&lt;String, String&gt; fieldsToRemove = asset.GetContent().Where(x =&gt; x.Key.StartsWith("component_")).ToDictionary(x =&gt; x.Key, x =&gt; x.Value);

						Dictionary&lt;String, String&gt; fieldsToCreate = new Dictionary&lt;string, string&gt;();

						foreach (String fieldToRemoveKey in fieldsToRemove.Keys)
						{
							if (fieldToRemoveKey.StartsWith("component_panel"))
							{
								//special case where we need to set the value to 0 as it is the only panel
								fieldsToCreate.Add(fieldToRemoveKey.Substring(0, fieldToRemoveKey.LastIndexOf(":") + 1) + "1", "0");
							}
							else
							{
								//creates a new field with the same value but with the index set to 1
								fieldsToCreate.Add(fieldToRemoveKey.Substring(0, fieldToRemoveKey.LastIndexOf(":") + 1) + "1", fieldsToRemove[fieldToRemoveKey]);
							}
						}

						displayContent(fieldsToRemove);
						asset.DeleteContentFields(fieldsToRemove.Keys.ToList());
						asset.SaveContent(fieldsToCreate);
						count++;
					}
					else
					{
						int contentFieldIndex = getContentFieldIndex(panelKey);

						Dictionary&lt;String, String&gt; fieldsToRemove = asset.GetContent().Where(x =&gt; x.Key.StartsWith("component_") &amp;&amp; getContentFieldIndex(x.Key) == contentFieldIndex).ToDictionary(x =&gt; x.Key, x =&gt; x.Value);

						Dictionary&lt;String, String&gt; fieldsToCreate = new Dictionary&lt;string, string&gt;();

						foreach (String fieldToRemoveKey in fieldsToRemove.Keys)
						{
							if (fieldToRemoveKey.StartsWith("component_panel"))
							{
								//special case where we need to set the value to 0 as it is the only panel
								fieldsToCreate.Add(fieldToRemoveKey.Substring(0, fieldToRemoveKey.LastIndexOf(":")), "0");
							}
							else
							{
								//creates a new field with the same value but with the :# removed from the key
								fieldsToCreate.Add(fieldToRemoveKey.Substring(0, fieldToRemoveKey.LastIndexOf(":")), fieldsToRemove[fieldToRemoveKey]);
							}
						}

						displayContent(fieldsToRemove);
						asset.DeleteContentFields(fieldsToRemove.Keys.ToList());
						asset.SaveContent(fieldsToCreate);
						count++;
					}
				}
				else if (moreThenOneComponentInMarkup)
				{


					Dictionary&lt;String, String&gt; fieldsToRemove = asset.GetContent().Where(x =&gt; x.Key.StartsWith("component_")).ToDictionary(x =&gt; x.Key, x =&gt; x.Value);

					Dictionary&lt;String, String&gt; fieldsToCreate = new Dictionary&lt;string, string&gt;();

					foreach (String fieldToRemoveKey in fieldsToRemove.Keys)
					{
						if (fieldToRemoveKey.StartsWith("component_panel"))
						{
							//special case where we need to set the value to 0 as it is the only panel
							fieldsToCreate.Add(fieldToRemoveKey + ":" + "1", "0");
						}
						else
						{
							//creates a new field with the same value but with the :# removed from the key
							fieldsToCreate.Add(fieldToRemoveKey + ":" + "1", fieldsToRemove[fieldToRemoveKey]);
						}
					}

					displayContent(fieldsToRemove);
					asset.DeleteContentFields(fieldsToRemove.Keys.ToList());
					asset.SaveContent(fieldsToCreate);
					count++;
				}
			}
			else
			{
				foreach (String panelKey in currentContentFieldLabels.Keys)
				{
					Out.DebugWriteLine("Current conent field: " + panelKey);

					if (getContentFieldIndex(panelKey) == count)
					{
						count++;
					}
					else
					{
						if (panelKey.Contains(":"))
						{
							int contentFieldIndex = getContentFieldIndex(panelKey);

							Dictionary&lt;String, String&gt; fieldsToRemove = asset.GetContent().Where(x =&gt; x.Key.StartsWith("component_") &amp;&amp; getContentFieldIndex(x.Key) == contentFieldIndex).ToDictionary(x =&gt; x.Key, x =&gt; x.Value);

							Dictionary&lt;String, String&gt; fieldsToCreate = new Dictionary&lt;string, string&gt;();

							foreach (String fieldToRemoveKey in fieldsToRemove.Keys)
							{
								if (fieldToRemoveKey.StartsWith("component_panel"))
								{
									//special case where we need to set the value to 0 as it is the only panel
									fieldsToCreate.Add(fieldToRemoveKey.Substring(0, fieldToRemoveKey.LastIndexOf(":") + 1) + count.ToString(), (count - 1).ToString());
								}
								else
								{
									//creates a new field with the same value but with the :# removed from the key
									fieldsToCreate.Add(fieldToRemoveKey.Substring(0, fieldToRemoveKey.LastIndexOf(":") + 1) + count.ToString(), fieldsToRemove[fieldToRemoveKey]);
								}
							}

							displayContent(fieldsToRemove);
							asset.DeleteContentFields(fieldsToRemove.Keys.ToList());
							asset.SaveContent(fieldsToCreate);
							count++;
						}
						else
						{
							Dictionary&lt;String, String&gt; fieldsToRemove = asset.GetContent().Where(x =&gt; x.Key.StartsWith("component_")).ToDictionary(x =&gt; x.Key, x =&gt; x.Value);

							Dictionary&lt;String, String&gt; fieldsToCreate = new Dictionary&lt;string, string&gt;();

							foreach (String fieldToRemoveKey in fieldsToRemove.Keys)
							{
								if (fieldToRemoveKey.StartsWith("component_panel"))
								{
									//special case where we need to set the value to 0 as it is the only panel
									fieldsToCreate.Add(fieldToRemoveKey + ":" + count.ToString(), (count - 1).ToString());
								}
								else
								{
									//creates a new field with the same value but with the :# removed from the key
									fieldsToCreate.Add(fieldToRemoveKey + ":" + count.ToString(), fieldsToRemove[fieldToRemoveKey]);
								}
							}

							displayContent(fieldsToRemove);
							asset.DeleteContentFields(fieldsToRemove.Keys.ToList());
							asset.SaveContent(fieldsToCreate);
							count++;
						}
					}
				}
			}

			Out.DebugWriteLine("consolidateCurrentContentFields()... COMPLETED!");

			return count;
		}

		/// &lt;summary&gt;
		/// Constructs the component's class file name using the parameters
		/// &lt;/summary&gt;
		/// &lt;param name="type"&gt;Specifies if you want the base class file or the override class file name&lt;/param&gt;
		/// &lt;param name="componentClassName"&gt;The component's name in class case&lt;/param&gt;
		/// &lt;returns&gt;the component's class file name&lt;/returns&gt;
		public static String createComponentClassFileName(String componentClassName, ComponentClassNameType type)
		{

			return xComponentNamespace + "_" + componentClassName + (type == ComponentClassNameType.Base ? "Base" : "") + ".cs";
		}

		/// &lt;summary&gt;
		/// Function delets the code file of the corresponding component asset.
		/// &lt;/summary&gt;
		/// &lt;param name="asset"&gt;The component asset for which the corresponding code file should be deleted&lt;/param&gt;
		public static void deleteCodeFile(Asset asset)
		{
			Asset componentLibraryClassFolder = getComponentLibraryClassFolder(asset);

			String codeFileName = createComponentClassFileName(asset["class_name"], ComponentClassNameType.Base);

			FilterParams fParams = new FilterParams();
			fParams.ExcludeProjectTypes = false;
			fParams.Add(AssetPropertyNames.Label, Comparison.Equals, codeFileName);

			List&lt;Asset&gt; matchingCodeFiles = componentLibraryClassFolder.GetFilterList(fParams);

			if (matchingCodeFiles.Count &lt; 1)
			{
				Out.DebugWriteLine("No matching class files found for component \"" + codeFileName + "\"");
			}
			else if (matchingCodeFiles.Count &gt; 1)
			{
				Out.DebugWriteLine("Multiple matching code files found...");
				foreach (Asset mcf in matchingCodeFiles)
				{
					Out.DebugWriteLine(mcf.AssetPath.ToString());
				}
			}
			else
			{
				Asset libraryFile = matchingCodeFiles[0];
				//Regex rx = new Regex(@"_v[0-9]*\.cs$");
				//MatchCollection matches = rx.Matches(libraryFile.Label);

				//if (matches.Count != 1)
				//{
				//Out.DebugWriteLine("Should delete but just renaming for testing purposes...");
				//Out.DebugWriteLine("no version number detected... starting from _v1");
				//libraryFile.Rename(libraryFile.Label.Substring(0, libraryFile.Label.LastIndexOf("."))  + "_v1.cs");
				libraryFile.Delete();
				//}
				//else
				//{
				//String versionString = matches[0].Value;
				//int versionNumber = Convert.ToInt32(versionString.Substring(2, versionString.Length - 2));
				//Out.DebugWriteLine("Should delete but just renaming for testing purposes...");
				//libraryFile.Rename(libraryFile.Label.Substring(0, libraryFile.Label.LastIndexOf(".")) + "_v" + (++versionNumber).ToString() + ".cs");
				//libraryFile.Delete();
				//}
			}
		}

		/// &lt;summary&gt;
		/// Creates a library code file using the provided component asset
		/// &lt;/summary&gt;
		/// &lt;param name="asset"&gt;The component asset for which a corresponding code file should be created&lt;/param&gt;
		/// /// &lt;param name="recompileSuccessful"&gt;Used to verify if the library code file is compiled &lt;/param&gt;
		/// &lt;returns&gt;&lt;/returns&gt;
		public static Asset createCodeFile(Asset asset, bool deferCompilation, ref bool recompileSuccessful, String currentPanelName = "")
		{
			#region initializations

			Asset componentLibraryConfig = getComponentLibraryConfig(asset);

			Asset componentLibraryClassFolder = getComponentLibraryClassFolder(asset);

			String componentLibraryNamespace = getComponentLibraryNamespace(asset);

			String className = asset["class_name"];

			currentPanelName = currentPanelName == "" ? "component_panel" : currentPanelName;

			StringBuilder childComponentInitialization = new StringBuilder();

			StringBuilder childComponents = new StringBuilder();

			StringBuilder inputFunctionCode = new StringBuilder();

			StringBuilder inputHelperFunctionCode = new StringBuilder();

			StringBuilder postInputFunctionCode = new StringBuilder();

			StringBuilder postInputHelperFunctionCode = new StringBuilder();

			StringBuilder outputFunctionCode = new StringBuilder();

			StringBuilder outputHelperFunctionCode = new StringBuilder();

			StringBuilder jsonFunctionCode = new StringBuilder();

			StringBuilder jsonHelperFunctionCode = new StringBuilder();

			StringBuilder indexedFieldsFunctionCode = new StringBuilder();

			List&lt;PanelEntry&gt; componentPanels = asset.GetPanels("component_panel");

			int listCount = 0;

			#endregion

			var createJsonComponent = asset.Raw["json_component"] == "yes";

			// Changed 2020-10-08 issue #57, specify field names in all JSON output
			var isSingleList = false; // componentPanels.Count == 1 &amp;&amp; componentPanels[0]["component_category"] != "component";
			if (!isSingleList)
			{
				jsonFunctionCode.AppendFormat(moarTabs(3) + "sbJson.Append(\"{{\");{0}", newLineChar);
			}

			for (int index = 0; index &lt; componentPanels.Count; index++)
			{
				PanelEntry pe = componentPanels[index];

				if (index &gt; 0) jsonFunctionCode.AppendFormat(moarTabs(3) + "sbJson.Append(\",\");{0}", newLineChar);

				if (pe["component_category"] == "component")
				{
					#region component logic

					String fieldName = pe["component_component_label"];
					String fieldLabelOverride = pe["component_component_input_label"];
					String requiredMessage = pe["component_component_required_message"];
					String fieldType = pe["component_component_type"];
					String fieldIndexed = pe["component_component_indexed"];
					String wrapInControlGroup = pe["component_component_form_override_type"];
					String messageContent = pe["component_component_message_content"];
					String messageType = pe["component_component_message_type"];
					if (string.IsNullOrWhiteSpace(messageType)) messageType = "basic";
					String codeSnippet = String.IsNullOrWhiteSpace(pe["component_component_hardcoded_snippet"]) ? "\"\"" : pe["component_component_hardcoded_snippet"];
					String componentHtml = getContentPlaceholderMarkup(fieldName, ContentNodeType.Content, asset["markup"]);

					if (fieldType != "Code")
					{
						//DECLARATION CODE
						childComponents.AppendFormat(moarTabs(2) + "public {0} {1} {{ get; set; }}{2}", fieldType, fieldName, newLineChar);

						//INITIALIZATION CODE
						childComponentInitialization.AppendFormat(moarTabs(3) + "{0} = new {1}();{2}", fieldName, fieldType, newLineChar);


						//INPUT CODE
						if (getCoreComponentTypes(asset).Contains(fieldType))
						{
							if (!String.IsNullOrWhiteSpace(messageContent))
							{
								inputFunctionCode.AppendFormat(moarTabs(3) + "Input.ShowMessage(\"{0}\", MessageType.{1});{2}", messageContent, labelize(messageType), newLineChar);
							}

							if (fieldType != "Code")
							{
								inputFunctionCode.AppendFormat(
										moarTabs(3) + "this.{0}.ComponentInput(asset, context, label + \" {1}\", name + \"_{2}\");{3}", fieldName,
										String.IsNullOrWhiteSpace(fieldLabelOverride) ? labelize(fieldName) : fieldLabelOverride,
										fieldName.ToLower(), newLineChar);
							}
						}
						else
						{
							if (wrapInControlGroup == "control_group")
							{
								inputFunctionCode.AppendFormat(moarTabs(3) + "Input.StartControlPanel(\"{0}\");{1}", fieldLabelOverride, newLineChar);
								if (!String.IsNullOrWhiteSpace(messageContent))
								{
									inputFunctionCode.AppendFormat(moarTabs(3) + "Input.ShowMessage(\"{0}\", MessageType.{1});{2}", messageContent, labelize(messageType), newLineChar);
								}
								inputFunctionCode.AppendFormat(moarTabs(3) + "this.{0}.ComponentInput(asset, context, label, name + \"_{1}\");{2}", fieldName, fieldName.ToLower(), newLineChar);
								inputFunctionCode.AppendFormat(moarTabs(3) + "Input.EndControlPanel();");
							}
							else
							{
								if (!String.IsNullOrWhiteSpace(messageContent))
								{
									inputFunctionCode.AppendFormat(moarTabs(3) + "Input.ShowMessage(\"{0}\", MessageType.{1});{2}", messageContent, labelize(messageType), newLineChar);
								}
								inputFunctionCode.AppendFormat(moarTabs(3) + "this.{0}.ComponentInput(asset, context, label + \" {1}\", name + \"_{2}\");{3}", fieldName, fieldLabelOverride.Trim(), fieldName.ToLower(), newLineChar);
							}
						}

						//POST_INPUT CODE
						#region post_input code
						if (fieldType != "Code")
						{
							if (pe["component_component_required"] == "yes")
							{
								//special case for image because Image class has a _image sufix. Should fix but will need to update all current content because it will break.
								if (fieldType == "Src")
								{
									postInputFunctionCode.AppendFormat(moarTabs(3) + "if (String.IsNullOrWhiteSpace(context.InputForm[name + \"_{0}_image\" + index])) {{ context.ValidationErrorFields.Add(name + \"_{0}_image\" + index, \"{1}\"); }} {2}", fieldName.ToLower(), requiredMessage, newLineChar);
								}
								else if (fieldType == "Href")
								{
									postInputFunctionCode.AppendFormat(moarTabs(3) + "if (context.InputForm[name + \"_{0}_link_type\" + index] == \"Internal\"){1}", fieldName.ToLower(), newLineChar);
									postInputFunctionCode.AppendFormat(moarTabs(3) + "{{ {0}", newLineChar);
									postInputFunctionCode.AppendFormat(moarTabs(4) + "if (String.IsNullOrWhiteSpace(context.InputForm[name + \"_{0}_link_internal\" + index])) {{ context.ValidationErrorFields.Add(name + \"_{0}_link_internal\" + index, \"{1}\"); }} {2}", fieldName.ToLower(), requiredMessage, newLineChar);
									postInputFunctionCode.AppendFormat(moarTabs(3) + "}} {0}", newLineChar);
									postInputFunctionCode.AppendFormat(moarTabs(3) + "if (context.InputForm[name + \"_{0}_link_type\" + index] == \"External\"){1}", fieldName.ToLower(), newLineChar);
									postInputFunctionCode.AppendFormat(moarTabs(3) + "{{ {0}", newLineChar);
									postInputFunctionCode.AppendFormat(moarTabs(4) + "if (String.IsNullOrWhiteSpace(context.InputForm[name + \"_{0}_link_external\" + index])) {{ context.ValidationErrorFields.Add(name + \"_{0}_link_external\" + index, \"{1}\"); }} {2}", fieldName.ToLower(), requiredMessage, newLineChar);
									postInputFunctionCode.AppendFormat(moarTabs(3) + "}} {0}", newLineChar);
								}
								else
								{
									postInputFunctionCode.AppendFormat(moarTabs(3) + "if (String.IsNullOrWhiteSpace(context.InputForm[name + \"_{0}\" + index])) {{ context.ValidationErrorFields.Add(name + \"_{0}\" + index, \"{1}\"); }} {2}", fieldName.ToLower(), requiredMessage, newLineChar);
								}
							}

							if (!ComponentLibraryHelper.getCoreComponentTypes(asset).Contains(fieldType))
							{
								postInputFunctionCode.AppendFormat(moarTabs(3) + "this.{0}.ComponentPostInput(asset, context, name + \"_{0}\" + index);{1}", fieldName, newLineChar);
							}
						}
						#endregion

						//OUTPUT CODE
						outputFunctionCode.AppendFormat(moarTabs(3) + "sbContent.Replace(@\"{3}\", this.{0}.ComponentOutput(asset, context, name + \"_{1}\", index, isDrag));{2}", fieldName, fieldName.ToLower(), newLineChar, componentHtml.Replace("\"", "\"\""));

						//JSON CODE
						jsonFunctionCode.AppendFormat(moarTabs(3) + "sbJson.AppendFormat(\"\\\"{{0}}\\\":{{1}}\", JsonHelper.StringToJson(\"{0}\"), this.{0}.ComponentJson(asset, context, name + \"_{1}\", index));{2}", fieldName, fieldName.ToLower(), newLineChar);

						//INDEXED FIELDS CODE
						indexedFieldsFunctionCode.AppendFormat(moarTabs(3) + "fields.AddRange(this.{0}.ComponentIndexedFields(asset, context, name + \"_{1}\", index));{2}", fieldName, fieldName.ToLower(), newLineChar);
						if (!string.IsNullOrWhiteSpace(fieldIndexed))
						{
							indexedFieldsFunctionCode.AppendFormat(moarTabs(3) + "fields.Add(new IndexedField(SearchG2FieldType.{0}, name + \"_{1}\" + index));{2}", fieldIndexed, fieldName.ToLower(), newLineChar);
						}
					}
					else
					{
						outputFunctionCode.AppendFormat("{0}sbContent.Replace(@\"{1}\", {2});{3}", moarTabs(3), componentHtml.Replace("\"", "\"\""), codeSnippet, newLineChar);

						jsonFunctionCode.AppendFormat(moarTabs(3) + "sbJson.AppendFormat(\"\\\"{{0}}\\\":{{1}}\", JsonHelper.StringToJson(\"{0}\"), JsonHelper.StringToJson({1}, includeQuotes: true));{2}", fieldName, codeSnippet, newLineChar);
					}

					#endregion
				}
				else /*is list*/
				{
					#region list logic

					String listLabel = pe["component_list_label"];
					String minPanels = String.IsNullOrWhiteSpace(pe["min_panels"]) ? "null" : pe["min_panels"];
					String maxPanels = String.IsNullOrWhiteSpace(pe["max_panels"]) ? "null" : pe["max_panels"];
					String listMessageContent = pe["component_list_message_content"];
					String listMessageType = pe["component_list_message_type"];
					if (string.IsNullOrWhiteSpace(listMessageType)) listMessageType = "basic";
					String subPanelEntryName = getNextComponentPanelDepth(currentPanelName);
					List&lt;PanelEntry&gt; subPanelEntryList = pe.GetPanels(subPanelEntryName);
					StringBuilder sbComponentHardcodedCode = new StringBuilder();

					//INPUT CODE
					inputFunctionCode.AppendFormat(moarTabs(3) + "Dictionary&lt;List&lt;String&gt;, Action&lt;Asset, InputContext, string, string&gt;&gt; {0}_fields = new Dictionary&lt;List&lt;String&gt;, Action&lt;Asset, InputContext, string, string&gt;&gt;();{1}", listLabel, newLineChar);
					//POST_INPUT CODE
					postInputFunctionCode.AppendFormat(moarTabs(3) + "Dictionary&lt;List&lt;String&gt;, Action&lt;Asset, PostInputContext, string, string&gt;&gt; {0}_fields = new Dictionary&lt;List&lt;String&gt;, Action&lt;Asset, PostInputContext, string, string&gt;&gt;();{1}", listLabel, newLineChar);
					//OUTPUT CODE       
					outputFunctionCode.AppendFormat(moarTabs(3) + "Dictionary&lt;List&lt;String&gt;, Func&lt;Asset, OutputContext, String, String, bool, String&gt;&gt; {0}_fields = new Dictionary&lt;List&lt;String&gt;, Func&lt;Asset, OutputContext, String, String, bool, String&gt;&gt;();{1}", listLabel, newLineChar);
					//JSON CODE
					jsonFunctionCode.AppendFormat(moarTabs(3) + "Dictionary&lt;List&lt;String&gt;, Func&lt;Asset, OutputContext, String, String, String&gt;&gt; {0}_fields = new Dictionary&lt;List&lt;String&gt;, Func&lt;Asset, OutputContext, String, String, String&gt;&gt;();{1}", listLabel, newLineChar);
					String subItemLabel = "sub";

					List&lt;String&gt; subComponents = pe["component_list_components"].Split(Util.MakeList(", ").ToArray(), StringSplitOptions.RemoveEmptyEntries).ToList();

					int subComponentCount = 0;

					Queue&lt;SubListDetails&gt; subListQueue = new Queue&lt;SubListDetails&gt;();

					#endregion

					foreach (PanelEntry subPanelEntry in subPanelEntryList)
					{
						/*IF SUBCOMPONENT IS LIST*/
						if (subPanelEntry["component_category"] == "list")
						{
							#region sub list logic

							//index++;
							//PanelEntry subComponentPanel = componentPanels[index];
							String subListLabel = subPanelEntry["component_list_label"];
							subItemLabel = subListLabel;
							String subListMessageContent = subPanelEntry["component_list_message_content"];
							String subListMessageType = subPanelEntry["component_list_message_type"];
							if (string.IsNullOrWhiteSpace(subListMessageType)) subListMessageType = "basic";
							String subListMinPanels = String.IsNullOrWhiteSpace(subPanelEntry["min_panels"]) ? "null" : subPanelEntry["min_panels"];
							String subListMaxPanels = String.IsNullOrWhiteSpace(subPanelEntry["max_panels"]) ? "null" : subPanelEntry["max_panels"];


							//INPUT CODE
							inputFunctionCode.AppendFormat(moarTabs(3) + "List&lt;String&gt; {0}_fieldParams = new List&lt;String&gt;();{1}", subListLabel, newLineChar);
							inputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"_{0}\");{1}", subListLabel, newLineChar);
							inputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"\");{1}", subListLabel, newLineChar);
							inputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"\");{1}", subListLabel, newLineChar);
							inputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"\");{1}", subListLabel, newLineChar);
							inputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"\");{1}", subListLabel, newLineChar);
							inputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fields.Add({1}_fieldParams, this.{1}ListInputHelper);{2}", listLabel, subListLabel, newLineChar);

							//POST-INPUT
							//TODO: add post input code

							//OUTPUT
							String subComponentHtml = getContentPlaceholderMarkup(subListLabel, ContentNodeType.ListNodeAndContentV2, asset["markup"], true);
							outputFunctionCode.AppendFormat(moarTabs(3) + "List&lt;String&gt; {0}_fieldParams = new List&lt;String&gt;();{1}", subListLabel, newLineChar);
							outputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(@\"{1}\");{2}", subListLabel, subComponentHtml.Replace("\"", "\"\"").Replace("\r", "").Replace("\n", ""), newLineChar);
							outputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"_{0}\");{1}", subListLabel, newLineChar);
							outputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fields.Add({1}_fieldParams, this.{1}ListOutputHelper);{2}", listLabel, subListLabel, newLineChar);

							//append lists "componentmarkup" to class vars
							childComponents.AppendFormat(moarTabs(2) + "public String {0}_ContentMarkup = @\"{1}\";{2}", subListLabel, subComponentHtml.Replace("\"", "\"\"").Replace("\r", "").Replace("\n", ""), newLineChar);

							//JSON
							jsonFunctionCode.AppendFormat(moarTabs(3) + "List&lt;String&gt; {0}_fieldParams = new List&lt;String&gt;();{1}", subListLabel, newLineChar);
							jsonFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(@\"{1}\");{2}", subListLabel, subComponentHtml.Replace("\"", "\"\"").Replace("\r", "").Replace("\n", ""), newLineChar);
							jsonFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"_{0}\");{1}", subListLabel, newLineChar);
							jsonFunctionCode.AppendFormat(moarTabs(3) + "{0}_fields.Add({1}_fieldParams, this.{1}ListJsonHelper);{2}", listLabel, subListLabel, newLineChar);

							//LIST HELPER
							//will recursively create inputs for each list
							//createCodeFileHelper(asset, subPanelEntry, subPanelEntryName, ref inputHelperFunctionCode, ref postInputHelperFunctionCode, ref outputHelperFunctionCode, ref childComponents, ref childComponentInitialization, ref listCount);
							subListQueue.Enqueue(new SubListDetails(subPanelEntry, subPanelEntryName));
							#endregion
						}
						/*IF SUBCOMPONENT IS COMPONENT*/
						else
						{
							#region sub component logic

							//index++;
							//PanelEntry subComponentPanel = componentPanels[index];
							String subComponentType = subPanelEntry["component_component_type"];
							String subComponentLabel = subPanelEntry["component_component_label"];
							subItemLabel = subComponentLabel;
							String subComponentLabelOverride = subPanelEntry["component_component_input_label"];
							String subComponentIsValidated = subPanelEntry["component_component_required"];
							String subComponentValidationMessage = subPanelEntry["component_component_required_message"];
							String subComponentWrapInControlGroup = subPanelEntry["component_component_form_override_type"];
							String subComponentMessageContent = subPanelEntry["component_component_message_content"];
							String subComponentMessageType = subPanelEntry["component_component_message_type"];
							if (string.IsNullOrWhiteSpace(subComponentMessageType)) subComponentMessageType = "basic";
							String subComponentHardcodedSnippet = String.IsNullOrWhiteSpace(subPanelEntry["component_component_hardcoded_snippet"]) ? "\"\"" : subPanelEntry["component_component_hardcoded_snippet"];
							String subComponentHtml = getContentPlaceholderMarkup(subComponentLabel, ContentNodeType.Content, asset["markup"]);

							if (subComponentType == "Code")
							{
								sbComponentHardcodedCode.AppendFormat("{0}sbContent.Replace(@\"{1}\", {2});{3}", moarTabs(3), subComponentHtml, subComponentHardcodedSnippet, newLineChar);
							}
							else
							{
								//DECLARATION
								childComponents.AppendFormat(moarTabs(2) + "public {0} {1} {{get; set;}}{2}", subComponentType, subComponentLabel, newLineChar);

								//INITIALIZATION
								childComponentInitialization.AppendFormat(moarTabs(3) + "{0} = new {1}();{2}", subComponentLabel, subComponentType, newLineChar);

								//INPUT CODE
								inputFunctionCode.AppendFormat(moarTabs(3) + "List&lt;String&gt; {0}_fieldParams = new List&lt;String&gt;();{1}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), newLineChar);
								inputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"_{0}\");{1}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), newLineChar);

								if (getCoreComponentTypes(asset).Contains(subComponentType))
								{
									inputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), String.IsNullOrWhiteSpace(subComponentLabelOverride) ? labelize(subComponentLabel) : subComponentLabelOverride, newLineChar);
									inputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), "", newLineChar);
								}
								else
								{
									inputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentLabelOverride.Trim(), newLineChar);
									inputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentWrapInControlGroup, newLineChar);
								}

								inputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentMessageContent, newLineChar);
								inputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentMessageType, newLineChar);
								inputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fields.Add({1}_fieldParams, this.{2}.ComponentInput);{3}", listLabel, (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentLabel, newLineChar);

								//POST_INPUT CODE
								postInputFunctionCode.AppendFormat(moarTabs(3) + "List&lt;String&gt; {0}_fieldParams = new List&lt;String&gt;();{1}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), newLineChar);
								postInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"_{0}\");{1}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), newLineChar);
								if (getCoreComponentTypes(asset).Contains(subComponentType) &amp;&amp; subComponentIsValidated == "yes")
								{
									postInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentType, newLineChar);
									postInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentValidationMessage, newLineChar);
								}
								postInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fields.Add({1}_fieldParams, this.{2}.ComponentPostInput);{3}", listLabel, (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentLabel, newLineChar);

								//OUTPUT CODE
								outputFunctionCode.AppendFormat(moarTabs(3) + "List&lt;String&gt; {0}_fieldParams = new List&lt;String&gt;();{1}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), newLineChar);
								outputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(@\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentHtml.Replace("\"", "\"\""), newLineChar);
								outputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"_{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), newLineChar);
								outputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fields.Add({1}_fieldParams, this.{2}.ComponentOutput);{3}", listLabel, (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentLabel, newLineChar);

								//JSON CODE
								jsonFunctionCode.AppendFormat(moarTabs(3) + "List&lt;String&gt; {0}_fieldParams = new List&lt;String&gt;();{1}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), newLineChar);
								jsonFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(@\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentHtml.Replace("\"", "\"\""), newLineChar);
								jsonFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"_{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), newLineChar);
								jsonFunctionCode.AppendFormat(moarTabs(3) + "{0}_fields.Add({1}_fieldParams, this.{2}.ComponentJson);{3}", listLabel, (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentLabel, newLineChar);

								//INDEXED FIELDS
								indexedFieldsFunctionCode.AppendFormat(moarTabs(3) + "fields.AddRange(IndexedField.ToArray(this.{0}.ComponentIndexedFields(asset, context, name + \"_panel_{1}\", index)));{2}", subComponentLabel, (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel).ToLowerInvariant(), newLineChar);
							}
							subComponentCount++;

							#endregion
						}
					}

					#region more list logic

					//INPUT CODE
					inputFunctionCode.AppendFormat("");

					if (!String.IsNullOrWhiteSpace(listMessageContent))
					{
						inputFunctionCode.AppendFormat(moarTabs(3) + "Input.ShowMessage(\"{0}\", MessageType.{1});{2}", listMessageContent, labelize(listMessageType), newLineChar);
					}

					inputFunctionCode.AppendFormat(moarTabs(3) + "PanelInput(asset, context, \"{0}\", name + {1}\"_panel\", {2}_fields, {3}, {4});{5}", labelize(listLabel), (listCount &gt; 0 ? "\"_" + listLabel + "\" + " : ""), listLabel, minPanels, maxPanels, newLineChar);
					inputFunctionCode.Append(newLineChar);

					//POST_INPUT CODE
					postInputFunctionCode.AppendFormat(moarTabs(3) + "PanelPostInput(asset, context, name + {0}\"_panel\", {1}_fields, index);{2}", (listCount &gt; 0 ? "\"_" + listLabel + "\" + " : ""), listLabel, newLineChar);

					//OUTPUT CODE
					String listContent = getContentPlaceholderMarkup(listLabel, ContentNodeType.ListNodeAndContentV2, asset["markup"]);
					listContent = listContent.Replace("\r", "").Replace("\n", "").Replace("\"", "\"\"");
					outputFunctionCode.AppendFormat(moarTabs(3) + "sbContent.Replace(@\"{0}\", PanelOutput(asset, context, name + {1}\"_panel\", @\"{2}\", \"{3}\", {4}_fields, index));{5}", listContent, (listCount &gt; 0 ? "\"_" + listLabel + "\" + " : ""), pe["component_list_content"].Replace("\r", "").Replace("\n", "").Replace("\"", "\"\""), listLabel, listLabel, newLineChar);
					outputFunctionCode.Append(sbComponentHardcodedCode.ToString());
					outputFunctionCode.Append(newLineChar);

					//JSON CODE

					// Strip any HTML from the list markup
					var jsonPanelMarkup = pe["component_list_content"].Replace("\r", "").Replace("\n", "").Replace("\"", "\"\"");
					jsonPanelMarkup = string.Join(",", new Regex("\\{[^}]+\\}").Matches(jsonPanelMarkup).OfType&lt;Match&gt;().Select(m =&gt; m.Value));
					if (isSingleList)
						jsonFunctionCode.AppendFormat(moarTabs(3) + "sbJson.AppendFormat(\"[{{0}}]\", PanelJson(asset, context, name + {1}\"_panel\", @\"{2}\", \"{3}\", \"{5}\", {4}_fields, index));{6}", listLabel, (listCount &gt; 0 ? "\"_" + listLabel + "\" + " : ""), jsonPanelMarkup, listLabel, listLabel, subItemLabel, newLineChar);
					else
						jsonFunctionCode.AppendFormat(moarTabs(3) + "sbJson.AppendFormat(\"\\\"{{0}}\\\":[{{1}}]\", JsonHelper.StringToJson(\"{3}\"), PanelJson(asset, context, name + {1}\"_panel\", @\"{2}\", \"{3}\", \"{5}\", {4}_fields, index));{6}", listLabel, (listCount &gt; 0 ? "\"_" + listLabel + "\" + " : ""), jsonPanelMarkup, listLabel, listLabel, subItemLabel, newLineChar);

					listCount++;

					while (subListQueue.Count &gt; 0)
					{
						SubListDetails sld = subListQueue.Dequeue();

						if (sld != null)
						{
							createCodeFileHelper(asset, sld.pe, sld.panelEntryName, ref inputHelperFunctionCode, ref postInputHelperFunctionCode, ref outputHelperFunctionCode, ref jsonHelperFunctionCode, ref childComponents, ref childComponentInitialization);
						}
					}
					#endregion
				}
			}
			if (!isSingleList)
			{
				jsonFunctionCode.AppendFormat(moarTabs(3) + "sbJson.Append(\"}}\");{0}", newLineChar);
			}

			#region add to code file frame and save

			String code = "using System;" + newLineChar +
										"using System.Collections.Generic;" + newLineChar +
										"using System.Linq;" + newLineChar +
										"using System.Text;" + newLineChar +
										"using CrownPeak.CMSAPI;" + newLineChar +
										"using CrownPeak.CMSAPI.Services;" + newLineChar +
										"using " + componentLibraryNamespace + ";" + newLineChar +
										"/* Some Namespaces are not allowed. */" + newLineChar +
										"namespace " + componentLibraryNamespace + newLineChar +
										"{" + newLineChar +
										tabChar + "[Serializable]" + newLineChar +
										tabChar + "public partial class " + className + " : " + (createJsonComponent ? "Json" : "") + "ComponentBase" + newLineChar +
										tabChar + "{" + newLineChar +
										childComponents.ToString() +
										newLineChar +
										tabChar + tabChar + "public " + className + "()" + newLineChar +
										tabChar + tabChar + "{" + newLineChar +
										childComponentInitialization.ToString() +
										tabChar + tabChar + tabChar + "ComponentMarkup = @\"" + asset["markup"].Replace("\"", "\"\"").Replace("\r", "").Replace("\n", "").Replace("\\{", "{").Replace("\\}", "}") + "\";" + newLineChar +
										tabChar + tabChar + "}" + newLineChar +
										newLineChar +
										tabChar + tabChar + "public void InputBase(Asset asset, InputContext context, string label, string name)" + newLineChar +
										tabChar + tabChar + "{" + newLineChar +
										inputFunctionCode.ToString() +
										tabChar + tabChar + "}" + newLineChar +
										newLineChar +
										inputHelperFunctionCode.ToString() +
										tabChar + tabChar + "public void PostInputBase(Asset asset, PostInputContext context, string name, string index = \"\")" + newLineChar +
										tabChar + tabChar + "{" + newLineChar +
										postInputFunctionCode.ToString() +
										tabChar + tabChar + "}" + newLineChar +
										newLineChar +
										postInputHelperFunctionCode.ToString() +
										tabChar + tabChar + "public string OutputBase(Asset asset, OutputContext context, string name, string index = \"\", bool isDrag = false)" + newLineChar +
										tabChar + tabChar + "{" + newLineChar +
										tabChar + tabChar + tabChar + "if (isDrag)" + newLineChar +
										tabChar + tabChar + tabChar + "{" + newLineChar +
										tabChar + tabChar + tabChar + tabChar + "StringBuilder ddContent = new StringBuilder();" + newLineChar +
										tabChar + tabChar + tabChar + tabChar + "ddContent.Append(ComponentMarkup);" + newLineChar +
										newLineChar +
										tabChar + tabChar + tabChar + tabChar + "return ComponentFramework.ParseDragAndDropMarkupForPreviewAndPublish(context, ddContent.ToString());" + newLineChar +
										tabChar + tabChar + tabChar + "}" + newLineChar +
										newLineChar +
										tabChar + tabChar + tabChar + "StringBuilder sbContent = new StringBuilder();" + newLineChar +
										tabChar + tabChar + tabChar + "sbContent.Append(ComponentMarkup);" + newLineChar +
										outputFunctionCode.ToString() +
										tabChar + tabChar + tabChar + "String markup = ComponentFramework.UpdateMarkupForPreviewPublish(context, sbContent.ToString());" + newLineChar +
										tabChar + tabChar + tabChar + "return markup;" + newLineChar +
										tabChar + tabChar + "}" + newLineChar +
										newLineChar +
										outputHelperFunctionCode.ToString() +
										(!createJsonComponent ? "" : (
										tabChar + tabChar + "public string JsonBase(Asset asset, OutputContext context, string name, string index = \"\")" + newLineChar +
										tabChar + tabChar + "{" + newLineChar +
										tabChar + tabChar + tabChar + "StringBuilder sbJson = new StringBuilder(1024);" + newLineChar +
										jsonFunctionCode.ToString() +
										tabChar + tabChar + tabChar + "return sbJson.ToString();" + newLineChar +
										tabChar + tabChar + "}" + newLineChar +
										newLineChar +
										jsonHelperFunctionCode.ToString() +
										newLineChar +
										tabChar + tabChar + "public IEnumerable&lt;IndexedField&gt; IndexedFieldsBase(Asset asset, SearchG2Context context, string name, string index = \"\")" + newLineChar +
										tabChar + tabChar + "{" + newLineChar +
										tabChar + tabChar + tabChar + "var fields = new List&lt;IndexedField&gt;();" + newLineChar +
										indexedFieldsFunctionCode +
										tabChar + tabChar + tabChar + "return fields;" + newLineChar +
										tabChar + tabChar + "}" + newLineChar
										)) +
										tabChar + "}" + newLineChar +
										"}";

			Dictionary&lt;String, String&gt; codeContent = new Dictionary&lt;string, string&gt;();
			codeContent.Add("body", Util.DecodeEntities(code));
			codeContent.Add("componentAsset", asset.GetLink(LinkType.Internal));

			String componentClassFileName = createComponentClassFileName(className, ComponentClassNameType.Base);
			String componentClassOverrideFileName = createComponentClassFileName(className, ComponentClassNameType.Override);


			String overrideCode = "using System;" + newLineChar +
									"using System.Collections.Generic;" + newLineChar +
									"using System.Linq;" + newLineChar +
									"using System.Text;" + newLineChar +
									"using CrownPeak.CMSAPI;" + newLineChar +
									"using CrownPeak.CMSAPI.Services;" + newLineChar +
									"using " + componentLibraryNamespace + ";" + newLineChar +
									"/* Some Namespaces are not allowed. */" + newLineChar +
									"namespace " + componentLibraryNamespace + newLineChar +
									"{" + newLineChar +
									tabChar + "public partial class " + className + " : " + (createJsonComponent ? "Json" : "") + "ComponentBase" + newLineChar +
									tabChar + "{" + newLineChar +
									tabChar + tabChar + "/*comment out \"InputBase(asset, context, label, name);\" &amp; modify this function if you want to overwrite the input functionality of the component.*/" + newLineChar +
									tabChar + tabChar + "public override void ComponentInput(Asset asset, InputContext context, String label, string name)" + newLineChar +
									tabChar + tabChar + "{" + newLineChar +
									tabChar + tabChar + tabChar + "InputBase(asset, context, label, name);" + newLineChar +
									tabChar + tabChar + "}" + newLineChar +
									newLineChar +
									tabChar + tabChar + "/*comment out \"PostInputBase(asset, context, name, index);\" &amp; modify this function if you want to overwrite the post_input functionality of the component.*/" + newLineChar +
									tabChar + tabChar + "public override void ComponentPostInput(Asset asset, PostInputContext context, string name, string index = \"\")" + newLineChar +
									tabChar + tabChar + "{" + newLineChar +
									tabChar + tabChar + tabChar + "PostInputBase(asset, context, name, index);" + newLineChar +
									tabChar + tabChar + "}" + newLineChar +
									newLineChar +
									tabChar + tabChar + "/*comment out \"OutputBase(asset, context, name, index, isDrag);\" &amp; modify this function if you want to overwrite the output functionality of the component.*/" + newLineChar +
									tabChar + tabChar + "public override string ComponentOutput(Asset asset, OutputContext context, string name, string index = \"\", bool isDrag = false)" + newLineChar +
									tabChar + tabChar + "{" + newLineChar +
									tabChar + tabChar + tabChar + "return OutputBase(asset, context, name, index, isDrag);" + newLineChar +
									tabChar + tabChar + "}" + newLineChar +
									(!createJsonComponent ? "" : (
									newLineChar +
									tabChar + tabChar + "/*comment out \"JsonBase(asset, context, name, index);\" &amp; modify this function if you want to overwrite the JSON functionality of the component.*/" + newLineChar +
									tabChar + tabChar + "public override string ComponentJson(Asset asset, OutputContext context, string name, string index = \"\")" + newLineChar +
									tabChar + tabChar + "{" + newLineChar +
									tabChar + tabChar + tabChar + "return JsonBase(asset, context, name, index);" + newLineChar +
									tabChar + tabChar + "}" + newLineChar +
									newLineChar +
									tabChar + tabChar + "/*comment out \"IndexedFieldsBase(asset, context, name, index);\" &amp; modify this function if you want to overwrite the indexed fields of the component.*/" + newLineChar +
									tabChar + tabChar + "public override IEnumerable&lt;IndexedField&gt; ComponentIndexedFields(Asset asset, SearchG2Context context, string name, string index = \"\")" + newLineChar +
									tabChar + tabChar + "{" + newLineChar +
									tabChar + tabChar + tabChar + "return IndexedFieldsBase(asset, context, name, index);" + newLineChar +
									tabChar + tabChar + "}" + newLineChar
									)) +
									tabChar + "}" + newLineChar +
									"}";

			Dictionary&lt;String, String&gt; overrideCodeContent = new Dictionary&lt;string, string&gt; { { "body", overrideCode } };


			Asset existingCodeFile = getComponentCodeFileAsset(asset["class_name"], asset, ComponentClassNameType.Base);

			Asset codeFile = null;
			Asset overrideCodeFile = null;

			if (existingCodeFile != null &amp;&amp; existingCodeFile.IsLoaded)
			{
				String componentAsset = existingCodeFile["componentAsset"];
				var branchVersion = getAssetForBranch(Asset.Load(componentAsset), asset);
				if (String.IsNullOrWhiteSpace(componentAsset) || componentAsset.Substring(componentAsset.LastIndexOf("/") + 1) == asset.Id.ToString() || branchVersion.Id == asset.Id)
				{
					//String contentBackup = existingCodeFile["body"];

					existingCodeFile.SaveContent(codeContent);
					if (deferCompilation) recompileSuccessful = true;
					else recompileSuccessful = existingCodeFile.SaveSource(Util.DecodeEntities(code));

					#region rollback code (COMMENTED OUT)
					//if (!recompileSuccessful)
					//{
					//    existingCodeFile.SaveContentField("body", contentBackup);
					//}

					//codeFile = existingCodeFile;
					#endregion
				}
			}
			else
			{
				String codeFileModelPath = getComponentLibraryModelFolder(asset).AssetPath + "/Code File";
				Asset codeFileModel = Asset.Load(codeFileModelPath);
				codeFile = Asset.CreateNewAsset(componentClassFileName, componentLibraryClassFolder, codeFileModel, codeContent);
				overrideCodeFile = Asset.CreateNewAsset(componentClassOverrideFileName, componentLibraryClassFolder, codeFileModel, overrideCodeContent);

				if (deferCompilation) recompileSuccessful = true;
				else recompileSuccessful = overrideCodeFile.SaveSource(Util.DecodeEntities(overrideCode));

				#region rollback code (COMMENTED OUT)
				//    if (!recompileSuccessful)
				//    {
				//        codeFile.Delete();
				//    }
				#endregion
			}

			if (!recompileSuccessful)
			{
				//Util.Email(String.Format("xCodefile {0} recompilation unsuccessful.", componentClassFileName),
				//            String.Format("Recompilation failed when recompiling after codefile {0} \r\n\r\n {1}", componentClassFileName, Util.DecodeEntities(code)),
				//            "corey.casado@crownpeak.com");
			}
			#endregion

			return codeFile;

			#region rollback code (COMMENTED OUT)
			//if (existingCodeFile != null &amp;&amp; existingCodeFile.IsLoaded)
			//{
			//    if (existingCodeFile["componentAsset"] == asset.GetLink(LinkType.Internal))
			//    {
			//        existingCodeFile.SaveContent(codeContent);

			//        codeFile = existingCodeFile;
			//    }
			//    else
			//    {
			//        throw new Exception("Error updating existing code file. The code file loaded is not associated with this asset.");
			//    }
			//}
			//else
			//{
			//    String codeFileModelPath = "/" + asset.AssetPath[0] + "/Component_Project/Models/Code File";
			//    Asset codeFileModel = Asset.Load(codeFileModelPath);
			//    codeFile = Asset.CreateNewAsset(componentClassFileName, componentLibraryClassFolder, Asset.Load("/" + asset.AssetPath[0] + "/Component_Project/Models/Code File"), codeContent);
			//}

			//return codeFile;
			#endregion
		}

		private static void createCodeFileHelper(Asset asset, PanelEntry pe, String currentPanelName, ref StringBuilder inputFunctionCode, ref StringBuilder postInputFunctionCode, ref StringBuilder outputFunctionCode, ref StringBuilder jsonFunctionCode, ref StringBuilder childComponents, ref StringBuilder childComponentInitialization)
		{
			StringBuilder newInputFunctionCode = new StringBuilder();

			StringBuilder newPostInputFunctionCode = new StringBuilder();

			StringBuilder newOutputFunctionCode = new StringBuilder();

			StringBuilder newJsonFunctionCode = new StringBuilder();

			#region list logic

			String listLabel = pe["component_list_label"];
			String minPanels = String.IsNullOrWhiteSpace(pe["min_panels"]) ? "null" : pe["min_panels"];
			String maxPanels = String.IsNullOrWhiteSpace(pe["max_panels"]) ? "null" : pe["max_panels"];
			String listMessageContent = pe["component_list_message_content"];
			String listMessageType = pe["component_list_message_type"];
			if (string.IsNullOrWhiteSpace(listMessageType)) listMessageType = "basic";
			String subPanelEntryName = getNextComponentPanelDepth(currentPanelName);
			List&lt;PanelEntry&gt; subPanelEntryList = pe.GetPanels(subPanelEntryName);
			StringBuilder sbComponentHardcodedCode = new StringBuilder();

			//INPUT CODE
			newInputFunctionCode.AppendFormat(moarTabs(3) + "Dictionary&lt;List&lt;String&gt;, Action&lt;Asset, InputContext, string, string&gt;&gt; {0}_fields = new Dictionary&lt;List&lt;String&gt;, Action&lt;Asset, InputContext, string, string&gt;&gt;();{1}", listLabel, newLineChar);
			//POST_INPUT CODE
			newPostInputFunctionCode.AppendFormat(moarTabs(3) + "Dictionary&lt;List&lt;String&gt;, Action&lt;Asset, PostInputContext, string, string&gt;&gt; {0}_fields = new Dictionary&lt;List&lt;String&gt;, Action&lt;Asset, PostInputContext, string, string&gt;&gt;();{1}", listLabel, newLineChar);
			//OUTPUT CODE       
			newOutputFunctionCode.AppendFormat(moarTabs(3) + "Dictionary&lt;List&lt;String&gt;, Func&lt;Asset, OutputContext, String, String, String&gt;&gt; {0}_fields = new Dictionary&lt;List&lt;String&gt;, Func&lt;Asset, OutputContext, String, String, bool, String&gt;&gt;();{1}", listLabel, newLineChar);
			// JSON CODE
			newJsonFunctionCode.AppendFormat(moarTabs(3) + "Dictionary&lt;List&lt;String&gt;, Func&lt;Asset, OutputContext, String, String, String&gt;&gt; {0}_fields = new Dictionary&lt;List&lt;String&gt;, Func&lt;Asset, OutputContext, String, String, String&gt;&gt;();{1}", listLabel, newLineChar);

			int subComponentCount = 0;

			Queue&lt;SubListDetails&gt; subListQueue = new Queue&lt;SubListDetails&gt;();

			#endregion

			foreach (PanelEntry subPanelEntry in subPanelEntryList)
			{
				/*IF SUBCOMPONENT IS LIST*/
				if (subPanelEntry["component_category"] == "list")
				{
					#region sub list logic

					//index++;
					//PanelEntry subComponentPanel = componentPanels[index];
					String subListLabel = subPanelEntry["component_list_label"];
					String subListMessageContent = subPanelEntry["component_list_message_content"];
					String subListMessageType = subPanelEntry["component_list_message_type"];
					if (string.IsNullOrWhiteSpace(subListMessageType)) subListMessageType = "basic";
					String subListMinPanels = String.IsNullOrWhiteSpace(subPanelEntry["min_panels"]) ? "null" : subPanelEntry["min_panels"];
					String subListMaxPanels = String.IsNullOrWhiteSpace(subPanelEntry["max_panels"]) ? "null" : subPanelEntry["max_panels"];

					//INPUT CODE
					newInputFunctionCode.AppendFormat(moarTabs(3) + "List&lt;String&gt; {0}_fieldParams = new List&lt;String&gt;();{1}", subListLabel, newLineChar);
					newInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"_{0}\");{1}", subListLabel, newLineChar);
					newInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"\");{1}", subListLabel, newLineChar);
					newInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"\");{1}", subListLabel, newLineChar);
					newInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"\");{1}", subListLabel, newLineChar);
					newInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"\");{1}", subListLabel, newLineChar);
					newInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fields.Add({1}_fieldParams, this.{1}ListInputHelper);{2}", listLabel, subListLabel, newLineChar);

					//POST-INPUT
					//TODO: add post input code

					//OUTPUT
					String subComponentHtml = getContentPlaceholderMarkup(subListLabel, ContentNodeType.ListNodeAndContentV2, asset["markup"], true);
					newOutputFunctionCode.AppendFormat(moarTabs(3) + "List&lt;String&gt; {0}_fieldParams = new List&lt;String&gt;();{1}", subListLabel, newLineChar);
					newOutputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(@\"{1}\");{2}", subListLabel, subComponentHtml.Replace("\"", "\"\""), newLineChar);
					newOutputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"_{0}\");{1}", subListLabel, newLineChar);
					newOutputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fields.Add({1}_fieldParams, this.{1}ListOutputHelper);{2}", listLabel, subListLabel, newLineChar);

					//append lists "componentmarkup" to class vars
					childComponents.AppendFormat(moarTabs(2) + "public String {0}_ContentMarkup = @\"{1}\";{2}", subListLabel, subComponentHtml.Replace("\"", "\"\"").Replace("\r", "").Replace("\n", ""), newLineChar);

					//LIST HELPER
					//will recursively create inputs for each list
					subListQueue.Enqueue(new SubListDetails(subPanelEntry, subPanelEntryName));

					#endregion
				}
				/*IF SUBCOMPONENT IS COMPONENT*/
				else
				{
					#region sub component logic

					//index++;
					//PanelEntry subComponentPanel = componentPanels[index];
					String subComponentType = subPanelEntry["component_component_type"];
					String subComponentLabel = subPanelEntry["component_component_label"];
					String subComponentLabelOverride = subPanelEntry["component_component_input_label"];
					String subComponentWrapInControlGroup = subPanelEntry["component_component_form_override_type"];
					String subComponentMessageContent = subPanelEntry["component_component_message_content"];
					String subComponentMessageType = subPanelEntry["component_component_message_type"];
					if (string.IsNullOrWhiteSpace(subComponentMessageType)) subComponentMessageType = "basic";
					String subComponentHardcodedSnippet = String.IsNullOrWhiteSpace(subPanelEntry["component_component_hardcoded_snippet"]) ? "\"\"" : subPanelEntry["component_component_hardcoded_snippet"];
					String subComponentHtml = getContentPlaceholderMarkup(subComponentLabel, ContentNodeType.Content, asset["markup"]);

					if (subComponentType == "Code")
					{
						sbComponentHardcodedCode.AppendFormat("{0}sbContent.Replace(@\"{1}\", {2});{3}", moarTabs(3), subComponentHtml, subComponentHardcodedSnippet, newLineChar);
					}
					else
					{
						//DECLARATION
						childComponents.AppendFormat(moarTabs(2) + "public {0} {1} {{get; set;}}{2}", subComponentType, subComponentLabel, newLineChar);

						//INITIALIZATION
						childComponentInitialization.AppendFormat(moarTabs(3) + "{0} = new {1}();{2}", subComponentLabel, subComponentType, newLineChar);

						//INPUT CODE
						newInputFunctionCode.AppendFormat(moarTabs(3) + "List&lt;String&gt; {0}_fieldParams = new List&lt;String&gt;();{1}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), newLineChar);
						newInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"_{0}\");{1}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), newLineChar);

						if (getCoreComponentTypes(asset).Contains(subComponentType))
						{
							newInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), String.IsNullOrWhiteSpace(subComponentLabelOverride) ? labelize(subComponentLabel) : subComponentLabelOverride, newLineChar);
							newInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), "", newLineChar);
						}
						else
						{
							newInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentLabelOverride.Trim(), newLineChar);
							newInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentWrapInControlGroup, newLineChar);
						}

						newInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentMessageContent, newLineChar);
						newInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentMessageType, newLineChar);
						newInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fields.Add({1}_fieldParams, this.{2}.ComponentInput);{3}", listLabel, (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentLabel, newLineChar);

						//POST_INPUT CODE
						newPostInputFunctionCode.AppendFormat(moarTabs(3) + "List&lt;String&gt; {0}_fieldParams = new List&lt;String&gt;();{1}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), newLineChar);
						newPostInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"_{0}\");{1}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), newLineChar);
						newPostInputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fields.Add({1}_fieldParams, this.{2}.ComponentPostInput);{3}", listLabel, (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentLabel, newLineChar);

						//OUTPUT CODE
						newOutputFunctionCode.AppendFormat(moarTabs(3) + "List&lt;String&gt; {0}_fieldParams = new List&lt;String&gt;();{1}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), newLineChar);
						newOutputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(@\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentHtml.Replace("\"", "\"\""), newLineChar);
						newOutputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"_{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), newLineChar);
						newOutputFunctionCode.AppendFormat(moarTabs(3) + "{0}_fields.Add({1}_fieldParams, this.{2}.ComponentOutput);{3}", listLabel, (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentLabel, newLineChar);

						//JSON CODE
						newJsonFunctionCode.AppendFormat(moarTabs(3) + "List&lt;String&gt; {0}_fieldParams = new List&lt;String&gt;();{1}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), newLineChar);
						newJsonFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(@\"{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentHtml.Replace("\"", "\"\""), newLineChar);
						newJsonFunctionCode.AppendFormat(moarTabs(3) + "{0}_fieldParams.Add(\"_{1}\");{2}", (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), newLineChar);
						newJsonFunctionCode.AppendFormat(moarTabs(3) + "{0}_fields.Add({1}_fieldParams, this.{2}.ComponentJson);{3}", listLabel, (subComponentCount &gt; 0 ? listLabel + "_" + subComponentLabel : listLabel), subComponentLabel, newLineChar);
					}
					subComponentCount++;

					#endregion
				}
			}

			#region more list logic

			//INPUT CODE
			newInputFunctionCode.AppendFormat("");

			if (!String.IsNullOrWhiteSpace(listMessageContent))
			{
				newInputFunctionCode.AppendFormat(moarTabs(3) + "Input.ShowMessage(\"{0}\", MessageType.{1});{2}", listMessageContent, labelize(listMessageType), newLineChar);
			}

			newInputFunctionCode.AppendFormat(moarTabs(3) + "PanelInput(asset, context, \"{0}\", name + {1}\"_panel\", {2}_fields, {3}, {4});{5}", labelize(listLabel), "\"_" + listLabel + "\" + ", listLabel, minPanels, maxPanels, newLineChar);
			newInputFunctionCode.Append(newLineChar);

			//POST_INPUT CODE
			newPostInputFunctionCode.AppendFormat(moarTabs(3) + "PanelPostInput(asset, context, name + {0}\"_panel\", {1}_fields, index);{2}", "\"_" + listLabel + "\" + ", listLabel, newLineChar);

			//OUTPUT CODE
			String listContent = getContentPlaceholderMarkup(listLabel, ContentNodeType.ListNodeAndContentV2, asset["markup"], true);
			listContent = listContent.Replace("\r", "").Replace("\n", "").Replace("\"", "\"\"");
			newOutputFunctionCode.AppendFormat(moarTabs(3) + "sbContent.Replace(@\"{0}\", PanelOutput(asset, context, name + {1}\"_panel\", @\"{2}\", \"{3}\", {4}_fields, index));{5}", listContent, "\"_" + listLabel + "\" + ", pe["component_list_content"].Replace("\"", "\"\""), listLabel, listLabel, newLineChar);
			newOutputFunctionCode.Append(sbComponentHardcodedCode.ToString());
			newOutputFunctionCode.Append(newLineChar);

			//JSON CODE
			listContent = getContentPlaceholderMarkup(listLabel, ContentNodeType.ListNodeAndContentV2, asset["markup"], true);
			listContent = listContent.Replace("\r", "").Replace("\n", "").Replace("\"", "\"\"");
			newJsonFunctionCode.AppendFormat(moarTabs(3) + "sbJson.AppendFormat(\"\\\"{{0}}\\\":{{1}}\", JsonHelper.StringToJson(\"{4}\"), PanelJson(asset, context, name + {1}\"_panel\", @\"{2}\", \"{3}\", {4}_fields, index));{5}", listContent, "\"_" + listLabel + "\" + ", pe["component_list_content"].Replace("\"", "\"\""), listLabel, listLabel, newLineChar);
			newJsonFunctionCode.Append(newLineChar);

			#region append to existing input, postInput, output &amp; json helper stringbuilders
			//INPUT
			inputFunctionCode.AppendFormat("{0}public void {1}ListInputHelper(Asset asset, String label, String name){2}", moarTabs(2), listLabel, newLineChar);
			inputFunctionCode.AppendFormat("{0}{{{1}", moarTabs(2), newLineChar);
			inputFunctionCode.Append(newInputFunctionCode.ToString());
			inputFunctionCode.AppendFormat("{0}}}{1}", moarTabs(2), newLineChar + newLineChar);
			//POSTINPUT
			postInputFunctionCode.AppendFormat("{0}public void {1}ListPostInputHelper(PostInputContext context, string name, string index = \"\"){2}", moarTabs(2), listLabel, newLineChar);
			postInputFunctionCode.AppendFormat("{0}{{{1}", moarTabs(2), newLineChar);
			postInputFunctionCode.Append(newPostInputFunctionCode.ToString());
			postInputFunctionCode.AppendFormat("{0}}}{1}", moarTabs(2), newLineChar + newLineChar);
			//OUTPUT
			outputFunctionCode.AppendFormat("{0}public String {1}ListOutputHelper(Asset asset, OutputContext context, string name, string index = \"\"){2}", moarTabs(2), listLabel, newLineChar);
			outputFunctionCode.AppendFormat("{0}{{{1}", moarTabs(2), newLineChar);
			outputFunctionCode.AppendFormat("{0}StringBuilder sbContent = new StringBuilder();{1}", moarTabs(3), newLineChar);
			outputFunctionCode.AppendFormat("{0}sbContent.Append({1}_ContentMarkup);{2}", moarTabs(3), listLabel, newLineChar);
			outputFunctionCode.Append(newOutputFunctionCode.ToString());
			outputFunctionCode.AppendFormat("{0}return sbContent.ToString();{1}", moarTabs(3), newLineChar);
			outputFunctionCode.AppendFormat("{0}}}{1}", moarTabs(2), newLineChar + newLineChar);
			//JSON
			jsonFunctionCode.AppendFormat("{0}public String {1}ListJsonHelper(Asset asset, OutputContext context, string name, string index = \"\"){2}", moarTabs(2), listLabel, newLineChar);
			jsonFunctionCode.AppendFormat("{0}{{{1}", moarTabs(2), newLineChar);
			jsonFunctionCode.AppendFormat("{0}StringBuilder sbJson = new StringBuilder();{1}", moarTabs(3), newLineChar);
			jsonFunctionCode.Append(newJsonFunctionCode.ToString());
			jsonFunctionCode.AppendFormat("{0}return sbJson.ToString();{1}", moarTabs(3), newLineChar);
			jsonFunctionCode.AppendFormat("{0}}}{1}", moarTabs(2), newLineChar + newLineChar);

			#endregion

			while (subListQueue.Count &gt; 0)
			{
				SubListDetails sld = subListQueue.Dequeue();

				if (sld != null)
				{
					createCodeFileHelper(asset, sld.pe, sld.panelEntryName, ref inputFunctionCode, ref postInputFunctionCode, ref outputFunctionCode, ref jsonFunctionCode, ref childComponents, ref childComponentInitialization);
				}
			}

			#endregion

		}

		private static Asset getProject(Asset asset)
		{
			SiteRootProperties srp = Asset.GetSiteRootProperties(asset.Id);
			var project = Asset.Load(srp.ProjectId);
			var projectPath = project.AssetPath;
			var assetPath = asset.AssetPath;
			if (assetPath.Count &gt;= projectPath.Count &amp;&amp; !assetPath.ToString().StartsWith(projectPath.ToString()))
			{
				var path = "/" + string.Join("/", assetPath.Take(projectPath.Count));
				if (Asset.Load(path + "/Component Library/Component Library Config").IsLoaded)
					return Asset.Load(path);
			}
			return project;
		}

		public static Asset getAssetForBranch(Asset asset, Asset branchAsset)
		{
			var project = getProject(branchAsset);
			var projectPath = project.AssetPath;
			var assetPath = asset.AssetPath;
			if (assetPath.Count &gt;= projectPath.Count &amp;&amp; !assetPath.ToString().StartsWith(projectPath.ToString()))
			{
				return Asset.Load(projectPath + "/" + string.Join("/", assetPath.Skip(projectPath.Count).Take(999)));
			}
			return asset;
		}

		public static Asset getComponentLibraryConfig(Asset asset)
		{
			if (GlobalLibraryConfig != null &amp;&amp; GlobalLibraryConfig.IsLoaded)
			{
				return GlobalLibraryConfig;
			}

			//String currentFolder = asset.Parent.AssetPath.ToString();

			Asset frameworkFolder = getProject(asset);

			FilterParams fParams = new FilterParams();
			fParams.ExcludeProjectTypes = false;
			fParams.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Component Library Configuration");
			Asset componentLibraryConfig = frameworkFolder.GetFilterList(fParams).FirstOrDefault();

			//componentLibraryConfig = Asset.Load(currentFolder).GetFilterList(fParams).FirstOrDefault();

			//while (currentFolder.Length &gt; 0 &amp;&amp; (componentLibraryConfig == null || !componentLibraryConfig.IsLoaded))
			//{
			//    currentFolder = currentFolder.Substring(0, currentFolder.LastIndexOf("/"));
			//    //check if the component library config is at the current level
			//    if (Asset.Load(currentFolder).GetFilterList(fParams).Count &gt; 0)
			//    {
			//        componentLibraryConfig = Asset.Load(currentFolder).GetFilterList(fParams).FirstOrDefault();
			//    }
			//}

			if (componentLibraryConfig == null || !componentLibraryConfig.IsLoaded)
			{
				throw new Exception("Unable to find CL Config asset");
			}

			// Populate if anything is empty
			componentLibraryConfig.GetContent();
			if (string.IsNullOrWhiteSpace(componentLibraryConfig["component_class_folder"])
					|| string.IsNullOrWhiteSpace(componentLibraryConfig["component_library_components_folder"])
					|| string.IsNullOrWhiteSpace(componentLibraryConfig["component_library_models_folder"])
					|| string.IsNullOrWhiteSpace(componentLibraryConfig["component_library_namespace"])
					|| string.IsNullOrWhiteSpace(componentLibraryConfig["component_library_project_folder"])
					|| string.IsNullOrWhiteSpace(componentLibraryConfig["component_library_root_folder"])
					|| string.IsNullOrWhiteSpace(componentLibraryConfig["site_root"]))
			{
				var siteRoot = Asset.GetSiteRoot(asset);
				var project = getProject(asset);
				var projectPath = project.AssetPath.ToString();

				if (string.IsNullOrWhiteSpace(componentLibraryConfig["site_root"]))
					componentLibraryConfig["site_root"] = siteRoot.GetCmsUtilityLink(UtilityLinkType.Internal);
				if (string.IsNullOrWhiteSpace(componentLibraryConfig["component_library_namespace"]))
					componentLibraryConfig["component_library_namespace"] = "Component_Library.Component_Project.Components";
				if (string.IsNullOrWhiteSpace(componentLibraryConfig["component_library_project_folder"]))
					componentLibraryConfig["component_library_project_folder"] = project.GetCmsUtilityLink(UtilityLinkType.Internal);
				if (string.IsNullOrWhiteSpace(componentLibraryConfig["component_class_folder"]))
					componentLibraryConfig["component_class_folder"] = Asset.Load(projectPath + "/Library").GetCmsUtilityLink(UtilityLinkType.Internal);
				if (string.IsNullOrWhiteSpace(componentLibraryConfig["component_library_root_folder"]))
					componentLibraryConfig["component_library_root_folder"] = Asset.Load(projectPath + "/Component Library").GetCmsUtilityLink(UtilityLinkType.Internal);
				if (string.IsNullOrWhiteSpace(componentLibraryConfig["component_library_components_folder"]))
					componentLibraryConfig["component_library_components_folder"] = Asset.Load(projectPath + "/Component Library/Component Definitions").GetCmsUtilityLink(UtilityLinkType.Internal);
				if (string.IsNullOrWhiteSpace(componentLibraryConfig["component_library_models_folder"]))
					componentLibraryConfig["component_library_models_folder"] = Asset.Load(projectPath + "/Models").GetCmsUtilityLink(UtilityLinkType.Internal);
			}

			GlobalLibraryConfig = componentLibraryConfig;

			return GlobalLibraryConfig;
		}

		public static String componentsPath(Asset asset)
		{
			Asset componentLibraryConfig = getComponentLibraryConfig(asset);

			return Asset.Load(componentLibraryConfig["component_library_components_folder"]).AssetPath.ToString();
		}

		public static Asset getComponentLibraryModelFolder(Asset asset)
		{
			Asset componentLibraryConfig = getComponentLibraryConfig(asset);

			return Asset.Load(componentLibraryConfig["component_library_models_folder"]);

			//Asset componentLibraryFolder = Asset.Load(getComponentLibraryConfig(asset)["component_class_folder"]);

			//if (!componentLibraryFolder.IsLoaded)
			//{
			//    componentLibraryFolder = Asset.Load("/" + asset.AssetPath[0] + "/Component Project/Components");

			//    if (!componentLibraryFolder.IsLoaded)
			//    {
			//        throw new Exception("Error Loading the Components library folder in the Components Project");
			//    }
			//}

			//return Asset.Load(componentLibraryFolder.Parent.AssetPath.ToString() + "/Models");
		}

		public static Asset getComponentLibraryProjectFolder(Asset asset)
		{
			Asset componentLibraryConfig = getComponentLibraryConfig(asset);

			return Asset.Load(componentLibraryConfig["component_library_project_folder"]);
		}

		public static Asset getComponentLibraryComponentsFolder(Asset asset)
		{
			Asset componentLibraryConfig = getComponentLibraryConfig(asset);

			return Asset.Load(componentLibraryConfig["component_library_components_folder"]);
		}

		public static Asset getcomponentLibraryRootFolder(Asset asset)
		{
			Asset componentLibraryConfig = getComponentLibraryConfig(asset);

			return Asset.Load(componentLibraryConfig["component_library_root_folder"]);
		}

		public static Asset getComponentLibraryClassFolder(Asset asset)
		{
			Asset componentLibraryConfig = getComponentLibraryConfig(asset);

			return Asset.Load(componentLibraryConfig["component_class_folder"]);

			//return Asset.Load(getComponentLibraryConfig(asset)["component_class_folder"]);
		}

		public static Asset getComponentLibrarySiteRootFolder(Asset asset)
		{
			Asset componentLibraryConfig = getComponentLibraryConfig(asset);

			return Asset.Load(componentLibraryConfig["site_root"]);
		}

		public static String getComponentLibraryNamespace(Asset asset)
		{
			// DEBUG
			return "Component_Library.Component_Project.Components";
			Asset componentLibraryConfig = getComponentLibraryConfig(asset);

			if (!String.IsNullOrWhiteSpace(componentLibraryConfig.Raw["component_library_namespace"]))
			{
				return componentLibraryConfig.Raw["component_library_namespace"];
			}
			else
			{
				Asset componentLibraryFolder = Asset.Load(componentLibraryConfig["component_class_folder"]);

				String componentNamespace = componentLibraryFolder.AssetPath.ToString().Replace(" ", "_").Replace("/", ".");

				if (componentNamespace[0] == '.')
				{
					componentNamespace = componentNamespace.Substring(1);
				}

				return componentNamespace;
			}

		}

		public static Asset getComponentAsset(Asset asset, String componentName)
		{
			Asset componentsFolder = getComponentLibraryComponentsFolder(asset);
			FilterParams fParams = new FilterParams();
			fParams.Add(AssetPropertyNames.Label, Comparison.Equals, componentName);
			return componentsFolder.GetFilterList(fParams).FirstOrDefault();
		}

		/// &lt;summary&gt;
		/// Creates a wysiwyg template for the specified component asset.
		/// &lt;/summary&gt;
		/// &lt;param name="asset"&gt;The component asset for which a wysiwyg template should be created&lt;/param&gt;
		/// &lt;param name="templateFolderPath"&gt;The folder path where the wysiwyg template should be created&lt;/param&gt;
		/// &lt;returns&gt;&lt;/returns&gt;
		public static Asset createWysiwygTemplate(Asset asset, String templateFolderPath)
		{
			Asset wysiwygTemplatesFolder = Asset.Load(templateFolderPath);

			Asset wysiwygTemplate = null;


			String body = @"&lt;%@ Page Language=""C#"" Inherits=""CrownPeak.Internal.Debug.OutputInit"" %&gt;
                            &lt;%@ Import Namespace=""CrownPeak.CMSAPI"" %&gt;
                            &lt;%@ Import Namespace=""CrownPeak.CMSAPI.Services"" %&gt;
                            &lt;%@ Import Namespace=""CrownPeak.CMSAPI.CustomLibrary"" %&gt;
                            &lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;
                            &lt;%//This plugin uses OutputContext as its context class type%&gt;
                            &lt;% 
                               // output.aspx: template file to specify the published content in site HTML
                               // if no preview.aspx exists, then this is used by default for preview
  
                              Out.WriteLine(ComponentLibraryHelper.generateComponentPreview(Asset.Load(" +
										asset.AssetPath + @")));
  
                            %&gt;";


			Dictionary&lt;String, String&gt; contentDict = new Dictionary&lt;String, String&gt;() { { "body", body } };



			FilterParams fParams = new FilterParams();
			fParams.Add(AssetPropertyNames.Label, Comparison.Equals, asset.Label);

			List&lt;Asset&gt; existingAssetList = wysiwygTemplatesFolder.GetFilterList(fParams);

			if (existingAssetList != null &amp;&amp; existingAssetList.Count == 1)
			{
				wysiwygTemplate = Asset.Load(existingAssetList[0].Id);
				wysiwygTemplate.SaveContentField("body", body);
			}
			else
			{
				Asset saveLocation = Asset.Load("/System/CMS Snippets/Default");
				String codeFileModelPath = getComponentLibraryModelFolder(asset).AssetPath + "/Code File";
				Asset codeFileModel = Asset.Load(codeFileModelPath);
				if (saveLocation.IsLoaded &amp;&amp; codeFileModel.IsLoaded)
				{
					wysiwygTemplate = Asset.CreateNewAsset(asset.Label, saveLocation, codeFileModel, contentDict);
				}
				else
				{
					if (!saveLocation.IsLoaded)
					{
						Out.DebugWriteLine(
								"Unable to load the save location for the Wysiwyg Template: /System/CMS Snippets/Default");
					}
					if (!codeFileModel.IsLoaded)
					{
						Out.DebugWriteLine("Unable to load the code file model for the Wysiwyg Template: " + codeFileModelPath);
					}
				}
			}

			return wysiwygTemplate;
		}

		/// &lt;summary&gt;
		/// Recompiles all the code files in the /System/Library folder
		/// &lt;/summary&gt;
		public static bool recompileLibrary(Asset asset)
		{
			return Asset.RecompileLibrary(getComponentLibraryClassFolder(asset).Id);
		}

		/// &lt;summary&gt;
		/// Returns the regular expression used to locate the specified content node type.
		/// &lt;/summary&gt;
		/// &lt;param name="type"&gt;The name of the markup field for which you want the corresponding regular expression returned&lt;/param&gt;
		/// &lt;returns&gt;&lt;/returns&gt;
		public static Regex getContentFieldRegex(ContentNodeType type, String name = "")
		{
			if (type == ContentNodeType.ListNodeAndContent)
			{
				return new Regex(@"&lt;" + repeatableNodeName + @"(\w|\s|\=|""|-)*&gt;(.|\n)*?&lt;/" + repeatableNodeName + "&gt;", RegexOptions.Compiled | RegexOptions.IgnoreCase);
			}
			else if (type == ContentNodeType.ListNode)
			{
				if (name != "")
				{
					return new Regex(@"\&lt;" + repeatableNodeName + @"(\w|\s|-)*\=""" + name + @"""&gt;", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
				}
				else
				{
					return new Regex(@"\&lt;" + repeatableNodeName + @"(\w|\s|\=|""|-)*&gt;", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
				}
			}
			else if (type == ContentNodeType.PreviewNodeOpen)
			{
				return new Regex(@"\&lt;" + previewOnlyNodeName + @"&gt;", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
			}
			else if (type == ContentNodeType.PreviewNodeClose)
			{
				return new Regex(@"&lt;/" + previewOnlyNodeName + "&gt;", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
			}
			else if (type == ContentNodeType.PreviewNodeAndContent)
			{
				return new Regex(@"\&lt;" + previewOnlyNodeName + @"&gt;(.|\n)*?&lt;/" + previewOnlyNodeName + "&gt;", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
			}
			else if (type == ContentNodeType.PublishNodeOpen)
			{
				return new Regex(@"\&lt;" + publishOnlyNodeName + @"&gt;", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
			}
			else if (type == ContentNodeType.PublishNodeClose)
			{
				return new Regex(@"&lt;/" + publishOnlyNodeName + "&gt;", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
			}
			else if (type == ContentNodeType.PublishNodeAndContent)
			{
				return new Regex(@"\&lt;" + publishOnlyNodeName + @"&gt;(.|\n)*?&lt;/" + publishOnlyNodeName + "&gt;", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
			}
			else if (type == ContentNodeType.ListNodeAndContentV2)
			{
				if (name != "")
				{
					return new Regex(@"&lt;" + repeatableNodeName + @"(\w|\s|)*\=""" + name + @"""&gt; (?&gt;&lt;" + repeatableNodeName + @" (?&lt;DEPTH&gt;) | &lt;/" + repeatableNodeName + @"&gt; (?&lt;-DEPTH&gt;) | .? )* (?(DEPTH)(?!))&lt;/" + repeatableNodeName + @"&gt;", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline);
				}
				else
				{
					return new Regex(@"&lt;" + repeatableNodeName + @"(\w|\s|\=|""|-)*&gt; (?&gt;&lt;" + repeatableNodeName + @" (?&lt;DEPTH&gt;) | &lt;/" + repeatableNodeName + @"&gt; (?&lt;-DEPTH&gt;) | .? )* (?(DEPTH)(?!))&lt;/" + repeatableNodeName + @"&gt;", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline);
				}
			}
			else
			{
				//return new Regex(@"\&lt;" + contentNodeName + @"(\w|\s|\=|""|-)*/&gt;", RegexOptions.Compiled | RegexOptions.IgnoreCase);
				return new Regex(@"(?&lt;!\{)\{\s*[^0-9][a-zA-Z0-9\s\w|:]*\}(?!\})", RegexOptions.Compiled | RegexOptions.IgnoreCase);
			}
		}

		/// &lt;summary&gt;
		/// Gets the content placeholder markup in the specified content markup
		/// &lt;/summary&gt;
		/// &lt;param name="fieldName"&gt;the content placeholder name to retrieve&lt;/param&gt;
		/// &lt;param name="type"&gt;the type of content placeholder&lt;/param&gt;
		/// &lt;param name="componentMarkup"&gt;the markup that should be searched through&lt;/param&gt;
		/// &lt;returns&gt;&lt;/returns&gt;
		public static String getContentPlaceholderMarkup(String fieldName, ContentNodeType type, String componentMarkup, bool isNestedList = false)
		{
			Regex rx = getContentFieldRegex(type);

			MatchCollection matches = rx.Matches(componentMarkup);
			if (type == ContentNodeType.Content)
			{
				foreach (Match m in matches)
				{
					String currentFieldName = getContentPlaceholderName(m.Value);

					if (currentFieldName == fieldName)
					{
						Out.DebugWriteLine(Util.HtmlEncode(m.Value) + " tag found! for fieldName: " + fieldName);
						return m.Value;
					}
				}
			}
			else
			{
				foreach (Match m in matches)
				{
					if (m.Value.Contains("name=\"" + fieldName + "\""))
					{
						if (isNestedList &amp;&amp; !m.Value.Trim().StartsWith("&lt;cp-list name=\"" + fieldName + "\""))
						{
							Regex startNodeRegex = getContentFieldRegex(ContentNodeType.ListNode);

							Match startNodeMatch = startNodeRegex.Match(componentMarkup);

							String subContent = m.Value.Trim().Replace(startNodeMatch.Value, "");

							subContent = subContent.Substring(0, subContent.LastIndexOf("&lt;/" + repeatableNodeName + "&gt;")).Trim();

							return getContentPlaceholderMarkup(fieldName, type, subContent, true);
						}

						else
						{
							Out.DebugWriteLine(Util.HtmlEncode(m.Value) + " tag found! for fieldName: " + fieldName);
							return m.Value;
						}
					}

				}
			}

			Out.DebugWriteLine("No matching tags found for fieldName: " + fieldName);
			return "";
		}

		/// &lt;summary&gt;
		/// Function used to start the navigation wrapper
		/// &lt;/summary&gt;
		/// &lt;param name="asset"&gt;the asset to be wrapped&lt;/param&gt;
		/// &lt;param name="context"&gt;the context of the specified asset&lt;/param&gt;
		/// &lt;param name="wrapper"&gt;the name of the wrapper template&lt;/param&gt;
		public static void startWrap(Asset asset, OutputContext context, String wrapper = "Content Wrapper", String wrapperType = null)
		{
			if (wrapperType != null &amp;&amp; wrapperType == "custom")
			{
				Out.Wrap(wrapper);
			}
			else
			{
				Asset wrapperAsset = Asset.Load(Asset.Load(asset.TemplateId).Parent.AssetPath + "/" + wrapper);
				if (wrapperAsset.IsLoaded)
				{
					Out.Wrap(Asset.Load(asset.TemplateId).Parent.AssetPath + "/" + wrapper);
				}
				else
				{
					Out.Wrap(wrapper);
				}
			}
		}

		/// &lt;summary&gt;
		/// Function used to end the navigation wrapper. IS CURRENTLY EMPTY and will need to be updated when content actually needs to be published.
		/// &lt;/summary&gt;
		/// &lt;param name="asset"&gt;the asset to be wrapped&lt;/param&gt;
		/// &lt;param name="context"&gt;the context of the specified asset&lt;/param&gt;
		public static void endWrap(Asset asset, OutputContext context)
		{
		}

		/// &lt;summary&gt;
		/// Calls the input function for the specified component asset class file
		/// &lt;/summary&gt;
		/// &lt;param name="componentAsset"&gt;the asset corresponding to the class whos input function is called&lt;/param&gt;
		public static void generateComponentPreviewContentInput(Asset componentAsset, String label = "", String name = "preview")
		{
			String className = componentAsset.Raw["class_name"].ToString();

			String componentNamespace = getComponentLibraryNamespace(componentAsset);

			string objectNamespaceString = String.Format(componentNamespace + "." + componentAsset.Raw["class_name"]);

			ComponentBase componentInstance = (ComponentBase)XUtils.CreateInstance(objectNamespaceString);

			if (!String.IsNullOrWhiteSpace(componentAsset["class_name"]) &amp;&amp; componentInstance != null)
			{
				componentInstance.ComponentInput(componentAsset, null, label, name);
			}
			else
			{
				Input.ShowMessage("This area allows you to customize the component preview once you save the markup in the pattern tab");
			}
		}

		public static Asset getComponentCodeFileAsset(String className, Asset componentAsset, ComponentClassNameType type)
		{
			String classFileLabel = createComponentClassFileName(className, type);

			Asset componentLibraryClassFolder = getComponentLibraryClassFolder(componentAsset);

			if (!String.IsNullOrWhiteSpace(classFileLabel) &amp;&amp; componentLibraryClassFolder.IsLoaded)
			{
				Asset codeFile = Asset.Load(componentLibraryClassFolder.AssetPath.ToString() + "/" + classFileLabel);

				if (codeFile.IsLoaded)
				{
					return codeFile;
				}
			}

			return null;
		}

		/// &lt;summary&gt;
		/// Calls the post_input function for the specified component asset class file
		/// &lt;/summary&gt;
		/// &lt;param name="componentAsset"&gt;the asset corresponding to the class whos post_input function is called&lt;/param&gt;
		/// &lt;param name="context"&gt;the current context&lt;/param&gt;
		/// &lt;returns&gt;returns the context with any errors that were caught during post_input validation&lt;/returns&gt;
		public static PostInputContext generateComponentPreviewPostInput(Asset componentAsset, PostInputContext context)
		{
			try
			{
				String className = componentAsset.Raw["class_name"].ToString();

				String componentNamespace = getComponentLibraryNamespace(componentAsset);

				string objectNamespaceString = String.Format(componentNamespace + "." + componentAsset.Raw["class_name"]);

				Out.DebugWriteLine(objectNamespaceString);

				ComponentBase componentInstance = (ComponentBase)XUtils.CreateInstance(objectNamespaceString);

				//CrownPeak.CMSAPI.CustomLibrary.MediaBlockSection componentInstance = new CrownPeak.CMSAPI.CustomLibrary.MediaBlockSection();

				componentInstance.ComponentPostInput(componentAsset, context, "preview");
			}
			catch (Exception ex)
			{

			}

			return context;
		}

		/// &lt;summary&gt;
		/// Calls the output function for the specified component asset class file
		/// &lt;/summary&gt;
		/// &lt;param name="componentAsset"&gt;the asset corresponding to the class whos output function is called&lt;/param&gt;
		/// &lt;returns&gt;returns the outputed content via a string&lt;/returns&gt;
		public static string generateComponentPreview(Asset componentAsset, OutputContext context, string name = "preview", Asset renderAsset = null)
		{
			StringBuilder sbContent = new StringBuilder();

			try
			{
				String className = componentAsset.Raw["class_name"].ToString();

				String componentNamespace = getComponentLibraryNamespace(componentAsset);

				string objectNamespaceString = String.Format(componentNamespace + "." + componentAsset.Raw["class_name"]);

				Out.DebugWriteLine("objectNamespaceString: " + objectNamespaceString);

				ComponentBase componentInstance = (ComponentBase)XUtils.CreateInstance(objectNamespaceString);

				//Hero componentInstance = new Hero();

				if (renderAsset == null)
				{
					sbContent.Append(componentInstance.ComponentOutput(componentAsset, context, name));
				}
				else
				{
					sbContent.Append(componentInstance.ComponentOutput(renderAsset, context, name));
				}
			}
			catch (Exception ex)
			{
				Out.DebugWriteLine("exception caught: " + ex.Message + " :: " + ex.InnerException);
			}

			return sbContent.ToString();
		}

		/// &lt;summary&gt;
		/// adds a list node to the content dictionary
		/// &lt;/summary&gt;
		/// &lt;param name="currentContent"&gt;the current content dictionary where the list node should be added to&lt;/param&gt;
		/// &lt;param name="nodeString"&gt;the string representation of the list node&lt;/param&gt;
		/// &lt;param name="currentPanel"&gt;the current panel index which will be incremented accordingly&lt;/param&gt;
		/// &lt;returns&gt;Returns the updated content dictionary with the list node added&lt;/returns&gt;
		private static Dictionary&lt;String, String&gt; addListNodeContent(Dictionary&lt;String, String&gt; currentContent, String nodeString, ref int currentPanel)
		{
			Regex listNodeRegex = getContentFieldRegex(ContentNodeType.ListNode);

			Match listNodeMatch = listNodeRegex.Match(nodeString);

			if (listNodeMatch != null &amp;&amp; !String.IsNullOrEmpty(listNodeMatch.Value))
			{
				String fieldName = getAttribValueFromComponentMarkup(listNodeMatch.Value, "name");

				if (!currentContent.Any(x =&gt; x.Key.Contains("component_list_label") &amp;&amp; x.Value == fieldName))
				{
					String nodeContent = nodeString.Replace("&lt;/" + repeatableNodeName + "&gt;", "").Replace(listNodeMatch.Value, "").Trim();

					Out.DebugWriteLine("repeatableNodeName found with field name: {0}", fieldName ?? "N/S");

					//Need to parse remaining content in the list node
					//get the types for each content field specified in the remaining content                    
					//get the field names
					//Dictionary&lt;String, String&gt; fieldNamesAndTypes = new Dictionary&lt;string, string&gt;();

					currentContent.Add("component_panel:" + currentPanel, (currentPanel - 1).ToString());
					currentContent.Add("component_category:" + currentPanel, "list");
					currentContent.Add("component_list_label:" + currentPanel, fieldName);
					currentContent.Add("component_list_content:" + currentPanel, nodeContent);

					currentPanel++;
				}
			}

			return currentContent;
		}

		/// &lt;summary&gt;
		///  adds a component node to the content dictionary
		/// &lt;/summary&gt;
		/// &lt;param name="currentContent"&gt;the current content dictionary where the list node should be added to&lt;/param&gt;
		/// &lt;param name="contentString"&gt;the string representation of the component node&lt;/param&gt;
		/// &lt;param name="currentPanel"&gt;the current panel index which will be incremented accordingly&lt;/param&gt;
		/// &lt;param name="isOnlyOneComponent"&gt;identifies if the compoentnt being added is the only component in the markup&lt;/param&gt;
		/// &lt;param name="containedComponents"&gt;field used specifically if the component is apart of a list. keeps a comma seperated list of components contained in the list&lt;/param&gt;
		/// &lt;returns&gt;Returns the updated content dictionary with the list node added&lt;/returns&gt;
		private static Dictionary&lt;String, String&gt; addContentPlaceholderContent(Dictionary&lt;String, String&gt; currentContent, String contentString, ref int currentPanel, bool isOnlyOneComponent, ref StringBuilder containedComponents)
		{
			String fieldName = getContentPlaceholderName(contentString);
			String typeName = getContentPlaceholderTypeFromMarkup(contentString);
			bool typeInMarkup = true;

			if (typeName == string.Empty)
			{
				typeName = defaultContentPlaceholderType;
				typeInMarkup = false;
			}

			String fieldLabel = cap(fieldName);

			if (fieldName != String.Empty)
			{
				fieldLabel = cap(fieldName);
			}

			if (!currentContent.Any(x =&gt; x.Key.Contains("component_component_label") &amp;&amp; x.Value == fieldName))
			{
				Out.DebugWriteLine("contentNode found with field name: {0}, type: {1}, panelCount: {2}", fieldName ?? "N/S", typeName ?? "N/S", currentPanel.ToString());
				if (isOnlyOneComponent)
				{
					currentContent.Add("component_panel", (currentPanel - 1).ToString());
					currentContent.Add("component_category", "component");
					currentContent.Add("component_component_label", fieldName);
					currentContent.Add("component_component_type", typeName);
					currentContent.Add("component_component_type_in_markup", typeInMarkup.ToString());
				}
				else
				{
					currentContent.Add("component_panel:" + currentPanel, (currentPanel - 1).ToString());
					currentContent.Add("component_category:" + currentPanel, "component");
					currentContent.Add("component_component_label:" + currentPanel, fieldName);
					currentContent.Add("component_component_type:" + currentPanel, typeName);
					currentContent.Add("component_component_type_in_markup:" + currentPanel, typeInMarkup.ToString());
				}
				currentPanel++;
				if (containedComponents != null)
				{
					containedComponents.Append(fieldName + ", ");
				}
			}
			else
			{
				Out.DebugWriteLine("Unable to add component: {0} because it already exists", fieldName);
			}
			return currentContent;
		}

		/// &lt;summary&gt;
		/// Parses the content field markup to get the content field name
		/// &lt;/summary&gt;
		/// &lt;param name="contentPlaceholderMarkup"&gt;the content field markup for which the field name is to be returned.&lt;/param&gt;
		/// &lt;returns&gt;the content field name from the provided content&lt;/returns&gt;
		public static String getContentPlaceholderName(String contentPlaceholderMarkup)
		{
			int delimeterIndex = contentPlaceholderMarkup.IndexOf(":");

			String contentPlaceholderName = "";

			if (delimeterIndex == -1)
			{
				contentPlaceholderName = contentPlaceholderMarkup.Replace("{", "").Replace("}", "").Trim();
			}
			else
			{
				contentPlaceholderName = contentPlaceholderMarkup.Substring(0, contentPlaceholderMarkup.IndexOf(":")).Replace("{", "").Replace("}", "").Trim();
			}

			return contentPlaceholderName;

		}

		/// &lt;summary&gt;
		/// Parses the content field markup to get the content field type
		/// &lt;/summary&gt;
		/// &lt;param name="contentPlaceholderMarkup"&gt;the content field markup for which the field name is to be returned.&lt;/param&gt;
		/// &lt;returns&gt;the content field name from the provided content&lt;/returns&gt;
		public static String getContentPlaceholderTypeFromMarkup(String contentPlaceholderMarkup)
		{
			if (!contentPlaceholderMarkup.Contains(":"))
			{
				return string.Empty;
			}

			var result = contentPlaceholderMarkup.Substring(contentPlaceholderMarkup.IndexOf(":") + 1).Replace("{", "").Replace("}", "").Trim();

			if (result.Contains(":"))
			{
				result = result.Substring(0, result.IndexOf(":"));
			}

			return result;
		}

		/// &lt;summary&gt;
		/// Parses the content field markup to get the indexed field details
		/// &lt;/summary&gt;
		/// &lt;param name="contentPlaceholderMarkup"&gt;the content field markup for which the indexed field is to be returned.&lt;/param&gt;
		/// &lt;returns&gt;the content indexed field details from the provided content&lt;/returns&gt;
		public static String getContentPlaceholderIndexedFieldFromMarkup(String contentPlaceholderMarkup)
		{
			if (!contentPlaceholderMarkup.Contains(":"))
			{
				return string.Empty;
			}

			var segments = contentPlaceholderMarkup.Replace("{", "").Replace("}", "").Trim().Split(":".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
			if (segments.Length &gt; 2)
			{
				var thirdSegment = segments[2].Trim();
				if (thirdSegment.StartsWith("Indexed"))
					return thirdSegment.Substring(7);
			}

			return string.Empty;
		}

		/// &lt;summary&gt;
		/// Retrieves the index of the content field of the provided content field key. Only expects non-nested componnets with no more then 1 semi-colon
		/// &lt;/summary&gt;
		/// &lt;param name="contentFieldKey"&gt;The content field key for which the index is to be returned&lt;/param&gt;
		/// &lt;returns&gt;The index of the content field key&lt;/returns&gt;
		private static int getContentFieldIndex(String contentFieldKey)
		{
			int index = -1;

			if (contentFieldKey.Contains(":"))
			{
				index = Convert.ToInt32(contentFieldKey.Substring(contentFieldKey.LastIndexOf(":") + 1, contentFieldKey.Length - (contentFieldKey.LastIndexOf(":") + 1)));
				Out.DebugWriteLine("returning index \"" + index.ToString() + "\" for " + contentFieldKey);
			}

			return index;
		}

		/// &lt;summary&gt;
		/// Displays the content of the dictioary provided for testing purposes
		/// &lt;/summary&gt;
		/// &lt;param name="content"&gt;the content to be displayed&lt;/param&gt;
		private static void displayContent(Dictionary&lt;string, string&gt; content)
		{
			Out.DebugWriteLine("Content Fields Being Deleted...");
			foreach (String key in content.Keys)
			{
				Out.DebugWriteLine(key + " : " + content[key]);
			}
			Out.DebugWriteLine("End Content Fields Being Deleted");
		}

		/// &lt;summary&gt;
		/// Retrives the attribute value for the specified attribName in the specified markup
		/// &lt;/summary&gt;
		/// &lt;param name="markup"&gt;The markup to be parsed&lt;/param&gt;
		/// &lt;param name="attribName"&gt;the attribute for which the value is to be returned&lt;/param&gt;
		/// &lt;returns&gt;the attribute value&lt;/returns&gt;
		public static String getAttribValueFromComponentMarkup(String markup, String attribName)
		{
			if (String.IsNullOrWhiteSpace(markup) || String.IsNullOrWhiteSpace(attribName))
			{
				return string.Empty;
			}

			Regex rx = new Regex(attribName + "\\s*=\\s*\"[a-zA-Z0-9\\w|-]*\"", RegexOptions.Compiled | RegexOptions.IgnoreCase);
			Match attribMatch = rx.Match(markup);
			Out.DebugWriteLine(attribMatch.Success ? "attribMatch.value: " + attribMatch.Value : "no match found");

			if (String.IsNullOrWhiteSpace(attribMatch.Value))
			{
				return string.Empty;
			}

			String attribMatchValue = attribMatch.Value.Replace(" ", "");
			String value = attribMatchValue.Substring(attribName.Length + 2, attribMatchValue.Length - (attribName.Length + 3));

			if (attribName == "label")
			{
				return cap(value); // char.ToUpper(value[0]) + value.Substring(1);
			}
			else
			{
				return value;
			}
		}

		public static String getListNodeContent(String markup)
		{
			Regex listNodeRegex = getContentFieldRegex(ContentNodeType.ListNode);

			Match listNodeMatch = listNodeRegex.Match(markup);

			return markup.Replace("&lt;/" + repeatableNodeName + "&gt;", "").Replace(listNodeMatch.Value, "").Trim();
		}

		public static String getListNodeComponents(String markup)
		{
			StringBuilder containedComponents = new StringBuilder();

			Regex contentPlaceholderRegex = getContentFieldRegex(ContentNodeType.Content);

			MatchCollection matches = contentPlaceholderRegex.Matches(markup);

			foreach (Match match in matches)
			{
				containedComponents.Append(getContentPlaceholderName(match.Value) + ", ");
			}

			if (!String.IsNullOrWhiteSpace(containedComponents.ToString()))
			{
				if (containedComponents.ToString().EndsWith(", "))
				{
					containedComponents.Remove(containedComponents.Length - 2, 2);
				}
			}

			return containedComponents.ToString();
		}

		/// &lt;summary&gt;
		/// Returns the specifed number of tab characters
		/// &lt;/summary&gt;
		/// &lt;param name="n"&gt;The number of tab characters to be returned&lt;/param&gt;
		/// &lt;returns&gt;The specifed number of tab characters&lt;/returns&gt;
		private static String moarTabs(int n)
		{
			StringBuilder sb = new StringBuilder();
			for (int x = 0; x &lt; n; x++)
			{
				sb.Append(tabChar);
			}
			return sb.ToString();
		}

		/// &lt;summary&gt;
		/// Capitalizes the first letter of the provided string
		/// &lt;/summary&gt;
		/// &lt;param name="s"&gt;The string where the first letter is to be capitalized&lt;/param&gt;
		/// &lt;returns&gt;The provided string with the first letter capitalized&lt;/returns&gt;
		public static String cap(String s)
		{
			if (s.Length &lt; 2)
			{
				return s;
			}
			else
			{
				return char.ToUpper(s[0]) + s.Substring(1);
			}
		}

		/// &lt;summary&gt;
		/// Changes the provided string by capitalizing the first letter and then capitalizing every subsaquent character that appears after an underscore
		/// &lt;/summary&gt;
		/// &lt;param name="s"&gt;The string to be changed&lt;/param&gt;
		/// &lt;returns&gt;the updated string&lt;/returns&gt;
		public static String labelize(String s)
		{
			String label = "";
			for (int index = 0; index &lt; s.Length; index++)
			{
				if (index == 0)
				{
					label = label + Char.ToUpper(s[index]);
				}
				else if (s[index] == '_')
				{
					label = label + " " + Char.ToUpper(s[index + 1]);
					index++;
				}
				else
				{
					label = label + s[index];
				}
			}

			return label;
		}

		/// &lt;summary&gt;
		/// Counts all components (list and content) in the markup
		/// &lt;/summary&gt;
		/// &lt;param name="markup"&gt;The markup for which components are counted&lt;/param&gt;
		/// &lt;returns&gt;The total number of components&lt;/returns&gt;
		private static int getTotalComponentCount(String markup)
		{
			Regex compRegex = getContentFieldRegex(ContentNodeType.Content);

			Regex listRegex = getContentFieldRegex(ContentNodeType.ListNode);

			MatchCollection compMatches = compRegex.Matches(markup);

			MatchCollection Listmatches = listRegex.Matches(markup);

			if (compMatches != null &amp;&amp; Listmatches != null)
			{
				return compMatches.Count + Listmatches.Count;
			}
			else
			{
				Out.DebugWriteLine("0 content fields or or " + repeatableNodeName + " elements found in markup.");
				return 0;
			}
		}

		/// &lt;summary&gt;
		/// parses the provided markup, removes either the preview or publish content depending on the context and then returns the updated markup
		/// &lt;/summary&gt;
		/// &lt;param name="asset"&gt;The current asset&lt;/param&gt;
		/// &lt;param name="context"&gt;The current asset's context&lt;/param&gt;
		/// &lt;param name="markup"&gt;The current markup being constructed&lt;/param&gt;
		/// &lt;returns&gt;an updated markup with the preview or publish content removed depending on the context&lt;/returns&gt;
		public static String updateMarkupForPreviewPublish(OutputContext context, String markup)
		{
			if (context.IsPublishing)
			{
				//removes all preview content from the markup
				Regex previewNodeAndContentRegex = getContentFieldRegex(ContentNodeType.PreviewNodeAndContent);
				MatchCollection previewContentMatches = previewNodeAndContentRegex.Matches(markup);
				foreach (Match match in previewContentMatches)
				{
					markup = markup.Replace(match.Value, "");
				}

				//removes all the publish node open tags from the markup
				Regex publishNodeOpenRegex = getContentFieldRegex(ContentNodeType.PublishNodeOpen);
				MatchCollection publishNodeOpenMatches = publishNodeOpenRegex.Matches(markup);
				foreach (Match match in publishNodeOpenMatches)
				{
					markup = markup.Replace(match.Value, "");
				}

				//removes all the publish node close tags from the markup
				Regex publishNodeCloseRegex = getContentFieldRegex(ContentNodeType.PublishNodeClose);
				MatchCollection publishNodeCloseMatches = publishNodeCloseRegex.Matches(markup);
				foreach (Match match in publishNodeCloseMatches)
				{
					markup = markup.Replace(match.Value, "");
				}
			}
			else
			{
				//removes all publish content from the markup
				Regex publishNodeAndContentRegex = getContentFieldRegex(ContentNodeType.PublishNodeAndContent);
				MatchCollection publishContentMatches = publishNodeAndContentRegex.Matches(markup);
				foreach (Match match in publishContentMatches)
				{
					markup = markup.Replace(match.Value, "");
				}

				//removes all the preview node open tags from the markup
				Regex previewNodeOpenRegex = getContentFieldRegex(ContentNodeType.PreviewNodeOpen);
				MatchCollection previewNodeOpenMatches = previewNodeOpenRegex.Matches(markup);
				foreach (Match match in previewNodeOpenMatches)
				{
					markup = markup.Replace(match.Value, "");
				}

				//removes all the preview node close tags from the markup
				Regex previewNodeCloseRegex = getContentFieldRegex(ContentNodeType.PreviewNodeClose);
				MatchCollection previewNodeCloseMatches = previewNodeCloseRegex.Matches(markup);
				foreach (Match match in previewNodeCloseMatches)
				{
					markup = markup.Replace(match.Value, "");
				}
			}

			return markup;
		}

		/// &lt;summary&gt;
		/// Values used to identify content node types
		/// &lt;/summary&gt;
		public enum ContentNodeType
		{
			Content,
			ListNode,
			ListNodeAndContent,
			ListNodeAndContentV2,
			PreviewNodeOpen,
			PreviewNodeClose,
			PreviewNodeAndContent,
			PublishNodeOpen,
			PublishNodeClose,
			PublishNodeAndContent
		}

		public enum ComponentClassNameType
		{
			Base,
			Override
		}

		public enum ContentPlaceholderCategory
		{
			List,
			Component
		}

		public static List&lt;ComponentContentPlaceholder&gt; buildComponentContentPlaceholderFromMarkup(String componentMarkup)
		{
			List&lt;ComponentContentPlaceholder&gt; componentContentPlaceholdersList = new List&lt;ComponentContentPlaceholder&gt;();

			ContentParser(ref componentContentPlaceholdersList, componentMarkup);

			return componentContentPlaceholdersList;
		}

		public static List&lt;ComponentContentPlaceholder&gt; buildComponentContentPlaceholderForTemplateFromMarkup(String componentMarkup)
		{
			List&lt;ComponentContentPlaceholder&gt; componentContentPlaceholdersList = new List&lt;ComponentContentPlaceholder&gt;();

			ContentParserForTemplate(ref componentContentPlaceholdersList, componentMarkup);

			return componentContentPlaceholdersList;
		}

		//        public static String parserTest(String ComponentMarkup)
		//        {
		//            //Regex rx = new Regex(@"&lt;" + repeatableNodeName + @"(\w|\s|\=|""|-)*&gt;(.|\n)*?&lt;/" + repeatableNodeName + "&gt;", RegexOptions.Compiled | RegexOptions.IgnoreCase);
		//            StringBuilder sb = new StringBuilder();
		//            string input = @"&lt;h1&gt;{title}&lt;/h1&gt;
		//
		//&lt;div class=""intro""&gt;
		//
		//	{intro_content : Wysiwyg}
		//	
		//&lt;/div&gt;
		//
		//&lt;cp-list name=""primary_accordion_list""&gt;
		//
		//	{accordion_title : AccordionTitle}
		//	
		//	&lt;cp-list name=""a_panel_list""&gt;
		//	
		//		{panel_content : Wysiwyg}
		//		
		//	&lt;/cp-list&gt;
		//	
		//	&lt;cp-list name=""b_panel_list""&gt;
		//	
		//		{panel_content : Wysiwyg}
		//		
		//	&lt;/cp-list&gt;
		//	
		//&lt;/cp-list&gt;
		//
		//&lt;cp-list name=""secondary_accordion_list_b""&gt;
		//
		//	{accordion_title : AccordionTitle}
		//	
		//	&lt;cp-list name=""c_panel_list""&gt;
		//	
		//		{panel_content : Wysiwyg}
		//		
		//	&lt;/cp-list&gt;
		//	
		//&lt;/cp-list&gt;";
		//            //string input = "username,TB_PEOPLE.fields(FirstName,LastName,TB_PHONE.fields(num_phone1, num_phone2)),password";
		//            string pattern = @"(?&gt;\w+\.)?\w+\((?&gt;\((?&lt;DEPTH&gt;)|\)(?&lt;-DEPTH&gt;)|[^()]+)*\)(?(DEPTH)(?!))|\w+";
		//                                //@"&lt;" + repeatableNodeName + @"(\w|\s|\=|""|-)*&gt;(.|\n)*?&lt;/" + repeatableNodeName + "&gt;"
		//                                //    @"(&lt;control\sid=.+?&gt;.+?(?:&lt;/control&gt;){2,})",(RegexOptions) 0);

		//            //Regex regex = new Regex(@"(&lt;cp-list\sname=.+?&gt;.+?(?:&lt;/cp-list&gt;){2,})",(RegexOptions) 0);
		//            Regex regex = new Regex(@"&lt;" + repeatableNodeName + @"(\w|\s|\=|""|-)*&gt; (?&gt;&lt;" + repeatableNodeName + @" (?&lt;DEPTH&gt;) | &lt;/" + repeatableNodeName + @"&gt; (?&lt;-DEPTH&gt;) | .? )* (?(DEPTH)(?!))&lt;/" + repeatableNodeName + @"&gt;", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline);
		//                      sb.AppendLine(@"&lt;" + repeatableNodeName + @"(\w|\s|\=|""|-)*&gt; (?&gt;&lt;" + repeatableNodeName + @" (?&lt;DEPTH&gt;) | &lt;/" + repeatableNodeName + @"&gt; (?&lt;-DEPTH&gt;) | .? )* (?(DEPTH)(?!))&lt;/" + repeatableNodeName + @"&gt;");
		//            MatchCollection matches = regex.Matches(input);
		//            sb.AppendLine(input).AppendLine();
		//            sb.AppendLine("# of Matches: " + matches.Count).AppendLine();
		//            foreach (Match match in matches)
		//            {
		//                sb.AppendLine("Match:: " + match.Groups[0].Value);
		//            }

		//            return sb.ToString();
		//        }

		//private static List&lt;XmlNode&gt; getXmlNodeListFromMarkup(String componentMarkup)
		//{
		//    List&lt;XmlNode&gt; nodeList = null;
		//    if (String.IsNullOrWhiteSpace(componentMarkup))
		//    {
		//        Input.ShowMessage("The component markup is not available");
		//        return nodeList;
		//    }

		//    Out.DebugWriteLine("componentMarkup: " + Util.HtmlEncode(componentMarkup));

		//    Regex rootNodeRx = new Regex(@"^\s*&lt;\s*([a-zA-Z0-9]|-)*\s*", RegexOptions.Compiled | RegexOptions.IgnoreCase);

		//    Match rootNodeMatch = rootNodeRx.Match(componentMarkup);

		//    String rootNodeName = "";

		//    if (!rootNodeMatch.Success)
		//    {
		//        Out.DebugWriteLine("No match for ar root node found.");
		//    }

		//    rootNodeName = rootNodeMatch.Value.Substring(rootNodeMatch.Value.IndexOf("&lt;") + 1).Trim();
		//    Out.DebugWriteLine("Root Node Match value: {0}", rootNodeName);

		//    try
		//    {
		//        nodeList = Util.LoadXml(componentMarkup, rootNodeName);
		//    }
		//    catch (Exception ex)
		//    {
		//        if (ex.Message.Contains("There are multiple root elements") || ex.Message.Contains("We're sorry - but the system was unable to complete your request due to an internal error."))
		//        {
		//            Out.DebugWriteLine("multiple root elements found. creating temporary root element...");
		//            String tempComponentMarkup = "&lt;root&gt;" + componentMarkup + "&lt;/root&gt;";
		//            nodeList = Util.LoadXml(tempComponentMarkup, "root");
		//            nodeList = nodeList[0].XmlNodes;
		//        }
		//        else
		//        {
		//            throw ex;
		//        }
		//    }

		//    return nodeList;
		//}

		public static void ContentParser(ref List&lt;ComponentContentPlaceholder&gt; componentContentPlaceholdersList, String myComponentMarkup)
		{
			//Pull out Lists
			Regex listAndContentRegex = getContentFieldRegex(ContentNodeType.ListNodeAndContentV2);

			MatchCollection listMAtchesList = listAndContentRegex.Matches(myComponentMarkup);

			//goes through and replaces all of the list matches found with empty strings so that we can focus on any remaining placeholders
			myComponentMarkup = listMAtchesList.Cast&lt;Match&gt;().Aggregate(myComponentMarkup, (current, listMatch) =&gt; current.Replace(listMatch.Value, String.Empty));

			//for each list recursion
			foreach (Match listMatch in listMAtchesList)
			{
				ComponentContentPlaceholder listCcp = getComponentContentPlaceholderFromMatch(listMatch);

				componentContentPlaceholdersList.Add(listCcp);
			}

			//add remaining content fields
			Regex contentPlaceholderRegex = getContentFieldRegex(ContentNodeType.Content);
			MatchCollection contenPlaceholdertMatchesList = contentPlaceholderRegex.Matches(myComponentMarkup);

			foreach (Match contentPlaceholderMatch in contenPlaceholdertMatchesList)
			{
				componentContentPlaceholdersList.Add(new ComponentContentPlaceholder(contentPlaceholderMatch, "component"));
			}

			//return
		}

		public static void ContentParserForTemplate(ref List&lt;ComponentContentPlaceholder&gt; componentContentPlaceholdersList, String myTemplateMarkup)
		{
			//Pull out Lists
			Regex listAndContentRegex = getContentFieldRegex(ContentNodeType.ListNodeAndContentV2);

			MatchCollection listMatchesList = listAndContentRegex.Matches(myTemplateMarkup);

			//goes through and replaces all of the list matches found with empty strings so that we can focus on any remaining placeholders
			myTemplateMarkup = listMatchesList.Cast&lt;Match&gt;().Aggregate(myTemplateMarkup, (current, listMatch) =&gt; current.Replace(listMatch.Value, String.Empty));

			//for each list recursion
			foreach (Match listMatch in listMatchesList)
			{
				ComponentContentPlaceholder listCcp = getComponentContentPlaceholderFromMatch(listMatch);

				componentContentPlaceholdersList.Add(listCcp);
			}

			//add remaining content fields
			Regex contentPlaceholderRegex = getContentFieldRegex(ContentNodeType.Content);
			MatchCollection contentPlaceholderMatchesList = contentPlaceholderRegex.Matches(myTemplateMarkup);

			foreach (Match contentPlaceholderMatch in contentPlaceholderMatchesList)
			{
				componentContentPlaceholdersList.Add(new ComponentContentPlaceholder(contentPlaceholderMatch, "template"));
			}

			//return
		}

		private static ComponentContentPlaceholder getComponentContentPlaceholderFromMatch(Match listMatch)
		{
			String listMatchValue = listMatch.Value;
			String listNodeString = getListNodeString(listMatchValue);

			String content = listMatchValue.Substring(listNodeString.Length + 2, listMatchValue.Length - listNodeString.Length - ("&lt;/" + repeatableNodeName + "&gt;").Length - 2).Trim();

			ComponentContentPlaceholder listPlaceholder = new ComponentContentPlaceholder();
			listPlaceholder.name = getAttribValueFromComponentMarkup(listNodeString, "name");
			listPlaceholder.category = ContentPlaceholderCategory.List;
			listPlaceholder.content = content;
			listPlaceholder.subComponents = ContentParserHelper(content);

			return listPlaceholder;
		}

		private static List&lt;ComponentContentPlaceholder&gt; ContentParserHelper(String myComponentMarkup)
		{
			List&lt;ComponentContentPlaceholder&gt; myComponentContentPlaceholderList = new List&lt;ComponentContentPlaceholder&gt;();
			//Pull out Lists
			Regex listAndContentRegex = getContentFieldRegex(ContentNodeType.ListNodeAndContentV2);

			MatchCollection listMAtchesList = listAndContentRegex.Matches(myComponentMarkup);

			//goes through and replaces all of the list matches found with empty strings so that we can focus on any remaining placeholders
			myComponentMarkup = listMAtchesList.Cast&lt;Match&gt;().Aggregate(myComponentMarkup, (current, listMatch) =&gt; current.Replace(listMatch.Value, String.Empty));

			//for each list recursion
			foreach (Match listMatch in listMAtchesList)
			{
				ComponentContentPlaceholder listCcp = getComponentContentPlaceholderFromMatch(listMatch);

				myComponentContentPlaceholderList.Add(listCcp);
			}

			//add remaining content fields
			Regex contentPlaceholderRegex = getContentFieldRegex(ContentNodeType.Content);
			MatchCollection contenPlaceholdertMatchesList = contentPlaceholderRegex.Matches(myComponentMarkup);

			foreach (Match contentPlaceholderMatch in contenPlaceholdertMatchesList)
			{
				ComponentContentPlaceholder contentPlaceholderToAdd = new ComponentContentPlaceholder(contentPlaceholderMatch, "component");

				if (!myComponentContentPlaceholderList.Any(x =&gt; x.name == contentPlaceholderToAdd.name &amp;&amp; x.category == contentPlaceholderToAdd.category))
				{
					myComponentContentPlaceholderList.Add(contentPlaceholderToAdd);
				}
			}

			//return
			return myComponentContentPlaceholderList;
		}

		private static String getListNodeString(String markup)
		{
			return markup.Substring(markup.IndexOf("&lt;"), markup.IndexOf("&gt;") + 1);
		}

		public static void deleteComponentContent(Asset asset)
		{
			List&lt;String&gt; keysToRemove = asset.GetContentFields().Keys.ToList();

			keysToRemove.Remove("markup");
			keysToRemove.Remove("class_name");
			keysToRemove.Remove("read_only");
			keysToRemove.Remove("json_component");
			keysToRemove.Remove("component_zones");
			keysToRemove.Remove("content_block_hide");
			keysToRemove.RemoveAll(x =&gt; x.StartsWith("preview_") || x.StartsWith("upload#") || x.StartsWith("upload_name#") || x.StartsWith("ommsnippetid#") || x.StartsWith("ommvariantid#"));

			asset.DeleteContentFields(keysToRemove);
		}

		public static void deleteTemplateContent(PostInputContext context)
		{
			List&lt;String&gt; keysToRemove = context.InputForm.Select(f =&gt; f.Key).ToList();

			keysToRemove.Remove("markup");
			keysToRemove.Remove("json_template");
			keysToRemove.Remove("wrapper_type");
			keysToRemove.Remove("wrapper");
			keysToRemove.Remove("custom_wrapper");
			keysToRemove.Remove("create");
			keysToRemove.Remove("template_name");
			keysToRemove.Remove("template_folder");
			keysToRemove.Remove("previewAsset");
			keysToRemove.Remove("meta");
			keysToRemove.Remove("custom_js_css");
			keysToRemove.Remove("advanced");
			keysToRemove.Remove("enable_tmf");
			keysToRemove.Remove("create_output_translate_xml");
			keysToRemove.Remove("output_translate_xml_body");
			keysToRemove.RemoveAll(x =&gt; x.StartsWith("upload#") || x.StartsWith("upload_name#") || x.StartsWith("ommsnippetid#") || x.StartsWith("ommvariantid#"));

			// Don't do a Remove here else it kills the ability to update and save the fields later
			//context.InputForm.Remove(keysToRemove);
			keysToRemove.ForEach(k =&gt; context.InputForm[k] = "");
		}

		public static String generateCssHeaderDeclarations(Asset configAsset)
		{
			string openTag = "&lt;" + "%";
			string closeTag = "%" + "&gt;";

			StringBuilder sb = new StringBuilder();

			sb.Append("&lt;link rel=\"stylesheet\" href=\"" + Asset.Load(configAsset["css_to_use"]).GetLink(LinkType.Include) + "\" media=\"all\" /&gt;").AppendLine();


			return sb.ToString();
		}

		//public static String outputComponentPlaceholderListContent(List&lt;ComponentContentPlaceholder&gt; componentContentPlaceholderList)
		//{
		//    StringBuilder sb = new StringBuilder();

		//    foreach (ComponentContentPlaceholder ccp in componentContentPlaceholderList)
		//    {
		//        if (ccp.type == "list")
		//        {
		//            sb.AppendFormat("&lt;p&gt;{0} : {1}&lt;/p&gt;", "type", ccp.type);
		//            sb.AppendFormat("&lt;p&gt;{0} : {1}&lt;/p&gt;", "type", ccp.type);
		//        }
		//        else if(ccp.type == "content")
		//        {

		//        }
		//        else
		//        {

		//        }
		//    }

		//    return sb.ToString();
		//}

		//private static void ContentParserListHelper(List&lt;XmlNode&gt; nodeList, ref Dictionary&lt;String, String&gt; currentContent, ref StringBuilder containedComponents, ref int panelCount)
		//{
		//    foreach (XmlNode currentNode in nodeList)
		//    {
		//        Out.DebugWriteLine("Entered ContentParserListHelper for Node: {0}...", currentNode.Name);

		//        /***IF THE CURRENT NODE IS A CONTENT NODE***/
		//        if (currentNode.Name == contentNodeName)
		//        {
		//            String fieldName = currentNode.Attributes["name"] ?? String.Empty;
		//            String typeName = currentNode.Attributes["type"] ?? String.Empty;

		//            if (fieldName != String.Empty)
		//            {
		//                String fieldLabel = cap(fieldName); // char.ToUpper(fieldName[0]) + fieldName.Substring(1);
		//            }

		//            if (typeName != String.Empty)
		//            {
		//                typeName = typeName.ToLower();
		//            }

		//            Out.DebugWriteLine("contentNode found with field name: {0}, type: {1}", fieldName ?? "N/S", typeName ?? "N/S");
		//            currentContent.Add("component_panel:" + panelCount, (panelCount - 1).ToString());
		//            currentContent.Add("component_category:" + panelCount, "component");
		//            currentContent.Add("component_component_label:" + panelCount, fieldName);
		//            currentContent.Add("component_component_type:" + panelCount, typeName);

		//            containedComponents.Append(fieldName + ", ");

		//            panelCount++;
		//        }
		//        /***IF THE CURRENT NODE IS A LIST NODE***/
		//        else if (currentNode.Name == repeatableNodeName)
		//        {
		//            String fieldName = currentNode.Attributes["name"] ?? String.Empty;
		//            /*if the current node is a list node but we are already in a list throw an error*/
		//            Input.ShowMessage("Error Parsing componnet Nested List: {0} found", fieldName);
		//        }
		//        //IF THE CURRENT NODE IS NOT A LIST OR CONTENT NODE
		//        else
		//        {
		//            ContentParserListHelper(currentNode.XmlNodes, ref currentContent, ref containedComponents, ref panelCount);
		//        }
		//    }
		//}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261252</id>
    <label>ComponentLibraryHelperUpdates.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/ComponentLibraryHelperUpdates.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Experimental;
using CrownPeak.CMSAPI.Services;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public abstract class JsonComponentBase : ComponentBase
	{
		//
		// Summary:
		//     The JSON function which is meant to be overridden by the child class
		//
		// Parameters:
		//   asset:
		//     The current asset
		//
		//   context:
		//     The current OutputContext context
		//
		//   name:
		//     The content field name for the current field or component
		//
		//   index:
		//     If this is in a list panel then the current panel index
		//
		// Returns:
		//     The JSON for the current component with all the content placeholders names
		//     and their specified content
		public abstract string ComponentJson(Asset asset, OutputContext context, string name, string index = "");

		//
		// Summary:
		//     The indexed fields function which is meant to be overridden by the child class
		//
		// Parameters:
		//   asset:
		//     The current asset
		//
		//   context:
		//     The current OutputContext context
		//
		//   name:
		//     The content field name for the current field or component
		//
		//   index:
		//     If this is in a list panel then the current panel index
		//
		// Returns:
		//     A collection of the sortable fields for the component
		public abstract IEnumerable&lt;IndexedField&gt; ComponentIndexedFields(Asset asset, SearchG2Context context, string name, string index = "");

		//
		// Summary:
		//     The default helper function used to iterate through each panel during the JSON output
		//     process when list panels are used.
		//
		// Parameters:
		//   asset:
		//     The current asset
		//
		//   context:
		//     The current OutputContext context
		//
		//   name:
		//     The current content field name for the current content field or component
		//
		//   markup:
		//     The markup that should be repeated within the panel
		//
		//   listName:
		//     the cp-list name attribute value
		//
		//   fields:
		//     A Dictionary where each key value pair consist of a list of string parameters
		//     and the corresponding content field's output function
		//
		//   index:
		//     If this is in a list panel then the current panel index
		//
		// Returns:
		//     The markup for the current list panel with all the content placeholders replaced
		//     with their specified content for each panel
		public string PanelJson(Asset asset, OutputContext context, string name, string markup, string listName, string itemName, Dictionary&lt;List&lt;string&gt;, Func&lt;Asset, OutputContext, string, string, string&gt;&gt; fields, string index = "")
		{
			Out.DebugWriteLine("Entered panel_json with name: {0}, markup: {1}, listName: {2}", name,
				Util.HtmlEncode(markup), listName);
			var output = new StringBuilder(1024);
			var i = 1;
			Out.DebugWriteLine("checking asset[" + name + Index(i) + index + "]...");

			if (!string.IsNullOrEmpty(asset[name + Index(i) + index]))
			{
				while (!string.IsNullOrEmpty(asset[name + Index(i) + index]))
				{
					var pattern = itemName.StartsWith("_")
						? markup
						: string.Format("{{\"{0}\":{1}}}", JsonHelper.StringToJson(itemName), markup);
					Out.DebugWriteLine("asset[" + name + Index(i) + index + "] = " + asset[name + Index(i) + index]);
					foreach (var entry in fields)
					{
						var fieldParams = entry.Key;
						var method = entry.Value;
						pattern = pattern.Replace(fieldParams[0],
							method(asset, context, name + fieldParams[1], Index(i) + index));
					}

					if (i++ &gt; 1) output.Append(",");
					output.Append(pattern);
				}
			}

			else if (!string.IsNullOrEmpty(asset[name + index]))
			{
				var pattern = itemName.StartsWith("_")
					? markup
					: string.Format("{{\"{0}\":{1}}}", JsonHelper.StringToJson(itemName), markup);
				Out.DebugWriteLine("asset[" + name + index + "] = " + asset[name + index]);
				foreach (var entry in fields)
				{
					var fieldParams = entry.Key;
					var method = entry.Value;
					pattern = pattern.Replace(fieldParams[0], method(asset, context, name + fieldParams[1], index));
				}

				if (i++ &gt; 1) output.Append(",");
				output.Append(pattern);
			}
			else if (!string.IsNullOrEmpty(asset[name + Index(i) + ":1"]))
			{
				while (!string.IsNullOrEmpty(asset[name + Index(i) + ":1"]))
				{
					var pattern = itemName.StartsWith("_")
						? markup
						: string.Format("{{\"{0}\":{1}}}", JsonHelper.StringToJson(itemName), markup);
					Out.DebugWriteLine("asset[" + name + Index(i) + ":1" + "] = " + asset[name + Index(i) + ":1"]);
					foreach (var entry in fields)
					{
						var fieldParams = entry.Key;
						var method = entry.Value;
						pattern = pattern.Replace(fieldParams[0],
							method(asset, context, name + fieldParams[1], Index(i) + ":1"));
					}

					if (i++ &gt; 1) output.Append(",");
					output.Append(pattern);
				}
			}

			return output.ToString();
		}

		//
		// Summary:
		//     A different helper function used to iterate through a list of assets to provide
		//     content for each panel. Use this option to generate the JSON output if your panels
		//     correspond to a list of external assets rather then content within the current
		//     asset
		//
		// Parameters:
		//   asset:
		//     The current asset
		//
		//   context:
		//     The current OutputContext context
		//
		//   markup:
		//     The markup that should be repeated within the panel
		//
		//   fields:
		//     A Dictionary where each key value pair consist of a list of string parameters
		//     and the corresponding content field's output function. Note that in this case
		//     it will only take the first kvp within the dictionary
		//
		//   index:
		//     If this is in a list panel then the current panel index
		//
		//   overrideAssetList:
		//     The list of assets from which the content will be pulled from instead of the
		//     current asset
		//
		// Returns:
		//     The markup for the current list panel with all the content placeholders replaced
		//     with their specified content for each panel
		public string PanelJson(Asset asset, OutputContext context, string markup, Dictionary&lt;List&lt;string&gt;, Func&lt;Asset, OutputContext, string, string, bool, string&gt;&gt; fields, string index = "", List&lt;Asset&gt; overrideAssetList = null)
		{
			throw new NotImplementedException();
		}

		//
		// Summary:
		//     A different helper function used to iterate through a list of assets to provide
		//     JSON content for each panel. Use this option to generate the output if your panels
		//     correspond to a list of external assets rather then content within the current
		//     asset
		//
		// Parameters:
		//   asset:
		//     The current asset
		//
		//   context:
		//     The current OutputContext context
		//
		//   markup:
		//     The markup that should be repeated within the panel
		//
		//   contentToReplace:
		//     The markup within the &lt;cp-list&gt; tags that should be updated with the content
		//     from the external assets
		//
		//   method:
		//     The method of the output function that should be used to replace the content
		//     placeholders within the &lt;cp-list&gt; tags
		//
		//   index:
		//     If this is in a list panel then the current panel index
		//
		//   overrideAssetList:
		//     The list of assets from which the content will be pulled from instead of the
		//     current asset
		//
		// Returns:
		//     The markup for the current list panel with all the content placeholders replaced
		//     with their specified content for each panel
		public string PanelJson(Asset asset, OutputContext context, string markup, string contentToReplace, Func&lt;Asset, OutputContext, string, string, bool, string&gt; method, string index = "", List&lt;Asset&gt; overrideAssetList = null)
		{
			throw new NotImplementedException();
		}
	}

	public class IndexedField
	{
		public SearchG2FieldType Type { get; set; }
		public string FieldName { get; set; }
		public string Name
		{
			get
			{
				var fieldType = "s";
				switch (Type)
				{
					case SearchG2FieldType.Boolean:
						fieldType = "b";
						break;
					case SearchG2FieldType.BooleanArray:
						fieldType = "bs";
						break;
					case SearchG2FieldType.Currency:
						fieldType = "c";
						break;
					case SearchG2FieldType.DateTime:
						fieldType = "dt";
						break;
					case SearchG2FieldType.DateTimeArray:
						fieldType = "dts";
						break;
					case SearchG2FieldType.Double:
						fieldType = "d";
						break;
					case SearchG2FieldType.DoubleArray:
						fieldType = "ds";
						break;
					case SearchG2FieldType.Float:
						fieldType = "f";
						break;
					case SearchG2FieldType.FloatArray:
						fieldType = "fs";
						break;
					case SearchG2FieldType.Integer:
						fieldType = "i";
						break;
					case SearchG2FieldType.IntegerArray:
						fieldType = "is";
						break;
					case SearchG2FieldType.Location:
						fieldType = "p";
						break;
					case SearchG2FieldType.Long:
						fieldType = "l";
						break;
					case SearchG2FieldType.LongArray:
						fieldType = "ls";
						break;
					case SearchG2FieldType.String:
						fieldType = "s";
						break;
					case SearchG2FieldType.StringArray:
						fieldType = "ss";
						break;
					case SearchG2FieldType.Text:
						fieldType = "t";
						break;
					case SearchG2FieldType.TextArray:
						fieldType = "txt";
						break;
				}
				return "custom_" + fieldType + "_" + FieldName.ToLowerInvariant().Replace(" ", "_").Split(":".ToCharArray()).First();
			}
		}

		public IndexedField(SearchG2FieldType type, string fieldName)
		{
			Type = type;
			FieldName = fieldName;
		}

		public static IndexedField ToArray(IndexedField field)
		{
			switch (field.Type)
			{
				case SearchG2FieldType.Boolean:
				case SearchG2FieldType.BooleanArray:
					return new IndexedField(SearchG2FieldType.BooleanArray, field.FieldName);
				case SearchG2FieldType.DateTime:
				case SearchG2FieldType.DateTimeArray:
					return new IndexedField(SearchG2FieldType.DateTimeArray, field.FieldName);
				case SearchG2FieldType.Double:
				case SearchG2FieldType.DoubleArray:
					return new IndexedField(SearchG2FieldType.DoubleArray, field.FieldName);
				case SearchG2FieldType.Float:
				case SearchG2FieldType.FloatArray:
					return new IndexedField(SearchG2FieldType.FloatArray, field.FieldName);
				case SearchG2FieldType.Integer:
				case SearchG2FieldType.IntegerArray:
					return new IndexedField(SearchG2FieldType.IntegerArray, field.FieldName);
				case SearchG2FieldType.Long:
				case SearchG2FieldType.LongArray:
					return new IndexedField(SearchG2FieldType.LongArray, field.FieldName);
				case SearchG2FieldType.String:
				case SearchG2FieldType.StringArray:
					return new IndexedField(SearchG2FieldType.StringArray, field.FieldName);
				case SearchG2FieldType.Text:
				case SearchG2FieldType.TextArray:
					return new IndexedField(SearchG2FieldType.TextArray, field.FieldName);
				case SearchG2FieldType.Currency:
				case SearchG2FieldType.Location:
					throw new NotSupportedException();
				default:
					throw new NotImplementedException();
			}
		}

		public static IEnumerable&lt;IndexedField&gt; ToArray(IEnumerable&lt;IndexedField&gt; fields)
		{
			return fields.Select(ToArray);
		}
	}

	public enum SearchG2FieldType
	{
		Boolean = 0,
		BooleanArray,
		Currency,
		DateTime,
		DateTimeArray,
		Double,
		DoubleArray,
		Float,
		FloatArray,
		Integer,
		IntegerArray,
		Location,
		Long,
		LongArray,
		String,
		StringArray,
		Text,
		TextArray
	}

	public static class Utils
	{
		public static string StripHtml(string value)
		{
			if (value == null) return null;
			var result = new Regex("&lt;script(.|\\n)*?&lt;/script&gt;", RegexOptions.IgnoreCase).Replace(value, "");
			result = new Regex("&lt;style(.|\\n)*?&lt;/style&gt;", RegexOptions.IgnoreCase).Replace(result, "");
			result = CrownPeak.CMSAPI.Util.StripHtml(result);
			result = new Regex("\\s+").Replace(result, " ");
			return result.Trim();
		}
	}

	public static class JsonHelper
	{
		public static string DragAndDropZoneToJson(Asset asset, OutputContext context, string zone)
		{
			var result = new StringBuilder(1024);
			result.AppendFormat("\"{0}\":[", StringToJson(zone));

			var componentNamespace = ComponentLibraryHelper.getComponentLibraryNamespace(asset);
			asset.GetContent();
			var first = true;
			foreach (var component in asset.GetPanels(zone + "_0"))
			{
				var componentType = component.Raw[zone + "_component_type"];
				if (string.IsNullOrWhiteSpace(componentType) || componentType == "Zone" || componentType == "DragDropZone") continue;
				if (first) first = false;
				else result.Append(",");

				var index = component.GetFieldName(zone + "_0");
				index = index.Substring(index.IndexOf(":"));
				result.Append("{");
				result.AppendFormat("\"{0}\":", StringToJson(componentType));
				var comp = XUtils.CreateInstance(componentNamespace + "." + componentType) as JsonComponentBase;
				if (comp != null)
				{
					result.Append(comp.ComponentJson(asset, context, zone, index));
				}
				else
				{
					result.Append("null");
				}
				result.Append("}");
			}

			result.Append("]");
			return result.ToString();
		}

		public static string StringToJson(string value, bool includeQuotes = false, bool escapeSlashes = true)
		{
			if (value == null) return null;
			var result = new JsonString(value).ToString();
			if (!escapeSlashes) result = result.Replace("\\/", "/");
			if (!includeQuotes) result = result.Substring(1, result.Length - 2);
			return result;
		}

		[DataContract]
		private class JsonString
		{
			[DataMember]
			public string Value { get; set; }

			public JsonString(string value)
			{
				Value = value;
			}

			public override string ToString()
			{
				var value = Util.SerializeDataContractJson(this);
				value = value.Substring(value.IndexOf(':') + 1);
				value = value.Replace("\\u000d", "\\r").Replace("\\u000a", "\\n").Replace("\\u0009", "\\t");
				return value.Substring(0, value.Length - 1);
			}
		}
	}
}
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261480</id>
    <label>ComponentLibraryLayoutHelper.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/ComponentLibraryLayoutHelper.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public class ComponentLibraryLayoutHelper
	{
		public static void FilenameHelper(Asset asset, OutputContext context)
		{
			context.PublishPath = string.Empty;
		}

		public static void InputHelper(Asset asset, InputContext context)
		{
			Input.StartControlPanel("Pattern");
			//Input.ShowTextBox("Class Name","class_name", helpMessage: "Must only consist of alphanumeric characters and an underscores");
			Input.ShowTextBox("Markup", "markup", width: 400, height: 30);
			Input.EndControlPanel();
		}

		public static void OutputHelper(Asset asset, OutputContext context)
		{
			//                Asset siteConfig = Asset.Load(asset.Parent.AssetPath + "/_Config/Site Config");

			//    //Root Assets folders
			//    string imageFolder = asset.Parent.Parent.Parent.AssetPath + "/_Assets/images/";
			//    string cssFolder = asset.Parent.Parent.Parent.AssetPath + "/_Assets/css/";
			//    string jsFolder = asset.Parent.Parent.Parent.AssetPath + "/_Assets/js/";
			//%&gt;
			//&lt;!DOCTYPE html&gt;
			//&lt;html class="pl"&gt;
			//    &lt;head&gt;
			//        &lt;meta charset="UTF-8"&gt;
			//        &lt;meta name="viewport" content="width=device-width" /&gt;
			//        &lt;link rel="stylesheet" href="&lt;%= Asset.Load(cssFolder + "/style.css").GetLink(LinkType.Include) %&gt;" media="all" /&gt;
			//        &lt;!-- Begin Pattern Lab (Required for Pattern Lab to run properly) --&gt;
			//                &lt;!-- never cache patterns --&gt;
			//        &lt;meta http-equiv="cache-control" content="max-age=0" /&gt;
			//        &lt;meta http-equiv="cache-control" content="no-cache" /&gt;
			//        &lt;meta http-equiv="expires" content="0" /&gt;
			//        &lt;meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" /&gt;
			//        &lt;meta http-equiv="pragma" content="no-cache" /&gt;
			//    &lt;!--		
			//        &lt;link rel="stylesheet" href="../../styleguide/css/styleguide.css?1413476785" media="all"&gt;
			//        &lt;link rel="stylesheet" href="../../styleguide/css/styleguide-specific.css?1413476785" media="all" /&gt;
			//        --&gt;
			//        &lt;!-- End Pattern Lab --&gt;
			//    &lt;/head&gt;
			//    &lt;body&gt;
			//    &lt;%=asset["markup"]%&gt; %&gt;
			//  &lt;/body&gt;
			//&lt;/html&gt;
		}

		public static void PostInputHelper(Asset asset, PostInputContext context)
		{

		}

		public static void PostSaveHelper(Asset asset, PostSaveContext context)
		{

		}

		public static void UrlHelper(Asset asset, OutputContext context)
		{
			context.PublishUrl = string.Empty;
		}
	}
}
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261481</id>
    <label>ComponentLibraryTemplateBuilderHelper.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/ComponentLibraryTemplateBuilderHelper.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public class ComponentLibraryTemplateBuilderHelper
	{
		public static void InputHelper(Asset asset, InputContext context)
		{
			Asset componentLibraryProjectTemplatesFolder = InitializeTemplateFolder(asset);
			String SiteRootFolderPath = ComponentLibraryHelper.getcomponentLibraryRootFolder(asset).AssetPath.ToString();
			String ComponentsFolderPath = ComponentLibraryHelper.getComponentLibraryComponentsFolder(asset).ToString();
			string libraryPath = ComponentLibraryHelper.getComponentLibraryComponentsFolder(asset).AssetPath.ToString();

			// setup dictionary of available layouts
			FilterParams fpLayoutFilter = new FilterParams();
			fpLayoutFilter.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Layout");
			fpLayoutFilter.SortOrder = SortOrder.OrderBy(AssetPropertyNames.FolderId).ThenBy(AssetPropertyNames.Label);

			Dictionary&lt;string, string&gt; layouts = new Dictionary&lt;string, string&gt;();
			foreach (Asset aLayout in Asset.Load(libraryPath).GetFilterList(fpLayoutFilter))
			{
				if (aLayout.IsLoaded) layouts.Add(aLayout.Label, aLayout.Label);
			}

			// setup dictionary of available components
			FilterParams fpComponentFilter = new FilterParams();
			fpComponentFilter.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Component");
			fpComponentFilter.SortOrder = SortOrder.OrderBy(AssetPropertyNames.FolderId).ThenBy(AssetPropertyNames.Label);

			Dictionary&lt;string, string&gt; components = new Dictionary&lt;string, string&gt;();
			foreach (Asset aComponent in Asset.Load(libraryPath).GetFilterList(fpComponentFilter))
			{
				if (aComponent.IsLoaded) components.Add(Asset.Load(aComponent.FolderId).Label + ": " + aComponent.Label + " (" + aComponent.Id + ")", aComponent.Label/*aComponent.GetLink(LinkType.Internal)*//*aComponent.AssetPath.ToString()*/);
			}

			components = components.OrderBy(x =&gt; x.Key).ToDictionary(x =&gt; x.Key, y =&gt; y.Value);

			// available columns
			Dictionary&lt;string, string&gt; columns = new Dictionary&lt;string, string&gt;()
	{
		{"Column One","col1"}, {"Column Two","col2"}//, {"Column Three","col3"}
	};

			if (String.IsNullOrEmpty(asset["inputBody"]))
			{
				Input.StartTabbedPanel("Components", "Wrapper", "Settings");
			}
			else
			{
				Input.StartTabbedPanel("Components", "Wrapper", "Settings", "Code");
			}

			while (Input.NextPanel("Layouts"))
			{
				Input.ShowTextBox("Section Name", "section");
				// Layouts
				ShowAcquireParams sapLayouts = new ShowAcquireParams();
				sapLayouts.DefaultFolder = ComponentsFolderPath + "/_thumbnails/layouts";
				sapLayouts.ShowUpload = false;
				Input.ShowAcquireImage("Layout", "layout_thumbnail", sapLayouts);
				Input.ShowDropDown("Select a Layout", "layout", layouts);

				Input.StartExpandPanel("Customize");
				//Input.ShowCheckBox("Editable", "editable", "yes", "yes");
				Input.ShowCheckBox("Consolidate section into the above section's input tab?", "consolidate_section_tab", "yes", "Yes");
				Input.EndExpandPanel();
				while (Input.NextPanel("Components"))
				{
					//Dictionary&lt;string, string&gt; dropDownRows = new Dictionary&lt;string, string&gt;() {{"Component", "component" }, { "Custom", "custom" }};
					ShowAcquireParams sapComponents = new ShowAcquireParams();
					sapComponents.DefaultFolder = ComponentsFolderPath + "/_thumbnails/components";
					sapComponents.ShowUpload = false;
					//	  Input.StartDropDownContainer("Content Type", "content_type", dropDownRows, firstRowLabel: "Content Type");

					// Components
					Input.StartHorizontalWrapContainer();
					Input.ShowAcquireImage("Component", "component_thumbnail", sapComponents);
					Input.ShowDropDown("Column", "column", columns, Util.MakeList("col1"));
					//   		  	  	      Input.ShowRadioButton("Column", "column", columns);
					Input.EndHorizontalWrapContainer();

					/*			  ShowAcquireParams aParams = new ShowAcquireParams();
												aParams.ShowBrowse = true;
												aParams.DefaultFolder = SiteRootFolderPath + "/_components/organisms";
												Input.ShowAcquireDocument("Component", "component_id", aParams);
					*/
					Input.ShowDropDown("Selected Component", "component", components);
					Input.StartExpandPanel("Customize");
					Input.ShowTextBox("Component Message", "message", width: 100);
					Input.ShowTextBox("Component Label", "label", width: 100);
					Input.ShowTextBox("Component Name", "name", width: 100);
					Input.ShowTextBox("Custom Code", "custom_code", width: 500, helpMessage: "if custom code is specified then it will be rendered instead of the component selected.");
					Input.EndExpandPanel();

				}
			}
			Input.NextTabbedPanel();
			//Dictionary&lt;String, String&gt; wrapperOptions = new Dictionary&lt;string, string&gt;() { { "Default", "default" }, { "Landing Page", "landing" }, { "None", "none" } };
			//Input.ShowRadioButton("Content Wrapper", "wrapper", wrapperOptions);
			ShowAcquireParams wrapperAcquireParams = new ShowAcquireParams { DefaultFolder = asset.Parent.AssetPath.ToString() + "/Site Wrappers" };

			Dictionary&lt;String, String&gt; wrapperTypeOptions = new Dictionary&lt;string, string&gt;();
			wrapperTypeOptions.Add("Built With Wrapper Builder", "template_builder");
			wrapperTypeOptions.Add("Custom Built Wrapper", "custom");

			Input.StartDropDownContainer("Wrapper Selection Type", "wrapper_type", wrapperTypeOptions, defaultValue: "template_builder");
			Input.ShowMessage("This options lets you select a wrapper built via a wrapper builder asset");
			Input.ShowAcquireDocument("Wrapper", "wrapper", wrapperAcquireParams);
			Input.NextDropDownContainer();
			Input.ShowMessage("This option lets you select a custom built wrapper");
			Input.ShowSelectFolder("Wrapper Template", "custom_wrapper");
			Input.EndDropDownContainer();

			Input.NextTabbedPanel();
			Input.ShowCheckBox("Create", "create", "yes", "yes");
			Input.ShowTextBox("Template Name", "template_name", asset.Label.Replace(" Template", "") + " Template");
			Input.StartExpandPanel("Template File Settings");
			Input.ShowCheckBox("", "do_not_overwrite_post_save", "do_not_overwrite", "Do not overwrite the post_save.aspx template file");
			Input.EndExpandPanel();
			Input.ShowSelectFolder("Template Folder", "template_folder", componentLibraryProjectTemplatesFolder.AssetPath);
			Input.ShowAcquireDocument("Select preview asset", "previewAsset", SiteRootFolderPath + "/_templates");
			Input.ShowCheckBox("Enable Page Metadata", "meta", "yes", "yes");
			Input.ShowCheckBox("Enable Page specific JavaScript and CSS", "custom_js_css", "yes", "yes");
			Input.ShowCheckBox("Enable Advanced Capabilities", "advanced", "yes", "yes", helpMessage: "This option adds an \"Advanced\" tab to the input form which contains a link to directly edit this template builder template.");
			Input.ShowCheckBox("Enable TMF", "enable_tmf", "yes", "Yes");
			Input.StartExpandPanel("TMF Settings");
			Input.ShowCheckBox("Create a output_translate_xml.aspx file?", "create_output_translate_xml", "yes", "Yes", helpMessage: "When custom code is required to package the content being translated you will need to enter the custom function in the text box below");
			Input.ShowTextBox("TMF output_translate_xml.aspx code", "output_translate_xml_body", width: 100, height: 5);
			Input.EndExpandPanel();

			if (!String.IsNullOrEmpty(asset["inputBody"]))
			{
				Input.NextTabbedPanel();
				Input.ShowTextBox("Input", "inputBody", width: 100, readOnly: true);
				Input.ShowTextBox("Post Input", "postinputBody", width: 100, readOnly: true);
				Input.ShowTextBox("Output", "outputBody", width: 100, readOnly: true);
				if (asset["enable_tmf"] == "yes")
				{
					Input.ShowTextBox("Output Post Save (TMF)", "postSaveBody", width: 100, readOnly: true);
					Input.ShowTextBox("Output Changes (TMF)", "outputChangesBody", width: 100, readOnly: true);
					if (asset["create_output_translate_xml"] == "yes")
					{
						Input.ShowTextBox("Output Translate Xml (TMF)", "outputTranslateXmlBody", width: 100, readOnly: true);
					}
				}
			}

			Input.EndTabbedPanel();
		}

		private static Asset InitializeTemplateFolder(Asset asset)
		{
			Asset componentLibraryProjectTemplatesFolder = Asset.Load(ComponentLibraryHelper.getComponentLibraryProjectFolder(asset).AssetPath + "/Templates");
			if (string.IsNullOrEmpty(asset["template_folder"]) &amp;&amp; componentLibraryProjectTemplatesFolder != null &amp;&amp; componentLibraryProjectTemplatesFolder.IsLoaded)
			{
				asset["template_folder"] = componentLibraryProjectTemplatesFolder.GetLink(LinkType.Internal);
			}

			return componentLibraryProjectTemplatesFolder;
		}

		public static void OutputHelper(Asset asset, OutputContext context)
		{
			Component_Layout layout = new Component_Layout();
			context.IsGeneratingDependencies = false;
			String componentColumn = "";
			String componentOutput = "";
			String wrapperType = asset["wrapper_type"];
			String SiteRootFolderPath = ComponentLibraryHelper.getcomponentLibraryRootFolder(asset).AssetPath.ToString();
			Asset globalConfig = Asset.Load(SiteRootFolderPath + "/_Global/Global Config");
			//dictionary to allow for multiple columns based on ComponentLibrary Config
			Dictionary&lt;int, StringBuilder&gt; columnDictionary = new Dictionary&lt;int, StringBuilder&gt;();
			Dictionary&lt;String, StringBuilder&gt; rowContent = new Dictionary&lt;string, StringBuilder&gt;();
			StringBuilder sbCol1 = new StringBuilder();
			StringBuilder sbCol2 = new StringBuilder();

			if (String.IsNullOrWhiteSpace(wrapperType))
			{
				wrapperType = asset["wrapper_type"];
			}

			if (wrapperType == "custom")
			{
				Asset wrapperAsset = Asset.Load(asset["custom_wrapper"]);

				if (wrapperAsset.IsLoaded)
				{
					ComponentLibraryHelper.startWrap(asset, context, wrapperAsset.AssetPath.ToString(), wrapperType);
				}
			}
			else
			{
				Asset wrapperAsset = Asset.Load(asset["wrapper"]);

				if (!string.IsNullOrEmpty(wrapperAsset.Raw["template_name"]))
				{
					ComponentLibraryHelper.startWrap(asset, context, wrapperAsset.Raw["template_name"]);
				}
			}

			foreach (PanelEntry entry in asset.GetPanels("layouts"))
			{
				sbCol1.Clear();
				sbCol2.Clear();
				foreach (PanelEntry subEntry in entry.GetPanels("components"))
				{
					componentOutput = "";
					componentColumn = "";
					if (String.IsNullOrEmpty(subEntry.Raw["custom_code"]))
					{
						Asset aComponent = ComponentLibraryHelper.getComponentAsset(asset, subEntry["component"]);
						if (aComponent != null &amp;&amp; aComponent.IsLoaded)
						{
							componentOutput = ComponentLibraryHelper.generateComponentPreview(aComponent, context);
						}
						componentColumn = subEntry["column"];
					}
					else
					{
						componentOutput = subEntry["custom_code"];
						componentColumn = subEntry["custom_column"];
					}

					switch (componentColumn)
					{
						case "col1":
							sbCol1.Append(componentOutput);
							break;
						case "col2":
							sbCol2.Append(componentOutput);
							break;
					}
				}

				rowContent.Add("{col1}", sbCol1);
				rowContent.Add("{col2}", sbCol2);

				Out.Write(layout.output(asset, entry.GetFieldName("layout"), rowContent, entry["layout"]));
				rowContent.Clear();
			}

			if (asset["wrapper"] == "yes")
			{
				ComponentLibraryHelper.endWrap(asset, context);
			}
		}

		public static void OutputCodeHelper(Asset asset, OutputContext context)
		{
			context.IsGeneratingDependencies = false;

			string SiteRootFolderPath = ComponentLibraryHelper.getcomponentLibraryRootFolder(asset).AssetPath.ToString();
			//Root Assets folders
			string cssFolder = SiteRootFolderPath + "/_Assets/css/";
			string jsFolder = SiteRootFolderPath + "/_Assets/js/";

			Out.DebugWriteLine("&lt;!DOCTYPE html&gt;");
			Out.WriteLine("&lt;html lang=\"en\"&gt;");
			Out.WriteLine("&lt;head&gt;");
			Out.WriteLine("    &lt;link rel=\"stylesheet\" href=\"" + Asset.Load(cssFolder + "/bootstrap.css").GetLink(LinkType.Include) + "\" media=\"all\" /&gt;");

			Out.WriteLine("    &lt;script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js\"&gt;&lt;/script&gt;");
			Out.WriteLine("&lt;/head&gt;");
			Out.WriteLine("&lt;body&gt;");
			Out.WriteLine("    &lt;div class=\"container\"&gt;");
			Out.WriteLine("        &lt;div id=\"content\"&gt;");
			Out.WriteLine("            &lt;ul id=\"tabs\" class=\"nav nav-tabs\" data-tabs=\"tabs\"&gt;");
			Out.WriteLine("                &lt;li class=\"active\"&gt;&lt;a href=\"#input\" data-toggle=\"tab\"&gt;Input&lt;/a&gt;&lt;/li&gt;");
			Out.WriteLine("                &lt;li&gt;&lt;a href=\"#postinput\" data-toggle=\"tab\"&gt;PostInput&lt;/a&gt;&lt;/li&gt;");
			Out.WriteLine("                &lt;li&gt;&lt;a href=\"#output\" data-toggle=\"tab\"&gt;Output&lt;/a&gt;&lt;/li&gt;");
			Out.WriteLine("            &lt;/ul&gt;");
			Out.WriteLine("            &lt;div id=\"my-tab-content\" class=\"tab-content\"&gt;");
			Out.WriteLine("                &lt;div class=\"tab-pane active\" id=\"input\"&gt;");
			Out.WriteLine("                    &lt;h1&gt;Input&lt;/h1&gt;");
			Out.WriteLine("                    " + Util.ConvertTextToHtml(asset["inputBody"]).Replace("&lt;dd&gt;", "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"));
			Out.WriteLine("                &lt;/div&gt;");
			Out.WriteLine("                &lt;div class=\"tab-pane\" id=\"postinput\"&gt;");
			Out.WriteLine("                    &lt;h1&gt;PostInput&lt;/h1&gt;");
			Out.WriteLine("                    " + Util.ConvertTextToHtml(asset["postinputBody"]).Replace("&lt;dd&gt;", "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"));
			Out.WriteLine("                &lt;/div&gt;");
			Out.WriteLine("                &lt;div class=\"tab-pane\" id=\"output\"&gt;");
			Out.WriteLine("                    &lt;h1&gt;Output&lt;/h1&gt;");
			Out.WriteLine("                    " + Util.ConvertTextToHtml(asset["outputBody"]).Replace("&lt;dd&gt;", "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"));
			Out.WriteLine("                &lt;/div&gt;");
			Out.WriteLine("            &lt;/div&gt;");
			Out.WriteLine("        &lt;/div&gt;");
			Out.WriteLine("        &lt;script type=\"text/javascript\"&gt;");
			Out.WriteLine("            jQuery(document).ready(function ($) {");
			Out.WriteLine("                $('#tabs').tab();");
			Out.WriteLine("            });");
			Out.WriteLine("        &lt;/script&gt;");
			Out.WriteLine("    &lt;/div&gt;");
			Out.WriteLine("    &lt;!-- container --&gt;");
			Out.WriteLine("    &lt;script type=\"text/javascript\" src=\"" + Asset.Load(jsFolder + "/bootstrap.js").GetLink(LinkType.Include) + "\"&gt;&lt;/script&gt;");
			Out.WriteLine("&lt;/body&gt;");
			Out.WriteLine("&lt;/html&gt;");
		}

		public static void OutputComponentsHelper(Asset asset, OutputContext context)
		{
			Component_Layout layout = new Component_Layout();
			Dictionary&lt;String, StringBuilder&gt; rowContent = new Dictionary&lt;string, StringBuilder&gt;();

			context.IsGeneratingDependencies = false;
			String SiteRootFolderPath = ComponentLibraryHelper.getcomponentLibraryRootFolder(asset).AssetPath.ToString();
			//Out.WriteLine(SiteRootFolderPath);
			Asset globalConfig = Asset.Load(SiteRootFolderPath + "/_Global/Global Config");

			//Root Assets folders
			string imageFolder = SiteRootFolderPath + "/_Assets/images/";
			string cssFolder = SiteRootFolderPath + "/_Assets/css/";
			string jsFolder = SiteRootFolderPath + "/_Assets/js/";
			string componentName = "";
			string componentThumbnail = "";
			string componentType = "";
			string componentPath = "";
			string componentId = "";
			string componentColumn = "";
			//  Asset aComponent;



			string componentOutput = "";

			StringBuilder sbCol1 = new StringBuilder();
			StringBuilder sbCol2 = new StringBuilder();

			String wrapperType = asset["wrapper_type"];

			if (String.IsNullOrWhiteSpace(wrapperType))
			{
				wrapperType = asset["wrapper_type"];
			}

			if (wrapperType == "custom")
			{
				Asset wrapperAsset = Asset.Load(asset["custom_wrapper"]);

				if (wrapperAsset.IsLoaded)
				{
					ComponentLibraryHelper.startWrap(asset, context, wrapperAsset.AssetPath.ToString(), wrapperType);
				}
			}
			else
			{
				Asset wrapperAsset = Asset.Load(asset["wrapper"]);

				if (!string.IsNullOrEmpty(wrapperAsset.Raw["template_name"]))
				{
					ComponentLibraryHelper.startWrap(asset, context, wrapperAsset.Raw["template_name"]);
				}
			}

			foreach (PanelEntry entry in asset.GetPanels("layouts"))
			{
				sbCol1.Clear();
				sbCol2.Clear();
				foreach (PanelEntry subEntry in entry.GetPanels("components"))
				{
					componentOutput = "";
					componentThumbnail = "";
					componentColumn = "";
					if (String.IsNullOrEmpty(subEntry.Raw["custom_code"]))
					{
						Asset aComponent = ComponentLibraryHelper.getComponentAsset(asset, subEntry["component"]);
						if (aComponent != null &amp;&amp; aComponent.IsLoaded)
						{
							componentOutput = "&lt;span " + Util.Editable("component", subEntry) + "&gt; " + makeRaw(ComponentLibraryHelper.generateComponentPreview(aComponent, context)) + "&lt;/span&gt;";
						}
						componentColumn = subEntry["column"];
					}
					else
					{
						componentOutput = subEntry["custom_code"];
						componentColumn = subEntry["custom_column"];
					}

					switch (componentColumn)
					{
						case "col1":
							sbCol1.Append(componentOutput);
							break;
						case "col2":
							sbCol2.Append(componentOutput);
							break;
					}
				}

				rowContent.Add("{col1}", sbCol1);
				rowContent.Add("{col2}", sbCol2);

				Out.Write(layout.output(asset, entry.GetFieldName("layout"), rowContent, entry["layout"]));
				rowContent.Clear();
			}

			if (asset["wrapper"] == "yes")
			{
				ComponentLibraryHelper.endWrap(asset, context);
			}
		}

		public static void OutputContentHelper(Asset asset, OutputContext context)
		{
			/***Commented out because no longer serves a purpose***/
			//Component_Layout layout = new Component_Layout();
			//Dictionary&lt;String, StringBuilder&gt; rowContent = new Dictionary&lt;string, StringBuilder&gt;();

			//context.IsGeneratingDependencies = false;
			//string SiteRootFolderPath = "/" + asset.AssetPath[0]; //"/Utility.GetSiteRootPathReg(asset);
			////Out.WriteLine(SiteRootFolderPath);
			//Asset globalConfig = Asset.Load(SiteRootFolderPath + "/_Global/Global Config");

			////Root Assets folders
			//string imageFolder = SiteRootFolderPath + "/_Assets/images/";
			//string cssFolder = SiteRootFolderPath + "/_Assets/css/";
			//string jsFolder = SiteRootFolderPath + "/_Assets/js/";
			//string componentName = "";
			//string componentThumbnail = "";
			//string componentType = "";
			//string componentPath = "";
			//string componentId = "";
			//string componentColumn = "";
			////  Asset aComponent;



			//string componentOutput = "";

			//StringBuilder sbCol1 = new StringBuilder();
			//StringBuilder sbCol2 = new StringBuilder();

			//if (!string.IsNullOrEmpty(Asset.Load(asset["wrapper"]).Raw["template_name"])) ComponentLibraryHelper.startWrap(asset, context, Asset.Load(asset["wrapper"]).Raw["template_name"]);

			//foreach (PanelEntry entry in asset.GetPanels("layouts"))
			//{
			//    sbCol1.Clear();
			//    sbCol2.Clear();
			//    foreach (PanelEntry subEntry in entry.GetPanels("components"))
			//    {
			//        componentOutput = "";
			//        componentThumbnail = "";
			//        componentColumn = "";
			//        if (String.IsNullOrEmpty(subEntry.Raw["custom_code"]))
			//        {
			//            componentPath = subEntry["component"];

			//            //componentPath = subEntry["component"];
			//            Asset aComponent = Asset.Load(componentPath);
			//            if (aComponent.IsLoaded)
			//            {
			//                componentOutput = ComponentLibraryHelper.generateComponentPreview(aComponent, context);
			//            }
			//            componentColumn = subEntry["column"];
			//        }
			//        else
			//        {
			//            componentOutput = subEntry["custom_code"];
			//            componentColumn = subEntry["custom_column"];
			//        }

			//        switch (componentColumn)
			//        {
			//            case "col1":
			//                sbCol1.Append(componentOutput);
			//                break;
			//            case "col2":
			//                sbCol2.Append(componentOutput);
			//                Console.WriteLine("Case 2");
			//                break;
			//        }
			//    }

			//    rowContent.Add("{col1}", sbCol1);
			//    rowContent.Add("{col2}", sbCol2);

			//    Out.Write(layout.output(asset, entry.GetFieldName("layout"), rowContent, entry["layout"]));
			//    rowContent.Clear();
			//}

			//if (asset["wrapper"] == "yes")
			//{
			//    ComponentLibraryHelper.endWrap(asset, context);
			//}
		}

		public static void PostInputHelper(Asset asset, PostInputContext context)
		{
			string ComponentLibraryComponentFolder = ComponentLibraryHelper.getComponentLibraryComponentsFolder(asset).AssetPath.ToString();
			//string ComponentLibraryRootFolderPath = ComponentLibraryHelper.getcomponentLibraryRootFolder(asset).AssetPath.ToString(); //"/Utility.GetSiteRootPathReg(asset);
			//Asset siteConfig = Asset.Load(SiteRootFolderPath + "/_Config/Site Config");

			//Root Assets folders
			//string imageFolder = SiteRootFolderPath + "/_Assets/images/";
			//string cssFolder = SiteRootFolderPath + "/_Assets/css/";
			//string jsFolder = SiteRootFolderPath + "/_Assets/js/";

			//string componentColumn = "";
			string nameSpace = ""; //"CrownPeak.CMSAPI.CustomLibrary.Components.";
			string componentLibraryClassName = "ComponentLibraryHelper";
			string layoutClassName = "layout";
			string openTag = "&lt;" + "%";
			string closeTag = "%" + "&gt;";
			string tab = "\t";
			string componentClassName = "";
			string componentName = "";
			string componentLabel = "";
			string componentMessage = "";
			string componentFieldName = "";
			string componentThumbnail = "";
			string componentType = "";
			Asset aComponent;

			//StringBuilder sbOutputLayouts = new StringBuilder();
			//StringBuilder sbCol1 = new StringBuilder();
			//StringBuilder sbCol2 = new StringBuilder();
			//StringBuilder sbInputDeclare = new StringBuilder();
			//StringBuilder sbPostInputDeclare = new StringBuilder();
			//StringBuilder sbOutputDeclare = new StringBuilder();
			StringBuilder sbDeclare = new StringBuilder();
			StringBuilder sbImportNamespaces = new StringBuilder();
			StringBuilder sbInput = new StringBuilder();
			StringBuilder sbInputContent = new StringBuilder();
			StringBuilder sbPostInput = new StringBuilder();
			StringBuilder sbPostInputContent = new StringBuilder();
			StringBuilder sbOutput = new StringBuilder();
			StringBuilder sbOutputContent = new StringBuilder();
			StringBuilder sbOutputChanges = new StringBuilder();
			StringBuilder sbOutputChangesContent = new StringBuilder();
			StringBuilder sbOutputTranslateXml = new StringBuilder();
			StringBuilder sbOutputTranslateXmlContent = new StringBuilder();
			StringBuilder sbPostSave = new StringBuilder();
			StringBuilder sbPostSaveContent = new StringBuilder();

			PanelEntry firstPe = context.InputForm.GetPanels("layouts").FirstOrDefault();

			//if (firstPe != null &amp;&amp; firstPe["consolidate_section_tab"] == "yes")
			//{
			//    context.ValidationError = "Please uncheck the \"Consolidate section into the above sections input tab\" checkbox on the first section.";
			//}
			//else
			//{

			Dictionary&lt;string, int&gt; components = new Dictionary&lt;string, int&gt;();

			sbDeclare.Append(openTag + "@ Import Namespace=\"CrownPeak.CMSAPI\" " + closeTag).AppendLine();
			sbImportNamespaces.Append(openTag + "@ Import Namespace=\"CrownPeak.CMSAPI\" " + closeTag).AppendLine();
			sbDeclare.Append(openTag + "@ Import Namespace=\"CrownPeak.CMSAPI.Services\" " + closeTag).AppendLine();
			sbImportNamespaces.Append(openTag + "@ Import Namespace=\"CrownPeak.CMSAPI.Services\" " + closeTag).AppendLine();
			sbDeclare.Append(openTag + "@ Import Namespace=\"CrownPeak.CMSAPI.CustomLibrary\" " + closeTag).AppendLine();
			sbImportNamespaces.Append(openTag + "@ Import Namespace=\"CrownPeak.CMSAPI.CustomLibrary\" " + closeTag).AppendLine();
			sbDeclare.Append(openTag + "@ Import Namespace=\"" + ComponentLibraryHelper.getComponentLibraryNamespace(asset) + "\"" + closeTag).AppendLine();
			sbImportNamespaces.Append(openTag + "@ Import Namespace=\"" + ComponentLibraryHelper.getComponentLibraryNamespace(asset) + "\"" + closeTag).AppendLine();

			sbDeclare.Append("&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;").AppendLine();
			sbImportNamespaces.Append("&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;").AppendLine();
			sbDeclare.Append(openTag).AppendLine();
			//sbImportNamespaces.Append(openTag).AppendLine();
			sbDeclare.Append(tab + nameSpace + "Component_Layout layout = new " + nameSpace + "Component_Layout();").AppendLine();
			if (context.InputForm["meta"] == "yes")
			{
				sbDeclare.Append(tab + nameSpace + "MetaData metaData = new " + nameSpace + "MetaData();").AppendLine();
			}

			if (context.InputForm["custom_js_css"] == "yes")
			{
				sbDeclare.Append(tab + nameSpace + "HeaderJavascriptAndCss headerAndJavascriptCSS = new " + nameSpace + "HeaderJavascriptAndCss();").AppendLine();
			}

			sbInputContent.Append(tab + "Input.StartTabbedPanel(");

			String dlm = "";
			foreach (PanelEntry entry in context.InputForm.GetPanels("layouts"))
			{
				if (entry["consolidate_section_tab"] != "yes")
				{
					sbInputContent.Append(dlm + "\"" + entry["section"] + "\"");
					dlm = ", ";
				}
			}
			if (context.InputForm["meta"] == "yes") sbInputContent.Append(", \"Metadata &amp; Header Content\"");
			if (context.InputForm["advanced"] == "yes") sbInputContent.Append(", \"Advanced\"");
			if (context.InputForm["enable_tmf"] == "yes") sbInputContent.Append(", \"TMF\"");
			sbInputContent.Append(");").AppendLine();

			//if(asset.Raw["editable"]=="yes") sbInput.Append(", \"Layout\"");


			String wrapperType = context.InputForm["wrapper_type"];

			if (String.IsNullOrWhiteSpace(wrapperType))
			{
				wrapperType = asset["wrapper_type"];
			}

			if (wrapperType == "custom")
			{
				Asset wrapperAsset = Asset.Load(context.InputForm["custom_wrapper"]);

				if (!wrapperAsset.IsLoaded)
				{
					wrapperAsset = Asset.Load(asset["custom_wrapper"]);
				}

				if (wrapperAsset.IsLoaded)
				{
					sbOutputContent.Append(tab + "//Begin Wrapper").AppendLine();
					sbOutputContent.Append(tab + componentLibraryClassName + ".startWrap(asset,context,\"" + wrapperAsset.AssetPath + "\", \"" + wrapperType + "\");").AppendLine();
				}
			}
			else
			{
				Asset wrapperAsset = Asset.Load(context.InputForm["wrapper"]);

				if (!wrapperAsset.IsLoaded)
				{
					wrapperAsset = Asset.Load(asset["wrapper"]);
				}

				if (!string.IsNullOrEmpty(wrapperAsset.Raw["template_name"]) &amp;&amp; !string.IsNullOrEmpty(wrapperAsset.Raw["template_folder"]))
				{
					String wrapperAssetPath = Asset.Load(wrapperAsset["template_folder"]).AssetPath + "/" + wrapperAsset.Raw["template_name"];
					sbOutputContent.Append(tab + "//Begin Wrapper").AppendLine();
					sbOutputContent.Append(tab + componentLibraryClassName + ".startWrap(asset,context,\"" + wrapperAssetPath + "\", \"" + wrapperType + "\");").AppendLine();
				}
			}

			sbOutputContent.Append(tab + "StringBuilder sbCol1 = new StringBuilder();").AppendLine();
			sbOutputContent.Append(tab + "StringBuilder sbCol2 = new StringBuilder();").AppendLine();
			sbOutputContent.Append(tab + "StringBuilder sbCol3 = new StringBuilder();").AppendLine();
			sbOutputContent.Append(tab + "StringBuilder sbCol4 = new StringBuilder();").AppendLine();
			sbOutputContent.Append(tab + "Dictionary&lt;String, StringBuilder&gt; rowContent = new Dictionary&lt;string, StringBuilder&gt;();").AppendLine();
			sbOutputContent.AppendLine();

			String nextTab = "";
			Int32 unique = 0;

			bool isFirstPe = true;

			/************BEGIN BUILDING INPUT &amp; POST-INPUT************/
			foreach (PanelEntry entry in context.InputForm.GetPanels("layouts"))
			{
				if (!(isFirstPe &amp;&amp; entry["consolidate_section_tab"] == "yes"))
				{
					if (!String.IsNullOrEmpty(entry["layout_thumbnail"]))
					{
						Asset aLayoutThumbnail = Asset.Load(entry["layout_thumbnail"]);
						if (aLayoutThumbnail.IsLoaded)
						{
							Asset aLayout = Asset.Load(ComponentLibraryComponentFolder + "/layouts/" + aLayoutThumbnail.Label.ToLower().Replace(".png", ""));
							if (aLayout.IsLoaded) entry["layout"] = aLayout.Label;
						}
					}

					if (entry["consolidate_section_tab"] != "yes")
					{
						sbInputContent.Append(nextTab).AppendLine();
					}

					Int32 col = 1;
					while (col &lt; 3)
					{
						if (!(isFirstPe &amp;&amp; entry["consolidate_section_tab"] == "yes"))
						{
							sbInputContent.Append(tab + tab + "// Capture content for Column " + col.ToString()).AppendLine();
						}

						foreach (PanelEntry subEntry in entry.GetPanels("components"))
						{
							if (subEntry["column"] == "col" + col.ToString())
							{
								/*
								// Commented out 2016-10-05 by RL - adding no value!
								if (!String.IsNullOrEmpty(subEntry["component_thumbnail"]))
								{
									componentThumbnail = Asset.Load(subEntry["component_thumbnail"]).Label;
									if (!String.IsNullOrEmpty(componentThumbnail))
									{
										componentType = componentThumbnail.Substring(0, componentThumbnail.IndexOf(" - ")).Trim();
										componentName = componentThumbnail.Substring(componentThumbnail.IndexOf(" - ") + 3).Replace(".png", "").Trim();
										//sbDeclare.AppendLine("//" + ComponentLibraryRootFolderPath + componentType + "s/" + componentName);
										aComponent = Asset.Load(ComponentLibraryComponentFolder + "/" + componentType + "s/" + componentName);
										if (aComponent.IsLoaded) subEntry["component"] = aComponent.Label; //aComponent.AssetPath.ToString(); //aComponent.Id.ToString();
									}
								}
								//sbInputContent.Append("component:" + componentThumbnail + " |" + componentType + " |" + componentName);
								*/
								aComponent = ComponentLibraryHelper.getComponentAsset(asset, subEntry["component"]);
								if (aComponent != null &amp;&amp; aComponent.IsLoaded)
								{
									componentClassName = aComponent.Raw["class_name"];
									componentLabel = subEntry["label"].Trim();
									componentName = char.ToLower(componentClassName[0]) + componentClassName.Substring(1);
									componentMessage = subEntry["message"];
									if (!string.IsNullOrWhiteSpace(componentMessage))
										sbInputContent.AppendFormat(tab + tab + "Input.ShowMessage(\"{0}\");", componentMessage.Replace("\"", "\\\"")).AppendLine();

									if (!components.ContainsKey(componentName))
									{
										components.Add(componentName, 0);
										sbDeclare.Append(tab + nameSpace + componentClassName + " " + componentName + " = new " + nameSpace + componentClassName + "();").AppendLine();
									}
									else components[componentName]++;

									componentFieldName = !String.IsNullOrEmpty(subEntry["name"]) ? subEntry["name"] : aComponent.Label.ToLower().Replace(" ", "_") + (components[componentName] &gt; 0 ? "_" + (components[componentName] + 1).ToString() : "");

									subEntry["name"] = componentFieldName;
									//subEntry["label"] = componentLabel;

									//                    sbInputContent.Append(tab + tab + componentName + ".input(\"" + subEntry["label"] + "\",\"" + subEntry.Raw["name"]+"\");").AppendLine();
									if (!(isFirstPe &amp;&amp; entry["consolidate_section_tab"] == "yes"))
									{
										sbInputContent.Append(tab + tab + componentName + ".ComponentInput(asset, context, \"" + componentLabel + "\",\"" + componentFieldName + "\");").AppendLine();
										//                    sbPostInputContent.Append(tab + componentName + ".postinput(context,\"" + subEntry.Raw["name"]+"\");").AppendLine();
										sbPostInputContent.Append(tab + componentName + ".ComponentPostInput(asset, context, \"" + componentFieldName + "\");").AppendLine();
									}
								}
							}
							unique++;
						}
						if (!(isFirstPe &amp;&amp; entry["consolidate_section_tab"] == "yes"))
						{
							sbInputContent.AppendLine();
						}
						col++;
					}

					//if (entry["editable"] == "yes")
					//{
					//    sbInputContent.Append(tab + tab + "//Layout").AppendLine();
					//    sbInputContent.Append(tab + tab + layoutClassName + ".input(asset,\"" + entry["section"] + " layout\",\"" + entry.GetFieldName("layout") + "\",\"" + entry["layout"] + "\");").AppendLine();
					//    sbInputContent.AppendLine();
					//}

					nextTab = "Input.NextTabbedPanel();";
				}
				isFirstPe = false;
			}
			/************END BUILDING INPUT &amp; POST-INPUT************/


			/*****************BEGIN BUILDING OUTPUT*****************/
			foreach (PanelEntry entry in context.InputForm.GetPanels("layouts"))
			{
				if (!String.IsNullOrEmpty(entry["layout_thumbnail"]))
				{
					Asset aLayoutThumbnail = Asset.Load(entry["layout_thumbnail"]);
					if (aLayoutThumbnail.IsLoaded)
					{
						Asset aLayout = Asset.Load(ComponentLibraryComponentFolder + "/layouts/" + aLayoutThumbnail.Label.ToLower().Replace(".png", ""));
						if (aLayout.IsLoaded) entry["layout"] = aLayout.Label;
					}
				}

				sbOutputContent.Append(tab + "// " + entry["section"]).AppendLine();
				sbOutputContent.AppendLine();

				Int32 col = 1;
				while (col &lt; 5)
				{
					sbOutputContent.Append(tab + "// Assemble content for Column " + col.ToString()).AppendLine();
					sbOutputContent.Append(tab + "sbCol" + col.ToString() + ".Clear();").AppendLine();

					foreach (PanelEntry subEntry in entry.GetPanels("components"))
					{
						if (subEntry["column"] == "col" + col.ToString())
						{
							/*
							// Commented out 2016-10-05 by RL - adding no value!
							if (!String.IsNullOrEmpty(subEntry["component_thumbnail"]))
							{
								componentThumbnail = Asset.Load(subEntry["component_thumbnail"]).Label;
								if (!String.IsNullOrEmpty(componentThumbnail))
								{
									componentType = componentThumbnail.Substring(0, componentThumbnail.IndexOf(" - ")).Trim();
									componentName = componentThumbnail.Substring(componentThumbnail.IndexOf(" - ") + 3).Replace(".png", "").Trim();
									aComponent = Asset.Load(ComponentLibraryComponentFolder + "/" + componentType + "s/" + componentName);
									if (aComponent.IsLoaded) subEntry["component"] = aComponent.Label; //aComponent.AssetPath.ToString(); //aComponent.Id.ToString();
								}
							}
							*/
							aComponent = ComponentLibraryHelper.getComponentAsset(asset, subEntry["component"]);
							if (aComponent != null &amp;&amp; aComponent.IsLoaded)
							{
								componentClassName = aComponent.Raw["class_name"];
								componentLabel = subEntry["label"].Trim();
								componentName = char.ToLower(componentClassName[0]) + componentClassName.Substring(1);

								if (!components.ContainsKey(componentName))
								{
									components.Add(componentName, 0);
									sbDeclare.Append(tab + nameSpace + componentClassName + " " + componentName + " = new " + nameSpace + componentClassName + "();").AppendLine();
								}
								else components[componentName]++;

								componentFieldName = !String.IsNullOrEmpty(subEntry["name"]) ? subEntry["name"] : aComponent.Label.ToLower().Replace(" ", "_") + (components[componentName] &gt; 0 ? "_" + (components[componentName] + 1).ToString() : "");

								subEntry["name"] = componentFieldName;
								// subEntry["label"] = componentLabel;

								// sbOutputContent.Append(tab + "sbCol"+ col.ToString()+".Append(" + componentName + ".output(asset,\"" + subEntry.Raw["name"]+"\"));").AppendLine();
								sbOutputContent.Append(tab + "sbCol" + col.ToString() + ".Append(" + componentName + ".output(asset, context,\"" + componentFieldName + "\"));").AppendLine();
							}
						}
						else if (!String.IsNullOrEmpty(subEntry["custom_code"]) &amp;&amp; subEntry["custom_column"] == "col" + col.ToString())
						{
							sbOutputContent.Append(tab + "Out.StartCapture();").AppendLine();
							sbOutputContent.Append(closeTag).AppendLine();
							sbOutputContent.Append(subEntry.Raw["custom_code"]).AppendLine();
							sbOutputContent.Append(openTag).AppendLine();
							sbOutputContent.Append(tab + "sbCol" + col.ToString() + ".Append(Out.StopCapture());").AppendLine();
						}
						unique++;
					}
					sbOutputContent.Append(tab + "rowContent.Add(\"{col" + col.ToString() + "}\", sbCol" + col.ToString() + ");").AppendLine();
					sbOutputContent.AppendLine();
					col++;
				}

				sbOutputContent.Append(tab + "// Output Content for Page using a specific layout").AppendLine();
				sbOutputContent.Append(tab + "Out.Write(layout.output(asset, \"" + entry.GetFieldName("layout") + "\", rowContent,\"" + entry["layout"] + "\"));").AppendLine();
				sbOutputContent.Append(tab + "rowContent.Clear();").AppendLine();
				sbOutputContent.AppendLine();

				nextTab = "Input.NextTabbedPanel();";
				isFirstPe = false;
			}
			/*****************END BUILDING OUTPUT*****************/



			sbDeclare.Append(closeTag).AppendLine();
			//sbImportNamespaces.Append(closeTag).AppendLine();

			if (context.InputForm["meta"] == "yes" || context.InputForm["custom_js_css"] == "yes")
			{
				sbInputContent.Append(tab + "Input.NextTabbedPanel();").AppendLine();


				if (context.InputForm["meta"] == "yes")
				{
					sbInputContent.Append(tab + tab + "Input.StartExpandPanel(\"Metadata\");").AppendLine();
					sbInputContent.Append(tab + tab + "metaData.ComponentInput(asset, context, \"Metadata\", \"meta\");").AppendLine();
					sbInputContent.Append(tab + tab + "Input.EndExpandPanel();").AppendLine();
					sbPostInputContent.Append(tab + "metaData.ComponentPostInput(asset, context, \"meta\");").AppendLine();
					//sbOutputContent.Append(tab + "// Metadata Output").AppendLine();
					//sbOutputContent.Append(tab + "metaData.output(asset, context, \"meta\");").AppendLine();
					sbOutputContent.AppendLine();
				}

				if (context.InputForm["custom_js_css"] == "yes")
				{
					sbInputContent.Append(tab + tab + "Input.StartExpandPanel(\"Javascript and CSS references\");").AppendLine();
					sbInputContent.Append(tab + tab + "headerAndJavascriptCSS.ComponentInput(asset, context, \"Metadata\", \"meta\");").AppendLine();
					sbInputContent.Append(tab + tab + "Input.EndExpandPanel();").AppendLine();
					//sbOutputContent.Append(tab + "// Page specific CSS &amp; JavaScript Output").AppendLine();
					//sbOutputContent.Append(tab + "headerAndJavascriptCSS.output(asset, context, \"meta\");").AppendLine();
					sbOutputContent.AppendLine();
				}
			}


			if (context.InputForm["advanced"] == "yes")
			{
				sbInputContent.Append(tab + "Input.NextTabbedPanel();").AppendLine();
				//site root not configurable via the site config yet.
				//sbInputContent.Append(tab + tab + "Input.ShowLink(Asset.Load(\"" + siteConfig.AssetPath.ToString() + "\"), \"Edit Theme\", InputLinkType.EditTab);").AppendLine();
				sbInputContent.Append(tab + tab + "Input.ShowLink(Asset.Load(\"" + asset.AssetPath.ToString() + "\"), \"Edit Template\", InputLinkType.EditTab);").AppendLine();
			}

			if (context.InputForm["enable_tmf"] == "yes")
			{
				sbInputContent.Append(tab + "Input.NextTabbedPanel();").AppendLine();
				// Replacing with TMF from the Service Library
				//sbInputContent.AppendLine().Append(tab + "try { TMFInput.LoadInput(asset, context); } catch (Exception ex){}").AppendLine().AppendLine();
				//sbPostInputContent.AppendLine().Append(tab + "try { TMFPostInput.LoadPostInput(asset, context); } catch (Exception ex){}").AppendLine();
				//sbOutputContent.Append(tab + "try { TMFOutput.LoadOutput(asset, context); } catch (Exception ex){}").AppendLine();
				//sbOutputChangesContent.Append(tab + "try { TMFOutput.LoadMasterAssetChanges(asset); } catch (Exception ex){}").AppendLine();
				//sbOutputTranslateXmlContent.Append(tab + "try { " + context.InputForm["output_translate_xml_body"] + " } catch (Exception ex){}").AppendLine();
				//sbPostSaveContent.Append(tab + "try { TMFPostSave.LoadPostSave(asset, context); } catch (Exception ex){}").AppendLine();
				sbInputContent.AppendLine().Append(tab + "try { ServicesTMF.Input.LoadInput(asset, context); } catch (Exception ex){}").AppendLine().AppendLine();
				//sbPostInputContent.AppendLine().Append(tab + "try { ServicesTMF.PostInput.LoadPostInput(asset, context); } catch (Exception ex){}").AppendLine();
				sbOutputContent.Append(tab + "try { ServicesTMF.Output.LoadOutput(asset, context); } catch (Exception ex){}").AppendLine();
				sbOutputChangesContent.Append(tab + "try { ServicesTMF.Output.LoadMasterAssetChanges(asset); } catch (Exception ex){}").AppendLine();
				sbOutputTranslateXmlContent.Append(tab + "try { " + context.InputForm["output_translate_xml_body"] + " } catch (Exception ex){}").AppendLine();
				sbPostSaveContent.Append(tab + "try { ServicesTMF.PostSave.LoadPostSave(asset, context); } catch (Exception ex){}").AppendLine();
			}

			sbInputContent.Append(tab + "Input.EndTabbedPanel();").AppendLine();

			/*
						if(context.InputForm["wrapper"]=="yes")
						{
							sbOutputContent.Append(tab + "//End Wrapper").AppendLine();
							sbOutputContent.Append(tab + componentLibraryClassName + ".endWrap(asset,context);").AppendLine();
						}  
				*/
			sbInput.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.InputInit\" " + closeTag).AppendLine();
			sbInput.Append(sbDeclare.ToString()).AppendLine();
			sbInput.Append(openTag).AppendLine();
			sbInput.Append(sbInputContent.ToString());
			sbInput.Append(closeTag).AppendLine();

			sbPostInput.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.PostInputInit\" " + closeTag).AppendLine();
			sbPostInput.Append(sbDeclare.ToString()).AppendLine();
			sbPostInput.Append(openTag).AppendLine();
			sbPostInput.Append(sbPostInputContent.ToString());
			sbPostInput.Append(closeTag).AppendLine();

			sbOutput.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.OutputInit\" " + closeTag).AppendLine();
			sbOutput.Append(sbDeclare.ToString()).AppendLine();
			sbOutput.Append(openTag).AppendLine();
			sbOutput.Append(sbOutputContent.ToString());
			sbOutput.Append(closeTag).AppendLine();

			if (context.InputForm["enable_tmf"] == "yes")
			{
				sbOutputChanges.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.OutputInit\" " + closeTag).AppendLine();
				sbOutputChanges.Append(sbImportNamespaces.ToString()).AppendLine();
				sbOutputChanges.Append(openTag).AppendLine();
				sbOutputChanges.Append(sbOutputChangesContent.ToString());
				sbOutputChanges.Append(closeTag).AppendLine();

				sbOutputTranslateXml.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.OutputInit\" " + closeTag).AppendLine();
				sbOutputTranslateXml.Append(sbImportNamespaces.ToString()).AppendLine();
				sbOutputTranslateXml.Append(openTag).AppendLine();
				sbOutputTranslateXml.Append(sbOutputTranslateXmlContent.ToString());
				sbOutputTranslateXml.Append(closeTag).AppendLine();

				sbPostSave.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.PostSaveInit\" " + closeTag).AppendLine();
				sbPostSave.Append(sbDeclare.ToString()).AppendLine();
				sbPostSave.Append(openTag).AppendLine();
				sbPostSave.Append(sbPostSaveContent.ToString());
				sbPostSave.Append(closeTag).AppendLine();
			}
			else
			{
				sbOutputChanges.Clear();
				sbOutputTranslateXml.Clear();
				sbPostSave.Clear();
			}


			context.InputForm["inputBody"] = sbInput.ToString();
			context.InputForm["postinputBody"] = sbPostInput.ToString();
			context.InputForm["outputBody"] = sbOutput.ToString();
			context.InputForm["outputChangesBody"] = sbOutputChanges.ToString();
			context.InputForm["outputTranslateXmlBody"] = sbOutputTranslateXml.ToString();
			context.InputForm["postSaveBody"] = sbPostSave.ToString();

			if (context.InputForm["create"] == "yes")
			{
				Asset folderAsset = Asset.Load(context.InputForm["template_folder"]);
				Asset templateAsset = Asset.Load(folderAsset.AssetPath + "/" + context.InputForm["template_name"]);

				//        if(templateAsset.IsLoaded &amp;&amp; String.IsNullOrEmpty(context.InputForm["override"]))
				//        {
				//           context.ValidationErrorFields.Add("override", "Please check this box to override existing template");
				//        }

				if (!folderAsset.IsLoaded)
				{
					context.ValidationErrorFields.Add("template_folder", "Please specify a folder to generate the template in");
				}
			}
		}

		public static void PostSaveHelper(Asset asset, PostSaveContext context)
		{
			if (asset["create"] == "yes")
			{
				Asset folderAsset = Asset.Load(asset["template_folder"]);
				Asset templateAsset = Asset.Load(folderAsset.AssetPath + "/" + asset.Raw["template_name"]);
				Asset modelAsset = Asset.LoadDirect("/System/Templates/Basis/Template/Template C#");
				Dictionary&lt;string, string&gt; contentFields = new Dictionary&lt;string, string&gt; { { "Auto created by", asset.Id.ToString() } };

				if (!templateAsset.IsLoaded)
				{
					templateAsset = Asset.CreateNewAsset(asset.Raw["template_name"], folderAsset, modelAsset, contentFields);
					asset["templateId"] = templateAsset.Id.ToString();
					asset.SaveContentField("templateId", templateAsset.Id.ToString());

					var defaultTemplateFolder = Asset.Load(ComponentLibraryHelper.getComponentLibraryProjectFolder(asset).AssetPath + "/Templates/Component Framework/Template Builder Default");
					if (defaultTemplateFolder.IsLoaded)
					{
						var ap = new AssetParams { ExcludeProjectTypes = false };
						var defaultTemplateFiles = defaultTemplateFolder.GetFileList(ap);
						defaultTemplateFiles.ForEach(f =&gt; Asset.CopyAsset(f.Label, templateAsset, f));
					}
				}

				if (templateAsset.IsLoaded)
				{
					folderAsset = templateAsset;

					modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/input.aspx");
					contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["inputBody"] } };
					Asset inputAsset = Asset.Load(folderAsset.AssetPath + "/input.aspx");
					if (inputAsset.IsLoaded)
					{
						//inputAsset.Delete();
						inputAsset.SaveContent(contentFields);
					}
					else
					{
						inputAsset = Asset.CreateNewAsset("input.aspx", folderAsset, modelAsset, contentFields);
					}

					modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/post_input.aspx");
					contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["postinputBody"] } };
					Asset postinputAsset = Asset.Load(folderAsset.AssetPath + "/post_input.aspx");
					if (postinputAsset.IsLoaded)
					{
						postinputAsset.SaveContent(contentFields);
						//postinputAsset.Delete();
					}
					else
					{
						postinputAsset = Asset.CreateNewAsset("post_input.aspx", folderAsset, modelAsset, contentFields);
					}

					modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/output.aspx");
					contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["outputBody"] } };
					Asset outputAsset = Asset.Load(folderAsset.AssetPath + "/output.aspx");
					if (outputAsset.IsLoaded)
					{
						outputAsset.SaveContent(contentFields);
						outputAsset.SaveSource(asset.Raw["outputBody"]);
						//outputAsset.Delete();
					}
					else
					{
						outputAsset = Asset.CreateNewAsset("output.aspx", folderAsset, modelAsset, contentFields);
					}

					if (asset["do_not_overwrite_post_save"] != "do_not_overwrite")
					{
						//Post save currently in "enable_tmf" because only used for TMF currently, should be moved out eventually
						modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/post_save.aspx");
						contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["postSaveBody"] } };
						Asset postSaveAsset = Asset.Load(folderAsset.AssetPath + "/post_save.aspx");
						if (postSaveAsset.IsLoaded) postSaveAsset.Delete();
						if (asset["enable_tmf"] == "yes")
						{
							postSaveAsset = Asset.CreateNewAsset("post_save.aspx", folderAsset, modelAsset, contentFields);
						}
					}

					modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/output.aspx");
					contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["outputChangesBody"] } };
					Asset outputChangesAsset = Asset.Load(folderAsset.AssetPath + "/output_changes.aspx");
					if (outputChangesAsset.IsLoaded) outputChangesAsset.Delete();
					if (asset["enable_tmf"] == "yes")
					{
						outputChangesAsset = Asset.CreateNewAsset("output_changes.aspx", folderAsset, modelAsset, contentFields);
					}

					modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/output.aspx");
					contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["outputTranslateXmlBody"] } };
					Asset outputTranslateXmlAsset = Asset.Load(folderAsset.AssetPath + "/output_translate_xml.aspx");
					if (outputTranslateXmlAsset.IsLoaded) outputTranslateXmlAsset.Delete();
					if (asset["enable_tmf"] == "yes" &amp;&amp; asset["create_output_translate_xml"] == "yes")
					{
						outputTranslateXmlAsset = Asset.CreateNewAsset("output_translate_xml.aspx", folderAsset, modelAsset, contentFields);
					}

				}

				if (!String.IsNullOrEmpty(asset[asset["previewAsset"]]))
				{
					Asset previewAsset = Asset.Load(asset["previewAsset"]);
					previewAsset.SetTemplate(templateAsset.Id);
					foreach (PanelEntry entry in asset.GetPanels("layouts"))
					{
						previewAsset[entry.GetFieldName("layout")] = entry["layout"];
					}
					previewAsset.SaveContent();
				}

			}
			asset.SaveContentField("override", "");
			asset.Rename(asset["template_name"]);
			//asset.SaveContent();
		}

		private static string makeRaw(string content)
		{
			foreach (Match mc in Regex.Matches(content, @"~\$CPIL\$\d+\$[\w:]+\$\w+\$"))
			{
				content = content.Replace(mc.Value, "").Replace("$/CPIL$~", "");
			}
			foreach (Match mc in Regex.Matches(content, @"%\$CPIL\$\d+\$[\w:]+\$\w+\$"))
			{
				content = content.Replace(mc.Value, "").Replace("$/CPIL$%", "");
			}
			return content;
		}
	}
}
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261482</id>
    <label>ComponentLibraryTemplateUtils.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/ComponentLibraryTemplateUtils.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public class ComponentLibraryTemplateUtils
	{
		#region Cleanup Component Library Files

		public static void CleanupComponentLibraryFilesInput(Asset asset, InputContext context)
		{
			Input.ShowCheckBox("Cleanup Library Files?", "cleanup", "yes", "Yes");
		}

		public static void CleanupComponentLibraryFilesOutput(Asset asset, OutputContext context)
		{
			Out.Write(asset["output_content"]);
		}

		public static void CleanupComponentLibraryFilesPostSave(Asset asset, PostSaveContext context)
		{
			FilterParams fParams = new FilterParams();
			fParams.ExcludeProjectTypes = false;

			List&lt;Asset&gt; componentLibraryFiles = ComponentLibraryHelper.getComponentLibraryClassFolder(asset).GetFilterList(fParams);

			StringBuilder outputSb = new StringBuilder();

			foreach (Asset clf in componentLibraryFiles)
			{
				int n;
				Regex rx = new Regex("[0-9]{3,}");

				if (rx.IsMatch(clf.Label))
				{
					outputSb.AppendFormat("&lt;p&gt;{0}&lt;/p&gt;", clf.Label).AppendLine();
					clf.Delete();
				}

			}

			asset.SaveContentField("output_content", outputSb.ToString());

			//StringBuilder outputSb = new StringBuilder();


			//FilterParams fParams = new FilterParams();
			//fParams.ExcludeProjectTypes = false;

			//List&lt;Asset&gt; componentLibraryFiles = ComponentLibraryHelper.getComponentLibraryClassFolder(asset).GetFilterList(fParams);


			//foreach (Asset clf in componentLibraryFiles)
			//{
			//    if (clf.Label.StartsWith("Components_") &amp;&amp; !clf.Label.EndsWith("Base.cs") )
			//    {
			//        String body = clf["body"];

			//        if (body.Contains("public override string output(Asset asset, OutputContext context, string name, string index = \"\")") || 
			//            body.Contains("return outputBase(asset, context, name, index);"))
			//        {
			//            outputSb.AppendFormat("&lt;p&gt;{0}&lt;/p&gt;", clf.Label);
			//            body = body.Replace("public override string output(Asset asset, OutputContext context, string name, string index = \"\")", "public override string output(Asset asset, OutputContext context, string name, string index = \"\", bool isDrag = false)");
			//            body = body.Replace("return outputBase(asset, context, name, index);", "return outputBase(asset, context, name, index, isDrag);");
			//            clf.SaveContentField("body", body);

			//        }
			//    }

			//    asset.SaveContentField("output_content", outputSb.ToString());
			//}
		}

		#endregion

		#region Delete DuplicateFiles

		public static void DeleteDuplicateFilesInput(Asset asset, InputContext context)
		{
			Input.ShowSelectFolder("Folder in which to delete duplicate files", "folder");
		}

		public static void DeleteDuplicateFilesOutput(Asset asset, OutputContext context)
		{
			Out.Write(asset["output"]);
		}

		public static void DeleteDuplicateFilesPostSave(Asset asset, PostSaveContext context)
		{
			FilterParams fParams = new FilterParams();
			fParams.ExcludeProjectTypes = false;
			StringBuilder outputSb = new StringBuilder();

			List&lt;Asset&gt; assets = Asset.Load(asset["folder"]).GetFilterList(fParams);
			List&lt;Asset&gt; alreadyExists = new List&lt;Asset&gt;();

			assets.Sort((x, y) =&gt;
			{
				int result = x.Label.CompareTo(y.Label);
				return result != 0 ? result : DateTime.Compare(x.CreateDate ?? DateTime.MinValue, y.CreateDate ?? DateTime.MinValue);
			});

			foreach (Asset a in assets)
			{
				if (alreadyExists.Any(x =&gt; x.Label == a.Label))
				{
					outputSb.AppendLine(String.Format("&lt;p&gt;{0} : {1} will be Deleted!&lt;/p&gt;", a.Label, a.CreateDate));
					//a.Delete();
				}
				else
				{
					alreadyExists.Add(a);
					outputSb.AppendLine(String.Format("&lt;p&gt;{0} : {1}&lt;/p&gt;", a.Label, a.CreateDate));
				}
			}

			asset.SaveContentField("output", outputSb.ToString());
		}

		#endregion

		#region Post Migration Cleanup 

		public static void PostMigrationCleanupInput(Asset asset, InputContext context)
		{
			Input.ShowSelectFolder("Component Library Migration Root folder", "root_folder");
			Input.ShowCheckBox("Run post migration script?", "run_script", "yes", "Yes");
		}

		public static void PostMigrationCleanupOutput(Asset asset, OutputContext context)
		{
		}

		public static void PostMigrationCleanupPostSave(Asset asset, PostSaveContext context)
		{
			StringBuilder outputSb = new StringBuilder();

			Asset rootFolder = Asset.Load(asset["root_folder"]);
			String rootFolderAssetPath = rootFolder.AssetPath.ToString();

			if (asset["run_script"] == "yes")
			{
				Asset componentLibraryConfig = Asset.Load(rootFolderAssetPath + "/_Framework/Component Library Config");

				componentLibraryConfig["component_class_folder"] = Asset.Load(rootFolderAssetPath + "/_Framework/Component_Project/Components").GetLink(LinkType.Internal);
				componentLibraryConfig["component_class_folder"] = componentLibraryConfig["component_class_folder"].Substring(0, componentLibraryConfig["component_class_folder"].Length - 1);

				componentLibraryConfig["component_library_components_folder"] = Asset.Load(rootFolderAssetPath + "/_Framework/_Components").GetLink(LinkType.Internal);
				componentLibraryConfig["component_library_components_folder"] = componentLibraryConfig["component_library_components_folder"].Substring(0, componentLibraryConfig["component_library_components_folder"].Length - 1);

				componentLibraryConfig["component_library_models_folder"] = Asset.Load(rootFolderAssetPath + "/_Framework/Component_Project/Models").GetLink(LinkType.Internal);
				componentLibraryConfig["component_library_models_folder"] = componentLibraryConfig["component_library_models_folder"].Substring(0, componentLibraryConfig["component_library_models_folder"].Length - 1);

				componentLibraryConfig["component_library_project_folder"] = Asset.Load(rootFolderAssetPath + "/_Framework/Component_Project").GetLink(LinkType.Internal);
				componentLibraryConfig["component_library_project_folder"] = componentLibraryConfig["component_library_project_folder"].Substring(0, componentLibraryConfig["component_library_project_folder"].Length - 1);
				rootFolder.SaveContentField("_cmsprojectid", Asset.Load(rootFolderAssetPath + "/_Framework/Component_Project").Id.ToString());

				componentLibraryConfig["component_library_root_folder"] = Asset.Load(rootFolderAssetPath + "/_Framework").GetLink(LinkType.Internal);
				componentLibraryConfig["component_library_root_folder"] = componentLibraryConfig["component_library_root_folder"].Substring(0, componentLibraryConfig["component_library_root_folder"].Length - 1);

				componentLibraryConfig["site_root"] = Asset.Load(rootFolderAssetPath).GetLink(LinkType.Internal);
				componentLibraryConfig["site_root"] = componentLibraryConfig["site_root"].Substring(0, componentLibraryConfig["site_root"].Length - 1);

				componentLibraryConfig["upload#site_config"] = Asset.Load(rootFolderAssetPath + "/_Site Config/site config").GetLink(LinkType.Internal);
				componentLibraryConfig["upload#site_config"] = componentLibraryConfig["upload#site_config"].Substring(0, componentLibraryConfig["upload#site_config"].Length - 1);

				componentLibraryConfig["upload_name#site_config"] = Asset.Load(rootFolderAssetPath + "/_Site Config/site config").AssetPath.ToString();

				componentLibraryConfig.SaveContent();

				rootFolder.SaveContentField("_cmsprojectid", Asset.Load(rootFolderAssetPath + "/_Framework/Component_Project").Id.ToString());

				List&lt;Asset&gt; assignWorkflowAssets = new List&lt;Asset&gt;();

				FilterParams awfaParams = new FilterParams();
				awfaParams.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "DeveloperCS");
				awfaParams.Add(Comparison.Equals, AssetType.File);

				FilterParams awfaPicturesParams = new FilterParams();
				awfaPicturesParams.Add(Comparison.Equals, AssetType.File);

				//everything in the root /_Assets/ folder
				assignWorkflowAssets = Asset.Load(rootFolderAssetPath + "/_Assets").GetFilterList(awfaParams);
				assignWorkflowAssets.AddRange(Asset.Load(rootFolderAssetPath + "/_Assets/images").GetFilterList(awfaPicturesParams));
				//everything in the /_Framework/_Assets/ folder
				assignWorkflowAssets.AddRange(Asset.Load(rootFolderAssetPath + "/_Framework/_Assets").GetFilterList(awfaParams));
				assignWorkflowAssets.AddRange(Asset.Load(rootFolderAssetPath + "/_Framework/_Assets/images").GetFilterList(awfaPicturesParams));
				//the site map
				assignWorkflowAssets.Add(Asset.Load(rootFolderAssetPath + "/Site Map"));

				//foreach (Asset wa in assignWorkflowAssets)
				//{
				//    wa.SetWorkflow("Basic Workflow");
				//}

				Asset.Load(rootFolderAssetPath + "/_Assets/css/developer").Delete();
				Asset.Load(rootFolderAssetPath + "/_Assets/js/developer").Delete();
				Asset.Load(rootFolderAssetPath + "/_Assets/images/developer").Delete();
				Asset.Load(rootFolderAssetPath + "/_Framework/_Components/developer").Delete();
				Asset.Load(rootFolderAssetPath + "/_Framework/_Templates/Visual Template Builder Templates").Delete();
				Asset.Load(rootFolderAssetPath + "/_Framework/_Templates/Site Wrappers/Developer Site Wrapper").Delete();

				Asset componentFolderModel = Asset.Load(rootFolderAssetPath + "/_Framework/Component_Project/Models/Component Folder");
				Asset.Load(rootFolderAssetPath + "/_Framework/_Components").SetModel(componentFolderModel.Id);
				Asset.Load(rootFolderAssetPath + "/_Framework/_Components/atoms").SetModel(componentFolderModel.Id);
				Asset.Load(rootFolderAssetPath + "/_Framework/_Components/core").SetModel(componentFolderModel.Id);
				Asset.Load(rootFolderAssetPath + "/_Framework/_Components/molecules").SetModel(componentFolderModel.Id);
				Asset.Load(rootFolderAssetPath + "/_Framework/_Components/organisms").SetModel(componentFolderModel.Id);

				Asset layoutsFolderModel = Asset.Load(rootFolderAssetPath + "/_Framework/Component_Project/Models/Layouts");
				Asset.Load(rootFolderAssetPath + "/_Framework/_Components/layouts").SetModel(layoutsFolderModel.Id);


				Asset templateBuilderFolderModel = Asset.Load(rootFolderAssetPath + "/_Framework/Component_Project/Models/Templates");
				Asset.Load(rootFolderAssetPath + "/_Framework/_Templates").SetModel(templateBuilderFolderModel.Id);

				Asset wrapperBuilderFolderModel = Asset.Load(rootFolderAssetPath + "/_Framework/Component_Project/Models/Wrapper Builder Folder Model");
				Asset.Load(rootFolderAssetPath + "/_Framework/_Templates/Site Wrappers").SetModel(wrapperBuilderFolderModel.Id);

				Asset articlesFolderModel = Asset.Load(rootFolderAssetPath + "/_Framework/Component_Project/Models/Articles");
				Asset.Load(rootFolderAssetPath + "/Articles").SetModel(articlesFolderModel.Id);

				Asset blogFolderModel = Asset.Load(rootFolderAssetPath + "/_Framework/Component_Project/Models/Blog");
				Asset.Load(rootFolderAssetPath + "/Blog").SetModel(blogFolderModel.Id);

				Asset campaignsFolderModel = Asset.Load(rootFolderAssetPath + "/_Framework/Component_Project/Models/Campaigns");
				Asset.Load(rootFolderAssetPath + "/Campaigns").SetModel(campaignsFolderModel.Id);

				Asset contentFolderModel = Asset.Load(rootFolderAssetPath + "/_Framework/Component_Project/Models/Content Pages");
				Asset.Load(rootFolderAssetPath + "/Content").SetModel(contentFolderModel.Id);

				Asset newsFolderModel = Asset.Load(rootFolderAssetPath + "/_Framework/Component_Project/Models/News Room");
				Asset.Load(rootFolderAssetPath + "/News Room").SetModel(newsFolderModel.Id);

				Asset widgetFolderModel = Asset.Load(rootFolderAssetPath + "/_Framework/Component_Project/Models/Widgets Folder Model");
				Asset.Load(rootFolderAssetPath + "/Widgets").SetModel(widgetFolderModel.Id);

				Asset rootFolderModel = Asset.Load(rootFolderAssetPath + "/_Framework/Component_Project/Models/Site Root Pages");
				Asset.Load(rootFolderAssetPath).SetModel(rootFolderModel.Id);

				/*Update all template builder template_folder paths*/
				FilterParams templateBuilderFilterParams = new FilterParams();
				templateBuilderFilterParams.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Template Builder");

				FilterParams wrapperBuilderFilterParams = new FilterParams();
				wrapperBuilderFilterParams.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Wrapper Builder");

				List&lt;Asset&gt; templateBuilderAssets = Asset.Load(rootFolderAssetPath + "/_Framework/_Templates").GetFilterList(templateBuilderFilterParams);
				templateBuilderAssets.AddRange(Asset.Load(rootFolderAssetPath + "/_Framework/_Templates").GetFilterList(wrapperBuilderFilterParams));

				String templateBuilderTemplatePath = Asset.Load(rootFolderAssetPath + "/_Framework/Component_Project/Templates").GetLink(LinkType.Internal);
				templateBuilderTemplatePath = templateBuilderTemplatePath.Substring(0, templateBuilderTemplatePath.Length - 1);

				foreach (Asset tba in templateBuilderAssets)
				{
					tba.SaveContentField("template_folder", templateBuilderTemplatePath);
				}

				asset.DeleteContentField("run_script");
			}
		}

		#endregion

		#region Update Template Builder Component Content Fields

		public static void UpdateTemplateBuilderComponentContentFieldsInput(Asset asset, InputContext context)
		{
			Input.ShowAcquireDocument("Update This Template Builder Template ONLY", "single");

			Input.ShowCheckBox("Update ALL Template Builder Templates", "all", "yes", "Yes");
		}

		public static void UpdateTemplateBuilderComponentContentFieldsOutput(Asset asset, OutputContext context)
		{
			Out.Write(asset["debug_output"]);
		}

		public static void UpdateTemplateBuilderComponentContentFieldsPostSave(Asset asset, PostSaveContext context)
		{
			StringBuilder outputSb = new StringBuilder();

			if (!String.IsNullOrWhiteSpace(asset["single"]))
			{
				Asset templateBuilder = Asset.Load(asset["single"]);
				foreach (PanelEntry layout in templateBuilder.GetPanels("layouts"))
				{
					foreach (PanelEntry component in layout.GetPanels("Components"))
					{
						if (component["component"].Contains("/"))
						{
							String currentComponent = component["component"];
							currentComponent = currentComponent.Substring(currentComponent.LastIndexOf("/") + 1);
							outputSb.AppendFormat("&lt;p&gt;{0} ==&gt; {1}&lt;/p&gt;", component["component"], currentComponent).AppendLine();
							//component["component"] = currentComponent;
						}
					}
				}

				templateBuilder.SaveContent();
			}
			else if (asset["all"] == "yes")
			{
				FilterParams fParams1 = new FilterParams();
				fParams1.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Template Builder");
				List&lt;Asset&gt; builderAssets = Asset.Load(ComponentLibraryHelper.getcomponentLibraryRootFolder(asset).AssetPath + "/_Templates").GetFilterList(fParams1);

				FilterParams fParams2 = new FilterParams();
				fParams2.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Wrapper Builder");
				builderAssets.AddRange(Asset.Load(ComponentLibraryHelper.getcomponentLibraryRootFolder(asset).AssetPath + "/_Templates").GetFilterList(fParams2));

				foreach (Asset builderAsset in builderAssets)
				{
					foreach (PanelEntry layout in builderAsset.GetPanels("layouts"))
					{
						foreach (PanelEntry component in layout.GetPanels("Components"))
						{
							if (component["component"].Contains("/"))
							{
								String currentComponent = component["component"];
								currentComponent = currentComponent.Substring(currentComponent.LastIndexOf("/") + 1);
								outputSb.AppendFormat("&lt;p&gt;workflow state: {0} template: {1} {2} ==&gt; {3}&lt;/p&gt;", builderAsset.WorkflowStatus.Name, builderAsset.TemplateLabel, component["component"], currentComponent).AppendLine();
								component["component"] = currentComponent;
							}
						}
					}

					builderAsset.SaveContent();
				}
			}


			asset.SaveContentField("debug_output", outputSb.ToString());
			asset.DeleteContentField("all");
			asset.DeleteContentField("single");
		}

		#endregion

		#region Component Library Code Refresh

		public static void ComponentLibraryCodeRefreshInput(Asset asset, InputContext context)
		{
			Input.ShowTextBox("Asset Id", "asset_id");

			FilterParams fparams = new FilterParams();
			fparams.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Component");

			Asset componentsFolder = ComponentLibraryHelper.getComponentLibraryComponentsFolder(asset);


			List&lt;Asset&gt; componentAssets = componentsFolder.GetFilterList(fparams);

			Dictionary&lt;String, String&gt; componentOptions = componentAssets.ToDictionary(x =&gt; x.Label, y =&gt; y.GetLink(LinkType.Internal));

			Input.ShowSelectList("Components To exclude", "compoents_to_exclude", componentOptions);


			Dictionary&lt;String, String&gt; options = new Dictionary&lt;string, string&gt;() { { "Yes", "Yes" }, { "No", "No" } };
			Input.ShowDropDown("Rebuild component classes?", "rebuild", options, Util.MakeList("No"));
		}

		public static void ComponentLibraryCodeRefreshOutput(Asset asset, OutputContext context)
		{
			Out.Write(asset["output_content"]);
		}

		public static void ComponentLibraryCodeRefreshPostInput(Asset asset, PostInputContext context)
		{
			//if (context.InputForm["rebuild"] == "Yes")
			//{
			Asset currentAsset = null;
			FilterParams fParams = new FilterParams();
			fParams.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Component");

			if (!String.IsNullOrWhiteSpace(context.InputForm["asset_id"]))
			{
				fParams.Add(AssetPropertyNames.Id, Comparison.Equals, context.InputForm["asset_id"]);
			}
			else if (!String.IsNullOrWhiteSpace(asset["asset_id"]))
			{
				fParams.Add(AssetPropertyNames.Id, Comparison.Equals, asset["asset_id"]);
			}

			List&lt;Asset&gt; assetsToExclude = asset.GetPanels("compoents_to_exclude").Select(panel =&gt; Asset.Load(panel["compoents_to_exclude"])).ToList();

			StringBuilder sbOutput = new StringBuilder();
			List&lt;Asset&gt; componentAssetList = Asset.Load(ComponentLibraryHelper.componentsPath(asset)).GetFilterList(fParams);
			for (int index = 0; index &lt; componentAssetList.Count; index++)
			{
				try
				{
					currentAsset = componentAssetList[index];
					if (currentAsset["read_only"] != "yes" &amp;&amp; assetsToExclude.All(x =&gt; x.Id != currentAsset.Id))
					{
						sbOutput.AppendLine("&lt;p&gt;Recompiled: " + currentAsset.AssetPath.ToString() + "&lt;/p&gt;");
						List&lt;ComponentContentPlaceholder&gt; markupContentPlaceholders = ComponentLibraryHelper.buildComponentContentPlaceholderFromMarkup(currentAsset["markup"]);
						List&lt;PanelEntry&gt; componentPanels = currentAsset.GetPanels("component_panel");
						List&lt;ComponentContentPlaceholder&gt; assetContentPlaceholders = ComponentContentPlaceholder.ConvertPanelEntryList(componentPanels, "component_panel");
						List&lt;ComponentContentPlaceholder&gt; flattenedAssetcontentPlaceholders = ComponentLibraryHelper.flattenComponentContentPlaceholderList(assetContentPlaceholders);

						ComponentLibraryHelper.deleteExistingContentFieldsForComponents(ref assetContentPlaceholders, markupContentPlaceholders);
						ComponentLibraryHelper.updateExistingContentFields(ref assetContentPlaceholders, markupContentPlaceholders);
						ComponentLibraryHelper.createContentFieldsForComponents(ref assetContentPlaceholders, markupContentPlaceholders, flattenedAssetcontentPlaceholders);

						Dictionary&lt;String, String&gt; content = ComponentContentPlaceholder.ConvertToContentDictionary(assetContentPlaceholders);

						ComponentLibraryHelper.deleteComponentContent(currentAsset);
						currentAsset.SaveContent(content);

						bool recompileSuccessful = false;
						Asset codeFile = ComponentLibraryHelper.createCodeFile(currentAsset, false, ref recompileSuccessful);
						Asset wysiwygTemplateFile = ComponentLibraryHelper.createWysiwygTemplate(currentAsset, "/System/CMS Snippets/Default");
					}
					else
					{
						if (assetsToExclude.Any(x =&gt; x.Id == currentAsset.Id))
						{
							sbOutput.AppendLine("&lt;p&gt;Manually Excluded: " + currentAsset.AssetPath.ToString() + "&lt;/p&gt;");
						}
						else
						{
							sbOutput.AppendLine("&lt;p&gt;Excluded: " + currentAsset.AssetPath.ToString() + "&lt;/p&gt;");
						}

					}
				}
				catch (Exception ex)
				{
					Util.Email(String.Format("Component Refresh Script exception AssetId: {0} {1}", currentAsset.Id, currentAsset.Label), String.Format("The following exception was thrown when running the script on asset id {0} \"{1}\" \r\n {2} \r\n {3}", currentAsset.Id, currentAsset.Label, ex.Message, ex.InnerException), "corey.casado@crownpeak.com");
				}
			}

			asset.SaveContentField("output_content", sbOutput.ToString());


			//bool libraryRecompileSuccessful = ComponentLibraryHelper.recompileLibrary(asset);

			//if (!libraryRecompileSuccessful)
			//{
			//    Util.Email("CL class refresh script recompilation unsuccessful.", "Recompilation failed when recompiling after the CL class refresh script was executed.", "corey.casado@crownpeak.com");
			//}
			//}
			context.InputForm.Remove("rebuild");
		}

		#endregion

		#region Component Library Template Refresh

		public static void ComponentLibraryTemplateRefreshInput(Asset asset, InputContext context)
		{
			Input.ShowTextBox("Asset Id", "asset_id");

			FilterParams fparams = new FilterParams();
			fparams.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Template Builder");

			Asset templatesFolder = Asset.Load(ComponentLibraryHelper.getcomponentLibraryRootFolder(asset).AssetPath + "/_Templates");


			List&lt;Asset&gt; templateBuilderAssets = templatesFolder.GetFilterList(fparams);

			Dictionary&lt;String, String&gt; templateOptions = templateBuilderAssets.ToDictionary(x =&gt; x.Label, y =&gt; y.GetLink(LinkType.Internal));

			Input.ShowSelectList("Templates To exclude", "templates_to_exclude", templateOptions);


			Dictionary&lt;String, String&gt; options = new Dictionary&lt;string, string&gt;() { { "Yes", "Yes" }, { "No", "No" } };
			Input.ShowDropDown("Rebuild templates?", "rebuild", options, Util.MakeList("No"));
		}

		public static void ComponentLibraryTemplateRefreshOutput(Asset asset, OutputContext context)
		{
			Out.Write(asset["output_content"]);
		}

		public static void ComponentLibraryTemplateRefreshPostInput(Asset asset, PostInputContext context)
		{
			//if (context.InputForm["rebuild"] == "Yes")
			//{
			Asset currentAsset = null;
			FilterParams fParams = new FilterParams();
			fParams.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Template Builder");

			if (!String.IsNullOrWhiteSpace(context.InputForm["asset_id"]))
			{
				fParams.Add(AssetPropertyNames.Id, Comparison.Equals, context.InputForm["asset_id"]);
			}
			else if (!String.IsNullOrWhiteSpace(asset["asset_id"]))
			{
				fParams.Add(AssetPropertyNames.Id, Comparison.Equals, asset["asset_id"]);
			}

			List&lt;Asset&gt; assetsToExclude = asset.GetPanels("templates_to_exclude").Select(panel =&gt; Asset.Load(panel["templates_to_exclude"])).ToList();

			StringBuilder sbOutput = new StringBuilder();
			List&lt;Asset&gt; templateAssetList = Asset.Load(ComponentLibraryHelper.getcomponentLibraryRootFolder(asset).AssetPath + "/_Templates").GetFilterList(fParams);
			for (int index = 0; index &lt; templateAssetList.Count; index++)
			{
				try
				{
					currentAsset = templateAssetList[index];
					if (assetsToExclude.All(x =&gt; x.Id != currentAsset.Id))
					{
						sbOutput.AppendLine("&lt;p&gt;Recompiled: " + currentAsset.AssetPath.ToString() + "&lt;/p&gt;");

						asset.SaveContentField("create", "yes");
					}
					else
					{
						if (assetsToExclude.Any(x =&gt; x.Id == currentAsset.Id))
						{
							sbOutput.AppendLine("&lt;p&gt;Manually Excluded: " + currentAsset.AssetPath.ToString() + "&lt;/p&gt;");
						}
						else
						{
							sbOutput.AppendLine("&lt;p&gt;Excluded: " + currentAsset.AssetPath.ToString() + "&lt;/p&gt;");
						}

					}
				}
				catch (Exception ex)
				{
					Util.Email(String.Format("Component Refresh Script exception AssetId: {0} {1}", (currentAsset != null ? currentAsset.Id.ToString() : "NULL"), (currentAsset != null ? currentAsset.Label : "NULL")), String.Format("The following exception was thrown when running the script on asset id {0} \"{1}\" \r\n {2} \r\n {3}", currentAsset.Id, currentAsset.Label, ex.Message, ex.InnerException), "corey.casado@crownpeak.com");
				}
			}

			asset.SaveContentField("output_content", sbOutput.ToString());


			//bool libraryRecompileSuccessful = ComponentLibraryHelper.recompileLibrary(asset);

			//if (!libraryRecompileSuccessful)
			//{
			//    Util.Email("CL class refresh script recompilation unsuccessful.", "Recompilation failed when recompiling after the CL class refresh script was executed.", "corey.casado@crownpeak.com");
			//}
			//}
			context.InputForm.Remove("rebuild");
		}

		#endregion
	}
}
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261483</id>
    <label>ComponentLibraryUtils.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/ComponentLibraryUtils.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public class ComponentLibraryUtils
	{

	}

	public class SubListDetails
	{
		public PanelEntry pe { get; set; }
		public String panelEntryName { get; set; }

		public SubListDetails(PanelEntry pe, String panelEntryName)
		{
			this.pe = pe;
			this.panelEntryName = panelEntryName;
		}
	}

	public class Component_Layout
	{
		public void input(Asset asset, String label, String name, String initial)
		{
			FilterParams fpFilter = new FilterParams();
			fpFilter.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Layout");
			Dictionary&lt;string, string&gt; layouts = new Dictionary&lt;string, string&gt;();
			foreach (Asset aLayout in Asset.Load(ComponentLibraryHelper.componentsPath(asset) + "layouts").GetFilterList(fpFilter))
			{
				if (aLayout.IsLoaded) layouts.Add(aLayout.Label, aLayout.Label);
			}
			Input.ShowDropDown(label + " layout", name, layouts, Util.MakeList(initial));
		}

		public String output(Asset asset, String name, Dictionary&lt;String, StringBuilder&gt; content, String layout = null)
		{
			StringBuilder sbContent = new StringBuilder();
			//Out.DebugWriteLine("temp " + Asset.Load(ComponentLibraryHelper.getcomponentLibraryRootFolder(asset) + "/Layout Definitions/" + (string.IsNullOrEmpty(layout) ? asset[name] : layout)).Id);
			sbContent.Append(Asset.Load(ComponentLibraryHelper.getcomponentLibraryRootFolder(asset) + "/Layout Definitions/" + (string.IsNullOrEmpty(layout) ? asset[name] : layout)).Raw["markup"]);
			//Out.DebugWriteLine("Layout: {0} loaded...", ComponentLibraryHelper.getcomponentLibraryRootFolder(asset) + "/Layout Definitions/" + asset[name]);
			foreach (KeyValuePair&lt;String, StringBuilder&gt; kvp in content)
			{
				sbContent.Replace(kvp.Key, kvp.Value.ToString());
			}

			return sbContent.ToString();
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261484</id>
    <label>ComponentLibraryWrapperBuilderHelper.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/ComponentLibraryWrapperBuilderHelper.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public class ComponentLibraryWrapperBuilderHelper
	{
		public static void InputHelper(Asset asset, InputContext context)
		{
			String componentLibraryProjectTemplateFolderPath = ComponentLibraryHelper.getComponentLibraryProjectFolder(asset).AssetPath + "/Templates";
			String SiteRootFolderPath = ComponentLibraryHelper.getcomponentLibraryRootFolder(asset).AssetPath.ToString();
			String ComponentsFolderPath = ComponentLibraryHelper.getComponentLibraryComponentsFolder(asset).ToString();
			string libraryPath = ComponentLibraryHelper.getComponentLibraryComponentsFolder(asset).AssetPath.ToString();
			Out.DebugWriteLine("Library Path: " + libraryPath);
			WysiwygParams wParams = ServicesInput.FullWYSIWYG();

			ShowAcquireParams sapComponents = new ShowAcquireParams();
			sapComponents.DefaultFolder = SiteRootFolderPath + "/_components/_thumbnails/components";
			sapComponents.ShowUpload = false;

			Dictionary&lt;string, string&gt; wrapperLocations = new Dictionary&lt;string, string&gt;() { { "Header", "header" }, { "Footer", "footer" } };

			// setup dictionary of available layouts
			FilterParams fpLayoutFilter = new FilterParams();
			fpLayoutFilter.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Layout");
			fpLayoutFilter.SortOrder = SortOrder.OrderBy(AssetPropertyNames.FolderId).ThenBy(AssetPropertyNames.Label);

			Dictionary&lt;string, string&gt; layouts = new Dictionary&lt;string, string&gt;();
			foreach (Asset aLayout in Asset.Load(libraryPath).GetFilterList(fpLayoutFilter))
			{
				if (aLayout.IsLoaded) layouts.Add(aLayout.Label, aLayout.Label);
			}

			// setup dictionary of available components
			FilterParams fpComponentFilter = new FilterParams();
			fpComponentFilter.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Component");
			fpComponentFilter.SortOrder = SortOrder.OrderBy(AssetPropertyNames.FolderId).ThenBy(AssetPropertyNames.Label);

			Dictionary&lt;string, string&gt; components = new Dictionary&lt;string, string&gt;();
			components.Add("- - None - -", "none");
			foreach (Asset aComponent in Asset.Load(libraryPath).GetFilterList(fpComponentFilter))
			{
				if (aComponent.IsLoaded) components.Add(Asset.Load(aComponent.FolderId).Label + ": " + aComponent.Label + " (" + aComponent.Id + ")", aComponent.Label /*aComponent.AssetPath.ToString()*/);
			}

			components = components.OrderBy(x =&gt; x.Key).ToDictionary(x =&gt; x.Key, y =&gt; y.Value);

			// available columns
			Dictionary&lt;string, string&gt; columns = new Dictionary&lt;string, string&gt;()
	{
		{"Column One","col1"}, {"Column Two","col2"}//, {"Column Three","col3"}
	};

			if (String.IsNullOrEmpty(asset["inputBody"]))
			{
				Input.StartTabbedPanel("Components", "Wrapper", "Settings");
			}
			else
			{
				Input.StartTabbedPanel("Components", "Wrapper", "Settings", "Code");
			}
			while (Input.NextPanel("Layouts"))
			{

				// Layouts
				Input.ShowTextBox("Section Name", "section");
				ShowAcquireParams sapLayouts = new ShowAcquireParams();
				sapLayouts.DefaultFolder = SiteRootFolderPath + "/_components/_thumbnails/layouts";
				sapLayouts.ShowUpload = false;
				Input.ShowAcquireImage("Layout", "layout_thumbnail", sapLayouts);
				Input.ShowRadioButton("Wrapper Option", "wrapper_option", wrapperLocations);
				Input.ShowDropDown("Seleced Layout", "layout", layouts);

				//Input.StartExpandPanel("Customize");
				//Input.ShowCheckBox("Editable", "editable", "yes", "yes");
				//Input.EndExpandPanel();
				while (Input.NextPanel("Components"))
				{
					// Components
					Input.StartHorizontalWrapContainer();
					Input.ShowAcquireImage("Component", "component_thumbnail", sapComponents);
					Input.ShowDropDown("Column", "column", columns, Util.MakeList("col1"));
					Input.EndHorizontalWrapContainer();

					Input.StartExpandPanel("Customize");
					Input.ShowDropDown("Selected Component", "component", components);
					Input.ShowTextBox("Component Label", "label", width: 100);
					Input.ShowTextBox("Component Name", "name", width: 100);
					Input.ShowTextBox("Custom Code", "custom_code", width: 500);
					Input.EndExpandPanel();

				}
			}
			Input.NextTabbedPanel();
			Input.StartExpandPanel("Header");
			Input.ShowMessage("Use {css} {css_configurable} {javascript} {page_specific_js_css} and {metadata} to specify where the css, javascript and metaData sections are located in the markup.");
			Input.ShowTextBox("Header Markup", "header_markup", width: 500, height: 10);
			while (Input.NextPanel("Header CSS"))
			{
				Input.ShowAcquireDocument("Select CSS File", "header_css");
			}
			while (Input.NextPanel("Header Javascript"))
			{
				Input.ShowAcquireDocument("Select JS File", "header_javascript");
			}
			Input.EndExpandPanel();

			Input.StartExpandPanel("Before Content");
			Input.ShowTextBox("Before Markup", "before_markup", width: 500, height: 10);
			Input.EndExpandPanel();

			Input.StartExpandPanel("After Content");
			Input.ShowTextBox("After Markup", "after_markup", width: 500, height: 10);
			Input.EndExpandPanel();

			Input.StartExpandPanel("Footer");
			Input.ShowMessage("Use {css} and {javascript} to specify where css and javascript sections are located in the markup.");
			Input.ShowTextBox("Footer Markup", "footer_markup", width: 500, height: 10);
			while (Input.NextPanel("Footer CSS"))
			{
				Input.ShowAcquireDocument("Select CSS File", "footer_css");
			}
			while (Input.NextPanel("Footer Javascript"))
			{
				Input.ShowAcquireDocument("Select JS File", "footer_javascript");
			}
			Input.EndExpandPanel();

			Input.NextTabbedPanel();
			Input.ShowCheckBox("Create", "create", "yes", "yes");
			Input.ShowTextBox("Wrapper Name", "template_name", asset.Label.Replace(" Wrapper", "") + " Wrapper");
			Input.ShowSelectFolder("Wrapper Folder", "template_folder", "/System/Templates");
			Dictionary&lt;String, String&gt; configAssetOptions = new Dictionary&lt;string, string&gt;() { { "Coupled", "coupled" }, { "Decoupled", "decoupled" } };
			Input.StartDropDownContainer("Config Asset Options", "config_asset_type", configAssetOptions, "coupled");
			{
				Input.ShowMessage("In this option the wrapper itself is its own config file.");
				Input.ShowAcquireDocument("Config Asset", "config_asset", helpMessage: "The asset where the wrapper configuration settings are kept");
			}
			Input.NextDropDownContainer();
			{
				Input.ShowMessage("In this option a seperate configuration asset is created from the template. The config template is saved in the same template folder as the wrapper");
				Input.ShowTextBox("Wrapper Config Name", "wrapper_config_template_name", asset.Label.Replace(" Wrapper", "") + " Wrapper Config");

				Dictionary&lt;String, String&gt; wrapperConfigReferenceOptions = new Dictionary&lt;string, string&gt;() { { "Relative", "relative" }, { "Custom", "custom" } };
				Input.ShowMessage("Since the config is now decoupled from the wrapper the below options determine how the wrapper knows where to find its config asset");
				Input.StartDropDownContainer("Wrapper Config Reference Options", "wrapper_config_reference_type", wrapperConfigReferenceOptions);
				{
					Input.ShowMessage("This options allows you to specify a folder path. The wrapper will look for a config asset of this type within the specified folder");
					Input.ShowSelectFolder("Config Folder", "wrapper_config_folder");
				}
				Input.NextDropDownContainer();
				{
					Input.ShowMessage("This option allows you to specify custom code (a function is reccomended) on how to find the config asset");
					Input.ShowTextBox("Custom Code", "wrapper_config_custom_code", width: 500, height: 3, helpMessage: "Asset wrapperConfig = [Custom Code]");
				}
				Input.EndDropDownContainer();
			}
			Input.EndDropDownContainer();

			if (!String.IsNullOrEmpty(asset["inputBody"]))
			{
				Input.NextTabbedPanel();
				Input.ShowTextBox("Input / Config", "inputBody", width: 100, readOnly: true);
				Input.ShowTextBox("Post Input", "postinputBody", width: 100, readOnly: true);
				Input.ShowTextBox("Output", "outputBody", width: 100, readOnly: true);
			}

			Input.EndTabbedPanel();
		}

		public static void OutputHelper(Asset asset, OutputContext context)
		{
			String wrapperAssetPath = Asset.Load(asset.Raw["template_folder"]).AssetPath + "/" + asset.Raw["template_name"];
			ComponentLibraryHelper.startWrap(asset, context, wrapperAssetPath);
			Out.WriteLine("&lt;p&gt;ASSET CONTENT&lt;/p&gt;");
		}

		public static void OutputCodeHelper(Asset asset, OutputContext context)
		{
			context.IsGeneratingDependencies = false;
			string SiteRootFolderPath = "/" + asset.AssetPath[0]; //"/Utility.GetSiteRootPathReg(asset);
			Asset siteConfig = Asset.Load(SiteRootFolderPath + "/_Config/site config");
			//Root Assets folders
			string cssFolder = SiteRootFolderPath + "/_Assets/css/";
			string jsFolder = SiteRootFolderPath + "/_Assets/js/";

			Out.DebugWriteLine("&lt;!DOCTYPE html&gt;");
			Out.WriteLine("&lt;html lang=\"en\"&gt;");
			Out.WriteLine("&lt;head&gt;");
			Out.WriteLine("    &lt;link rel=\"stylesheet\" href=\"" + Asset.Load(cssFolder + "/original.css").GetLink(LinkType.Include) + "\" media=\"all\" /&gt;");
			Out.WriteLine("    &lt;link rel=\"stylesheet\" href=\"" + Asset.Load(cssFolder + "/PatternLabIO.css").GetLink(LinkType.Include) + "\" media=\"all\" /&gt;");
			Out.WriteLine("    &lt;script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js\"&gt;&lt;/script&gt;");
			Out.WriteLine("&lt;/head&gt;");
			Out.WriteLine("&lt;body&gt;");
			Out.WriteLine("    &lt;div class=\"container\"&gt;");
			Out.WriteLine("        &lt;div id=\"content\"&gt;");
			Out.WriteLine("            &lt;ul id=\"tabs\" class=\"nav nav-tabs\" data-tabs=\"tabs\"&gt;");
			Out.WriteLine("                &lt;li class=\"active\"&gt;&lt;a href=\"#input\" data-toggle=\"tab\"&gt;Input&lt;/a&gt;&lt;/li&gt;");
			Out.WriteLine("                &lt;li&gt;&lt;a href=\"#postinput\" data-toggle=\"tab\"&gt;PostInput&lt;/a&gt;&lt;/li&gt;");
			Out.WriteLine("                &lt;li&gt;&lt;a href=\"#output\" data-toggle=\"tab\"&gt;Output&lt;/a&gt;&lt;/li&gt;");
			Out.WriteLine("            &lt;/ul&gt;");
			Out.WriteLine("            &lt;div id=\"my-tab-content\" class=\"tab-content\"&gt;");
			Out.WriteLine("                &lt;div class=\"tab-pane active\" id=\"input\"&gt;");
			Out.WriteLine("                    &lt;h1&gt;Input&lt;/h1&gt;");
			Out.WriteLine("                    " + Util.ConvertTextToHtml(asset["inputBody"]).Replace("&lt;dd&gt;", "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"));
			Out.WriteLine("                &lt;/div&gt;");
			Out.WriteLine("                &lt;div class=\"tab-pane\" id=\"postinput\"&gt;");
			Out.WriteLine("                    &lt;h1&gt;PostInput&lt;/h1&gt;");
			Out.WriteLine("                    " + Util.ConvertTextToHtml(asset["postinputBody"]).Replace("&lt;dd&gt;", "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"));
			Out.WriteLine("                &lt;/div&gt;");
			Out.WriteLine("                &lt;div class=\"tab-pane\" id=\"output\"&gt;");
			Out.WriteLine("                    &lt;h1&gt;Output&lt;/h1&gt;");
			Out.WriteLine("                    " + Util.ConvertTextToHtml(asset["outputBody"]).Replace("&lt;dd&gt;", "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"));
			Out.WriteLine("                &lt;/div&gt;");
			Out.WriteLine("            &lt;/div&gt;");
			Out.WriteLine("        &lt;/div&gt;");
			Out.WriteLine("        &lt;script type=\"text/javascript\"&gt;");
			Out.WriteLine("            jQuery(document).ready(function ($) {");
			Out.WriteLine("                $('#tabs').tab();");
			Out.WriteLine("            });");
			Out.WriteLine("        &lt;/script&gt;");
			Out.WriteLine("    &lt;/div&gt;");
			Out.WriteLine("    &lt;!-- container --&gt;");
			Out.WriteLine("    &lt;script type=\"text/javascript\" src=\"" + Asset.Load(jsFolder + "/bootstrap.js").GetLink(LinkType.Include) + "\"&gt;&lt;/script&gt;");
			Out.WriteLine("&lt;/body&gt;");
			Out.WriteLine("&lt;/html&gt;");
		}

		public static void OutputComponentsHelper(Asset asset, OutputContext context)
		{
			Component_Layout layout = new Component_Layout();
			Dictionary&lt;String, StringBuilder&gt; rowContent = new Dictionary&lt;string, StringBuilder&gt;();

			context.IsGeneratingDependencies = false;
			string SiteRootFolderPath = "/" + asset.AssetPath[0]; //"/Utility.GetSiteRootPathReg(asset);
																														//Out.WriteLine(SiteRootFolderPath);
			Asset siteConfig = Asset.Load(SiteRootFolderPath + "/_Config/Site Config");

			//Root Assets folders
			string imageFolder = SiteRootFolderPath + "/_Assets/images/";
			string cssFolder = SiteRootFolderPath + "/_Assets/css/";
			string jsFolder = SiteRootFolderPath + "/_Assets/js/";
			string componentName = "";
			string componentThumbnail = "";
			string componentType = "";
			string componentPath = "";
			string componentId = "";
			string componentColumn = "";
			//  Asset aComponent;
			bool startFooter = false;

			string componentOutput = "";

			StringBuilder sbCol1 = new StringBuilder();
			StringBuilder sbCol2 = new StringBuilder();
			StringBuilder sbCol3 = new StringBuilder();

			String header = "";
			String footer = "";
			String css = "";
			String javascript = "";

			foreach (PanelEntry entry in asset.GetPanels("Header CSS"))
				css += "&lt;link rel=\"stylesheet\" href=\"" + Asset.Load(entry["header_css"]).GetLink(LinkType.Include) + "\" media=\"all\" /&gt;";
			foreach (PanelEntry entry in asset.GetPanels("Header Javascript"))
				javascript += "&lt;link rel=\"stylesheet\" href=\"" + Asset.Load(entry["header_javascript"]).GetLink(LinkType.Include) + "\" media=\"all\" /&gt;";
			header = asset.Raw["header_markup"].Replace("{css}", css).Replace("{javascript}", javascript);

			css = "";
			javascript = "";

			foreach (PanelEntry entry in asset.GetPanels("Footer CSS"))
				css += "&lt;link rel=\"stylesheet\" href=\"" + Asset.Load(entry["footer_css"]).GetLink(LinkType.Include) + "\" media=\"all\" /&gt;";
			foreach (PanelEntry entry in asset.GetPanels("Footer Javascript"))
				javascript += "&lt;link rel=\"stylesheet\" href=\"" + Asset.Load(entry["header_javascript"]).GetLink(LinkType.Include) + "\" media=\"all\" /&gt;";

			footer = asset.Raw["footer_markup"].Replace("{css}", css).Replace("{javascript}", javascript);

			Out.WriteLine(header);
			foreach (PanelEntry entry in asset.GetPanels("layouts"))
			{
				sbCol1.Clear();
				sbCol2.Clear();
				sbCol3.Clear();

				if (entry["wrapper_option"] == "footer") startFooter = true;
				if (startFooter) Out.WriteLine(asset.Raw["before_markup"] + "ASSET CONTENT" + asset.Raw["after_markup"]);

				foreach (PanelEntry subEntry in entry.GetPanels("components"))
				{
					componentOutput = "";
					componentThumbnail = "";
					componentColumn = "";
					if (String.IsNullOrEmpty(subEntry.Raw["custom_code"]))
					{
						componentPath = subEntry["component"];

						//componentPath = subEntry["component"];
						Asset aComponent = Asset.Load(componentPath);
						if (aComponent.IsLoaded)
						{
							componentOutput = "&lt;span " + Util.Editable("component", subEntry) + "&gt;" + makeRaw(ComponentLibraryHelper.generateComponentPreview(aComponent, context)) + "&lt;/span&gt;";
						}
						componentColumn = subEntry["column"];
					}
					else
					{
						componentOutput = subEntry["custom_code"];
						componentColumn = subEntry["custom_column"];
					}

					switch (componentColumn)
					{
						case "col1":
							sbCol1.Append(componentOutput);
							break;
						case "col2":
							sbCol2.Append(componentOutput);
							break;
						case "col3":
							sbCol3.Append(componentOutput);
							break;
					}
				}

				rowContent.Add("{col1}", sbCol1);
				rowContent.Add("{col2}", sbCol2);

				Out.Write(layout.output(asset, entry.GetFieldName("layout"), rowContent, entry["layout"]));
				rowContent.Clear();
			}
			Out.WriteLine(footer);
		}

		public static void PostInputHelper(Asset asset, PostInputContext context)
		{
			PanelEntry firstPe = context.InputForm.GetPanels("layouts").FirstOrDefault();
			if (firstPe != null &amp;&amp; firstPe["consolidate_section_tab"] == "yes")
			{
				context.ValidationError = "Please uncheck the \"Consolidate section into the above sections input tab\" checkbox on the first section.";
			}
			else
			{
				Asset siteConfig = Asset.Load(!String.IsNullOrWhiteSpace(context.InputForm["config_asset"]) ? context.InputForm["config_asset"] : asset["config_asset"]);

				if (context.InputForm["config_asset_type"] == "decoupled")
				{
					if (context.InputForm["wrapper_config_reference_type"] == "relative")
					{
						if (String.IsNullOrWhiteSpace(context.InputForm["wrapper_config_template_name"]))
						{
							context.ValidationErrorFields.Add("wrapper_config_template_name", "Please specify a wrapper config name");
						}
						else if (String.IsNullOrWhiteSpace(context.InputForm["wrapper_config_folder"]))
						{
							context.ValidationErrorFields.Add("wrapper_config_folder", "Please specify the folder the wrapper will exist in");
						}

						FilterParams wrapperConfigFilterParams = new FilterParams();
						wrapperConfigFilterParams.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, context.InputForm["wrapper_config_template_name"]);
						siteConfig = Asset.Load(Asset.Load(context.InputForm["wrapper_config_folder"]).AssetPath).GetFilterList(wrapperConfigFilterParams).FirstOrDefault();
					}
					else if (context.InputForm["wrapper_config_reference_type"] != "custom")
					{
						context.ValidationErrorFields.Add("wrapper_config_reference_type", "Please select a wrapper config reference option");
					}
				}

				Asset componentLibraryComponentsFolder = ComponentLibraryHelper.getComponentLibraryComponentsFolder(asset);

				string nameSpace = "";
				string componentLibraryClassName = "ComponentLibraryHelper";
				string layoutClassName = "layout";
				string openTag = "&lt;" + "%";
				string closeTag = "%" + "&gt;";
				string tab = "\t";
				string componentClassName = "";
				string componentName = "";
				string componentLabel = "";
				string componentFieldName = "";
				string componentThumbnail = "";
				string componentType = "";
				string componentColumn = "";
				Asset aComponent;
				bool startFooter = false;
				bool GetWrapContentPlaceholderInserted = false;


				StringBuilder sbDeclare = new StringBuilder();
				StringBuilder sbInput = new StringBuilder();
				StringBuilder sbPostInput = new StringBuilder();
				StringBuilder sbOutput = new StringBuilder();
				StringBuilder sbInputContent = new StringBuilder();
				StringBuilder sbPostInputContent = new StringBuilder();
				StringBuilder sbOutputContent = new StringBuilder();
				Dictionary&lt;string, int&gt; components = new Dictionary&lt;string, int&gt;();

				String header = context.InputForm["header_markup"];
				bool enableThemingOnConfig = header.Contains("{css_configurable}");
				String footer = context.InputForm["footer_markup"];
				String css = "";
				String javascript = "";
				String metaData = openTag + " Out.Write(metaData.output(asset, context, \"meta\")); " + closeTag;
				String customJavascriptAndCss = openTag + " Out.Write(customJavascriptAndCss.output(asset, context, \"meta\")); " + closeTag;


				List&lt;PanelEntry&gt; cssHeaderPanels = context.InputForm.GetPanels("Header CSS");
				for (int cssIndex = 0; cssIndex &lt; cssHeaderPanels.Count; cssIndex++)
				{
					PanelEntry entry = cssHeaderPanels[cssIndex];

					String cssString = "&lt;link rel=\"stylesheet\" href=\"" + openTag + "=Asset.Load(\"" + Asset.Load(entry["header_css"]).AssetPath.ToString() + "\").GetLink(LinkType.Include)" + closeTag + "\" media=\"all\" /&gt;";

					css += cssString + "\r\n\t\t";

					Regex cssPlaceholderRegex = new Regex(@"{\s*css\s*:\s*" + (cssIndex + 1) + @"\s*}");

					MatchCollection matches = cssPlaceholderRegex.Matches(header);

					foreach (Match match in matches)
					{
						header = header.Replace(match.Value, cssString);
					}
				}

				List&lt;PanelEntry&gt; jsHeaderPanels = context.InputForm.GetPanels("Header Javascript");
				for (int jsIndex = 0; jsIndex &lt; jsHeaderPanels.Count; jsIndex++)
				{
					PanelEntry entry = jsHeaderPanels[jsIndex];

					String jsString = "&lt;script src=\"" + openTag + "=Asset.Load(\"" + Asset.Load(entry["header_javascript"]).AssetPath.ToString() + "\").GetLink(LinkType.Include)" + closeTag + "\"&gt;&lt;/script&gt;";

					javascript += jsString + "\r\n\t\t";

					Regex jsPlaceholderRegex = new Regex(@"{\s*javascript\s*:\s*" + (jsIndex + 1) + @"\s*}");

					MatchCollection matches = jsPlaceholderRegex.Matches(header);

					foreach (Match match in matches)
					{
						header = header.Replace(match.Value, jsString);
					}
				}

				header = header.Replace("{css}", css).Replace("{javascript}", javascript).Replace("{metadata}", metaData).Replace("{page_specific_js_css}", customJavascriptAndCss).Replace("{css_configurable}", openTag + "Out.Write(ComponentLibraryHelper.generateCssHeaderDeclarations(siteConfig)); " + closeTag);

				css = "";
				javascript = "";

				List&lt;PanelEntry&gt; cssFooterPanels = context.InputForm.GetPanels("Footer CSS");
				for (int cssIndex = 0; cssIndex &lt; cssFooterPanels.Count; cssIndex++)
				{
					PanelEntry entry = cssFooterPanels[cssIndex];

					String cssString = "&lt;link rel=\"stylesheet\" href=\"" + openTag + "=Asset.Load(\"" + Asset.Load(entry["footer_css"]).AssetPath.ToString() + "\").GetLink(LinkType.Include)" + closeTag + "\" media=\"all\" /&gt;"; ;

					css += cssString + "\r\n\t\t";

					Regex cssPlaceholderRegex = new Regex(@"{\s*css\s*:\s*" + (cssIndex + 1) + @"\s*}");

					MatchCollection matches = cssPlaceholderRegex.Matches(footer);

					foreach (Match match in matches)
					{
						footer = footer.Replace(match.Value, cssString);
					}
				}

				List&lt;PanelEntry&gt; jsFooterPanels = context.InputForm.GetPanels("Footer Javascript");
				for (int jsIndex = 0; jsIndex &lt; jsFooterPanels.Count; jsIndex++)
				{
					PanelEntry entry = jsFooterPanels[jsIndex];

					String jsString = "&lt;script src=\"" + openTag + "=Asset.Load(\"" + Asset.Load(entry["footer_javascript"]).AssetPath.ToString() + "\").GetLink(LinkType.Include)" + closeTag + "\"&gt;&lt;/script&gt;";

					javascript += jsString + "\r\n\t\t";

					Regex jsPlaceholderRegex = new Regex(@"{\s*javascript\s*:\s*" + (jsIndex + 1) + @"\s*}");

					MatchCollection matches = jsPlaceholderRegex.Matches(footer);

					foreach (Match match in matches)
					{
						footer = footer.Replace(match.Value, jsString);
					}
				}

				footer = footer.Replace("{css}", css).Replace("{javascript}", javascript);

				String componentLibraryNamespace = ComponentLibraryHelper.getComponentLibraryNamespace(asset);

				sbDeclare.Append(openTag + "@ Import Namespace=\"CrownPeak.CMSAPI\" " + closeTag).AppendLine();
				sbDeclare.Append(openTag + "@ Import Namespace=\"CrownPeak.CMSAPI.Services\" " + closeTag).AppendLine();
				sbDeclare.Append(openTag + "@ Import Namespace=\"CrownPeak.CMSAPI.CustomLibrary\" " + closeTag).AppendLine();
				sbDeclare.Append(openTag + "@ Import Namespace=\"" + componentLibraryNamespace + "\" " + closeTag).AppendLine();

				sbDeclare.Append("&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;").AppendLine();
				sbDeclare.Append(openTag).AppendLine();
				sbDeclare.Append(tab + nameSpace + "Component_Layout layout = new " + nameSpace + "Component_Layout();").AppendLine();
				sbDeclare.Append(tab + nameSpace + "MetaData metaData = new " + nameSpace + "MetaData();").AppendLine();
				sbDeclare.Append(tab + nameSpace + "HeaderJavascriptAndCss customJavascriptAndCss = new " + nameSpace + "HeaderJavascriptAndCss();").AppendLine();
				if (enableThemingOnConfig)
				{
					sbInputContent.Append(tab + "String SiteRootFolderPath = ComponentLibraryHelper.getComponentLibrarySiteRootFolder(asset).AssetPath.ToString();").AppendLine();
				}

				sbInputContent.Append(tab + "Input.StartTabbedPanel(");

				if (context.InputForm["config_asset_type"] == "decoupled")
				{
					if (context.InputForm["wrapper_config_reference_type"] == "relative")
					{
						sbOutputContent.Append(tab + "FilterParams wrapperConfigFilterParams = new FilterParams();").AppendLine();
						sbOutputContent.Append(tab + "wrapperConfigFilterParams.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, \"" + context.InputForm["wrapper_config_template_name"] + "\");").AppendLine();
						sbOutputContent.Append(tab + "Asset siteConfig = Asset.Load(\"" + Asset.Load(context.InputForm["wrapper_config_folder"]).AssetPath + "\").GetFilterList(wrapperConfigFilterParams).FirstOrDefault();").AppendLine();
					}
					else
					{
						sbOutputContent.Append(tab + "Asset siteConfig = " + context.InputForm["wrapper_config_custom_code"]).AppendLine();
					}
				}
				else
				{
					sbOutputContent.Append(tab + "Asset siteConfig = Asset.Load(\"" + siteConfig.AssetPath + "\");").AppendLine();
				}

				String dlm = "";
				foreach (PanelEntry entry in context.InputForm.GetPanels("layouts"))
				{
					if (entry["consolidate_section_tab"] != "yes")
					{
						sbInputContent.Append(dlm + "\"" + entry["section"] + "\"");
						dlm = ", ";
					}
				}
				if (context.InputForm["meta"] == "yes") sbInputContent.Append(", \"Meta Data\"");
				if (enableThemingOnConfig) sbInputContent.Append(", \"Theme / CSS\"");
				if (context.InputForm["advanced"] == "yes") sbInputContent.Append(", \"Advanced\"");
				sbInputContent.Append(");").AppendLine();

				// add header content
				sbOutputContent.Append(closeTag).AppendLine();
				sbOutputContent.Append(header).AppendLine();
				sbOutputContent.Append(openTag).AppendLine();

				sbOutputContent.Append(tab + "StringBuilder sbCol1 = new StringBuilder();").AppendLine();
				sbOutputContent.Append(tab + "StringBuilder sbCol2 = new StringBuilder();").AppendLine();
				sbOutputContent.Append(tab + "StringBuilder sbCol3 = new StringBuilder();").AppendLine();
				sbOutputContent.Append(tab + "Dictionary&lt;String, StringBuilder&gt; rowContent = new Dictionary&lt;string, StringBuilder&gt;();").AppendLine();
				sbOutputContent.AppendLine();

				String nextTab = "";
				Int32 unique = 0;

				foreach (PanelEntry entry in context.InputForm.GetPanels("layouts"))
				{

					if (entry["wrapper_option"] == "footer")
						startFooter = true;
					if (startFooter &amp;&amp; !GetWrapContentPlaceholderInserted)
					{
						// add main content
						sbOutputContent.Append(closeTag).AppendLine();
						sbOutputContent.Append(context.InputForm["before_markup"]).AppendLine();
						sbOutputContent.Append(tab + openTag + "= Out.GetWrapContentPlaceholder()" + closeTag).AppendLine();
						sbOutputContent.Append(context.InputForm["after_markup"]).AppendLine();
						sbOutputContent.Append(openTag).AppendLine();
						GetWrapContentPlaceholderInserted = true;
					}

					if (!String.IsNullOrEmpty(entry["layout_thumbnail"]))
					{
						Asset aLayoutThumbnail = Asset.Load(entry["layout_thumbnail"]);
						if (aLayoutThumbnail.IsLoaded)
						{
							Asset aLayout = Asset.Load(componentLibraryComponentsFolder + "/layouts/" + aLayoutThumbnail.Label.ToLower().Replace(".png", ""));
							if (aLayout.IsLoaded) entry["layout"] = aLayout.Label;
						}
					}

					if (entry["consolidate_section_tab"] != "yes")
					{
						sbInputContent.Append(nextTab).AppendLine();
					}
					sbOutputContent.Append(tab + "// " + entry["section"]).AppendLine();
					sbOutputContent.AppendLine();

					Int32 col = 1;
					while (col &lt; 3)
					{
						sbInputContent.Append(tab + tab + "// Capture content for Column " + col.ToString()).AppendLine();
						sbOutputContent.Append(tab + "// Assemble content for Column " + col.ToString()).AppendLine();
						sbOutputContent.Append(tab + "sbCol" + col.ToString() + ".Clear();").AppendLine();

						foreach (PanelEntry subEntry in entry.GetPanels("components"))
						{
							if (subEntry["column"] == "col" + col.ToString())
							{
								if (!String.IsNullOrEmpty(subEntry["component_thumbnail"]))
								{
									componentThumbnail = Asset.Load(subEntry["component_thumbnail"]).Label;
									if (!String.IsNullOrEmpty(componentThumbnail))
									{
										componentType = componentThumbnail.Substring(0, componentThumbnail.IndexOf(" - ")).Trim();
										componentName = componentThumbnail.Substring(componentThumbnail.IndexOf(" - ") + 3).Replace(".png", "").Trim();
										aComponent = Asset.Load(componentLibraryComponentsFolder + "/" + componentType + "s/" + componentName);
										if (aComponent.IsLoaded) subEntry["component"] = aComponent.Label; //aComponent.AssetPath.ToString();
									}
								}
								aComponent = ComponentLibraryHelper.getComponentAsset(asset, subEntry["component"]);
								if (aComponent != null &amp;&amp; aComponent.IsLoaded)
								{
									componentClassName = aComponent.Raw["class_name"];
									//componentLabel = String.IsNullOrEmpty(subEntry["label"])?aComponent.Label:subEntry["label"];
									componentName = char.ToLower(componentClassName[0]) + componentClassName.Substring(1);

									if (!components.ContainsKey(componentName))
									{
										components.Add(componentName, 0);
										sbDeclare.Append(tab + nameSpace + componentClassName + " " + componentName + " = new " + nameSpace + componentClassName + "();").AppendLine();
									}
									else components[componentName]++;

									componentFieldName = !String.IsNullOrEmpty(subEntry["name"]) ? subEntry["name"] : aComponent.Label.ToLower().Replace(" ", "_") + (components[componentName] &gt; 0 ? "_" + (components[componentName] + 1).ToString() : "");

									subEntry["name"] = componentFieldName;
									//subEntry["label"] = componentLabel;

									sbInputContent.Append(tab + tab + componentName + ".input(asset, \"" + componentLabel + "\",\"" + componentFieldName + "\");").AppendLine();
									sbPostInputContent.Append(tab + componentName + ".postinput(context,\"" + componentFieldName + "\");").AppendLine();
									sbOutputContent.Append(tab + "sbCol" + col.ToString() + ".Append(" + componentName + ".output(siteConfig, context,\"" + componentFieldName + "\"));").AppendLine();
								}
							}
							else if (subEntry["content_type"] == "custom" &amp;&amp; !String.IsNullOrEmpty(subEntry["custom_code"]) &amp;&amp; subEntry["custom_column"] == "col" + col.ToString())
							{

								sbOutputContent.Append(tab + "Out.StartCapture();").AppendLine();
								sbOutputContent.Append(closeTag).AppendLine();
								sbOutputContent.Append(subEntry.Raw["custom_code"]).AppendLine();
								sbOutputContent.Append(openTag).AppendLine();
								sbOutputContent.Append(tab + "sbCol" + col.ToString() + ".Append(Out.StopCapture());").AppendLine();
							}
							unique++;
						}
						sbInputContent.AppendLine();
						sbOutputContent.Append(tab + "rowContent.Add(\"{col" + col.ToString() + "}\", sbCol" + col.ToString() + ");").AppendLine();
						sbOutputContent.AppendLine();
						col++;
					}

					if (entry["editable"] == "yes")
					{
						sbInputContent.Append(tab + tab + "//Layout").AppendLine();
						sbInputContent.Append(tab + tab + layoutClassName + ".input(asset,\"" + entry["section"] + " layout\",\"" + entry.GetFieldName("layout") + "\",\"" + entry["layout"] + "\");").AppendLine();
						sbInputContent.AppendLine();
					}

					sbOutputContent.Append(tab + "// Output Content for Page using a specific layout").AppendLine();
					sbOutputContent.Append(tab + "Out.Write(layout.output(asset, \"" + entry.GetFieldName("layout") + "\", rowContent,\"" + entry["layout"] + "\"));").AppendLine();
					sbOutputContent.Append(tab + "rowContent.Clear();").AppendLine();
					sbOutputContent.AppendLine();

					nextTab = "Input.NextTabbedPanel();";
				}

				if (!startFooter)
				{
					//append Out.writeline even if footer is not present
					sbOutputContent.Append(closeTag).AppendLine();
					sbOutputContent.Append(context.InputForm["before_markup"]).AppendLine();
					sbOutputContent.Append(tab + openTag + "=Out.GetWrapContentPlaceholder();" + closeTag).AppendLine();
					sbOutputContent.Append(context.InputForm["after_markup"]).AppendLine();
					sbOutputContent.Append(openTag).AppendLine();
					GetWrapContentPlaceholderInserted = true;
				}

				sbDeclare.Append(closeTag).AppendLine();

				if (enableThemingOnConfig)
				{
					sbInputContent.Append(tab + "Input.NextTabbedPanel();").AppendLine();

					sbInputContent.Append(tab + tab + "ShowAcquireParams parameters = new ShowAcquireParams();").AppendLine();
					sbInputContent.Append(tab + tab + "parameters.DefaultFolder = SiteRootFolderPath + \"/_themes\";").AppendLine();
					sbInputContent.Append(tab + tab + "parameters.ShowUpload = false;").AppendLine();
					sbInputContent.Append(tab + tab + "Input.ShowAcquireImage(\"Theme\", \"theme\", parameters);").AppendLine();

					sbInputContent.Append(tab + tab + "ShowAcquireParams aParams = new ShowAcquireParams();").AppendLine();
					sbInputContent.Append(tab + tab + "aParams.DefaultFolder = SiteRootFolderPath + \"/_Assets/css\";").AppendLine();
					sbInputContent.Append(tab + tab + "Input.ShowAcquireDocument(\"Custom Theme\", \"theme_id\", aParams);").AppendLine();

					sbPostInputContent.Append("*/").AppendLine();
					sbPostInputContent.Append(tab + "string cssFolder = \"/\" + asset.AssetPath[0] + \"/_Assets/css/\";").AppendLine();
					sbPostInputContent.Append(tab + "string cssFileId = Asset.Load(cssFolder + \"original.css\").Id.ToString();").AppendLine();
					sbPostInputContent.Append(tab + "if (!String.IsNullOrEmpty(context.InputForm[\"theme_id\"]))").AppendLine();
					sbPostInputContent.Append(tab + "{").AppendLine();
					sbPostInputContent.Append(tab + "    Asset aCSSFile = Asset.Load(context.InputForm[\"theme_id\"]);").AppendLine();
					sbPostInputContent.Append(tab + "    if (aCSSFile.IsLoaded)").AppendLine();
					sbPostInputContent.Append(tab + "    {").AppendLine();
					sbPostInputContent.Append(tab + "        cssFileId = aCSSFile.Id.ToString();").AppendLine();
					sbPostInputContent.Append(tab + "        //context.InputForm.Remove(\"theme\");").AppendLine();
					sbPostInputContent.Append(tab + "        context.InputForm[\"theme\"] = \"\";").AppendLine();
					sbPostInputContent.Append(tab + "        context.InputForm[\"upload#theme\"] = \"\";").AppendLine();
					sbPostInputContent.Append(tab + "        context.InputForm[\"upload_name#theme\"] = \"\";").AppendLine();
					sbPostInputContent.Append(tab + "    }").AppendLine();
					sbPostInputContent.Append(tab + "}").AppendLine();
					sbPostInputContent.Append(tab + "else if (!String.IsNullOrEmpty(context.InputForm[\"theme\"]))").AppendLine();
					sbPostInputContent.Append(tab + "{").AppendLine();
					sbPostInputContent.Append(tab + "    Asset aCSSTheme = Asset.Load(context.InputForm[\"theme\"]);").AppendLine();
					sbPostInputContent.Append(tab + "    if (aCSSTheme.IsLoaded)").AppendLine();
					sbPostInputContent.Append(tab + "    {").AppendLine();
					sbPostInputContent.Append(tab + "        Asset aCSSFile = Asset.Load(cssFolder + aCSSTheme.Label.ToLower().Replace(\"png\", \"css\"));").AppendLine();
					sbPostInputContent.Append(tab + "        if (aCSSFile.IsLoaded) cssFileId = aCSSFile.Id.ToString();").AppendLine();
					sbPostInputContent.Append(tab + "    }").AppendLine();
					sbPostInputContent.Append(tab + "}").AppendLine();
					sbPostInputContent.Append(tab + "context.InputForm[\"css_to_use\"] = cssFileId;").AppendLine();
					sbPostInputContent.Append("/*").AppendLine();
				}

				if (context.InputForm["advanced"] == "yes")
				{
					sbInputContent.Append(tab + "Input.NextTabbedPanel();").AppendLine();
					if (context.InputForm["config_asset_type"] != "decoupled" &amp;&amp; context.InputForm["wrapper_config_reference_type"] != "custom")
					{
						sbInputContent.Append(tab + tab + "Input.ShowLink(Asset.Load(\"" + siteConfig.AssetPath.ToString() + "\"), \"Edit Theme\", InputLinkType.EditTab);").AppendLine();
					}
					sbInputContent.Append(tab + tab + "Input.ShowLink(Asset.Load(\"" + asset.AssetPath.ToString() + "\"), \"Edit Template\", InputLinkType.EditTab);").AppendLine();
				}

				sbInputContent.Append(tab + "Input.EndTabbedPanel();").AppendLine();

				// add footer content
				sbOutputContent.Append(closeTag).AppendLine();
				sbOutputContent.Append(footer).AppendLine();
				sbOutputContent.Append(openTag).AppendLine();

				sbInput.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.InputInit\" " + closeTag).AppendLine();
				sbInput.Append(sbDeclare.ToString()).AppendLine();
				sbInput.Append(openTag).AppendLine();
				sbInput.Append(sbInputContent.ToString());
				sbInput.Append(closeTag).AppendLine();

				sbPostInput.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.PostInputInit\" " + closeTag).AppendLine();
				sbPostInput.Append(sbDeclare.ToString()).AppendLine();
				sbPostInput.Append(openTag + "/*").AppendLine();
				sbPostInput.Append(sbPostInputContent.ToString());
				sbPostInput.Append("*/" + closeTag).AppendLine();

				sbOutput.Append(openTag + "@ Page Language=\"C#\" Inherits=\"CrownPeak.Internal.Debug.OutputInit\" " + closeTag).AppendLine();
				sbOutput.Append(sbDeclare.ToString()).AppendLine();
				sbOutput.Append(openTag).AppendLine();
				sbOutput.Append(sbOutputContent.ToString());
				sbOutput.Append(closeTag).AppendLine();

				context.InputForm["inputBody"] = sbInput.ToString();
				context.InputForm["postinputBody"] = sbPostInput.ToString();
				context.InputForm["outputBody"] = sbOutput.ToString();

				if (context.InputForm["create"] == "yes")
				{
					Asset folderAsset = Asset.Load(context.InputForm["template_folder"]);
					Asset templateAsset = Asset.Load(folderAsset.AssetPath + "/" + context.InputForm["template_name"]);
				}

			}
		}

		public static void PostSaveHelper(Asset asset, PostSaveContext context)
		{
			if (asset["create"] == "yes")
			{
				Asset folderAsset = Asset.Load(asset["template_folder"]);
				Asset wrapperTemplateAsset = Asset.Load(folderAsset.AssetPath + "/" + asset.Raw["template_name"]);
				Asset configTemplateAsset = asset["config_asset_type"] == "decoupled" ? Asset.Load(folderAsset.AssetPath + "/" + asset.Raw["wrapper_config_template_name"]) : null;
				Asset modelAsset = Asset.LoadDirect("/System/Templates/Basis/Template/Template Folder");
				Dictionary&lt;string, string&gt; contentFields = new Dictionary&lt;string, string&gt; { { "Auto created by", asset.Id.ToString() } };

				if (!wrapperTemplateAsset.IsLoaded)
				{
					wrapperTemplateAsset = Asset.CreateNewAsset(asset.Raw["template_name"], folderAsset, modelAsset, contentFields);
					asset.SaveContentField("templateId", wrapperTemplateAsset.Id.ToString());
					asset["templateId"] = wrapperTemplateAsset.Id.ToString();
				}

				if (asset["config_asset_type"] == "decoupled" &amp;&amp; !configTemplateAsset.IsLoaded)
				{
					configTemplateAsset = Asset.CreateNewAsset(asset.Raw["wrapper_config_template_name"], folderAsset, modelAsset, contentFields);
					asset.SaveContentField("configTemplateId", configTemplateAsset.Id.ToString());
					asset["configTemplateId"] = configTemplateAsset.Id.ToString();
				}

				if (wrapperTemplateAsset.IsLoaded)
				{
					folderAsset = wrapperTemplateAsset;

					if (asset["config_asset_type"] == "decoupled" &amp;&amp; configTemplateAsset.IsLoaded)
					{
						modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/input.aspx");
						contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["inputBody"] } };
						Asset inputAsset = Asset.Load(configTemplateAsset.AssetPath + "/input.aspx");
						if (inputAsset.IsLoaded) inputAsset.Delete();
						inputAsset = Asset.CreateNewAsset("input.aspx", configTemplateAsset, modelAsset, contentFields);

						modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/post_input.aspx");
						contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["postinputBody"] } };
						Asset postinputAsset = Asset.Load(configTemplateAsset.AssetPath + "/post_input.aspx");
						if (postinputAsset.IsLoaded) postinputAsset.Delete();
						postinputAsset = Asset.CreateNewAsset("post_input.aspx", configTemplateAsset, modelAsset, contentFields);
					}
					else
					{
						modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/input.aspx");
						contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["inputBody"] } };
						Asset inputAsset = Asset.Load(folderAsset.AssetPath + "/input.aspx");
						if (inputAsset.IsLoaded) inputAsset.Delete();
						inputAsset = Asset.CreateNewAsset("input.aspx", folderAsset, modelAsset, contentFields);

						modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/post_input.aspx");
						contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["postinputBody"] } };
						Asset postinputAsset = Asset.Load(folderAsset.AssetPath + "/post_input.aspx");
						if (postinputAsset.IsLoaded) postinputAsset.Delete();
						postinputAsset = Asset.CreateNewAsset("post_input.aspx", folderAsset, modelAsset, contentFields);
					}

					modelAsset = Asset.LoadDirect("/System/Templates/Basis/ComponentsCS/output.aspx");
					contentFields = new Dictionary&lt;string, string&gt; { { "body", asset.Raw["outputBody"] } };
					Asset outputAsset = Asset.Load(folderAsset.AssetPath + "/output.aspx");
					if (outputAsset.IsLoaded) outputAsset.Delete();
					outputAsset = Asset.CreateNewAsset("output.aspx", folderAsset, modelAsset, contentFields);
				}

				if (!String.IsNullOrEmpty(asset[asset["previewAsset"]]))
				{
					Asset previewAsset = Asset.Load(asset["previewAsset"]);
					previewAsset.SetTemplate(wrapperTemplateAsset.Id);
					foreach (PanelEntry entry in asset.GetPanels("layouts"))
					{
						previewAsset[entry.GetFieldName("layout")] = entry["layout"];
					}
					previewAsset.SaveContent();
				}

			}
			asset.SaveContentField("override", "");
			asset.Rename(asset["template_name"]);
			//asset.SaveContent();
		}

		private static string makeRaw(string content)
		{
			foreach (Match mc in Regex.Matches(content, @"~\$CPIL\$\d+\$[\w:]+\$\w+\$"))
			{
				content = content.Replace(mc.Value, "").Replace("$/CPIL$~", "");
			}
			foreach (Match mc in Regex.Matches(content, @"%\$CPIL\$\d+\$[\w:]+\$\w+\$"))
			{
				content = content.Replace(mc.Value, "").Replace("$/CPIL$%", "");
			}
			return content;
		}
	}
}
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>172437</id>
    <label>Components_Code.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_Code.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public partial class Code : JsonComponentBase
	{
		/*comment out "inputBase(label, name);" &amp; modify this function if you want to overwrite the input functionality of the component.*/
		public override void ComponentInput(Asset asset, InputContext context, String label, string name)
		{
            //inputBase(asset, label, name);
            Input.ShowTextBox(label, name);
		}

		/*comment out "postInputBase(context, name, index);" &amp; modify this function if you want to overwrite the post_input functionality of the component.*/
		public override void ComponentPostInput(Asset asset, PostInputContext context, string name, string index = "")
		{
			PostInputBase(asset, context, name, index);
		}

		/*comment out "outputBase(asset, context, name, index, isDrag);" &amp; modify this function if you want to overwrite the output functionality of the component.*/
		public override string ComponentOutput(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
            //return outputBase(asset, context, name, index, );
            return asset[name + index];
		}

		public override string ComponentJson(Asset asset, OutputContext context, string name, string index = "")
		{
			//The below function refers the automatically generated output functionality for this component.
			//If you wish to alter the the output functionality write your own output code here.
			//NOTE: It is important to handle cases where the asset AND OR the context will be null in your custom code
 			var content = asset.Raw[name + index];
      return string.IsNullOrEmpty(content) ? "null" : JsonHelper.StringToJson(content, includeQuotes: true);
		}

		/*comment out "IndexedFieldsBase(asset, context, name, index);" &amp; modify this function if you want to overwrite the indexed fields of the component.*/
		public override IEnumerable&lt;IndexedField&gt; ComponentIndexedFields(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return IndexedFieldsBase(asset, context, name, index);
		}
  }
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>172436</id>
    <label>Components_CodeBase.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_CodeBase.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	[Serializable]
	public partial class Code : JsonComponentBase
	{

		public Code()
		{
			ComponentMarkup = @"";
		}

		public void InputBase(Asset asset, InputContext context, string label, string name)
		{
		}

		public void PostInputBase(Asset asset, PostInputContext context, string name, string index = "")
		{
		}

		public string OutputBase(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			if (isDrag)
			{
				StringBuilder ddContent = new StringBuilder();
				ddContent.Append(ComponentMarkup);

				return ComponentFramework.ParseDragAndDropMarkupForPreviewAndPublish(context, ddContent.ToString());
			}

			StringBuilder sbContent = new StringBuilder();
			sbContent.Append(ComponentMarkup);
			 string markup = ComponentFramework.UpdateMarkupForPreviewPublish(context, sbContent.ToString());
			return markup;
		}

		public string JsonBase(Asset asset, OutputContext context, string name, string index = "")
		{
			return "";
		}

		public IEnumerable&lt;IndexedField&gt; IndexedFieldsBase(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return new IndexedField[0];
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>172435</id>
    <label>Components_Color.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_Color.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public partial class Color : JsonComponentBase
	{
		/*comment out "inputBase(label, name);" &amp; modify this function if you want to overwrite the input functionality of the component.*/
		public override void ComponentInput(Asset asset, InputContext context, String label, string name)
		{
			//inputBase(asset, label, name);
            Input.ShowSelectColor(label, name);
		}

		/*comment out "postInputBase(context, name, index);" &amp; modify this function if you want to overwrite the post_input functionality of the component.*/
		public override void ComponentPostInput(Asset asset, PostInputContext context, string name, string index = "")
		{
			PostInputBase(asset, context, name, index);
		}

		/*comment out "outputBase(asset, context, name, index, isDrag);" &amp; modify this function if you want to overwrite the output functionality of the component.*/
		public override string ComponentOutput(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			//return outputBase(asset, context, name, index, isDrag);
            return asset[name + index];
		}

		public override string ComponentJson(Asset asset, OutputContext context, string name, string index = "")
		{
			//The below function refers the automatically generated output functionality for this component.
			//If you wish to alter the the output functionality write your own output code here.
			//NOTE: It is important to handle cases where the asset AND OR the context will be null in your custom code
			var content = asset.Raw[name + index];
			return string.IsNullOrEmpty(content) ? "null" : JsonHelper.StringToJson(content, includeQuotes: true);
		}

		/*comment out "IndexedFieldsBase(asset, context, name, index);" &amp; modify this function if you want to overwrite the indexed fields of the component.*/
		public override IEnumerable&lt;IndexedField&gt; ComponentIndexedFields(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return IndexedFieldsBase(asset, context, name, index);
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>172434</id>
    <label>Components_ColorBase.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_ColorBase.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	[Serializable]
	public partial class Color : JsonComponentBase
	{

		public Color()
		{
			ComponentMarkup = @"";
		}

		public void InputBase(Asset asset, InputContext context, string label, string name)
		{
		}

		public void PostInputBase(Asset asset, PostInputContext context, string name, string index = "")
		{
		}

		public string OutputBase(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			if (isDrag)
			{
				StringBuilder ddContent = new StringBuilder();
				ddContent.Append(ComponentMarkup);

				return ComponentFramework.ParseDragAndDropMarkupForPreviewAndPublish(context, ddContent.ToString());
			}

			StringBuilder sbContent = new StringBuilder();
			sbContent.Append(ComponentMarkup);
			 string markup = ComponentFramework.UpdateMarkupForPreviewPublish(context, sbContent.ToString());
			return markup;
		}

		public string JsonBase(Asset asset, OutputContext context, string name, string index = "")
		{
			return "";
		}

		public IEnumerable&lt;IndexedField&gt; IndexedFieldsBase(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return new IndexedField[0];
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261346</id>
    <label>Components_Date.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_Date.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public partial class Date : JsonComponentBase
	{
		public override void ComponentInput(Asset asset, InputContext context, string label, string name)
		{
			Input.ShowSelectDate(label, name);
		}

		public override void ComponentPostInput(Asset asset, PostInputContext context, string name, string index = "")
		{
			//The below function refers the automatically generated post_input functionality for this component.
			//If you wish to alter the the post_input functionality write your own post_input code here.
			//NOTE: It is important to handle cases where the asset AND OR the context will be null in your custom code
			PostInputBase(asset, context, name, index);
		}

		public override string ComponentOutput(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			//The below function refers the automatically generated output functionality for this component.
			//If you wish to alter the the output functionality write your own output code here.
			//NOTE: It is important to handle cases where the asset AND OR the context will be null in your custom code
			if (isDrag &amp;&amp; !context.IsPublishing)
			{
				return "~$cpfield$" + name + index + "$/cpfield$~";
			}
			return asset[name + index];
		}

		public override string ComponentJson(Asset asset, OutputContext context, string name, string index = "")
		{
			//The below function refers the automatically generated output functionality for this component.
			//If you wish to alter the the output functionality write your own output code here.
			//NOTE: It is important to handle cases where the asset AND OR the context will be null in your custom code
			var value = asset.Raw[name + index];
			DateTime dt;
			if (DateTime.TryParseExact(value, "M/d/yyyy", null, DateTimeStyles.None, out dt))
				return JsonHelper.StringToJson(dt.ToString("yyyy-MM-dd"), includeQuotes: true);

			return "null";
		}

		/*comment out "IndexedFieldsBase(asset, context, name, index);" &amp; modify this function if you want to overwrite the indexed fields of the component.*/
		public override IEnumerable&lt;IndexedField&gt; ComponentIndexedFields(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return IndexedFieldsBase(asset, context, name, index);
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261345</id>
    <label>Components_DateBase.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_DateBase.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	[Serializable]
	public partial class Date : JsonComponentBase
	{

		public Date()
		{
			ComponentMarkup = @"";
		}

		public void InputBase(Asset asset, InputContext context, string label, string name)
		{
		}

		public void PostInputBase(Asset asset, PostInputContext context, string name, string index = "")
		{
		}

		public string OutputBase(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			if (isDrag)
			{
				StringBuilder ddContent = new StringBuilder();
				ddContent.Append(ComponentMarkup);

				return ComponentFramework.ParseDragAndDropMarkupForPreviewAndPublish(context, ddContent.ToString());
			}

			StringBuilder sbContent = new StringBuilder();
			sbContent.Append(ComponentMarkup);
			 string markup = ComponentFramework.UpdateMarkupForPreviewPublish(context, sbContent.ToString());
			return markup;
		}

		public string JsonBase(Asset asset, OutputContext context, string name, string index = "")
		{
			return "null";
		}

		public IEnumerable&lt;IndexedField&gt; IndexedFieldsBase(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return new IndexedField[0];
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>263534</id>
    <label>Components_Document.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_Document.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public partial class Document : JsonComponentBase
	{
		public override void ComponentInput(Asset asset, InputContext context, string label, string name)
		{
			//The below function refers the automatically generated input functionality for this component.
			//If you wish to alter the the input functionality write your own input code here.
			//NOTE: It is important to handle cases where the asset AND OR the context will be null in your custom code
			var sap = new ShowAcquireParams
			{
				DefaultFolder = Asset.GetSiteRoot(asset).AssetPath.ToString(),
				PickerType = PickerViewType.FileView,
				ShowBrowse = true,
				ShowUpload = false,
			};
			Input.ShowAcquireDocument(label, name, sap);
		}

		public override void ComponentPostInput(Asset asset, PostInputContext context, string name, string index = "")
		{
			//The below function refers the automatically generated post_input functionality for this component.
			//If you wish to alter the the post_input functionality write your own post_input code here.
			//NOTE: It is important to handle cases where the asset AND OR the context will be null in your custom code
			PostInputBase(asset, context, name, index);
		}

		public override string ComponentOutput(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			//The below function refers the automatically generated output functionality for this component.
			//If you wish to alter the the output functionality write your own output code here.
			//NOTE: It is important to handle cases where the asset AND OR the context will be null in your custom code
			if (isDrag &amp;&amp; !context.IsPublishing)
			{
				return "~$cpfield$" + name + index + "$/cpfield$~";
			}
			return asset[name + index];
		}

		public override string ComponentJson(Asset asset, OutputContext context, string name, string index = "")
		{
			//The below function refers the automatically generated output functionality for this component.
			//If you wish to alter the the output functionality write your own output code here.
			//NOTE: It is important to handle cases where the asset AND OR the context will be null in your custom code
			if (asset == null) return "null";
			var linkedAsset = Asset.Load(asset.Raw[name + index]);
			if (linkedAsset == null || !linkedAsset.IsLoaded) return "null";
			return string.Format("{{\"AssetId\":{0},\"Label\":\"{1}\",\"Url\":\"{2}\"}}",
				linkedAsset.Id,
				JsonHelper.StringToJson(linkedAsset.Label),
				JsonHelper.StringToJson(linkedAsset.GetLink(true, ProtocolType.Https)) ?? "");
		}

		/*comment out "IndexedFieldsBase(asset, context, name, index);" &amp; modify this function if you want to overwrite the indexed fields of the component.*/
		public override IEnumerable&lt;IndexedField&gt; ComponentIndexedFields(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return IndexedFieldsBase(asset, context, name, index);
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>263533</id>
    <label>Components_DocumentBase.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_DocumentBase.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	[Serializable]
	public partial class Document : JsonComponentBase
	{

		public Document()
		{
			ComponentMarkup = @"";
		}

		public void InputBase(Asset asset, InputContext context, string label, string name)
		{
		}

		public void PostInputBase(Asset asset, PostInputContext context, string name, string index = "")
		{
		}

		public string OutputBase(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			if (isDrag)
			{
				StringBuilder ddContent = new StringBuilder();
				ddContent.Append(ComponentMarkup);

				return ComponentFramework.ParseDragAndDropMarkupForPreviewAndPublish(context, ddContent.ToString());
			}

			StringBuilder sbContent = new StringBuilder();
			sbContent.Append(ComponentMarkup);
			 string markup = ComponentFramework.UpdateMarkupForPreviewPublish(context, sbContent.ToString());
			return markup;
		}

		public string JsonBase(Asset asset, OutputContext context, string name, string index = "")
		{
			return "null";
		}

		public IEnumerable&lt;IndexedField&gt; IndexedFieldsBase(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return new IndexedField[0];
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261148</id>
    <label>Components_Href.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_Href.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public partial class Href : JsonComponentBase
  {
		/*comment out "inputBase(label, name);" &amp; modify this function if you want to overwrite the input functionality of the component.*/
		public override void ComponentInput(Asset asset, InputContext context, String label, string name)
		{
			//inputBase(asset, label, name);
            Dictionary&lt;String, String&gt; linkTypeOptions = new Dictionary&lt;string, string&gt; { { "Internal", "Internal" }, { "External", "External" } };
            Input.StartDropDownContainer(label + " Type", name + "_link_type", linkTypeOptions, defaultValue: "External");
            //Internal
            Input.ShowAcquireDocument(label, name + "_link_internal");
            Input.NextDropDownContainer();
            Input.ShowTextBox(label, name + "_link_external", defaultValue: "#");
            Input.EndDropDownContainer();
		}

		/*comment out "postInputBase(context, name, index);" &amp; modify this function if you want to overwrite the post_input functionality of the component.*/
		public override void ComponentPostInput(Asset asset, PostInputContext context, string name, string index = "")
		{
			PostInputBase(asset, context, name, index);
		}

		/*comment out "outputBase(asset, context, name, index, isDrag);" &amp; modify this function if you want to overwrite the output functionality of the component.*/
		public override string ComponentOutput(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			//return outputBase(asset, context, name, index, isDrag);
            if (asset[name + "_link_type" + index] == "Internal")
            {
                if (String.IsNullOrWhiteSpace(asset[name + "_link_internal" + index]))
                {
                    return "#";
                }
                else
                {
                    return asset[name + "_link_internal" + index];
                }
            }
            else
            {
                if (String.IsNullOrWhiteSpace(asset[name + "_link_external" + index]))
                {
                    return "#";
                }
                else
                {
                    return asset[name + "_link_external" + index];
                }
            }
		}

		public override string ComponentJson(Asset asset, OutputContext context, string name, string index = "")
		{
      //The below function refers the automatically generated output functionality for this component.
      //If you wish to alter the the output functionality write your own output code here.
      //NOTE: It is important to handle cases where the asset AND OR the context will be null in your custom code
      //return JsonBase(asset, context, name, index);
      if (asset[name + "_link_type" + index] == "Internal")
      {
	      if (!string.IsNullOrWhiteSpace(asset[name + "_link_internal" + index]))
	      {
		      return JsonHelper.StringToJson(asset.Raw[name + "_link_internal" + index], includeQuotes: true, escapeSlashes: false);
	      }
      }
      else
      {
	      if (!string.IsNullOrWhiteSpace(asset[name + "_link_external" + index]))
	      {
		      return JsonHelper.StringToJson(asset.Raw[name + "_link_external" + index], includeQuotes: true);
	      }
      }
      return JsonHelper.StringToJson("#", includeQuotes: true);
		}

		/*comment out "IndexedFieldsBase(asset, context, name, index);" &amp; modify this function if you want to overwrite the indexed fields of the component.*/
		public override IEnumerable&lt;IndexedField&gt; ComponentIndexedFields(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return IndexedFieldsBase(asset, context, name, index);
		}
  }
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261146</id>
    <label>Components_HrefBase.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_HrefBase.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	[Serializable]
	public partial class Href : JsonComponentBase
	{

		public Href()
		{
			ComponentMarkup = @"";
		}

		public void InputBase(Asset asset, InputContext context, string label, string name)
		{
		}

		public void PostInputBase(Asset asset, PostInputContext context, string name, string index = "")
		{
		}

		public string OutputBase(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			if (isDrag)
			{
				StringBuilder ddContent = new StringBuilder();
				ddContent.Append(ComponentMarkup);

				return ComponentFramework.ParseDragAndDropMarkupForPreviewAndPublish(context, ddContent.ToString());
			}

			StringBuilder sbContent = new StringBuilder();
			sbContent.Append(ComponentMarkup);
			 string markup = ComponentFramework.UpdateMarkupForPreviewPublish(context, sbContent.ToString());
			return markup;
		}

		public string JsonBase(Asset asset, OutputContext context, string name, string index = "")
		{
			return "null";
		}

		public IEnumerable&lt;IndexedField&gt; IndexedFieldsBase(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return new IndexedField[0];
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261145</id>
    <label>Components_Image.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_Image.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public partial class Image : JsonComponentBase
	{
		/*comment out "inputBase(label, name);" &amp; modify this function if you want to overwrite the input functionality of the component.*/
		public override void ComponentInput(Asset asset, InputContext context, String label, string name)
		{
			InputBase(asset, context, label, name);
		}

		/*comment out "postInputBase(context, name, index);" &amp; modify this function if you want to overwrite the post_input functionality of the component.*/
		public override void ComponentPostInput(Asset asset, PostInputContext context, string name, string index = "")
		{
			PostInputBase(asset, context, name, index);
		}

		/*comment out "outputBase(asset, context, name, index, isDrag);" &amp; modify this function if you want to overwrite the output functionality of the component.*/
		public override string ComponentOutput(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			return OutputBase(asset, context, name, index, isDrag);
		}

		public override string ComponentJson(Asset asset, OutputContext context, string name, string index = "")
		{
			//The below function refers the automatically generated output functionality for this component.
			//If you wish to alter the the output functionality write your own output code here.
			//NOTE: It is important to handle cases where the asset AND OR the context will be null in your custom code
			return JsonBase(asset, context, name, index);
		}

		/*comment out "IndexedFieldsBase(asset, context, name, index);" &amp; modify this function if you want to overwrite the indexed fields of the component.*/
		public override IEnumerable&lt;IndexedField&gt; ComponentIndexedFields(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return IndexedFieldsBase(asset, context, name, index);
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261144</id>
    <label>Components_ImageBase.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_ImageBase.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	[Serializable]
	public partial class Image : JsonComponentBase
	{
		public Src my_image { get; set; }

		public Image()
		{
			my_image = new Src();
			ComponentMarkup = @"&lt;img src=""{my_image : Src}"" /&gt;";
		}

		public void InputBase(Asset asset, InputContext context, string label, string name)
		{
			this.my_image.ComponentInput(asset, context, label + " My Image", name + "_my_image");
		}

		public void PostInputBase(Asset asset, PostInputContext context, string name, string index = "")
		{
		}

		public string OutputBase(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			if (isDrag)
			{
				StringBuilder ddContent = new StringBuilder();
				ddContent.Append(ComponentMarkup);

				return ComponentFramework.ParseDragAndDropMarkupForPreviewAndPublish(context, ddContent.ToString());
			}

			StringBuilder sbContent = new StringBuilder();
			sbContent.Append(ComponentMarkup);
			sbContent.Replace(@"{my_image : Src}", this.my_image.ComponentOutput(asset, context, name + "_my_image", index));
			 string markup = ComponentFramework.UpdateMarkupForPreviewPublish(context, sbContent.ToString());
			return markup;
		}

		public string JsonBase(Asset asset, OutputContext context, string name, string index = "")
		{
			var sbJson = new StringBuilder(1024);
			sbJson.Append("{");
			sbJson.AppendFormat("\"{0}\":{1}", JsonHelper.StringToJson("my_image"), this.my_image.ComponentJson(asset, context, name + "_my_image", index));
			sbJson.Append("}");
			return sbJson.ToString();
		}

		public IEnumerable&lt;IndexedField&gt; IndexedFieldsBase(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return new IndexedField[0];
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261143</id>
    <label>Components_Layout.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_Layout.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.ComponentFrameworkTemplates;
using CrownPeak.CMSAPI.Services;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
/*  public class Component_Layout
  {
    public void input(Asset asset, String label, String name, String initial)
    {
      //FilterParams fpFilter = new FilterParams();
      //fpFilter.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Layout");
      //Dictionary&lt;string, string&gt; layouts = new Dictionary&lt;string, string&gt;();
      //foreach (Asset aLayout in Asset.Load(ComponentLibraryHelper.componentsPath(asset) + "layouts").GetFilterList(fpFilter))
      //{
      //  if (aLayout.IsLoaded) layouts.Add(aLayout.Label, aLayout.Label);
      //}
      //Input.ShowDropDown(label + " layout", name, layouts, Util.MakeList(initial));
    }

    public String output(Asset asset, String name, Dictionary&lt;String, StringBuilder&gt; content, String layout = null, Asset CLConfig = null)
    {
      StringBuilder sbContent = new StringBuilder();
      string id = ComponentLibraryConfig.GetCLConfig(asset).ComponentLibraryRootFolder;
      Asset ClFolder = Asset.Load(id);
      string layoutName = ClFolder.AssetPath.ToString() + "/layout definitions/" + (string.IsNullOrEmpty(layout) ? asset[name] : layout);
      sbContent.Append(Asset.Load(layoutName).Raw["markup"]);
      //Out.DebugWriteLine("Layout: {0} loaded...", ComponentBase.componentsPath(asset) + "layouts/" + asset[name]);
      foreach (KeyValuePair&lt;String, StringBuilder&gt; kvp in content)
      {
        sbContent.Replace(kvp.Key, kvp.Value.ToString());
      }

      return sbContent.ToString();
     // return new CrownPeak.CMSAPI.ComponentFrameworkComponents.Component_Layout().Output(asset, name, content, layout);      
    }
  } */
}
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>172405</id>
    <label>Components_MetaData.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_MetaData.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public partial class MetaData : JsonComponentBase
	{
		/*comment out "InputBase(asset, context, label, name);" &amp; modify this function if you want to overwrite the input functionality of the component.*/
		public override void ComponentInput(Asset asset, InputContext context, String label, string name)
		{
			CrownPeak.CMSAPI.Services.ServicesInput.ShowMetaInput();
			while (Input.NextPanel("custom_metadata_tags"))
			{
				Input.StartHorizontalWrapContainer();
				Input.ShowTextBox("Meta Name", "meta_name");
				Input.ShowTextBox("Meta Content", "meta_content");
				Input.EndHorizontalWrapContainer();
			}
			Input.ShowTextBox("Canonical Link", "canonical_link");
		}

		/*comment out "PostInputBase(asset, context, name, index);" &amp; modify this function if you want to overwrite the post_input functionality of the component.*/
		public override void ComponentPostInput(Asset asset, PostInputContext context, string name, string index = "")
		{
			PostInputBase(asset, context, name, index);
		}

		/*comment out "OutputBase(asset, context, name, index, isDrag);" &amp; modify this function if you want to overwrite the output functionality of the component.*/
		public override string ComponentOutput(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			StringBuilder sb = new StringBuilder();
			sb.AppendLine("&lt;title&gt;" + asset["html_title"] + "&lt;/title&gt;").AppendLine();
			sb.AppendLine(CrownPeak.CMSAPI.Services.ServicesOutput.MetaOutputBuilder(asset, asset, false, false));
			foreach (PanelEntry pe in asset.GetPanels("custom_metadata_tags"))
			{
				if (!String.IsNullOrWhiteSpace(pe["meta_name"]) || !String.IsNullOrWhiteSpace(pe["meta_content"]))
				{
					sb.AppendFormat("&lt;meta name=\"{0}\" content=\"{1}\" &gt;", pe["meta_name"], pe["meta_content"]).AppendLine();
				}
			}

			if (!String.IsNullOrWhiteSpace(asset["canonical_link"]))
			{
				sb.AppendLine("&lt;link rel=\"canonical\" href=\"" + asset["canonical_link"] + "\" /&gt;");
			}

			return sb.ToString();
		}

		/*comment out "JsonBase(asset, context, name, index);" &amp; modify this function if you want to overwrite the JSON functionality of the component.*/
		public override string ComponentJson(Asset asset, OutputContext context, string name, string index = "")
		{
			StringBuilder sbJson = new StringBuilder(1024);
			sbJson.Append("{");
			sbJson.AppendFormat("\"{0}\":{1}", JsonHelper.StringToJson("html_title"), JsonHelper.StringToJson(asset.Raw["html_title"], true));
			sbJson.Append(",");
			sbJson.AppendFormat("\"{0}\":{1}", JsonHelper.StringToJson("meta_author"), JsonHelper.StringToJson(asset.Raw["meta_author"], true));
			sbJson.Append(",");
			sbJson.AppendFormat("\"{0}\":{1}", JsonHelper.StringToJson("meta_title"), JsonHelper.StringToJson(asset.Raw["meta_title"], true));
			sbJson.Append(",");
			sbJson.AppendFormat("\"{0}\":{1}", JsonHelper.StringToJson("meta_desc"), JsonHelper.StringToJson(asset.Raw["meta_desc"], true));
			sbJson.Append(",");
			sbJson.AppendFormat("\"{0}\":{1}", JsonHelper.StringToJson("meta_keywords"), JsonHelper.StringToJson(asset.Raw["meta_keywords"], true));
			sbJson.Append(",");
			sbJson.AppendFormat("\"{0}\":[", JsonHelper.StringToJson("custom_metadata"));
			var first = true;
			foreach (PanelEntry pe in asset.GetPanels("custom_metadata_tags"))
			{
				if (!string.IsNullOrWhiteSpace(pe.Raw["meta_name"]))
				{
					if (!first) sbJson.Append(",");
					sbJson.AppendFormat("{{\"{0}\":{1}", "name", JsonHelper.StringToJson(pe.Raw["meta_name"], true));
					sbJson.AppendFormat(",\"{0}\":{1}}}", "content", JsonHelper.StringToJson(pe.Raw["meta_content"], true));
					first = false;
				}
			}
			sbJson.Append("],");
			sbJson.AppendFormat("\"{0}\":{1}", JsonHelper.StringToJson("canonical_link"), JsonHelper.StringToJson(asset.Raw["canonical_link"], true));
			sbJson.Append("}");
			return sbJson.ToString();
		}

		/*comment out "IndexedFieldsBase(asset, context, name, index);" &amp; modify this function if you want to overwrite the indexed fields of the component.*/
		public override IEnumerable&lt;IndexedField&gt; ComponentIndexedFields(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return IndexedFieldsBase(asset, context, name, index);
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>172406</id>
    <label>Components_MetaDataBase.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_MetaDataBase.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	[Serializable]
	public partial class MetaData : JsonComponentBase
	{

		public MetaData()
		{
			ComponentMarkup = @"";
		}

		public void InputBase(Asset asset, InputContext context, string label, string name)
		{
		}

		public void PostInputBase(Asset asset, PostInputContext context, string name, string index = "")
		{
		}

		public string OutputBase(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			if (isDrag)
			{
				StringBuilder ddContent = new StringBuilder();
				ddContent.Append(ComponentMarkup);

				return ComponentFramework.ParseDragAndDropMarkupForPreviewAndPublish(context, ddContent.ToString());
			}

			StringBuilder sbContent = new StringBuilder();
			sbContent.Append(ComponentMarkup);
			string markup = ComponentFramework.UpdateMarkupForPreviewPublish(context, sbContent.ToString());
			return markup;
		}

		public string JsonBase(Asset asset, OutputContext context, string name, string index = "")
		{
			return "";
		}
		
		public IEnumerable&lt;IndexedField&gt; IndexedFieldsBase(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return new IndexedField[0];
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261122</id>
    <label>Components_Src.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_Src.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public partial class Src : JsonComponentBase
	{
		/*comment out "inputBase(label, name);" &amp; modify this function if you want to overwrite the input functionality of the component.*/
		public override void ComponentInput(Asset asset, InputContext context, String label, string name)
		{
			//inputBase(asset, label, name);
            ShowAcquireParams img = new ShowAcquireParams();
            img.ShowBrowse = true;
            img.ShowUpload = true;
            //img.DefaultFolder = "/Component Library Auto POC/_Assets/images"; //will need to think of a way to get Asset.getSiteRoot(asset); in here
            img.Extensions = Util.MakeList("jpg", "jpeg", "gif", "png");
            //img.DefaultFolder = "...../Assets/images/";
            Input.ShowAcquireImage(label, name, img);
		}

		/*comment out "postInputBase(context, name, index);" &amp; modify this function if you want to overwrite the post_input functionality of the component.*/
		public override void ComponentPostInput(Asset asset, PostInputContext context, string name, string index = "")
		{
			PostInputBase(asset, context, name, index);
		}

		/*comment out "outputBase(asset, context, name, index, isDrag);" &amp; modify this function if you want to overwrite the output functionality of the component.*/
		public override string ComponentOutput(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			//return outputBase(asset, context, name, index, isDrag);
			return asset[name + index];
		}

		public override string ComponentJson(Asset asset, OutputContext context, string name, string index = "")
		{
			//The below function refers the automatically generated output functionality for this component.
			//If you wish to alter the the output functionality write your own output code here.
			//NOTE: It is important to handle cases where the asset AND OR the context will be null in your custom code
			var url = Asset.Load(asset.Raw[name + index]).GetLink(true, ProtocolType.Https);
			return string.IsNullOrEmpty(url) ? "null" : JsonHelper.StringToJson(url, includeQuotes: true);
		}

		/*comment out "IndexedFieldsBase(asset, context, name, index);" &amp; modify this function if you want to overwrite the indexed fields of the component.*/
		public override IEnumerable&lt;IndexedField&gt; ComponentIndexedFields(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return IndexedFieldsBase(asset, context, name, index);
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261121</id>
    <label>Components_SrcBase.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_SrcBase.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	[Serializable]
	public partial class Src : JsonComponentBase
	{

		public Src()
		{
			ComponentMarkup = @"";
		}

		public void InputBase(Asset asset, InputContext context, string label, string name)
		{
		}

		public void PostInputBase(Asset asset, PostInputContext context, string name, string index = "")
		{
		}

		public string OutputBase(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			if (isDrag)
			{
				StringBuilder ddContent = new StringBuilder();
				ddContent.Append(ComponentMarkup);

				return ComponentFramework.ParseDragAndDropMarkupForPreviewAndPublish(context, ddContent.ToString());
			}

			StringBuilder sbContent = new StringBuilder();
			sbContent.Append(ComponentMarkup);
			 string markup = ComponentFramework.UpdateMarkupForPreviewPublish(context, sbContent.ToString());
			return markup;
		}

		public string JsonBase(Asset asset, OutputContext context, string name, string index = "")
		{
			return "";
		}

		public IEnumerable&lt;IndexedField&gt; IndexedFieldsBase(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return new IndexedField[0];
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261115</id>
    <label>Components_Text.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_Text.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public partial class Text : JsonComponentBase
	{
		/*comment out "inputBase(label, name);" &amp; modify this function if you want to overwrite the input functionality of the component.*/
		public override void ComponentInput(Asset asset, InputContext context, String label, string name)
		{
			//inputBase(asset, label, name);
            Input.ShowTextBox(label, name);
		}

		/*comment out "postInputBase(context, name, index);" &amp; modify this function if you want to overwrite the post_input functionality of the component.*/
		public override void ComponentPostInput(Asset asset, PostInputContext context, string name, string index = "")
		{
			PostInputBase(asset, context, name, index);
		}

		/*comment out "outputBase(asset, context, name, index, isDrag);" &amp; modify this function if you want to overwrite the output functionality of the component.*/
		public override string ComponentOutput(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			//return outputBase(asset, context, name, index, isDrag);
            if (isDrag &amp;&amp; !context.IsPublishing)
            {
                return "~$cpfield$" + name + index + "$/cpfield$~";
            }
            return asset[name + index];

		}

		public override string ComponentJson(Asset asset, OutputContext context, string name, string index = "")
		{
			//The below function refers the automatically generated output functionality for this component.
			//If you wish to alter the the output functionality write your own output code here.
			//NOTE: It is important to handle cases where the asset AND OR the context will be null in your custom code
			return JsonHelper.StringToJson(asset.Raw[name + index], includeQuotes: true);
		}

		public override IEnumerable&lt;IndexedField&gt; ComponentIndexedFields(Asset asset, SearchG2Context context, string name, string index = "")
		{
			//The below function refers to the automatically generated functionality for this component.
			//If you wish to alter the the output functionality write your own output code here.
			//NOTE: It is important to handle cases where the asset AND OR the context will be null in your custom code
			return IndexedFieldsBase(asset, context, name, index);
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261116</id>
    <label>Components_TextBase.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_TextBase.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	[Serializable]
	public partial class Text : JsonComponentBase
	{

		public Text()
		{
			ComponentMarkup = @"";
		}

		public void InputBase(Asset asset, InputContext context, string label, string name)
		{
		}

		public void PostInputBase(Asset asset, PostInputContext context, string name, string index = "")
		{
		}

		public string OutputBase(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			if (isDrag)
			{
				StringBuilder ddContent = new StringBuilder();
				ddContent.Append(ComponentMarkup);

				return ComponentFramework.ParseDragAndDropMarkupForPreviewAndPublish(context, ddContent.ToString());
			}

			StringBuilder sbContent = new StringBuilder();
			sbContent.Append(ComponentMarkup);
			 string markup = ComponentFramework.UpdateMarkupForPreviewPublish(context, sbContent.ToString());
			return markup;
		}

		public string JsonBase(Asset asset, OutputContext context, string name, string index = "")
		{
			return "";
		}

		public IEnumerable&lt;IndexedField&gt; IndexedFieldsBase(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return new IndexedField[0];
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>172378</id>
    <label>Components_Video.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_Video.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public partial class Video : JsonComponentBase
	{
		/*comment out "inputBase(label, name);" &amp; modify this function if you want to overwrite the input functionality of the component.*/
		public override void ComponentInput(Asset asset, InputContext context, String label, string name)
		{
			InputBase(asset, context, label, name);
		}

		/*comment out "postInputBase(context, name, index);" &amp; modify this function if you want to overwrite the post_input functionality of the component.*/
		public override void ComponentPostInput(Asset asset, PostInputContext context, string name, string index = "")
		{
			PostInputBase(asset, context, name, index);
		}

		/*comment out "outputBase(asset, context, name, index, isDrag);" &amp; modify this function if you want to overwrite the output functionality of the component.*/
		public override string ComponentOutput(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			return OutputBase(asset, context, name, index, isDrag);
		}

		public override string ComponentJson(Asset asset, OutputContext context, string name, string index = "")
		{
			//The below function refers the automatically generated output functionality for this component.
			//If you wish to alter the the output functionality write your own output code here.
			//NOTE: It is important to handle cases where the asset AND OR the context will be null in your custom code
			var url = Asset.Load(asset.Raw[name + "_video_src" + index]).GetLink(true, ProtocolType.Https);
			return string.IsNullOrEmpty(url) ? "null" : JsonHelper.StringToJson(url, includeQuotes: true);
		}

		/*comment out "IndexedFieldsBase(asset, context, name, index);" &amp; modify this function if you want to overwrite the indexed fields of the component.*/
		public override IEnumerable&lt;IndexedField&gt; ComponentIndexedFields(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return IndexedFieldsBase(asset, context, name, index);
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>172377</id>
    <label>Components_VideoBase.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_VideoBase.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	[Serializable]
	public partial class Video : JsonComponentBase
	{
		public Src video_src { get; set; }

		public Video()
		{
			video_src = new Src();
			ComponentMarkup = @"&lt;video width controls=""""&gt;  &lt;source src=""{video_src : Src}"" type=""{type : Code}""&gt;  Your browser does not support HTML5 video.&lt;/video&gt;";
		}

		public void InputBase(Asset asset, InputContext context, string label, string name)
		{
			this.video_src.ComponentInput(asset, context, label + " Video Src", name + "_video_src");
		}

		public void PostInputBase(Asset asset, PostInputContext context, string name, string index = "")
		{
		}

		public string OutputBase(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			if (isDrag)
			{
				StringBuilder ddContent = new StringBuilder();
				ddContent.Append(ComponentMarkup);

				return ComponentFramework.ParseDragAndDropMarkupForPreviewAndPublish(context, ddContent.ToString());
			}

			StringBuilder sbContent = new StringBuilder();
			sbContent.Append(ComponentMarkup);
			sbContent.Replace(@"{video_src : Src}", this.video_src.ComponentOutput(asset, context, name + "_video_src", index));
			sbContent.Replace(@"{type : Code}", "");
			 string markup = ComponentFramework.UpdateMarkupForPreviewPublish(context, sbContent.ToString());
			return markup;
		}

		public string JsonBase(Asset asset, OutputContext context, string name, string index = "")
		{
			return "";
		}

		public IEnumerable&lt;IndexedField&gt; IndexedFieldsBase(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return new IndexedField[0];
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261110</id>
    <label>Components_Widget.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_Widget.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public partial class Widget : JsonComponentBase
	{
		/*comment out "inputBase(label, name);" &amp; modify this function if you want to overwrite the input functionality of the component.*/
		public override void ComponentInput(Asset asset, InputContext context, String label, string name)
		{
			//inputBase(asset, label, name);
			Input.ShowAcquireDocument(label, name);
		}

		/*comment out "postInputBase(context, name, index);" &amp; modify this function if you want to overwrite the post_input functionality of the component.*/
		public override void ComponentPostInput(Asset asset, PostInputContext context, string name, string index = "")
		{
			PostInputBase(asset, context, name, index);
		}

		/*comment out "outputBase(asset, context, name, index, isDrag);" &amp; modify this function if you want to overwrite the output functionality of the component.*/
		public override string ComponentOutput(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			//return outputBase(asset, context, name, index, isDrag);
			Asset widget = Asset.Load(asset[name + index]);
			return widget.Show();
		}

		public override string ComponentJson(Asset asset, OutputContext context, string name, string index = "")
		{
			//The below function refers the automatically generated output functionality for this component.
			//If you wish to alter the the output functionality write your own output code here.
			//NOTE: It is important to handle cases where the asset AND OR the context will be null in your custom code
			var widget = Asset.Load(asset[name + index]);
			if (widget != null &amp;&amp; widget.IsLoaded)
			{
				return widget.Show("output_json");
			}
			return "null";
		}

		/*comment out "IndexedFieldsBase(asset, context, name, index);" &amp; modify this function if you want to overwrite the indexed fields of the component.*/
		public override IEnumerable&lt;IndexedField&gt; ComponentIndexedFields(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return IndexedFieldsBase(asset, context, name, index);
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261109</id>
    <label>Components_WidgetBase.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_WidgetBase.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	[Serializable]
	public partial class Widget : JsonComponentBase
	{

		public Widget()
		{
			ComponentMarkup = @"";
		}

		public void InputBase(Asset asset, InputContext context, string label, string name)
		{
		}

		public void PostInputBase(Asset asset, PostInputContext context, string name, string index = "")
		{
		}

		public string OutputBase(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			if (isDrag)
			{
				StringBuilder ddContent = new StringBuilder();
				ddContent.Append(ComponentMarkup);

				return ComponentFramework.ParseDragAndDropMarkupForPreviewAndPublish(context, ddContent.ToString());
			}

			StringBuilder sbContent = new StringBuilder();
			sbContent.Append(ComponentMarkup);
			string markup = ComponentFramework.UpdateMarkupForPreviewPublish(context, sbContent.ToString());
			return markup;
		}

		public string JsonBase(Asset asset, OutputContext context, string name, string index = "")
		{
			return null;
		}

		public IEnumerable&lt;IndexedField&gt; IndexedFieldsBase(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return new IndexedField[0];
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261108</id>
    <label>Components_Wysiwyg.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_Wysiwyg.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using CrownPeak.CMSAPI.CustomLibrary;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	public partial class Wysiwyg : JsonComponentBase
	{
		/*comment out "inputBase(label, name);" &amp; modify this function if you want to overwrite the input functionality of the component.*/
		public override void ComponentInput(Asset asset, InputContext context, String label, string name)
		{
			//inputBase(asset, label, name);
            WysiwygParams wParams = ServicesInput.FullWYSIWYG();
            Input.ShowWcoControls(name);
            Input.ShowWysiwyg(label, name, wParams, width: 950, height: 200);
		}

		/*comment out "postInputBase(context, name, index);" &amp; modify this function if you want to overwrite the post_input functionality of the component.*/
		public override void ComponentPostInput(Asset asset, PostInputContext context, string name, string index = "")
		{
			PostInputBase(asset, context, name, index);
		}

		/*comment out "outputBase(asset, context, name, index, isDrag);" &amp; modify this function if you want to overwrite the output functionality of the component.*/
		public override string ComponentOutput(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			//return outputBase(asset, context, name, index, isDrag);
            if (isDrag &amp;&amp; !context.IsPublishing)
            {
                return "~$cpfield$" + name + index + "$/cpfield$~";
            }
            return asset[name + index];
		}

		public override string ComponentJson(Asset asset, OutputContext context, string name, string index = "")
		{
			//The below function refers the automatically generated output functionality for this component.
			//If you wish to alter the the output functionality write your own output code here.
			//NOTE: It is important to handle cases where the asset AND OR the context will be null in your custom code
			return JsonHelper.StringToJson(Util.ReplaceAttachments(Util.ReplaceCptInternals(asset.Raw[name + index])), includeQuotes:true);
		}

		/*comment out "IndexedFieldsBase(asset, context, name, index);" &amp; modify this function if you want to overwrite the indexed fields of the component.*/
		public override IEnumerable&lt;IndexedField&gt; ComponentIndexedFields(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return IndexedFieldsBase(asset, context, name, index);
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261106</id>
    <label>Components_WysiwygBase.cs</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Library/Components_WysiwygBase.cs</path>
    <folder_id>261059</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>LibraryClass</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrownPeak.CMSAPI;
using CrownPeak.CMSAPI.Services;
using Component_Library.Component_Project.Components;
/* Some Namespaces are not allowed. */
namespace Component_Library.Component_Project.Components
{
	[Serializable]
	public partial class Wysiwyg : JsonComponentBase
	{

		public Wysiwyg()
		{
			ComponentMarkup = @"";
		}

		public void InputBase(Asset asset, InputContext context, string label, string name)
		{
		}

		public void PostInputBase(Asset asset, PostInputContext context, string name, string index = "")
		{
		}

		public string OutputBase(Asset asset, OutputContext context, string name, string index = "", bool isDrag = false)
		{
			if (isDrag)
			{
				StringBuilder ddContent = new StringBuilder();
				ddContent.Append(ComponentMarkup);

				return ComponentFramework.ParseDragAndDropMarkupForPreviewAndPublish(context, ddContent.ToString());
			}

			StringBuilder sbContent = new StringBuilder();
			sbContent.Append(ComponentMarkup);
			 string markup = ComponentFramework.UpdateMarkupForPreviewPublish(context, sbContent.ToString());
			return markup;
		}

		public string JsonBase(Asset asset, OutputContext context, string name, string index = "")
		{
			return "";
		}

		public IEnumerable&lt;IndexedField&gt; IndexedFieldsBase(Asset asset, SearchG2Context context, string name, string index = "")
		{
			return new IndexedField[0];
		}
	}
}</value>
      </field>
    </fields>
  </asset>
  <folder>
    <id>261054</id>
    <label>Models</label>
    <model_id>
    </model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <path>/Component Project/Models</path>
    <folder_id>261049</folder_id>
    <subType>4096</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Model, Folder</intendedType>
    <type>4</type>
  </folder>
  <folder>
    <id>261107</id>
    <label>Component Definition Folder</label>
    <model_id>802</model_id>
    <model_path>/System/Models/Basis/Asset/Asset Folder/</model_path>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <path>/Component Project/Models/Component Definition Folder</path>
    <folder_id>261054</folder_id>
    <subType>0</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Model, Folder</intendedType>
    <type>4</type>
  </folder>
  <asset>
    <id>261521</id>
    <label>Enhanced Component</label>
    <template_id>261485</template_id>
    <template_path>/Component Project/Templates/Component Framework/Enhanced/Component Definition/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Models/Component Definition Folder/Enhanced Component</path>
    <folder_id>261107</folder_id>
    <subType>0</subType>
    <templateSubType>512</templateSubType>
    <intendedType>Model, ContentAsset</intendedType>
    <type>2</type>
    <fields />
  </asset>
  <folder>
    <id>261100</id>
    <label>Template Definition Folder</label>
    <model_id>802</model_id>
    <model_path>/System/Models/Basis/Asset/Asset Folder/</model_path>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <path>/Component Project/Models/Template Definition Folder</path>
    <folder_id>261054</folder_id>
    <subType>0</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Model, Folder</intendedType>
    <type>4</type>
  </folder>
  <asset>
    <id>261547</id>
    <label>Enhanced Template</label>
    <template_id>261538</template_id>
    <template_path>/Component Project/Templates/Component Framework/Enhanced Template Definition/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>0</workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Models/Template Definition Folder/Enhanced Template</path>
    <folder_id>261100</folder_id>
    <subType>0</subType>
    <templateSubType>512</templateSubType>
    <intendedType>Model, ContentAsset</intendedType>
    <type>2</type>
    <fields />
  </asset>
  <folder>
    <id>261056</id>
    <label>Templates</label>
    <model_id>
    </model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <path>/Component Project/Templates</path>
    <folder_id>261049</folder_id>
    <subType>256</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>TemplatesFolder</intendedType>
    <type>4</type>
  </folder>
  <folder>
    <id>261105</id>
    <label>Component Framework</label>
    <model_id>
    </model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <path>/Component Project/Templates/Component Framework</path>
    <folder_id>261056</folder_id>
    <subType>256</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>TemplateFolder</intendedType>
    <type>4</type>
  </folder>
  <folder>
    <id>267063</id>
    <label>Enhanced</label>
    <model_id>
    </model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <path>/Component Project/Templates/Component Framework/Enhanced</path>
    <folder_id>261105</folder_id>
    <subType>256</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>TemplateFolder</intendedType>
    <type>4</type>
  </folder>
  <folder>
    <id>261485</id>
    <label>Component Definition</label>
    <model_id>
    </model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <path>/Component Project/Templates/Component Framework/Enhanced/Component Definition</path>
    <folder_id>267063</folder_id>
    <subType>512</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>TemplateFolder</intendedType>
    <type>4</type>
  </folder>
  <asset>
    <id>261486</id>
    <label>copy.aspx</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Templates/Component Framework/Enhanced/Component Definition/copy.aspx</path>
    <folder_id>261485</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Template</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>&lt;%@ Page Language="C#" Inherits="CrownPeak.Internal.Debug.CopyInit" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.Services" %&gt;
&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.CustomLibrary" %&gt;
&lt;%@ Import Namespace="Component_Library.Component_Project.Components" %&gt;
&lt;% //MODIFY or ADD Import Statements to Define Namespaces Used by the Template %&gt;
&lt;%//This plugin uses CopyContext as its context class type%&gt;
&lt;%
	CrownPeak.CMSAPI.ComponentFrameworkTemplates.ComponentBuilder.CopyHelper(asset, context);
%&gt;
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261487</id>
    <label>delete.aspx</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Templates/Component Framework/Enhanced/Component Definition/delete.aspx</path>
    <folder_id>261485</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Template</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>&lt;%@ Page Language="C#" Inherits="CrownPeak.Internal.Debug.DeleteInit" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.Services" %&gt;
&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.CustomLibrary" %&gt;
&lt;%@ Import Namespace="Component_Library.Component_Project.Components" %&gt;
&lt;% //MODIFY or ADD Import Statements to Define Namespaces Used by the Template %&gt;
&lt;%//This plugin uses DeleteContext as its context class type%&gt;
&lt;%
    CrownPeak.CMSAPI.ComponentFrameworkTemplates.ComponentBuilder.DeleteHelper(asset, context);
%&gt;
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261488</id>
    <label>filename.aspx</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Templates/Component Framework/Enhanced/Component Definition/filename.aspx</path>
    <folder_id>261485</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Template</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>&lt;%@ Page Language="C#" Inherits="CrownPeak.Internal.Debug.FilenameInit" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.Services" %&gt;
&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.CustomLibrary" %&gt;
&lt;%@ Import Namespace="Component_Library.Component_Project.Components" %&gt;
&lt;% //MODIFY or ADD Import Statements to Define Namespaces Used by the Template %&gt;
&lt;%//This plugin uses OutputContext as its context class type%&gt;
&lt;%
    CrownPeak.CMSAPI.ComponentFrameworkTemplates.ComponentBuilder.FilenameHelper(asset, context);
%&gt;
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261489</id>
    <label>input.aspx</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Templates/Component Framework/Enhanced/Component Definition/input.aspx</path>
    <folder_id>261485</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Template</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>&lt;%@ Page Language="C#" Inherits="CrownPeak.Internal.Debug.InputInit" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.Services" %&gt;
&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.CustomLibrary" %&gt;
&lt;%@ Import Namespace="Component_Library.Component_Project.Components" %&gt;
&lt;% //MODIFY or ADD Import Statements to Define Namespaces Used by the Template %&gt;
&lt;%//This plugin uses InputContext as its context class type%&gt;
&lt;%
    //CrownPeak.CMSAPI.ComponentFrameworkTemplates.ComponentBuilder.InputHelper(asset, context);
  ComponentBuilderHelper.InputHelper(asset, context);
%&gt;
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261490</id>
    <label>output.aspx</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Templates/Component Framework/Enhanced/Component Definition/output.aspx</path>
    <folder_id>261485</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Template</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>&lt;%@ Page Language="C#" Inherits="CrownPeak.Internal.Debug.OutputInit" %&gt;

&lt;%@ Import Namespace="CrownPeak.CMSAPI" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.Services" %&gt;
&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.CustomLibrary" %&gt;
&lt;%@ Import Namespace="Component_Library.Component_Project.Components" %&gt;
&lt;% //MODIFY or ADD Import Statements to Define Namespaces Used by the Template %&gt;
&lt;%//This plugin uses OutputContext as its context class type%&gt;
&lt;%
    Component_Layout layout = new Component_Layout();
    MetaData metaData = new MetaData();
    HeaderJavascriptAndCss customJavascriptAndCss = new HeaderJavascriptAndCss();
    NavFooterContent navFooterContent = new NavFooterContent();
%&gt;

&lt;%
    context.DisablePreviewCache = true;
    Asset siteConfig = Asset.Load("/Site-Summer-of-Fun/_Site Config/site config");
%&gt;
&lt;!doctype html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;Demo&lt;/title&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
    &lt;link rel="stylesheet" href="&lt;%=Asset.Load("/Site-Summer-of-Fun/_Assets/css/bootstrap.css").GetLink(LinkType.Include)%&gt;" media="all" /&gt;
    &lt;link rel="stylesheet" href="&lt;%=Asset.Load("/Site-Summer-of-Fun/_Assets/css/custom.css").GetLink(LinkType.Include)%&gt;" media="all" /&gt;
    &lt;link rel="stylesheet" href="&lt;%=Asset.Load("/Site-Summer-of-Fun/_Assets/css/flexslider.css").GetLink(LinkType.Include)%&gt;" media="all" /&gt;
    &lt;link rel="stylesheet" href="&lt;%=Asset.Load("/Site-Summer-of-Fun/_Assets/css/lightbox.min.css").GetLink(LinkType.Include)%&gt;" media="all" /&gt;
    &lt;link rel="stylesheet" href="&lt;%=Asset.Load("/Site-Summer-of-Fun/_Assets/css/lightbox.min.css").GetLink(LinkType.Include)%&gt;" media="all" /&gt;
    &lt;link rel="stylesheet" href="&lt;%=Asset.Load("/Site-Summer-of-Fun/_Assets/css/theme.css").GetLink(LinkType.Include)%&gt;" media="all" /&gt;
    &lt;link rel="stylesheet" href="&lt;%=Asset.Load("/Site-Summer-of-Fun/_Assets/css/themify-icons.css").GetLink(LinkType.Include)%&gt;" media="all" /&gt;

    &lt;link href='//fonts.googleapis.com/css?family=Lato:300,400%7CRaleway:100,400,300,500,600,700%7COpen+Sans:400,500,600' rel='stylesheet' type='text/css'&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;%
        StringBuilder sbCol1 = new StringBuilder();
        StringBuilder sbCol2 = new StringBuilder();
        StringBuilder sbCol3 = new StringBuilder();
        Dictionary&lt;String, StringBuilder&gt; rowContent = new Dictionary&lt;string, StringBuilder&gt;();

    %&gt;
&lt;/div&gt;
    &lt;div class="main-container"&gt;
        &lt;% CrownPeak.CMSAPI.ComponentFrameworkTemplates.ComponentBuilder.OutputHelper(asset, context); %&gt;
        &lt;script src="&lt;%=Asset.Load("/Site-Summer-of-Fun/_Assets/js/jquery.min.js").GetLink(LinkType.Include)%&gt;"&gt;&lt;/script&gt;
        &lt;script src="&lt;%=Asset.Load("/Site-Summer-of-Fun/_Assets/js/bootstrap.min.js").GetLink(LinkType.Include)%&gt;"&gt;&lt;/script&gt;
        &lt;script src="&lt;%=Asset.Load("/Site-Summer-of-Fun/_Assets/js/flexslider.min.js").GetLink(LinkType.Include)%&gt;"&gt;&lt;/script&gt;
        &lt;script src="&lt;%=Asset.Load("/Site-Summer-of-Fun/_Assets/js/lightbox.min.js").GetLink(LinkType.Include)%&gt;"&gt;&lt;/script&gt;
        &lt;script src="&lt;%=Asset.Load("/Site-Summer-of-Fun/_Assets/js/scripts.js").GetLink(LinkType.Include)%&gt;"&gt;&lt;/script&gt;
        &lt;script src="&lt;%=Asset.Load("/Site-Summer-of-Fun/_Assets/js/parallax.js").GetLink(LinkType.Include)%&gt;"&gt;&lt;/script&gt;

    &lt;/div&gt;
&lt;/body&gt;
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261491</id>
    <label>post_input.aspx</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Templates/Component Framework/Enhanced/Component Definition/post_input.aspx</path>
    <folder_id>261485</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Template</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>&lt;%@ Page Language="C#" Inherits="CrownPeak.Internal.Debug.PostInputInit" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.Services" %&gt;
&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.CustomLibrary" %&gt;
&lt;%@ Import Namespace="Component_Library.Component_Project.Components" %&gt;
&lt;% //MODIFY or ADD Import Statements to Define Namespaces Used by the Template %&gt;
&lt;%//This plugin uses PostInputContext as its context class type%&gt;
&lt;%
  //CrownPeak.CMSAPI.ComponentFrameworkTemplates.ComponentBuilder.PostInputHelper(asset, context);
	ComponentBuilderHelper.PostInputHelper(asset, context);
%&gt;
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261492</id>
    <label>post_save.aspx</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Templates/Component Framework/Enhanced/Component Definition/post_save.aspx</path>
    <folder_id>261485</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Template</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>&lt;%@ Page Language="C#" Inherits="CrownPeak.Internal.Debug.PostSaveInit" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.Services" %&gt;
&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.CustomLibrary" %&gt;
&lt;%@ Import Namespace="Component_Library.Component_Project.Components" %&gt;
&lt;% //MODIFY or ADD Import Statements to Define Namespaces Used by the Template %&gt;
&lt;%//This plugin uses PostSaveContext as its context class type%&gt;
&lt;%
  //CrownPeak.CMSAPI.ComponentFrameworkTemplates.ComponentBuilder.PostSaveHelper(asset, context);
  ComponentBuilderHelper.PostSaveHelper(asset, context);
%&gt;
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261493</id>
    <label>url.aspx</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Templates/Component Framework/Enhanced/Component Definition/url.aspx</path>
    <folder_id>261485</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Template</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>&lt;%@ Page Language="C#" Inherits="CrownPeak.Internal.Debug.UrlInit" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.Services" %&gt;
&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.CustomLibrary" %&gt;
&lt;%@ Import Namespace="Component_Library.Component_Project.Components" %&gt;
&lt;% //MODIFY or ADD Import Statements to Define Namespaces Used by the Template %&gt;
&lt;%//This plugin uses OutputContext as its context class type%&gt;
&lt;%
    CrownPeak.CMSAPI.ComponentFrameworkTemplates.ComponentBuilder.UrlHelper(asset, context);
%&gt;
</value>
      </field>
    </fields>
  </asset>
  <folder>
    <id>261538</id>
    <label>Enhanced Template Definition</label>
    <model_id>
    </model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <path>/Component Project/Templates/Component Framework/Enhanced Template Definition</path>
    <folder_id>261105</folder_id>
    <subType>512</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>TemplateFolder</intendedType>
    <type>4</type>
  </folder>
  <asset>
    <id>261539</id>
    <label>filename.aspx</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Templates/Component Framework/Enhanced Template Definition/filename.aspx</path>
    <folder_id>261538</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Template</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>&lt;%@ Page Language="C#" Inherits="CrownPeak.Internal.Debug.FilenameInit" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.Services" %&gt;
&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.CustomLibrary" %&gt;
&lt;%@ Import Namespace="Component_Library.Component_Project.Components" %&gt;
&lt;% //MODIFY or ADD Import Statements to Define Namespaces Used by the Template %&gt;
&lt;%//This plugin uses OutputContext as its context class type%&gt;
&lt;%
    CrownPeak.CMSAPI.ComponentFrameworkTemplates.TemplateBuilder.FilenameHelper(asset, context);
%&gt;
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261540</id>
    <label>input.aspx</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Templates/Component Framework/Enhanced Template Definition/input.aspx</path>
    <folder_id>261538</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Template</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>&lt;%@ Page Language="C#" Inherits="CrownPeak.Internal.Debug.InputInit" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.Services" %&gt;
&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.CustomLibrary" %&gt;
&lt;%@ Import Namespace="Component_Library.Component_Project.Components" %&gt;
&lt;% //MODIFY or ADD Import Statements to Define Namespaces Used by the Template %&gt;
&lt;%//This plugin uses InputContext as its context class type%&gt;
&lt;%
    //CrownPeak.CMSAPI.ComponentFrameworkTemplates.TemplateBuilder.InputHelper(asset, context);
	ComponentLibraryEnhancedTemplateBuilderHelper.InputHelper(asset, context);
%&gt;
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261541</id>
    <label>output.aspx</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Templates/Component Framework/Enhanced Template Definition/output.aspx</path>
    <folder_id>261538</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Template</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>&lt;%@ Page Language="C#" Inherits="CrownPeak.Internal.Debug.OutputInit" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.Services" %&gt;
&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.CustomLibrary" %&gt;
&lt;%@ Import Namespace="Component_Library.Component_Project.Components" %&gt;
&lt;% //MODIFY or ADD Import Statements to Define Namespaces Used by the Template %&gt;
&lt;%//This plugin uses OutputContext as its context class type%&gt;
&lt;%
	//CrownPeak.CMSAPI.ComponentFrameworkTemplates.TemplateBuilder.OutputHelper(asset, context);
	ComponentLibraryEnhancedTemplateBuilderHelper.OutputHelper(asset, context);
%&gt;
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261542</id>
    <label>output_code.aspx</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Templates/Component Framework/Enhanced Template Definition/output_code.aspx</path>
    <folder_id>261538</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Template</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>&lt;%@ Page Language="C#" Inherits="CrownPeak.Internal.Debug.OutputInit" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.Services" %&gt;
&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.CustomLibrary" %&gt;
&lt;%@ Import Namespace="Component_Library.Component_Project.Components" %&gt;
&lt;% //MODIFY or ADD Import Statements to Define Namespaces Used by the Template %&gt;
&lt;%//This plugin uses OutputContext as its context class type%&gt;
&lt;%
	//CrownPeak.CMSAPI.ComponentFrameworkTemplates.TemplateBuilder.OutputCodeHelper(asset, context);
	ComponentLibraryEnhancedTemplateBuilderHelper.OutputCodeHelper(asset, context);
%&gt;</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261543</id>
    <label>output_components.aspx</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Templates/Component Framework/Enhanced Template Definition/output_components.aspx</path>
    <folder_id>261538</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Template</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>&lt;%@ Page Language="C#" Inherits="CrownPeak.Internal.Debug.OutputInit" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.Services" %&gt;
&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.CustomLibrary" %&gt;
&lt;%@ Import Namespace="Component_Library.Component_Project.Components" %&gt;
&lt;% //MODIFY or ADD Import Statements to Define Namespaces Used by the Template %&gt;
&lt;%//This plugin uses OutputContext as its context class type%&gt;
&lt;%
  //CrownPeak.CMSAPI.ComponentFrameworkTemplates.TemplateBuilder.OutputComponentsHelper(asset, context);
	ComponentLibraryEnhancedTemplateBuilderHelper.OutputComponentsHelper(asset, context);
%&gt;
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261544</id>
    <label>post_input.aspx</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Templates/Component Framework/Enhanced Template Definition/post_input.aspx</path>
    <folder_id>261538</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Template</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>&lt;%@ Page Language="C#" Inherits="CrownPeak.Internal.Debug.PostInputInit" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.Services" %&gt;
&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.CustomLibrary" %&gt;
&lt;%@ Import Namespace="Component_Library.Component_Project.Components" %&gt;
&lt;% //MODIFY or ADD Import Statements to Define Namespaces Used by the Template %&gt;
&lt;%//This plugin uses PostInputContext as its context class type%&gt;
&lt;%
	//CrownPeak.CMSAPI.ComponentFrameworkTemplates.TemplateBuilder.PostInputHelper(asset, context);
	ComponentLibraryEnhancedTemplateBuilderHelper.PostInputHelper(asset, context);
%&gt;
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261545</id>
    <label>post_save.aspx</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Templates/Component Framework/Enhanced Template Definition/post_save.aspx</path>
    <folder_id>261538</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Template</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>&lt;%@ Page Language="C#" Inherits="CrownPeak.Internal.Debug.PostSaveInit" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.Services" %&gt;
&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.CustomLibrary" %&gt;
&lt;%@ Import Namespace="Component_Library.Component_Project.Components" %&gt;
&lt;% //MODIFY or ADD Import Statements to Define Namespaces Used by the Template %&gt;
&lt;%//This plugin uses PostSaveContext as its context class type%&gt;
&lt;%
	//CrownPeak.CMSAPI.ComponentFrameworkTemplates.TemplateBuilder.PostSaveHelper(asset, context);
	ComponentLibraryEnhancedTemplateBuilderHelper.PostSaveHelper(asset, context);
%&gt;
</value>
      </field>
    </fields>
  </asset>
  <asset>
    <id>261546</id>
    <label>url.aspx</label>
    <template_id>1792</template_id>
    <template_path>/System/Templates/Basis/DeveloperCS/</template_path>
    <template_language>1</template_language>
    <model_id>0</model_id>
    <is_deleted>false</is_deleted>
    <is_hidden>false</is_hidden>
    <workflow_id>
    </workflow_id>
    <status>0</status>
    <status_name>
    </status_name>
    <path>/Component Project/Templates/Component Framework/Enhanced Template Definition/url.aspx</path>
    <folder_id>261538</folder_id>
    <subType>17</subType>
    <templateSubType>
    </templateSubType>
    <intendedType>Template</intendedType>
    <type>2</type>
    <fields>
      <field>
        <name>body</name>
        <value>&lt;%@ Page Language="C#" Inherits="CrownPeak.Internal.Debug.UrlInit" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI" %&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.Services" %&gt;
&lt;!--DO NOT MODIFY CODE ABOVE THIS LINE--&gt;
&lt;%@ Import Namespace="CrownPeak.CMSAPI.CustomLibrary" %&gt;
&lt;%@ Import Namespace="Component_Library.Component_Project.Components" %&gt;
&lt;% //MODIFY or ADD Import Statements to Define Namespaces Used by the Template %&gt;
&lt;%//This plugin uses OutputContext as its context class type%&gt;
&lt;%
CrownPeak.CMSAPI.ComponentFrameworkTemplates.TemplateBuilder.UrlHelper(asset, context);
%&gt;
</value>
      </field>
    </fields>
  </asset>
</assets>