private SCActivity <TPublic> Convert <TActivity, TOrigin, TPublic>(TActivity input, Func <TOrigin, TPublic> converter) where TActivity : ActivityBase, IActivity <TOrigin> { return(new SCActivity <TPublic> { Type = input.Type, Tags = string.IsNullOrEmpty(input.Tags) ? new SCActivityTag[0] : input.Tags .Split(new[] { ",", " " }, StringSplitOptions.RemoveEmptyEntries) .Select(x => x.GetValue <SCActivityTag>()) .ToArray(), CreatedAt = dateTimeConverter.SafeConvert(input.CreatedAt), Activity = converter(input.Origin) }); }
public SCWebProfile Convert(WebProfile webProfile) { if (webProfile == null) { return(null); } return(new SCWebProfile { Id = webProfile.Id, Kind = webProfile.Kind, Service = webProfile.Service, Title = webProfile.Title, Url = webProfile.Url, UserName = webProfile.UserName, CreatedAt = dateTimeConverter.SafeConvert(webProfile.CreatedAt) }); }
public SCComment Convert(Comment comment) { if (comment == null) { return(null); } return(new SCComment { Id = comment.Id, Uri = comment.Uri, User = userConverter.Convert(comment.User), UserId = comment.UserId, CreatedAt = dateTimeConverter.SafeConvert(comment.CreatedAt), Body = comment.Body, Timestamp = TimeSpan.FromMilliseconds(comment.Timestamp), TrackId = comment.TrackId }); }
public SCConnection Convert(Connection connection) { if (connection == null) { return(null); } return(new SCConnection { Id = connection.Id, CreatedAt = dateTimeConverter.SafeConvert(connection.CreatedAt), DisplayName = connection.DisplayName, Uri = connection.Uri, Service = connection.Service.GetValue <SCServiceType>(), Type = connection.Type, PostFavorite = connection.PostFavorite, PostPublish = connection.PostPublish }); }