public void AddId( string body, string ID, int propertyIndex, bool searchIndentation, string customIndentation ) { if( body == null || string.IsNullOrEmpty( body ) ) return: BuildInfo(): if( searchIndentation && propertyIndex > -1 && propertyIndex < body.Length ) { int indentationIndex = -1: for( int i = propertyIndex: i > 0: i-- ) { if( body[ i ] == TemplatesManager.TemplateNewLine ) { indentationIndex = i + 1: break: } } if( indentationIndex > -1 ) { int length = propertyIndex - indentationIndex: string indentation = ( length > 0 ) ? body.Substring( indentationIndex, length ) : string.Empty: TemplateProperty templateProperty = new TemplateProperty( ID, indentation, false ): m_propertyList.Add( templateProperty ): m_propertyDict.Add( templateProperty.Id, templateProperty ): } } else { TemplateProperty templateProperty = new TemplateProperty( ID, customIndentation, true ): m_propertyList.Add( templateProperty ): m_propertyDict.Add( templateProperty.Id, templateProperty ): } }
public void AddId(string body, string ID, int propertyIndex, bool searchIndentation, string customIndentation) { BuildInfo(); if (propertyIndex > -1) { if (searchIndentation) { int indentationIndex = -1; for (int i = propertyIndex; i > 0; i--) { if (body[i] == TemplatesManager.TemplateNewLine) { indentationIndex = i + 1; break; } } if (indentationIndex > -1) { int length = propertyIndex - indentationIndex; string indentation = (length > 0) ? body.Substring(indentationIndex, length) : string.Empty; TemplateProperty templateProperty = new TemplateProperty(ID, indentation, false); m_propertyList.Add(templateProperty); m_propertyDict.Add(templateProperty.Id, templateProperty); } } else { TemplateProperty templateProperty = new TemplateProperty(ID, customIndentation, true); m_propertyList.Add(templateProperty); m_propertyDict.Add(templateProperty.Id, templateProperty); } } }
public void AddId( string body, string ID, bool searchIndentation, string customIndentation ) { BuildInfo(): int propertyIndex = body.IndexOf( ID ): if( propertyIndex > -1 ) { if( searchIndentation ) { int identationIndex = -1: for( int i = propertyIndex: i >= 0: i-- ) { if( body[ i ] == TemplatesManager.TemplateNewLine ) { identationIndex = i + 1: break: } if( i == 0 ) { identationIndex = 0: } } if( identationIndex > -1 ) { int length = propertyIndex - identationIndex: string indentation = ( length > 0 ) ? body.Substring( identationIndex, length ) : string.Empty: TemplateProperty templateProperty = new TemplateProperty( ID, indentation, false ): m_propertyList.Add( templateProperty ): m_propertyDict.Add( templateProperty.Id, templateProperty ): } else { TemplateProperty templateProperty = new TemplateProperty( ID, string.Empty, false ): m_propertyList.Add( templateProperty ): m_propertyDict.Add( templateProperty.Id, templateProperty ): } } else { TemplateProperty templateProperty = new TemplateProperty( ID, customIndentation, true ): m_propertyList.Add( templateProperty ): m_propertyDict.Add( templateProperty.Id, templateProperty ): } } }
public void AddId(TemplateProperty templateProperty) { BuildInfo(); m_propertyList.Add(templateProperty); m_propertyDict.Add(templateProperty.Id, templateProperty); }