Disco.Services.AttachmentDataStoreExtensions.RepositoryThumbnailFilename C# (CSharp) Method

RepositoryThumbnailFilename() public static method

public static RepositoryThumbnailFilename ( this Attachment, DiscoDataContext Database ) : string
Attachment this
Database Disco.Data.Repository.DiscoDataContext
return string
        public static string RepositoryThumbnailFilename(this IAttachment Attachment, DiscoDataContext Database)
        {
            switch (Attachment.AttachmentType)
            {
                case AttachmentTypes.Device:
                    return Path.Combine(DataStore.CreateLocation(Database, "DeviceAttachments", Attachment.Timestamp),
                        string.Format("{0}_{1}_thumb.jpg", Attachment.Reference, Attachment.Id));
                case AttachmentTypes.Job:
                    return Path.Combine(DataStore.CreateLocation(Database, "JobAttachments", Attachment.Timestamp),
                        string.Format("{0}_{1}_thumb.jpg", Attachment.Reference, Attachment.Id));
                case AttachmentTypes.User:
                    return Path.Combine(DataStore.CreateLocation(Database, "UserAttachments", Attachment.Timestamp),
                        string.Format("{0}_{1}_thumb.jpg", ((string)Attachment.Reference).Replace('\\', '_'), Attachment.Id));
                default:
                    throw new ArgumentException("Unknown Attachment Type", nameof(Attachment));
            }
        }