当前位置: 首页>>代码示例>>C#>>正文


C# IBackend.FileIsNotMissing方法代码示例

本文整理汇总了C#中IBackend.FileIsNotMissing方法的典型用法代码示例。如果您正苦于以下问题:C# IBackend.FileIsNotMissing方法的具体用法?C# IBackend.FileIsNotMissing怎么用?C# IBackend.FileIsNotMissing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IBackend的用法示例。


在下文中一共展示了IBackend.FileIsNotMissing方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: _UpdateMP3FileInfo

        ///
        /// Updates the database info for a file. Assumes the file is an
        /// MP3 file.
        ///
        /// \todo Create a pluggable interface to extract the file info
        ///   from various file types, not just mp3
        ///
        void _UpdateMP3FileInfo( string path, IBackend engine )
        {
            // Get ID3 tags from the file

             ID3v2 tag = new ID3v2( path, false );
             if (!tag.isValid)
             {
            _Trace( "Note: No id3v2 tag found in file: '"
                    + path
                    + "'" );

            return;
             }

             if ((null == tag.tit2) || (tag.tit2.Length == 0))
             {
            // Match anything after the last forward/backslash
            string basename = Path.GetFileName( path );
            Debug.Assert( null != basename, "All files have names!" );
            Debug.Assert( basename.Length > 0, "All files have names!" );
            _Trace( "Song title is empty, using file name: '"
                    + basename
                    + "'" );

            tag.tit2 = basename;
             }

             string genre = tag.DefaultGenre;
             if (null == genre)
            genre = "unknown";

             if (engine.EntryExists( path ))
             {
            engine.FileIsNotMissing( path );
             }
             else
             {
            // Oh god, the noise, the noise! Just comment when something interesting
            // heppens, OK?
            // _Trace( "adding '" + path + "'" );

            PlayableData data = new PlayableData();
            data.filePath = path;

            if (tag.tpe1 == null)
               data.artist = "";
            else
               data.artist = tag.tpe1;

            if (tag.talb == null)
               data.album = "";
            else
               data.album = tag.talb;

            if (tag.tit2 == null) // no title, maybe check tit1 and tit3?
               data.title = "";
            else
               data.title = tag.tit2;

            data.track = tag.trackIndex;
            data.genre = genre;
            data.lengthInSeconds = 0; // unknown, ID3 tag doesn't know
            engine.Add( data );
             }
        }
开发者ID:BackupTheBerlios,项目名称:tamjb,代码行数:72,代码来源:RecursiveScanner.cs


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