private void SetContentMetadata(TSyncAsset targetAsset, SmintIoAsset rawAsset, SmintIoBinary binary) { var contentTypeString = !string.IsNullOrEmpty(binary?.ContentType) ? binary.ContentType : rawAsset.ContentType; targetAsset.SetContentElementUuid(rawAsset.ContentElementUuid); targetAsset.SetContentProvider(GetContentProviderKey(rawAsset.Provider)); targetAsset.SetContentType(GetContentTypeKey(contentTypeString)); targetAsset.SetContentCategory(GetContentCategoryKey(rawAsset.Category)); targetAsset.SetSmintIoUrl(rawAsset.SmintIoUrl); targetAsset.SetPurchasedAt(rawAsset.PurchasedAt); targetAsset.SetCreatedAt(rawAsset.CreatedAt); targetAsset.SetCartUuid(rawAsset.CartPurchaseTransactionUuid); targetAsset.SetHasBeenCancelled(rawAsset.State == Client.Generated.LicensePurchaseTransactionStateEnum.Cancelled); if (!string.IsNullOrEmpty(binary?.BinaryType)) { targetAsset.SetBinaryType(GetBinaryTypeKey(binary.BinaryType)); } if (rawAsset.LastUpdatedAt != null) { targetAsset.SetLastUpdatedAt((DateTimeOffset)rawAsset.LastUpdatedAt); } if (binary?.Name?.Count > 0) { targetAsset.SetNameInternal(binary.Name); } else if (rawAsset.Name?.Count > 0) { targetAsset.SetNameInternal(rawAsset.Name); } if (binary?.Description?.Count > 0) { targetAsset.SetDescription(binary.Description); } else if (rawAsset.Description?.Count > 0) { targetAsset.SetDescription(rawAsset.Description); } if (!string.IsNullOrEmpty(rawAsset.ProjectUuid)) { targetAsset.SetProjectUuid(rawAsset.ProjectUuid); } if (rawAsset.ProjectName?.Count > 0) { targetAsset.SetProjectName(rawAsset.ProjectName); } if (!string.IsNullOrEmpty(rawAsset.CollectionUuid)) { targetAsset.SetCollectionUuid(rawAsset.CollectionUuid); } if (rawAsset.CollectionName?.Count > 0) { targetAsset.SetCollectionName(rawAsset.CollectionName); } if (rawAsset.Keywords?.Count > 0) { targetAsset.SetKeywords(rawAsset.Keywords); } if (rawAsset.CopyrightNotices?.Count > 0) { targetAsset.SetCopyrightNotices(rawAsset.CopyrightNotices); } if (binary != null) { targetAsset.SetBinaryUuidInternal(binary.Uuid); if (binary.Usage?.Count > 0) { targetAsset.SetBinaryUsageInternal(binary.Usage); } var binaryCulture = binary.Culture; if (!string.IsNullOrEmpty(binaryCulture)) { targetAsset.SetBinaryCulture(binaryCulture); } targetAsset.SetBinaryVersionInternal(binary.Version); } }
internal void SetBinary(SmintIoBinary binary) { Binary = binary; }