Pb avec les filestreams : compression n fichiers->fichier et decompression du fichier
	
	
		Bonjour, 
je vais essayer au mieux de résumer mon problème, mon but étant de créer une méthode qui compress n fichiers en un seul (c'est déjà fait) et une autre qui decompress le fichier en n fichiers .
Voici mon Pb :
Compression
j'ai réaliser une méthode CompressDir qui me prend n  fichiers et les compresse puis récupère leur nombre et les noms de chaque fichiers suivies de leur taille , je mets tous ces données dans un String puis après je copie le contenu des fichiers compressés dans ce fichier. 
decompression
je récupère le string du début , puis je récupere le nombre des fichiers et je fais une boucle pour chaque partie du fichier qui correspondait à un fichier compressé  je crée un fichier du nom du fichier d'origine et je decompresse 
Problème
->le streamfile où je mets la partie du fichier (le fichier compressé )me lit tjrs depuis le début c'est à dire que le binaryreader revient tjrs au début 
->quand je décompresse il decompresse pas 
donc voici le code :
	Code:
	
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 
 | void CompressDir(String ^dirSource, String ^ dirDestination)
{
	String ^str = "";
 
	String ^file;
	array<String ^> ^ directories;
	array<String ^> ^ files;
	int k = 0;
 
	String ^path = dirSource;
	String ^pathnew = dirDestination;
 
 
 
	files = Directory::GetFiles(path);
		for each (file in files)
	{ 
		String ^v= file->Substring(path->Length);
 
		if (!compresserFichier(file, file+".gz"))
				Console::WriteLine("failure in compression");
 
		FileStream ^fs = gcnew FileStream(file+".gz", FileMode::Open);
		BinaryReader ^br = gcnew BinaryReader(fs);
 
 
		k = k + 1;
		int j =(int)fs->Length;
 
		String ^jstr = ""+j;
		str = str+file+"\n"+jstr+"\n";
		br->Close();
		fs->Close();
 
 
	}
 
 
 
 
 
 
		FileStream ^fs = gcnew FileStream("c:\\mytest.txt", FileMode::CreateNew);
		BinaryWriter ^bw = gcnew BinaryWriter(fs);
		String ^kkk = ""+k;
 
		str= kkk+"\n"+str;
		k=0;
		bw->Write(str);
		fs->Close();
		bw->Close();
 
		for each (file in files)
		{
		FileStream ^fs = gcnew FileStream(file+".gz", FileMode::Open);
		BinaryReader ^br = gcnew BinaryReader(fs);
		FileStream ^fws = gcnew FileStream("c:\\mytest.txt", FileMode::Append);
		BinaryWriter ^bw = gcnew BinaryWriter(fws);
 
		bw->Write(br->ReadBytes(fs->Length));
 
		fs->Close();
		br->Close();
		fws->Close();
		bw->Close();
 
		File::Delete(file+".gz");
		}
 
}
void DecompressDir(String ^dirSource, String ^ dirDestination)
{
 
	FileStream ^fs = gcnew FileStream(dirSource, FileMode::Open);
	BinaryReader ^br = gcnew BinaryReader(fs);
 
 
 
 
		String^a = br->ReadString();
 
		int m = a->Length;
		fs->Close();
		br->Close();
 
		String ^kl ="\n"; 
		int i = a->IndexOf(kl);
 
 
		String ^b = a->Substring(0,i);
		int j = System::Convert::ToInt32(b);
		String^c = a->Substring(i+1);
		int n ;
 
		FileStream ^fs1 = gcnew FileStream(dirSource, FileMode::Open);
		BinaryReader ^br1 = gcnew BinaryReader(fs1);
		br1->ReadString();
		for (n=0;n<j;n++)
		{
 
 
			i = c->IndexOf(kl);
			String ^filename = c->Substring(0,i);
			c = c->Substring(i+1);
			i = c->IndexOf(kl);
			String^fileleng = c->Substring(0,i);
			c = c->Substring(i+1);
 
			Int32 ^filelength=System::Convert::ToInt32(fileleng); 
 
 
 
 
			FileStream ^fws1 = gcnew FileStream(filename, FileMode::CreateNew);
			BinaryWriter ^bw1 = gcnew BinaryWriter(fws1);
			bw1->Write(br1->ReadBytes((int)filelength));
			if (!decompression(filename, filename+"decompressed"))
				System::Windows::Forms::MessageBox::Show("failure in compression");
 
			fws1->Close();
			bw1->Close();
 
			//File::Delete(filename);
		}
		fs1->Close();
		br1->Close();
 
 
		}
 
 
 
 
 
} | 
 
merci de votre aide 
j'espere que j'étais bien clair dans l'explication de mon problème