473,662 Members | 2,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Yenc Help

Does anyone know how to decode a yenc encoded file? I have created a
decoder that seems to work great for text. Now i am trying to create
another one for images and I can't get it to work. I have changed the
encoding on mine and that didn't work and then I tried the only 2 open
source ones I can Find. It is driving me nuts.
Feb 10 '08 #1
6 2242
On Sat, 09 Feb 2008 21:27:18 -0800, Extremest <ad***@binindex .netwrote:
Does anyone know how to decode a yenc encoded file? I have created a
decoder that seems to work great for text. Now i am trying to create
another one for images and I can't get it to work. I have changed the
encoding on mine and that didn't work and then I tried the only 2 open
source ones I can Find. It is driving me nuts.
It seems to me that "the horse's mouth", so to speak, would be your best
bet:
http://www.yenc.org/

I don't think this newsgroup is a good place for general "yenc-specific"
discussions, but if you've got an issue implementing the format decoder
that relates specifically to your use of C# or .NET, please feel free to
post those questions here.

Pete
Feb 10 '08 #2
I think i have the decode part right. The problem seems to maybe be
with the encoding of the string or something. Was wanting some help
on that part of it. The rest should be ok. I have looked at quite
a few decoders and they all do the same thing. My problem is the
encoding of the stream or something.

Feb 11 '08 #3
This is extremely vague. If you want to post a "short but complete" code
sample, being very specific about the exact problem with appropriate code
comments, you can probably expect to get some help.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"Extremest" wrote:
I think i have the decode part right. The problem seems to maybe be
with the encoding of the string or something. Was wanting some help
on that part of it. The rest should be ok. I have looked at quite
a few decoders and they all do the same thing. My problem is the
encoding of the stream or something.

Feb 11 '08 #4
Ok here is my function that goes through the data. I have gotten it
really close just don't know if there is some encoding on a stream
that I am doing wrong or what. Code is rough. Want to get it
working then will clean it up.

static void collect()
{
for (int x = 0; x < msg_ids.Count; x++)
{
Connect();
byte[] buff = new byte[BUFFERSIZE];//buffer for
decoded data.
NetworkStream networkStream = tcpClient.GetSt ream
();//nntp connection.
StreamReader reader = new StreamReader
(networkStream, Encoding.Defaul t);//reader for nntp connection.
StreamWriter writer = new StreamWriter
(networkStream) ;//writer for nntp connection.
writer.AutoFlus h = true;
int bufferLength = 0;//where we are in the buff
array.
int filelength = 0;//Length of the file from the
header.
string id = msg_ids[x] as string;//The msg_id for
the article.
string line;//Line that is read from the connection.
string fileName;//Name of the file from the header.
id = "body " + id;//build article request.
id = id.Trim();
writer.WriteLin e(id);//write article request to nntp
line = reader.ReadLine ();//read response from nntp
/*Loop until it finds the beginning of the yenc
data*/
while (reader.Peek() >= 0 && line != null && !
line.StartsWith ("=ybegin") &&
!line.StartsWit h("begin 644"))
{
line = reader.ReadLine ();
if (line == ".")
{
break;
}
}
if (line.StartsWit h("begin 644"))//Not implemented
yet.
{
Disconnect();
continue;
}
else
{
if (line == null || line == ".")
{
Disconnect();
continue;
}
fileName = parseForName(li ne);//get filename
from the header.
string tempsize = parseForString( line,
"size");//get size from the header.
Console.WriteLi ne(tempsize);
filelength = int.Parse(temps ize);
if (fileName == null)//not valid header.
{
Disconnect();
continue;
}
String partNo = parseForString( line, "part");//
get part # from header.
if (partNo != null)//check and see if there are
more parts or to remove the line from the code.
{
while (line != null && !line.StartsWit h
("=ypart"))
{
line = reader.ReadLine ();
Console.WriteLi ne("--{0}--", line);
}
if (line == null)
throw new IOException("Er ror while
handling a multipart reader. Could not locate line starting with
\"=ypart\"." );
}
// Decode the file
line = reader.ReadLine ();//read first line of
encoded data.
while (line != null && !line.StartsWit h
("=yend"))//will go to end of encoded data.
{
for (int lcv = 0; lcv < line.Length;
lcv++)//go through line by char.
{
if (line[lcv] == '=')//find escape char.
{
lcv++;
if (line[lcv] < 106)//used for the
mod
{
int ts = 106 - line[lcv];
ts = 256 - ts;
buff[bufferLength] = (byte) ts;
bufferLength++;
}
else
{
buff[bufferLength] = (byte)
((line[lcv] - 64) - 42);
bufferLength++;
}
}
else
{
if (line[lcv] < 42)//used for the
mod
{
int ts = 42 - line[lcv];
ts = 256 - ts;
buff[bufferLength] = (byte) ts;
bufferLength++;
}
else
{
buff[bufferLength] = (byte)
(line[lcv] - 42);
bufferLength++;
}
}
}
line = reader.ReadLine ();//read next line
for the loop.
}
}
if (bufferLength 0)//check to see if we decoded
anything if so then write it to a file.
{
FileStream fs = File.Create(fil eName);
BinaryWriter bw = new BinaryWriter
(fs,Encoding.De fault);
bw.Write(buff,0 ,filelength);
bw.Close();
fs.Close();
}
}
}

Feb 11 '08 #5
On Mon, 11 Feb 2008 10:29:56 -0800, Ex*******@extre mest.com <Extremest>
wrote:
Ok here is my function that goes through the data. I have gotten it
really close just don't know if there is some encoding on a stream
that I am doing wrong or what. Code is rough. Want to get it
working then will clean it up.
All due respect, it's not really clear what you expect. Are you thinking
that someone will read through your code and discover an error in the
basic logic of your yenc implementation? If so, I think you're being too
optimistic.

If there is something specific to how you're using C# and/or .NET in your
implementation that you have a question about, this is an appropriate
forum. But I wouldn't say that it's very likely you're going to find
anyone who would just review your code for random bugs, especially for a
task of relatively marginal popularity like a yenc implementation.

If you expect help here, you need to be asking more specific questions
than just "here's my code, what's wrong with it?"

Pete
Feb 11 '08 #6
I was mainly asking if anyone knew if the encoding of the streams
was right? I have managed to get uudecoding done with those streams
using php in c# and when I try to do yenc decoding a come up with
only a couple of bytes that are not right when comparing to the same
picture already downloaded with another program.

Feb 12 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2357
by: Freddie | last post by:
Hi, I posted a while ago for some help with my word finder program, which is now quite a lot faster than I could manage. Thanks to all who helped :) This time, I've written a basic batch binary usenet poster in Python, but encoding the data into yEnc format is fairly slow. Is it possible to improve the routine any, WITHOUT using non-standard libraries? I don't want to have to rely on something strange ;)
5
369
by: Marvin Grill | last post by:
Hi, I'm working on a type of NewsHound program and am stuck on how to decode the yEnc encoded articles (body). I tried using Joe Feser's yEnc class but can't seem to get it to work properly Not sure whether it's an Encoding.Type problem or not getting the stream start position right. In any case here's part of the code with the problem:
2
2060
by: Phillip Hamlyn | last post by:
I'm trying to get a Yenc Decoding algorithm working but keep getting the same problem. I'm using data from the yenc test newsgroup and have tried the same thing with most of the example source code on sourceforge etc. with multiple different posts and I keep getting the same problem - the post I'm trying to decode has an encoded JPG file (a film poster for Kill Bill 2) which the yEnc tools like yEnc.EXE manage to decode and encode fine, but...
6
6836
by: Scirious | last post by:
People, many of you may not know what yEnc is. To simplify, it is a methode to encode binary files very used in Usenet because it creates an overhead of only 2% when compare to 33%-40% of overhead created by other methos such as UUencode, base64... However, every code example I so was in C and using unsigned numbers. Actually, I've found one example in Java, but just for decode, not for encode. Are there anyone who knows how to help me?...
1
1526
by: Kairo Matthias | last post by:
How can i encode with yEnc?
0
1062
by: BiT | last post by:
Hi, I'm working on a newsgroup program and stuck on how to decode the yEnc encoded articles (body). i've found this dll of yenc32 - yDecLib.dll in https://sourceforge.net/projects/yenc32/ but when i try to add it to my project i get error message: please make sure that the file is accessible, and that it is a valid assembly or COM component. dose any1 kow source code or dll file of function to decode yenc?
2
2174
by: John Savage | last post by:
I save posts from a midi music newsgroup, some are encoded with yenc encoding. This gave me an opportunity to try out the decoders in Python. The UU decoder works okay, but my YENC effort gives results unexpected: import yenc, sys fd1=open(sys.argv,'r') #yenc.encode(sys.argv,"outfile.yenc",bytes=0) yenc.decode(sys.argv,"outfile.mid",bytes=0,crc_in='')
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1754
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.