Beispiel #1
0
 internal Font(SpriteFont xnaFont)
 {
     this.xnaFont   = xnaFont;
     this.charsizes = new Vector[xnaFont.Characters.Count];
     this.name      = null;
     this.source    = ContentSource.ResourceContent;
 }
        /*********
        ** Public methods
        *********/
        /// <summary>Load content from SMAPI's content API with added support for audio files.</summary>
        /// <typeparam name="T">The expected data type.</typeparam>
        /// <param name="content">The content manager to extend.</param>
        /// <param name="key">The asset key to fetch (if the <paramref name="source"/> is <see cref="ContentSource.GameContent"/>), or the local path to a content file relative to the mod folder.</param>
        /// <param name="source">Where to search for a matching content asset.</param>
        /// <remarks>Since this is just a quick prototype, this doesn't handle caching and such for audio files.</remarks>
        public static T ExtendedLoad <T>(this IContentHelper content, string key, ContentSource source = ContentSource.ModFolder)
        {
            // ignore non-audio files
            if (source != ContentSource.ModFolder || key?.Trim().EndsWith(".ogg", StringComparison.InvariantCultureIgnoreCase) != true)
            {
                return(content.Load <T>(key, source));
            }

            // get mod file
            key = content.NormalizeAssetName(key);
            FileInfo file = content.GetPrivateField <object>("ModContentManager").InvokePrivateMethod <FileInfo>("GetModFile", key);

            if (!file.Exists)
            {
                return(content.Load <T>(key, source));
            }

            // load unpacked audio file
            if (typeof(T) != typeof(IModCue) && typeof(T) != typeof(ICue))
            {
                throw new ContentLoadException($"Failed loading asset '{key}' from content manager: can't read file with extension '{file.Extension}' as type '{typeof(T)}'; must be type '{typeof(ICue)}' or '{typeof(IModCue)}'.");
            }
            SoundEffect effect = OggLoader.Load(file.FullName);

            return((T)(object)new SoundEffectCue(key, effect));
        }
        internal override string show()
        {
            StringBuilder sb = new StringBuilder();

            if (this.contentSourceId == 0)
            {
                return(Provider.GetResource("Select the content source"));
            }

            ContentSource contentSource = (ContentSource)Provider.Database.Read(typeof(ContentSource), this.contentSourceId);

            if (contentSource == null)
            {
                return(Provider.GetResource("The content source couldn't be found. It may be deleted."));
            }

            try
            {
                Provider.FetchAutoContent(contentSource);
            }
            catch (Exception ex)
            {
                sb.Append(Provider.GetResource("There was an error while reading auto content") + "<br/>" + ex.Message);
            }

            if (this.showOnlyAutoContent)
            {
                this.Filter += (String.IsNullOrEmpty(this.Filter) ? "" : " AND ") + "ContentSourceId=" + this.contentSourceId;
            }

            sb.Append(base.show());

            return(sb.ToString());
        }
Beispiel #4
0
        /// <summary>Remove an asset from the content cache so it's reloaded on the next request. This will reload core game assets if needed, but references to the former asset will still show the previous content.</summary>
        /// <param name="key">The asset key to fetch (if the <paramref name="source"/> is <see cref="ContentSource.GameContent"/>), or the local path to a content file relative to the mod folder.</param>
        /// <param name="source">Where to search for a matching content asset.</param>
        /// <exception cref="ArgumentException">The <paramref name="key"/> is empty or contains invalid characters.</exception>
        /// <returns>Returns whether the given asset key was cached.</returns>
        public bool InvalidateCache(string key, ContentSource source = ContentSource.ModFolder)
        {
            this.Monitor.Log($"Requested cache invalidation for '{key}' in {source}.", LogLevel.Trace);
            string actualKey = this.GetActualAssetKey(key, source);

            return(this.ContentManager.InvalidateCache((otherKey, type) => otherKey.Equals(actualKey, StringComparison.InvariantCultureIgnoreCase)));
        }
        /*********
        ** Public methods
        *********/
        /// <summary>Load content from SMAPI's content API with added support for audio files.</summary>
        /// <typeparam name="T">The expected data type.</typeparam>
        /// <param name="content">The content manager to extend.</param>
        /// <param name="key">The asset key to fetch (if the <paramref name="source"/> is <see cref="ContentSource.GameContent"/>), or the local path to a content file relative to the mod folder.</param>
        /// <param name="source">Where to search for a matching content asset.</param>
        /// <remarks>Since this is just a quick prototype, this doesn't handle caching and such for audio files.</remarks>
        public static T ExtendedLoad <T>(this IContentHelper content, string key, ContentSource source = ContentSource.ModFolder)
        {
            // check filetype
            FileType type = GetAudioType(key);

            // ignore non-audio files
            if (source != ContentSource.ModFolder || type == FileType.Unknown)
            {
                return(content.Load <T>(key, source));
            }

            // get mod file
            key = content.NormalizeAssetName(key);
            FileInfo file = content.GetPrivateField <object>("ModContentManager").InvokePrivateMethod <FileInfo>("GetModFile", key);

            if (!file.Exists)
            {
                return(content.Load <T>(key, source));
            }

            // load unpacked audio file
            if (typeof(T) != typeof(IModCue) && typeof(T) != typeof(ICue))
            {
                throw new ContentLoadException($"Failed loading asset '{key}' from content manager: can't read file with extension '{file.Extension}' as type '{typeof(T)}'; must be type '{typeof(ICue)}' or '{typeof(IModCue)}'.");
            }
            SoundEffectCue effect = new SoundEffectCue(file.Name, file.FullName, type);

            return((T)(object)effect);
        }
Beispiel #6
0
 public Text <_> GetComplexText(ContentSource contentSource)
 {
     return(Find <Text <_> >(
                $"Complex Text Using {contentSource} Source",
                new TermAttribute("Complex Text"),
                new GetsContentFromSourceAttribute(contentSource)));
 }
Beispiel #7
0
        public Delta GetLatestDeltaInDatabase()
        {
            ContentSource contentSource = ContentSourceFactory.NewContentSource(new Uri(_connectionString));


            using (var session = contentSource.NewSession())
            {
                const string xqueryToExcecute = @"xquery version ""1.0-ml"";
                                           declare namespace m=""http://mldeploy.org"";
                                           for $doc in //*:LatestDelta 
                                           return $doc/m:Number/text()";

                Request request = session.NewAdhocQuery(xqueryToExcecute);
                string  result  = session.SubmitRequest(request).AsString();

                if (result == string.Empty)
                {
                    return(new NoDelta());
                }

                var number      = Int64.Parse(result);
                var description = GetLatestDeltaDescriptionFromDatabase();
                return(new Delta(number, string.Format("{0}\\{1}.xqy", _path, number), description));
            }
        }
 public Navigator(IPersister persister, IHost host, VirtualNodeFactory nodes, ContentSource sources)
 {
     this.persister    = persister;
     this.host         = host;
     this.virtualNodes = nodes;
     this.sources      = sources;
 }
Beispiel #9
0
        public static Texture2D GetIcon(this ContentSource s)
        {
            Texture2D result;

            if (s != ContentSource.Undefined)
            {
                if (s != ContentSource.LocalFolder)
                {
                    if (s != ContentSource.SteamWorkshop)
                    {
                        throw new NotImplementedException();
                    }
                    result = ContentSourceUtility.ContentSourceIcon_SteamWorkshop;
                }
                else
                {
                    result = ContentSourceUtility.ContentSourceIcon_LocalFolder;
                }
            }
            else
            {
                result = BaseContent.BadTex;
            }
            return(result);
        }
Beispiel #10
0
 public Text <_> GetComplexText(ContentSource contentSource)
 {
     return(Controls.Create <Text <_> >(
                $"Complex Text Using {contentSource} Source",
                new TermAttribute("Complex Text"),
                new ContentSourceAttribute(contentSource)));
 }
Beispiel #11
0
        /// <summary>Load content from the game folder or mod folder (if not already cached), and return it. When loading a <c>.png</c> file, this must be called outside the game's draw loop.</summary>
        /// <typeparam name="T">The expected data type. The main supported types are <see cref="Map"/>, <see cref="Texture2D"/>, and dictionaries; other types may be supported by the game's content pipeline.</typeparam>
        /// <param name="key">The asset key to fetch (if the <paramref name="source"/> is <see cref="ContentSource.GameContent"/>), or the local path to a content file relative to the mod folder.</param>
        /// <param name="source">Where to search for a matching content asset.</param>
        /// <exception cref="ArgumentException">The <paramref name="key"/> is empty or contains invalid characters.</exception>
        /// <exception cref="ContentLoadException">The content asset couldn't be loaded (e.g. because it doesn't exist).</exception>
        public T Load <T>(string key, ContentSource source = ContentSource.ModFolder)
        {
            SContentLoadException GetContentError(string reasonPhrase) => new SContentLoadException($"{this.ModName} failed loading content asset '{key}' from {source}: {reasonPhrase}.");

            try
            {
                this.AssertValidAssetKeyFormat(key);
                switch (source)
                {
                case ContentSource.GameContent:
                    return(this.ContentManager.Load <T>(key));

                case ContentSource.ModFolder:
                    // get file
                    FileInfo file = this.GetModFile(key);
                    if (!file.Exists)
                    {
                        throw GetContentError($"there's no matching file at path '{file.FullName}'.");
                    }

                    // get asset path
                    string assetName = this.ContentCore.GetAssetNameFromFilePath(file.FullName);

                    // try cache
                    if (this.ContentCore.IsLoaded(assetName))
                    {
                        return(this.ContentManager.Load <T>(assetName));
                    }

                    // fix map tilesheets
                    if (file.Extension.ToLower() == ".tbin")
                    {
                        // validate
                        if (typeof(T) != typeof(Map))
                        {
                            throw GetContentError($"can't read file with extension '{file.Extension}' as type '{typeof(T)}'; must be type '{typeof(Map)}'.");
                        }

                        // fetch & cache
                        FormatManager formatManager = FormatManager.Instance;
                        Map           map           = formatManager.LoadMap(file.FullName);
                        this.FixCustomTilesheetPaths(map, key);

                        // inject map
                        this.ContentManager.Inject(assetName, map);
                        return((T)(object)map);
                    }

                    // load through content manager
                    return(this.ContentManager.Load <T>(assetName));

                default:
                    throw GetContentError($"unknown content source '{source}'.");
                }
            }
            catch (Exception ex) when(!(ex is SContentLoadException))
            {
                throw new SContentLoadException($"{this.ModName} failed loading content asset '{key}' from {source}.", ex);
            }
        }
Beispiel #12
0
        public Models.ContentSource CreateContentSource()
        {
            var result = new ContentSource();

            this.context.Entry(result).State = System.Data.Entity.EntityState.Added;
            return(result);
        }
        internal static MemoryStream xnb2tbin(string path, IModHelper helper, ContentSource contentSource)
        {
            Map map = helper.Content.Load <Map>(path, contentSource);

            map.LoadTileSheets(Game1.mapDisplayDevice);
            return(map2tbin(map));
        }
Beispiel #14
0
        private void XCCUpload(FileInfo file)
        {
            Logger.Info("Entering XCCUpload");
            ContentCreateOptions options = null;
            Session session = null;

            try
            {
                Uri           uri = new Uri(ConfigurationManager.AppSettings["XCC_Connection"]);
                ContentSource cs  = ContentSourceFactory.NewContentSource(uri);
                session = cs.NewSession();
                Logger.Debug("Logging results for ContentSource");
                this.LoadFile(session, file, options);
            }
            catch (Exception ex)
            {
                CMSException excption = new CMSException(ex.Message, ex);
                Logger.Error("Error on XCCUpload" + ex.Message);
                throw excption;
            }
            finally
            {
                session.Close();
            }
        }
Beispiel #15
0
        public FakeEngine(params Type[] types)
        {
            AddComponentInstance <ITypeFinder>(new FakeTypeFinder(types));
            var definitionManager = TestSupport.SetupDefinitions(types.Where(t => typeof(ContentItem).IsAssignableFrom(t)).ToArray());

            AddComponentInstance <IDefinitionManager>(definitionManager);
            var adapterProvider = new ContentAdapterProvider(this, Resolve <ITypeFinder>());

            AddComponentInstance <IContentAdapterProvider>(adapterProvider);
            var itemRepository = new FakeContentItemRepository();

            AddComponentInstance <IRepository <ContentItem> >(itemRepository);
            AddComponentInstance <IContentItemRepository>(itemRepository);
            var webContext = new ThreadContext();

            AddComponentInstance <IWebContext>(webContext);
            var host = new Host(webContext, 1, 1);

            AddComponentInstance <IHost>(host);
            var security = new FakeSecurityManager();

            AddComponentInstance <ISecurityManager>(security);
            var source = new ContentSource(security, new [] { new DatabaseSource(host, itemRepository) });

            AddComponentInstance(source);
            AddComponentInstance <IPersister>(new ContentPersister(source, itemRepository));
            AddComponentInstance <IWebContext>(webContext);
            var proxyFactory = new InterceptingProxyFactory();

            AddComponentInstance <IProxyFactory>(proxyFactory);
            var activator = new ContentActivator(new N2.Edit.Workflow.StateChanger(), new ItemNotifier(), proxyFactory);

            AddComponentInstance <ContentActivator>(activator);
            activator.Initialize(definitionManager.GetDefinitions());
        }
Beispiel #16
0
 public Importer(IPersister persister, IItemXmlReader reader, IFileSystem fs, ContentSource source, IContentItemRepository repository)
 {
     this.persister = new ContentPersisterImport(source, repository);
     this.reader    = reader;
     this.fs        = fs;
     //TODO: Initialize 'logger' ---> this.logger =;
 }
Beispiel #17
0
        /// <summary>Switch the audio source.</summary>
        /// <param name="source">Where to load the sound from.</param>
        /// <param name="cueName">The cue name to play.</param>
        private void SetAudio(ContentSource source, string cueName)
        {
            if (source == this.Source && cueName == this.CueName)
            {
                return;
            }

            // remove last sound
            this.Cue?.Stop(AudioStopOptions.Immediate);

            // set new sound
            this.Source  = source;
            this.CueName = cueName;
            if (cueName != null)
            {
                switch (source)
                {
                case ContentSource.GameContent:
                    this.Cue = Game1.soundBank.GetCue(cueName);
                    break;

                case ContentSource.ModFolder:
                {
                    IModCue sound = this.Helper.Content.ExtendedLoad <IModCue>($"assets/{cueName}.ogg");
                    sound.IsLooped = true;
                    this.Cue       = sound;
                }
                break;
                }
            }
            else
            {
                this.Cue = null;
            }
        }
Beispiel #18
0
 public Task <ContentResponse> BrowseContinuationAsync(
     MediaNamespace mediaNamespace,
     ContentSource source,
     ItemType type,
     string continuationToken)
 {
     return(BrowseApiAsync(mediaNamespace, source, type, continuationToken: continuationToken));
 }
Beispiel #19
0
 internal Font(string name, ContentSource source, int fontSize)
 {
     this.xnaFont   = null;
     this.charsizes = null;
     this.name      = name;
     this.source    = source;
     this.fontSize  = fontSize;
 }
Beispiel #20
0
 public void SaveAnything()
 {
     IContentSource content = new ContentSource {
         Category = CategoryEnum.Personal, SourceId = 1, SourceUri = "xyz"
     };
     ContentSourceRepository repo = new ContentSourceRepository();
     var response = repo.Insert(content);
 }
Beispiel #21
0
        public override void SetUp()
        {
            base.SetUp();

            webContext = new ThreadContext();
            host       = new Host(webContext, 1, 1);
            source     = TestSupport.SetupContentSource(webContext, host, persister);
        }
 public Texture2DExtended(IContentPack ContentPack, string modID, string path)
 {
     this.Name    = Path.GetFileNameWithoutExtension(path);
     this.path    = path;
     this.texture = ContentPack.LoadAsset <Texture2D>(path);
     this.helper  = null;
     this.modID   = modID;
     this.source  = ContentSource.ModFolder;
 }
Beispiel #23
0
        private static ContentSource CreateSource()
        {
            ContentSource cs = new ContentSource(new Fakes.FakeSecurityManager(), new SourceBase[] {
                new DatabaseSource(null, null),
                new TestSource()
            });

            return(cs);
        }
Beispiel #24
0
        public void DatabaseSource_IsOrdered_AfterInterfaceSource()
        {
            ContentSource cs = new ContentSource(new Fakes.FakeSecurityManager(), new SourceBase[] {
                new DatabaseSource(null, null),
                new TestSource()
            });

            Assert.That(cs.Sources.Last(), Is.TypeOf <DatabaseSource>());
        }
        public ClassModel(string name, ContentSource source, string markdown)
        {
            _Spells     = new ObservableList <SpellModel>();
            _Subclasses = new ObservableList <ClassModel>();

            Name     = name;
            Source   = source;
            Markdown = markdown;
        }
Beispiel #26
0
 public Texture2DExtended(IModHelper helper, string modID, string path, ContentSource contentSource = ContentSource.ModFolder)
 {
     this.Name    = Path.GetFileNameWithoutExtension(path);
     this.path    = path;
     this.texture = helper.Content.Load <Texture2D>(path, contentSource);
     this.helper  = helper;
     this.modID   = modID;
     this.source  = contentSource;
 }
Beispiel #27
0
 public Task <ContentResponse> SubBrowseContinuationAsync(
     string id,
     ContentSource source,
     BrowseItemType browseType,
     ExtraDetails extra,
     string continuationToken)
 {
     return(SubBrowseApiAsync(id, source, browseType, extra, continuationToken: continuationToken));
 }
Beispiel #28
0
        private void Run(string script)
        {
            ContentSource contentSource = ContentSourceFactory.NewContentSource(new Uri(_connectionString));

            using (var session = contentSource.NewSession())
            {
                Request request = session.NewAdhocQuery(script);
                session.SubmitRequest(request).AsString();
            }
        }
 public static Texture2D GetIcon(this ContentSource s)
 {
     return(s switch
     {
         ContentSource.Undefined => BaseContent.BadTex,
         ContentSource.OfficialModsFolder => ContentSourceIcon_OfficialModsFolder,
         ContentSource.ModsFolder => ContentSourceIcon_ModsFolder,
         ContentSource.SteamWorkshop => ContentSourceIcon_SteamWorkshop,
         _ => throw new NotImplementedException(),
     });
        public static bool Convert(string pathIn, string pathOut, IModHelper helper, ContentSource contentSource = ContentSource.ModFolder, IMonitor monitor = null)
        {
            if (!pathIn.EndsWith(".tbin") && !pathIn.EndsWith(".xnb") && !pathOut.EndsWith(".tmx"))
            {
                new FileInfo(Path.Combine(helper.DirectoryPath, pathIn)).CopyTo(Path.Combine(helper.DirectoryPath, pathOut), true);
                return(true);
            }

            if (!pathOut.EndsWith(".tmx"))
            {
                pathOut = pathOut + ".tmx";
            }


            MemoryStream mem = null;

            try
            {
                if (pathIn.EndsWith(".tbin"))
                {
                    mem = tbin2tmx(pathIn, helper, contentSource);
                }
                else
                {
                    mem = xnb2tmx(pathIn, helper, contentSource);
                }

                FileStream file = new FileStream(Path.Combine(helper.DirectoryPath, pathOut), FileMode.Create);
                mem.Position = 0;
                mem.CopyTo(file);

                if (monitor != null)
                {
                    monitor.Log($"Converting {pathIn} -> {pathOut}", LogLevel.Trace);
                }
                return(true);
            }
            catch (Exception ex)
            {
                Monitor.Log("Map Error" + ex.Message + ":" + ex.StackTrace);

                try
                {
                    string    imagePath = pathOut.Replace(".tmx", ".png");
                    Texture2D image     = helper.Content.Load <Texture2D>(pathIn);
                    image.SaveAsPng(new FileStream(Path.Combine(helper.DirectoryPath, imagePath), FileMode.Create), image.Width, image.Height);
                    return(true);
                }
                catch (Exception e)
                {
                    Monitor.Log("Image Error" + e.Message + ":" + e.StackTrace);
                    return(false);
                }
            }
        }
Beispiel #31
0
 public static IHtmlString JsBuilder(this HtmlHelper htmlHelper, UrlHelper url, string value, ContentSource source)
 {
     TagBuilder builder = new TagBuilder("script");
     switch (source)
     {
         case ContentSource.Site:
             builder.Attributes.Add("src", url.Content("~/Scripts/" + value));
             break;
         case ContentSource.CDN:
             if (GlobalConfig.IsCDNEnabled)
                 builder.Attributes.Add("src", url.Content(String.Format("{0}/Scripts/{1}", GlobalConfig.CDNBaseUrl, value)));
             else
                 builder.Attributes.Add("src", url.Content("~/cdn/Scripts/") + value);
             break;
         case ContentSource.Assets:
             builder.Attributes.Add("src", url.Content(String.Format("{0}/scripts/{1}", GlobalConfig.AssetsBaseUrl, value)));
             break;
     }
     builder.Attributes.Add("type", "text/javascript");
     builder.Attributes.Add("language", "JavaScript");
     return htmlHelper.Raw(builder.ToString());
 }
Beispiel #32
0
 public static IHtmlString CssBuilder(this HtmlHelper htmlHelper, UrlHelper url, string value, ContentSource source)
 {
     TagBuilder builder = new TagBuilder("link");
     switch (source)
     {
         case ContentSource.Site:
             builder.Attributes.Add("href", url.Content("~/Content/" + value));
             break;
         case ContentSource.CDN:
             if (GlobalConfig.IsCDNEnabled)
                 builder.Attributes.Add("href", url.Content(String.Format("{0}/Content/{1}", GlobalConfig.CDNBaseUrl, value)));
             else
                 builder.Attributes.Add("href", url.Content("~/cdn/Content/") + value);
             break;
         case ContentSource.Assets:
             builder.Attributes.Add("href", @url.Content(String.Format("{0}/content/{1}", GlobalConfig.AssetsBaseUrl, value)));
             break;
     }
     builder.Attributes.Add("rel", "stylesheet");
     builder.Attributes.Add("type", "text/css");
     return htmlHelper.Raw(builder.ToString(TagRenderMode.SelfClosing));
 }
 private void ConstructStartAddresses(ContentSource contentSource, 
     IEnumerable<XElement> startAddressElements)
 {
     Func<XElement, Uri> startAddressConstructor;
     if (contentSource.Type == ContentSourceType.Web)
         startAddressConstructor = ConstructWebStartAddress;
     else if (contentSource.Type == ContentSourceType.Business)
         startAddressConstructor = ConstructBusinessDataStartAddress;
     else
         throw new InvalidOperationException(
             string.Format(ContentSourceNotSupportedExceptionFormat,
                 contentSource.Type));
     foreach (var startAddressElement in startAddressElements)
     {
         contentSource.StartAddresses.Add(startAddressConstructor(startAddressElement));
     }
 }
Beispiel #34
0
        public static IHtmlString ImageBuilder(this HtmlHelper htmlHelper, UrlHelper url, string image, [System.Runtime.InteropServices.Optional, System.Runtime.InteropServices.DefaultParameterValue(null)] object htmlAttributes, ContentSource source)
        {
            TagBuilder builder = new TagBuilder("img");
            switch (source)
            {
                case ContentSource.Site:
                    builder.Attributes.Add("src", url.Content("~/Content/images/") + image);
                    break;
                case ContentSource.CDN:
                    if (GlobalConfig.IsCDNEnabled)
                        builder.Attributes.Add("src", url.Content(String.Format("{0}/Content/images/{1}", GlobalConfig.CDNBaseUrl, image)));
                    else
                        builder.Attributes.Add("src", url.Content("~/cdn/Content/images/") + image);
                    break;
                case ContentSource.Assets:
                    builder.Attributes.Add("src", url.Content(String.Format("{0}/content/images/{1}", GlobalConfig.AssetsBaseUrl, image)));
                    break;

            }
            builder.Attributes.Add("border", "0");
            builder.MergeAttributes(new RouteValueDictionary(htmlAttributes));
            return htmlHelper.Raw(builder.ToString(TagRenderMode.SelfClosing));
        }
Beispiel #35
0
 /**
  *
  */
 private void PrepareContentSource()
 {
     //logger.info("using content source " + connectionUri);
     try
     {
         // support SSL
         bool ssl = connectionUri.Scheme.Equals("xccs");
         contentSource =
             ssl ?
                 ContentSourceFactory.NewContentSource(connectionUri/*, newTrustAnyoneOptions()*/)
                 : ContentSourceFactory.NewContentSource(connectionUri);
     }
     catch (XccConfigException e)
     {
         //logger.logException(connectionUri.toString(), e);
         throw e;
     }
     //catch (KeyManagementException e) {
     //    logger.logException(connectionUri.toString(), e);
     //    throw new RuntimeException(e);
     //} catch (NoSuchAlgorithmException e) {
     //    logger.logException(connectionUri.toString(), e);
     //    throw new RuntimeException(e);
     //}
     catch
     {
         throw;
     }
 }
 /// <summary>
 /// Lookup an item and get details about it.
 /// </summary>
 /// <param name="client">An IXboxMusicClient instance.</param>
 /// <param name="itemId">Id to look up, prefixed by a namespace: {namespace.id}.</param>
 /// <param name="source">The content source: Catalog, Collection or both</param>
 /// <param name="language">ISO 2 letter code.</param>
 /// <param name="country">ISO 2 letter code.</param>
 /// <param name="extras">Enumeration of extra details.</param>
 /// <returns> Content response with details about one or more items.</returns>
 public static Task<ContentResponse> LookupAsync(this IXboxMusicClient client, string itemId, ContentSource? source = null, string language = null,
     string country = null, ExtraDetails extras = ExtraDetails.None)
 {
     return client.LookupAsync(new List<string> { itemId }, source, language, country, extras);
 }