Sdl.Web.Tridion/ContentManager/TcmUri.cs
/// <summary>
/// Converts a string that represents a TCM URI into an actual <see cref="TcmUri"/> type.
/// </summary>
/// <param name="uri">The string representation of a <see cref="TcmUri"/>.</param>
/// <exception cref="InvalidTcmUriException">
///     Thrown if <paramref name="uri"/> is an invalid <see cref="String"/> representation of <see cref="TcmUri"/>.
/// </exception>
Converts a string that represents a TCM URI into an actual  type.
Converts a string that represents a TCM URI into an actual type .
private void Parse(string uri)
        {
            try
            {
                Match match = _tcmUriRegEx.Match(uri);
                if (!match.Success)
                {
                    throw new InvalidTcmUriException(uri);
                }
                _publicationId = (uint)int.Parse(match.Groups["pubId"].Value);
                _itemId = (uint)int.Parse(match.Groups["itemId"].Value);
                if (match.Groups["itemType"].Captures.Count > 0)
                {
                    _itemType = (ItemType)int.Parse(match.Groups["itemType"].Value);
                }
                else
                {
                    _itemType = ItemType.Component;
                }
                if (match.Groups["version"].Captures.Count > 0)
                {
                    _version = (uint)int.Parse(match.Groups["version"].Value);
                }
            }
            catch (Exception ex)
            {
                throw new InvalidTcmUriException(uri, ex);
            }
        }
private void Parse ( string uri ) { try { Match match = _tcmUriRegEx . Match ( uri ) ; if ( ! match . Success ) { throw new InvalidTcmUriException ( uri ) ; } _publicationId = ( uint ) int . Parse ( match . Groups [ " " ] . Value ) ; _itemId = ( uint ) int . Parse ( match . Groups [ " " ] . Value ) ; if ( match . Groups [ " " ] . Captures . Count > 0 ) { _itemType = ( ItemType ) int . Parse ( match . Groups [ " " ] . Value ) ; } else { _itemType = ItemType . Component ; } if ( match . Groups [ " " ] . Captures . Count > 0 ) { _version = ( uint ) int . Parse ( match . Groups [ " " ] . Value ) ; } } catch ( Exception ex ) { throw new InvalidTcmUriException ( uri , ex ) ; } }
Converts a string that represents a TCM URI into an actual  type.
Converts a string that represents a TCM URI into an actual type .
// Getting the values from the RexEx groups, if they exist. // When item type is not specified, this implies ItemType.Component. // NOTE: integer parse errors will be wrapped here
Thrown if  is an invalid  representation of .
Thrown if is an invalid representation of .
uri
string
The string representation of a .
The string representation of a .