João Carias,
Go to:
http://www.vbaccelerator.com/article.asp?id=3489
I converted the primary Function from VB.Net to C# below:
Try this:
long DiscID() {
tocSum = 0;
foreach (track in CDTOC) {
tocSum = (tocSum + AddDigits(track.PositionInSeconds));
}
firstLastSum = CDTOC.track(0).PositionInSeconds;
firstLastSum = (firstLastSum - CDTOC.leadOut.PositionInSeconds);
return (ShiftRight((tocSum && 255), 24)
| (ShiftRight(firstLastSum, 8) | CDTOC.NumTracks));
}
void AddDigits(void position) {
addDigits = 0;
while ((position > 0)) {
addDigits = (addDigits
+ (position % 10));
position = (position / 10);
}
}
Thanks,
J
--------------------
From: "Quina" <ca*********@gmail.com>
Newsgroups: microsoft.public.dotnet.languages.csharp
Subject: freeDB discID Calculation - retreive the TOC
Date: 6 Mar 2006 10:05:08 -0800
Organization: http://groups.google.com
Lines: 12
Message-ID: <11**********************@v46g2000cwv.googlegroups .com>
NNTP-Posting-Host: 82.154.40.137
Mime-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1141668319 14850 127.0.0.1 (6 Mar 2006
18:05:19 GMT)X-Complaints-To: gr**********@google.com
NNTP-Posting-Date: Mon, 6 Mar 2006 18:05:19 +0000 (UTC)
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
NET CLR 2.0.50727),gzip(gfe),gzip(gfe)Complaints-To: gr**********@google.com
Injection-Info: v46g2000cwv.googlegroups.com; posting-host=82.154.40.137;
posting-account=l4wRMQ0AAAAZ3HcbFX3kUlCiDa5heVG2
Path:
TK2MSFTNGXA03.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSF TFEED01.phx.gbl!TK2MSFTNGP
08.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!news.glorb.com!postnews.go
ogle.com!v46g2000cwv.googlegroups.com!not-for-mailXref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.languages.csharp:390235
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
Hi there, i'm building an windows application to manage my disc
collection. I also want to enable it with cd recognition features on
audio CDs. In order to do this I must submit the CD info (discID, ...)
to freedb.org.
The problem is that I don't know how to retrieve the Table Of Contents
(toc) from the disc. The information provided by freedb tells how to
calculate the DiscID, based on the toc, but it doesn't explain how to
get the Toc... there anyone who can help me how to do this?
Thank you in advance,
João Carias
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl {\f0\fnil\fprq2\fcharset0
MS Sans Serif;}{\f1\fswiss\fcharset0 Arial;}}
{\*\generator Msftedit 5.41.21.2500;}\viewkind4\uc1\pard\f0\fs20 Cheers,\par
\par
johnKn [MS-SDK]\par
\par
\par
\par
-Please do not send email directly to this alias. This alias is for \par
newsgroup purposes only\par
\par
-This posting is provided "AS IS" with no warranties, and confers no
rights.\par
\par
-To provide additional feedback about your community experience please send
\par
e-mail to:
sd*****@microsoft.com\par
\f1\par
}