COMPRESSION / DECOMPRESSION A PARTIR DU SDK LZMA DE 7ZIP ( MULTI FICHIER )
JossGP
Messages postés7Date d'inscriptionvendredi 28 septembre 2007StatutMembreDernière intervention15 octobre 2007
-
29 sept. 2007 à 00:03
cs_Roulito
Messages postés1Date d'inscriptionlundi 23 février 2004StatutMembreDernière intervention 4 mai 2008
-
4 mai 2008 à 15:15
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.
cs_Roulito
Messages postés1Date d'inscriptionlundi 23 février 2004StatutMembreDernière intervention 4 mai 2008 4 mai 2008 à 15:15
Bonjour.
J'ai repris dans VS 2005 ton projet.
La compilation se passe normalement.
J'ai tenté de créer une archive (avec le projet de demo) et même s'il n'y a pas d'erreur, le logiciel 7-Zip ne peut pas lire cette archive. Est-ce normal ?
Comment peut-on corriger cela ?
Seul le programme que tu as fait permet de relire correctement cette archive.
Roulito
JossGP
Messages postés7Date d'inscriptionvendredi 28 septembre 2007StatutMembreDernière intervention15 octobre 2007 15 oct. 2007 à 19:39
Hi, Vince_02
Thank you for answer.
I want to inform you about another change i made.
private UInt32 ReadLeUInt32()
{
uint Number;
uint item;
Number = ReadLeByte();
for (int i = 1; i < 4; i++)
{
item = ReadLeByte();
Number = (item << 8*i ) | Number ;
}
return Number;
}
This was necessary to read correctly a UINT number without truncation.
After that all take place in the right way.
I found very interesting your idea to add an error journal ,because it can help us to check if everything is went ok. Please inform me when you have news bout it.
Giorgio
JossGP
Messages postés7Date d'inscriptionvendredi 28 septembre 2007StatutMembreDernière intervention15 octobre 2007 15 oct. 2007 à 19:33
Hi, Vince_02
Thank you for answer.
I want to inform you about another change i made.
private UInt32 ReadLeUInt32()
{
uint Number;
uint item;
Number = ReadLeByte();
for (int i = 1; i < 4; i++)
{
item = ReadLeByte();
Number = (item << 8*i ) | Number ;
}
return Number;
}
This was necessary to read correctly a UINT number without truncation.
After that all take place in the right way.
I found very interesting your idea to add an error journal ,because it can help us to check if everything is went ok. Please inform me when you have news bout it.
Giorgio
Vince_02
Messages postés32Date d'inscriptiondimanche 15 mai 2005StatutMembreDernière intervention14 janvier 20162 14 oct. 2007 à 13:37
OK, je suis comme toi, je sais lire l'anglais, mais l'écrire, c'est une autre histoire ...
Pour l'erreur "OutOfRangeMemory" je pense que c'est du à la class "SevenZip", le taux de compression doit être trop élevé, enfin c'est une supposition et non une certitude.
(Plus le taux est élevé, plus cela prend de mémoire.)
Pour les 2 solutions que tu m'as apporté, je ne comprends pas pourquoi cela ne fonctionne pas pour toi, personnellement je n'ai jamais eu de problème sur ces 2 fonctions. Mais bon, j'en tiens compte pour la prochaine mise à jour.
Sur la prochaine Mise à jour, j'ai ajouté pas mal de fonction utils comme créé un SFX, un système de "Journal d'erreur" et quelque correction, ceux que tu as apporté seront inclus.
par contre je ne saurais te dire quand, actuellement j'ai moin de temps a consacré a tout ça ...
JossGP
Messages postés7Date d'inscriptionvendredi 28 septembre 2007StatutMembreDernière intervention15 octobre 2007 30 sept. 2007 à 00:20
Hi, after several hours , it seems I have found some problems. I want to post here if someone has the same problems I had.
1. in some circumstances this function crash.
private void WriteLeInt16(Int16 value)
{
//archiveStream.WriteByte((byte)(value); --->>> crash
archiveStream.WriteByte((byte)(value & 0xFF)); --->>> Ok!
archiveStream.WriteByte((byte)(value >> 8));
}
2. When you calculate the CRC and call this function:
I don't do ...
//WriteLeInt32((Int32)crc32); -->> this truncate the value with wrong value
I create a new function
WriteLeUInt32(crc32);
private void WriteLeUInt32(uint value)
{
uint ch;
for (int i = 0; i < 4; i++) {
ch = value >> (8 * i) ;
archiveStream.WriteByte((byte)(ch & 0xFF));
}
}
after these little modification the class is starting to take place and I see some results. Now I go on , if I found something else I post here for other people.
Thank.
Giorgio
JossGP
Messages postés7Date d'inscriptionvendredi 28 septembre 2007StatutMembreDernière intervention15 octobre 2007 29 sept. 2007 à 13:43
Hi,
After some investigation, I noted that the problem maybe in this statement:
LzmaArchive lzArchive = new LzmaArchive() in lzmaForms.cs
After this statement i tested the lzArchive.ArchiveInitialized flag and it is false. This means that the lzArchive object has not been created.
How to resolve the problem ?
Do I have to use the lzma#.dll and the libCompress.dll in place of the entires projects ? or what ever else?
Thank for your help
Giorgio
JossGP
Messages postés7Date d'inscriptionvendredi 28 septembre 2007StatutMembreDernière intervention15 octobre 2007 29 sept. 2007 à 00:03
hi , sorry, but I speek a bad france even tough I read it.
Thank for your classes about LZMA. I was just looking for it.
I downloaded the zip and I tryed in my sharpdevelop environment , without modification, just to understand the logic of all pieces.( classes)
It compile fine , but when I launch the program and select a file I got an error: Exception o type 'system.OutOfMemoryException' was thrown.
What's wrong? I noted in debug mode than this appens at these line:
4 mai 2008 à 15:15
J'ai repris dans VS 2005 ton projet.
La compilation se passe normalement.
J'ai tenté de créer une archive (avec le projet de demo) et même s'il n'y a pas d'erreur, le logiciel 7-Zip ne peut pas lire cette archive. Est-ce normal ?
Comment peut-on corriger cela ?
Seul le programme que tu as fait permet de relire correctement cette archive.
Roulito
15 oct. 2007 à 19:39
Thank you for answer.
I want to inform you about another change i made.
private UInt32 ReadLeUInt32()
{
uint Number;
uint item;
Number = ReadLeByte();
for (int i = 1; i < 4; i++)
{
item = ReadLeByte();
Number = (item << 8*i ) | Number ;
}
return Number;
}
This was necessary to read correctly a UINT number without truncation.
After that all take place in the right way.
I found very interesting your idea to add an error journal ,because it can help us to check if everything is went ok. Please inform me when you have news bout it.
Giorgio
15 oct. 2007 à 19:33
Thank you for answer.
I want to inform you about another change i made.
private UInt32 ReadLeUInt32()
{
uint Number;
uint item;
Number = ReadLeByte();
for (int i = 1; i < 4; i++)
{
item = ReadLeByte();
Number = (item << 8*i ) | Number ;
}
return Number;
}
This was necessary to read correctly a UINT number without truncation.
After that all take place in the right way.
I found very interesting your idea to add an error journal ,because it can help us to check if everything is went ok. Please inform me when you have news bout it.
Giorgio
14 oct. 2007 à 13:37
Pour l'erreur "OutOfRangeMemory" je pense que c'est du à la class "SevenZip", le taux de compression doit être trop élevé, enfin c'est une supposition et non une certitude.
(Plus le taux est élevé, plus cela prend de mémoire.)
Pour les 2 solutions que tu m'as apporté, je ne comprends pas pourquoi cela ne fonctionne pas pour toi, personnellement je n'ai jamais eu de problème sur ces 2 fonctions. Mais bon, j'en tiens compte pour la prochaine mise à jour.
Sur la prochaine Mise à jour, j'ai ajouté pas mal de fonction utils comme créé un SFX, un système de "Journal d'erreur" et quelque correction, ceux que tu as apporté seront inclus.
par contre je ne saurais te dire quand, actuellement j'ai moin de temps a consacré a tout ça ...
30 sept. 2007 à 00:20
1. in some circumstances this function crash.
private void WriteLeInt16(Int16 value)
{
//archiveStream.WriteByte((byte)(value); --->>> crash
archiveStream.WriteByte((byte)(value & 0xFF)); --->>> Ok!
archiveStream.WriteByte((byte)(value >> 8));
}
2. When you calculate the CRC and call this function:
private void WriteCompressedSizeAndCrc(long compressedSize, uint crc32)
I don't do ...
//WriteLeInt32((Int32)crc32); -->> this truncate the value with wrong value
I create a new function
WriteLeUInt32(crc32);
private void WriteLeUInt32(uint value)
{
uint ch;
for (int i = 0; i < 4; i++) {
ch = value >> (8 * i) ;
archiveStream.WriteByte((byte)(ch & 0xFF));
}
}
after these little modification the class is starting to take place and I see some results. Now I go on , if I found something else I post here for other people.
Thank.
Giorgio
29 sept. 2007 à 13:43
After some investigation, I noted that the problem maybe in this statement:
LzmaArchive lzArchive = new LzmaArchive() in lzmaForms.cs
After this statement i tested the lzArchive.ArchiveInitialized flag and it is false. This means that the lzArchive object has not been created.
How to resolve the problem ?
Do I have to use the lzma#.dll and the libCompress.dll in place of the entires projects ? or what ever else?
Thank for your help
Giorgio
29 sept. 2007 à 00:03
Thank for your classes about LZMA. I was just looking for it.
I downloaded the zip and I tryed in my sharpdevelop environment , without modification, just to understand the logic of all pieces.( classes)
It compile fine , but when I launch the program and select a file I got an error: Exception o type 'system.OutOfMemoryException' was thrown.
What's wrong? I noted in debug mode than this appens at these line:
if (openFile.ShowDialog() == DialogResult.OK)
{
if (File.Exists(openFile.FileName))
{
try
{ lzArchive.Open(openFile.FileName);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Erreur !", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
Have you any suggestion about it?.
Thank for your help.
Giorgio