1

Resolved

"Media" Extras Option not working

description

It's important for us to be able to see the media type of the Photo item, but p.Extras == ( ExtrasOption.Media ) was not working until updated the GetExtrasString method from Helper.cs to include the following:

if ( ( extras & ExtrasOption.Media ) == ExtrasOption.Media )
{
   if ( builder.Length > 0 ) builder.Append( "," );
   builder.Append( ExtrasOption.Media.ToString() );
}
return builder.ToString().ToLower();


... alternatively I've also rewritten this method for you to be a little cleaner (also attached updated Helper.cs):
internal static string GetExtrasString( this ExtrasOption extras )
{
    List<string> list = new List<string>();

    if ( ( extras & ExtrasOption.Date_Taken ) == ExtrasOption.Date_Taken )
    {
        list.Add( ExtrasOption.Date_Taken.ToString() );
    }
    if ( ( extras & ExtrasOption.Date_Upload ) == ExtrasOption.Date_Upload )
    {
        list.Add( ExtrasOption.Date_Upload.ToString() );
    }
    if ( ( extras & ExtrasOption.Icon_Server ) == ExtrasOption.Icon_Server )
    {
        list.Add( ExtrasOption.Icon_Server.ToString() );
    }
    if ( ( extras & ExtrasOption.License ) == ExtrasOption.License )
    {
        list.Add( ExtrasOption.License.ToString() );
    }
    if ( ( extras & ExtrasOption.Owner_Name ) == ExtrasOption.Owner_Name )
    {
        list.Add( ExtrasOption.Owner_Name.ToString() );
    }
    if ( ( extras & ExtrasOption.Original_Format ) == ExtrasOption.Original_Format )
    {
        list.Add( ExtrasOption.Owner_Name.ToString() );
    }
    if ( ( extras & ExtrasOption.Last_Update ) == ExtrasOption.Last_Update )
    {
        list.Add( ExtrasOption.Last_Update.ToString() );
    }
    if ( ( extras & ExtrasOption.Tags ) == ExtrasOption.Tags )
    {
        list.Add( ExtrasOption.Tags.ToString() );
    }
    if ( ( extras & ExtrasOption.Geo ) == ExtrasOption.Geo )
    {
        list.Add( ExtrasOption.Geo.ToString() );
    }
    if ( ( extras & ExtrasOption.Views ) == ExtrasOption.Views )
    {
        list.Add( ExtrasOption.Views.ToString() );
    }
    if ( ( extras & ExtrasOption.Media ) == ExtrasOption.Media )
    {
        list.Add( ExtrasOption.Media.ToString() );
    }

    return string.Join( ",", list.ToArray() ).ToLower();
}

file attachments

comments

mehfuzh wrote Apr 10, 2009 at 10:44 AM

Great.. i will add to to the code. Thanks !!!