• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# BaseItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中BaseItem的典型用法代码示例。如果您正苦于以下问题:C# BaseItem类的具体用法?C# BaseItem怎么用?C# BaseItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BaseItem类属于命名空间,在下文中一共展示了BaseItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Save

        /// <summary>
        /// Saves the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task.</returns>
        public void Save(BaseItem item, CancellationToken cancellationToken)
        {
            var builder = new StringBuilder();

            builder.Append("<Item>");

            XmlSaverHelpers.AddCommonNodes(item, builder);

            if (item.ProductionLocations.Count > 0)
            {
                builder.Append("<PlaceOfBirth>" + SecurityElement.Escape(item.ProductionLocations[0]) + "</PlaceOfBirth>");
            }

            builder.Append("</Item>");

            var xmlFilePath = GetSavePath(item);

            XmlSaverHelpers.Save(builder, xmlFilePath, new[]
                {
                    "PlaceOfBirth"
                });

            // Set last refreshed so that the provider doesn't trigger after the file save
            PersonProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
        }
开发者ID:0sm0,项目名称:MediaBrowser,代码行数:31,代码来源:PersonXmlSaver.cs


示例2: SetInitialItemValues

        /// <summary>
        /// Sets the initial item values.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="parent">The parent.</param>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="libraryManager">The library manager.</param>
        /// <param name="directoryService">The directory service.</param>
        /// <exception cref="System.ArgumentException">Item must have a path</exception>
        public static void SetInitialItemValues(BaseItem item, Folder parent, IFileSystem fileSystem, ILibraryManager libraryManager, IDirectoryService directoryService)
        {
            // This version of the below method has no ItemResolveArgs, so we have to require the path already being set
            if (string.IsNullOrWhiteSpace(item.Path))
            {
                throw new ArgumentException("Item must have a Path");
            }

            // If the resolver didn't specify this
            if (parent != null)
            {
                item.Parent = parent;
            }

            item.Id = libraryManager.GetNewItemId(item.Path, item.GetType());

            item.IsLocked = item.Path.IndexOf("[dontfetchmeta]", StringComparison.OrdinalIgnoreCase) != -1 ||
                item.Parents.Any(i => i.IsLocked);

            // Make sure DateCreated and DateModified have values
            var fileInfo = directoryService.GetFile(item.Path);
            item.DateModified = fileSystem.GetLastWriteTimeUtc(fileInfo);
            SetDateCreated(item, fileSystem, fileInfo);

            EnsureName(item, fileInfo);
        }
开发者ID:jrags56,项目名称:MediaBrowser,代码行数:35,代码来源:ResolverHelper.cs


示例3: FetchAsync

        public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
        {
            var releaseId = item.GetProviderId(MetadataProviders.Musicbrainz);
            var releaseGroupId = item.GetProviderId(MetadataProviders.MusicBrainzReleaseGroup);

            if (string.IsNullOrEmpty(releaseId))
            {
                var result = await GetReleaseResult((MusicAlbum)item, cancellationToken).ConfigureAwait(false);

                if (!string.IsNullOrEmpty(result.ReleaseId))
                {
                    releaseId = result.ReleaseId;
                    item.SetProviderId(MetadataProviders.Musicbrainz, releaseId);
                }

                if (!string.IsNullOrEmpty(result.ReleaseGroupId))
                {
                    releaseGroupId = result.ReleaseGroupId;
                    item.SetProviderId(MetadataProviders.MusicBrainzReleaseGroup, releaseGroupId);
                }
            }

            // If we have a release Id but not a release group Id...
            if (!string.IsNullOrEmpty(releaseId) && string.IsNullOrEmpty(releaseGroupId))
            {
                releaseGroupId = await GetReleaseGroupId(releaseId, cancellationToken).ConfigureAwait(false);

                item.SetProviderId(MetadataProviders.MusicBrainzReleaseGroup, releaseGroupId);
            }

            SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
            return true;
        }
开发者ID:RomanDengin,项目名称:MediaBrowser,代码行数:33,代码来源:MusicBrainzAlbumProvider.cs


示例4: IsEnabledFor

        /// <summary>
        /// Determines whether [is enabled for] [the specified item].
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="updateType">Type of the update.</param>
        /// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
        public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
        {
            if (!(item is Folder))
            {
                return false;
            }

            var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit;
            var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload;
            
            // If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed
            if ((_config.Configuration.SaveLocalMeta && wasMetadataDownloaded) || wasMetadataEdited)
            {
                if (!(item is Series) && !(item is BoxSet) && !(item is MusicArtist) && !(item is MusicAlbum) &&
                    !(item is Season))
                {
                    return true;
                }
            }

            // If new metadata has been downloaded or metadata was manually edited, proceed
            if (wasMetadataDownloaded || wasMetadataEdited)
            {
                if (item is AggregateFolder || item is UserRootFolder || item is CollectionFolder)
                {
                    return true;
                }
            }

            return false;
        }
开发者ID:0sm0,项目名称:MediaBrowser,代码行数:37,代码来源:FolderXmlSaver.cs


示例5: Fetch

        /// <summary>
        /// Fetches the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
        private async Task<bool> Fetch(BaseItem item, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            
            var metadataFile = item.ResolveArgs.GetMetaFileByPath(Path.Combine(item.MetaLocation, "movie.xml"));

            if (metadataFile != null)
            {
                var path = metadataFile.FullName;
                var boxset = item as BoxSet;

                await XmlParsingResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);

                try
                {
                    if (boxset != null)
                    {
                        new BaseItemXmlParser<BoxSet>(Logger).Fetch(boxset, path, cancellationToken);
                    }
                    else
                    {
                        new BaseItemXmlParser<Movie>(Logger).Fetch((Movie)item, path, cancellationToken);
                    }
                }
                finally
                {
                    XmlParsingResourcePool.Release();
                }

                SetLastRefreshed(item, DateTime.UtcNow);
                return true;
            }

            return false;
        }
开发者ID:snap608,项目名称:MediaBrowser,代码行数:41,代码来源:MovieProviderFromXml.cs


示例6: BaseEquipment

 public BaseEquipment(BaseItem item)
     : base(item)
 {
     subType = ((BaseEquipment)item).subType;
     Stats = new EquipmentStatCollection();
     Stats.AddStat<LinkableStat>(StatType.ARMOR, item.Stats.GetStat(StatType.ARMOR).BaseValue);
 }
开发者ID:RAWeber,项目名称:Unity,代码行数:7,代码来源:BaseEquipment.cs


示例7: Assign

 internal override void Assign(BaseItem baseItem ) { 
     base.Assign(baseItem);
     folder = (Folder)baseItem;
     folderChildren.Assign(this, FireChildrenChangedEvents);
     folder.QuickListChanged += QuickListChanged;
     folder.UnwatchedCountChanged += AdjustUnwatched;
 }
开发者ID:neil18,项目名称:MediaBrowser.Classic,代码行数:7,代码来源:FolderModel.cs


示例8: Start

 // Use this for initialization
 void Start()
 {
     Physics.IgnoreCollision(GameControl.player.GetComponent<Collider>(), this.GetComponent<Collider>());
     try
     {
         switch (ItemDatabase.itemDatabase[itemName].Type)
         {
             case BaseItem.ItemType.WEAPON:
                 item = new BaseWeapon((BaseWeapon)ItemDatabase.itemDatabase[itemName]);
                 break;
             case BaseItem.ItemType.EQUIPMENT:
                 item = new BaseEquipment(ItemDatabase.itemDatabase[itemName]);
                 break;
             case BaseItem.ItemType.RELIC:
                 item = new BaseRelic(ItemDatabase.itemDatabase[itemName]);
                 for (int i = 0; i < UnityEngine.Random.Range(1, 3); i++)
                 {
                     int randStat = UnityEngine.Random.Range((int)StatType.STRENGTH, (int)StatType.DEFENSE+1);
                     item.Stats.AddStat<ModifiableStat>((StatType)randStat, UnityEngine.Random.Range(1, 11));
                 }
                 break;
             case BaseItem.ItemType.CONSUMABLE:
                 item = new BaseConsumable(ItemDatabase.itemDatabase[itemName]);
                 break;
         }
     }
     catch (Exception)
     {
         Debug.Log("No item of name "+itemName+" within itemDatabase");
     }
 }
开发者ID:RAWeber,项目名称:Unity,代码行数:32,代码来源:GameItem.cs


示例9: FetchAsync

        /// <summary>
        /// Fetches metadata and returns true or false indicating if any work that requires persistence was done
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="force">if set to <c>true</c> [force].</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task{System.Boolean}.</returns>
        public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            var path = MovieXmlSaver.GetMovieSavePath(item);

            if (File.Exists(path))
            {
                await XmlParsingResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);

                try
                {
                    var video = (Video)item;

                    await new MovieXmlParser(Logger, _itemRepo).FetchAsync(video, path, cancellationToken).ConfigureAwait(false);
                }
                finally
                {
                    XmlParsingResourcePool.Release();
                }
            }

            SetLastRefreshed(item, DateTime.UtcNow, providerInfo);

            return true;
        }
开发者ID:RomanDengin,项目名称:MediaBrowser,代码行数:33,代码来源:MovieProviderFromXml.cs


示例10: FindId

        /// <summary>
        /// Finds the id.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task{System.String}.</returns>
        private async Task<string> FindId(BaseItem item, CancellationToken cancellationToken)
        {
            if (item is Artist)
            {
                // Since MusicArtists are refreshed first, try to find it from one of them
                var id = FindIdFromMusicArtistEntity(item);

                if (!string.IsNullOrEmpty(id))
                {
                    return id;
                }
            }

            try
            {
                // If we don't get anything, go directly to music brainz
                return await FindIdFromMusicBrainz(item, cancellationToken).ConfigureAwait(false);
            }
            catch (HttpException e)
            {
                if (e.StatusCode.HasValue && e.StatusCode.Value == HttpStatusCode.BadRequest)
                {
                    // They didn't like a character in the name. Handle the exception so that the provider doesn't keep retrying over and over
                    return null;
                }

                throw;
            }
        }
开发者ID:Jon-theHTPC,项目名称:MediaBrowser,代码行数:35,代码来源:LastfmArtistProvider.cs


示例11: GetValue

        private string GetValue(BaseItem item)
        {
            Series series = null;

            var season = item as Season;

            if (season != null)
            {
                series = season.Series;
            }

            var episode = item as Episode;

            if (episode != null)
            {
                series = episode.Series;
            }

            if (series == null)
            {
                series = item as Series;
            }

            return series != null ? series.SortName : null;
        }
开发者ID:paul-777,项目名称:Emby,代码行数:25,代码来源:SeriesSortNameComparer.cs


示例12: GetFileSystemStamp

        protected override Guid GetFileSystemStamp(BaseItem item)
        {
            var location = GetLocation(item);

            try
            {
                var files = new DirectoryInfo(location)
                    .EnumerateFiles("*", SearchOption.TopDirectoryOnly)
                    .Where(i =>
                    {
                        var ext = i.Extension;

                        return !string.IsNullOrEmpty(ext) &&
                            BaseItem.SupportedImageExtensions.Contains(ext, StringComparer.OrdinalIgnoreCase);
                    })
                    .ToList();

                return GetFileSystemStamp(files);
            }
            catch (DirectoryNotFoundException)
            {
                // User doesn't have the folder. No need to log or blow up

                return Guid.Empty;
            }
        }
开发者ID:Jon-theHTPC,项目名称:MediaBrowser,代码行数:26,代码来源:ImagesByNameProvider.cs


示例13: FetchAsync

        /// <summary>
        /// Fetches metadata and returns true or false indicating if any work that requires persistence was done
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="force">if set to <c>true</c> [force].</param>
        /// <param name="providerInfo">The provider information.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task{System.Boolean}.</returns>
        public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            var metadataFile = item.ResolveArgs.GetMetaFileByPath(Path.Combine(item.MetaLocation, XmlFileName));

            if (metadataFile != null)
            {
                var path = metadataFile.FullName;

                await XmlParsingResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);

                try
                {
                    new BaseItemXmlParser<Folder>(Logger).Fetch((Folder)item, path, cancellationToken);
                }
                finally
                {
                    XmlParsingResourcePool.Release();
                }
            }

            SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
            return true;
        }
开发者ID:RomanDengin,项目名称:MediaBrowser,代码行数:33,代码来源:FolderProviderFromXml.cs


示例14: DeleteItem

 public static Task DeleteItem(this ILibraryManager manager, BaseItem item)
 {
     return manager.DeleteItem(item, new DeleteOptions
     {
         DeleteFileLocation = true
     });
 }
开发者ID:rezafouladian,项目名称:Emby,代码行数:7,代码来源:LibraryManagerExtensions.cs


示例15: AssignItem

 public void AssignItem(BaseItem item)
 {
     ItemScript = item;
     spriteImage.sprite = ItemScript.inventoryTile;
     UpdateQuantity(item.Quantity);
     ItemScript.onQuantityChanged += ItemScript_onQuantityChanged;
 }
开发者ID:DanStout,项目名称:FablesOfSol,代码行数:7,代码来源:InventoryButton.cs


示例16: NeedsRefreshInternal

        protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
        {
            if (HasAltMeta(item))
                return false;

            return base.NeedsRefreshInternal(item, providerInfo);
        }
开发者ID:rrb008,项目名称:MediaBrowser,代码行数:7,代码来源:TmdbPersonProvider.cs


示例17: Save

        /// <summary>
        /// Saves the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task.</returns>
        public void Save(BaseItem item, CancellationToken cancellationToken)
        {
            var builder = new StringBuilder();

            builder.Append("<Item>");

            var game = (Game)item;

            if (game.PlayersSupported.HasValue)
            {
                builder.Append("<Players>" + SecurityElement.Escape(game.PlayersSupported.Value.ToString(UsCulture)) + "</Players>");
            }

            if (!string.IsNullOrEmpty(game.GameSystem))
            {
                builder.Append("<GameSystem><![CDATA[" + game.GameSystem + "]]></GameSystem>");
            }
            
            XmlSaverHelpers.AddCommonNodes(item, builder);

            builder.Append("</Item>");

            var xmlFilePath = GetSavePath(item);

            XmlSaverHelpers.Save(builder, xmlFilePath, new[]
                {
                    "Players",
                    "GameSystem"
                });

            // Set last refreshed so that the provider doesn't trigger after the file save
            MovieProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
        }
开发者ID:rrb008,项目名称:MediaBrowser,代码行数:39,代码来源:GameXmlSaver.cs


示例18: GetItemElement

        public XmlElement GetItemElement(XmlDocument doc, BaseItem item, string deviceId, Filter filter, StreamInfo streamInfo = null)
        {
            var element = doc.CreateElement(string.Empty, "item", NS_DIDL);
            element.SetAttribute("restricted", "1");
            element.SetAttribute("id", item.Id.ToString("N"));

            if (item.Parent != null)
            {
                element.SetAttribute("parentID", item.Parent.Id.ToString("N"));
            }

            //AddBookmarkInfo(item, user, element);

            AddGeneralProperties(item, element, filter);

            // refID?
            // storeAttribute(itemNode, object, ClassProperties.REF_ID, false);

            var audio = item as Audio;
            if (audio != null)
            {
                AddAudioResource(element, audio, deviceId, filter, streamInfo);
            }

            var video = item as Video;
            if (video != null)
            {
                AddVideoResource(element, video, deviceId, filter, streamInfo);
            }

            AddCover(item, element);

            return element;
        }
开发者ID:rsolmn,项目名称:MediaBrowser,代码行数:34,代码来源:DidlBuilder.cs


示例19: CanSync

        public bool CanSync(BaseItem item, TraktUser traktUser)
        {
            if (item.Path == null || item.LocationType == LocationType.Virtual)
            {
                return false;
            }

            if (traktUser.LocationsExcluded != null && traktUser.LocationsExcluded.Any(s => _fileSystem.ContainsSubPath(s, item.Path)))
            {
                return false;
            }

            var movie = item as Movie;

            if (movie != null)
            {
                return !string.IsNullOrEmpty(movie.GetProviderId(MetadataProviders.Imdb)) ||
                    !string.IsNullOrEmpty(movie.GetProviderId(MetadataProviders.Tmdb));
            }

            var episode = item as Episode;

            if (episode != null && episode.Series != null && !episode.IsVirtualUnaired && !episode.IsMissingEpisode)
            {
                var series = episode.Series;

                return !string.IsNullOrEmpty(series.GetProviderId(MetadataProviders.Imdb)) ||
                    !string.IsNullOrEmpty(series.GetProviderId(MetadataProviders.Tvdb));
            }

            return false;
        }
开发者ID:ryu4000,项目名称:MediaBrowser.Plugins,代码行数:32,代码来源:TraktApi.cs


示例20: Compare

        /// <summary>
        /// Compares the specified x.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        /// <returns>System.Int32.</returns>
        public int Compare(BaseItem x, BaseItem y)
        {
            if (x.PremiereDate.HasValue && y.PremiereDate.HasValue)
            {
                var val = DateTime.Compare(x.PremiereDate.Value, y.PremiereDate.Value);

                if (val != 0)
                {
                    //return val;
                }
            }

            var episode1 = x as Episode;
            var episode2 = y as Episode;

            if (episode1 == null)
            {
                if (episode2 == null)
                {
                    return 0;
                }

                return 1;
            }

            if (episode2 == null)
            {
                return -1;
            }

            return Compare(episode1, episode2);
        }
开发者ID:bigjohn322,项目名称:MediaBrowser,代码行数:38,代码来源:AiredEpisodeOrderComparer.cs



注:本文中的BaseItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# BaseMethodCompiler类代码示例发布时间:2022-05-24
下一篇:
C# BaseInstruction类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap