home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Development
General Development (no feature request here!)
TBS: CI/CAM support and other improvements
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="mm1352000" data-source="post: 1019578" data-attributes="member: 82144"><p>If you take a look at the DvbTextConverter class that I pointed to I think you'll see the answer.</p><p>An easier solution might be to do something like this (code not compiled or checked):</p><p> </p><p>[code] List<string> entries = new List<string>();</p><p> </p><p> List<byte> entryBytes = new List<byte>();</p><p> </p><p> int entryCount = 0;</p><p> </p><p> </p><p> </p><p> for (int i = 1; i < length; i++)</p><p> </p><p> {</p><p> </p><p> if (content[i] == 0)</p><p> </p><p> {</p><p> IntPtr p = Marshal.AllocCoTaskMem(entryBytes.Count + 1);</p><p> Marshal.Copy(entryBytes.ToArray(), 0, p, entryBytes.Count);</p><p> Marshal.WriteByte(p, entryBytes.Count, 0);</p><p> DVB_MMI.DumpBinary(p, 0, entryBytes.Count); // for debug showing the byte values</p><p> entries.Add(DvbTextConverter.Convert(p, null));</p><p> entryCount++;</p><p> entryBytes.Clear();</p><p> Marshal.FreeCoTaskMem(p);</p><p> }</p><p> else</p><p> </p><p> {</p><p> entryBytes.Add(content[i]);</p><p> </p><p> }</p><p> </p><p> }</p><p> </p><p>[/code]</p><p> </p><p>Note:</p><p>1. You'll need to also add handling for the last entry.</p><p>2. I would never commit this to TVE 3.5. Instead I'd refactor DvbTextConverter to provide a method that accepts a byte[].</p><p> </p><p> </p><p> </p><p></p><p>The first byte of each entry tells you the encoding. DvbTextCoverter handles all of that, which is why I suggested to use it. <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite2" alt=";)" title="Wink ;)" loading="lazy" data-shortname=";)" /></p></blockquote><p></p>
[QUOTE="mm1352000, post: 1019578, member: 82144"] If you take a look at the DvbTextConverter class that I pointed to I think you'll see the answer. An easier solution might be to do something like this (code not compiled or checked): [code] List<string> entries = new List<string>(); List<byte> entryBytes = new List<byte>(); int entryCount = 0; for (int i = 1; i < length; i++) { if (content[i] == 0) { IntPtr p = Marshal.AllocCoTaskMem(entryBytes.Count + 1); Marshal.Copy(entryBytes.ToArray(), 0, p, entryBytes.Count); Marshal.WriteByte(p, entryBytes.Count, 0); DVB_MMI.DumpBinary(p, 0, entryBytes.Count); // for debug showing the byte values entries.Add(DvbTextConverter.Convert(p, null)); entryCount++; entryBytes.Clear(); Marshal.FreeCoTaskMem(p); } else { entryBytes.Add(content[i]); } } [/code] Note: 1. You'll need to also add handling for the last entry. 2. I would never commit this to TVE 3.5. Instead I'd refactor DvbTextConverter to provide a method that accepts a byte[]. The first byte of each entry tells you the encoding. DvbTextCoverter handles all of that, which is why I suggested to use it. ;) [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
General Development (no feature request here!)
TBS: CI/CAM support and other improvements
Contact us
RSS
Top
Bottom