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


C# UnicodeEncoding.Replace方法代码示例

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


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

示例1: parseMhod

        private void parseMhod(MediaItem media)
        {
            byte[] buff = new byte[4];
            long position = strDB.Position;
            debug("Found mhod");
            seek(8); //skip over mhod to total length
            strDB.Read(buff, 0, 4); //read total length
            long totalLength = System.BitConverter.ToUInt32(buff, 0);
            debug("Size of this mhod is " + totalLength);
            strDB.Read(buff, 0, 4); //now at position 20 of this mhod
            long type = System.BitConverter.ToUInt32(buff, 0);
            if ((type == (long)Types.Album) || (type == (long)Types.Artist) || (type == (long)Types.Genre) ||
                (type == (long)Types.Location) || (type == (long)Types.Title)) //artist, album, title, filename
            {
                debug("Read type : " + type);
                seek(12);
                strDB.Read(buff, 0, 4); //read length of string
                long strLen = System.BitConverter.ToUInt32(buff, 0);
                debug("String length is " + strLen);
                seek(8); //now at position 40 of mhod (actual string)
                byte[] str = new byte[strLen];
                strDB.Read(str, 0, str.Length);
                String theString = new UnicodeEncoding().GetString(str);
                 switch (type)
                {
                    case (long)Types.Title:
                        media.Title = theString;
                        break;
                    case (long)Types.Album:
                        media.Album = theString;
                        break;
                    case (long)Types.Artist:
                        media.Artist = theString;
                        break;
                    case (long)Types.Location:
                        media.Filename = iPodDrive + theString.Replace(':', '\\');
                        break;
                     case (long)Types.Genre:
                         media.Genre = theString;
                        break;
                    default:
                        break;
                }

            }
            strDB.Seek(position, SeekOrigin.Begin);
            strDB.Seek(totalLength, SeekOrigin.Current);
        }
开发者ID:rcw5,项目名称:iSavr,代码行数:48,代码来源:IPod5GDbReader.cs


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