mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-01-15 11:52:04 +01:00
initial import
This commit is contained in:
23
ChanSort.Plugin.TllFile/ChannelDataMapping.cs
Normal file
23
ChanSort.Plugin.TllFile/ChannelDataMapping.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using ChanSort.Api;
|
||||
|
||||
namespace ChanSort.Plugin.TllFile
|
||||
{
|
||||
internal static class ChannelDataMapping
|
||||
{
|
||||
public static unsafe void SetChannelName(ChannelMappingBase mapping, string channelName, Encoding defaultEncoding)
|
||||
{
|
||||
byte[] codePagePrefix = new byte[0]; // DvbStringDecoder.GetCodepageBytes(defaultEncoding);
|
||||
byte[] name = defaultEncoding.GetBytes(channelName);
|
||||
byte[] newName = new byte[codePagePrefix.Length + name.Length + 1];
|
||||
Array.Copy(codePagePrefix, 0, newName, 0, codePagePrefix.Length);
|
||||
Array.Copy(name, 0, newName, codePagePrefix.Length, name.Length);
|
||||
fixed (byte* ptrNewName = newName)
|
||||
{
|
||||
mapping.NamePtr = ptrNewName;
|
||||
}
|
||||
mapping.NameLength = newName.Length;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user