本文整理汇总了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);
}