Hold on ... not yet ... i will be with you now
ddanbe commented: nice +4
Hold on ... not yet ... i will be with you now
Dude this works
private void Form1_Activated(object sender, EventArgs e)
{
Form2 F2 = new Form2();
F2.ShowDialog(); // Puts it on top (form1 wont be accessible)
F2.Show(); // Makes form 1 accessible
}
Hope that helps
So do you want them to ALWAYS be on top ?? kind of like Windows live ?? or do you want them both to show if you click on form1 ?
reader.Close();
if (!reader.close())
{
reader.Close();
}
else
{}
application.DoEvents();
You have your form declaration here
Form2 F2 = new Form2();
F2.Show();
F2.WindowState = FormWindowState.Minimized;
then you have this on the FormWindows State changed or on a button click
if (this.WindowState == FormWindowState.Normal)
{
F2.WindowState = FormWindowState.Normal;
}
Hope it helps , mark as solved if it did... viola
No way man ... you can do this
mail.Priority = MailPriority.High;
or
mail.Priority = MailPriority.Normal;
works like a bombbbbbbb
Just minimize and maximize the form you want on top ...l it will work ...
You meant if it does NOT contain "."
Im doing this now :
foreach (string ChildDir in Result)
{
TreeNode ChildNode = new TreeNode(ChildDir);
if (ChildDir.Equals("."))
{ }
else
{
Console.WriteLine("Start Childnode :" + ChildNode.Text);
Node.Nodes.Add(ChildNode);
// MessageBox.Show("Start Childnode :" + txtFtpServerName.Text + "/" + ChildNode.Text);
recureseChild(ChildNode, root + ChildDir + "/");
recureseChild(ChildNode, root + ChildDir);
}
coz if i go into the "." dir it will be an endless loop ...
unfortunately it takes like 20minutes to go through my server...but i will get there now hehe
YAAAAYYYYYY, you guys are awesome , it works now !!!! finally
one problem still though = it list all the directories, yet it lists no files
How can this be fixed ???
here's my current code :
void recurese(string root)
{
// New instance of the StringBuilder Class (resluts)
StringBuilder result = new StringBuilder();
// New instance of FtpWebRequest (reqFTP)
FtpWebRequest reqFTP;
// Setting root to server
root = "ftp://" + txtFtpServerName.Text;
try
{
// Ceating URI for reqFTP , Setting URI to ROOT
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(root));
// Setting Binary to true
reqFTP.UseBinary = true;
// Setting credentials for reqFTP
reqFTP.Credentials = new NetworkCredential(txtFtpUserName.Text, txtFtpPassword.Text);
// Setting method of reqFTP to get a list of directories
reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
// Creating FtpWebResponse, response gets the webrequest
WebResponse response = reqFTP.GetResponse();
// Creating new stream reader to read the response
StreamReader reader = new StreamReader(response.GetResponseStream());
// Creatinf string (line) that reads the streamreader lines
string line = reader.ReadLine();
// While the line is not null
while (line != null)
{
// StringBuilder adds line (the streamreader line)
result.Append(line);
// Add a line break to the line
result.Append("\n");
// telling line to read another line of the streamreader
line = reader.ReadLine();
}
// Removing last linebreak from Stringbuilder...
result.Remove(result.ToString().LastIndexOf('\n'), 1);
// Closing the StremReader
reader.Close();
// Closing FtpWebResponse
response.Close();
// Creating array RESULT
// Splitting Streamreader string where linebreak occurs
string[] Result = result.ToString().Split('\n');
// If Result is not null or void whatever
if (Result != null) …
Thanks LizR, i only see that now ... but now i have been trying to manipulate the recurseChild's Root, i cant really get it there, ... what to do , what to do .... give me a while, thanks for the advice people , i love you <3
I understand what you are saying , but i dont nderstand what you are asking...
I will quickly try and fix that , please try and help me ?? i havent slept in a few days now ... hehehe
miculnegru = GENIUS
hahaha, ok i get what you're saying... let me put it this way
ftp://theserver.com/datasafe_backup/Database_Differential_Backup.bak.zip/
<----- We know this one is stopping there----->
Failure in Recurse Child : The remote server returned an error: (550) File unavailable (e.g., file not found, no access).
A first chance exception of type 'System.Net.WebException' occurred in System.dllStart Childnode :public_html/es
Child Root : ftp://theserver.com/public_html/public_html/es/--->This one must continue<---
A first chance exception of type 'System.Net.WebException' occurred in System.dll
Failure in Recurse Child : The remote server returned an error: (550) File unavailable (e.g., file not found, no access).
The path it cannot find is /dir1/dir2/dir3
i take it, there must be a problem loading the recurseChild within the recurseChild, can you check that out and maybe give me a tip, i am clueless, you know ive been on this one thing for 2 weeks now ...
The path would be
tfp://servername + "/" + ChildDir + "/"
I am making a recursive treeview that lists the directories on my server [or trying atleast]...
So far so good , it seems to work, cept it does not load all the files / directories, please consider my code :
void recurese(string root)
{
// New instance of the StringBuilder Class (resluts)
StringBuilder result = new StringBuilder();
// New instance of FtpWebRequest (reqFTP)
FtpWebRequest reqFTP;
// Setting root to ftp://ngaleafrica.co.za
root = "ftp://" + txtFtpServerName.Text;
try
{
// Ceating URI for reqFTP , Setting URI to ROOT
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(root));
// Setting Binary to true
reqFTP.UseBinary = true;
// Setting credentials for reqFTP
reqFTP.Credentials = new NetworkCredential(txtFtpUserName.Text, txtFtpPassword.Text);
// Setting method of reqFTP to get a list of directories
reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
// Creating FtpWebResponse, response gets the webrequest
WebResponse response = reqFTP.GetResponse();
// Creating new stream reader to read the response
StreamReader reader = new StreamReader(response.GetResponseStream());
// Creatinf string (line) that reads the streamreader lines
string line = reader.ReadLine();
// While the line is not null
while (line != null)
{
// StringBuilder adds line (the streamreader line)
result.Append(line);
// Add a line break to the line
result.Append("\n");
// telling line to read another line of the streamreader
line = reader.ReadLine();
}
// Removing last linebreak from Stringbuilder...
result.Remove(result.ToString().LastIndexOf('\n'), 1);
// Closing the StremReader
reader.Close();
// Closing FtpWebResponse
response.Close();
// Creating array RESULT
// Splitting Streamreader string where linebreak occurs
string[] Result = result.ToString().Split('\n');
// If Result is not null or void whatever
if …
ok i guess you will have to split them first , then remove where
text.Contains("The duplicate")
, then add them all together ...
Should be fine ??
YOUTUBE !!!!!!!! C# Tutorials , start off with C# Fundamentals , go through .NET Framework 070-526, 070-528, 070-529, 070-536, 070-549....you will be good
Can i maybe give you a new approach ???
Ive done this like this
in the formload of form1
this.Tag = form2;
now you can access form 2, so now you can say on a button -
Form2.Show(); // If you want both to be active for use
Form2.ShowDialog(); // If you want form1 to be disabled
Now you can also say this on a button on form1
form2.close(); // If you want to close it
form2.WindowState = FormWindowState.Minimized;
Happy coding my friend ...
You can try something like this
public static bool IsPalindrome(string strValue)
{
int intLen, intStrPartLen;
intLen = strValue.Length - 1;
//Cut the length of the string into 2 halfs
intStrPartLen = intLen / 2;
for (int intIndex = 0; intIndex <= intStrPartLen; intIndex++)
{
//intIndex is the index of the char in the front of the string
//Check from behind and front for match
if (strValue[intIndex] != strValue[intLen])
{
return false;
}
//decrease the lenght of the original string to
//test the next Char from behind
intLen--;
}
return true;
}
You have fun now
Look i know the problemo is this
string[] Child_Name = GetChildFileList();
if (Child_Name != null)
{
foreach (string filename2 in Child_Name)
{
TreeNode ChildNode = new TreeNode(filename2);
ParentNode.Nodes.Add(ChildNode);
}
}
but i cant really bypass that one or can I ???
Welll well well, i feel like a retard now hahahahahahahaha!!!
Although , thats not the problem...
The problem lies here
string[] Child_Name = GetChildFileList();
for some reason (i think) the Uri does not change because you have to SELECT a node first...
So i did this
private void btnDoIt_Click(object sender, EventArgs e)
{
string[] Parent_Name = GetFileList();
treeView1.Nodes.Clear();
if (Parent_Name != null)
{
/* Parent Node */
foreach (string filename in Parent_Name)
{
TreeNode ParentNode = new TreeNode(filename);
// changed the GetChildFileList uri to 'reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + txtftpServerName.Text + "/" + txtShowDirectory.Text + "/"));'
[B][U]txtShowDirectory.Text = filename;[/U][/B]
string[] Child_Name = GetChildFileList();
if (Child_Name != null)
{
foreach (string filename2 in Child_Name)
{
TreeNode ChildNode = new TreeNode(filename2);
ParentNode.Nodes.Add(ChildNode);
}
}
treeView1.Nodes.Add(ParentNode);
}
}
}
WORKS LIKE A BOMB!!!!!!!!
cept i still get an error on my try -> catch saying
"The remote server returned an error: (550) File unavailable. (eg. File not found, unavailable)."
Obviously there is still some kind of error
Ah man , ive been adjusting the code so much ...
I am trying to make a treeview that display's all the directories and files on theserver (SO FAR SO GOOD) ...
Here's my code to retrieve Directories and files
public string[] GetFileList()
{
string[] downloadFiles;
StringBuilder result = new StringBuilder();
FtpWebRequest reqFTP;
try
{
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + txtftpServerName.Text + "/"));
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(txtftpUserName.Text, txtftpPassword.Text);
reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
WebResponse response = reqFTP.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string line = reader.ReadLine();
while (line != null)
{
result.Append(line);
result.Append("\n");
line = reader.ReadLine();
}
result.Remove(result.ToString().LastIndexOf('\n'), 1);
reader.Close();
response.Close();
return result.ToString().Split('\n');
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
downloadFiles = null;
return downloadFiles;
}
}
public string[] GetChildFileList()
{
string[] downloadFiles;
StringBuilder result = new StringBuilder();
FtpWebRequest reqFTP;
try
{
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + txtftpServerName.Text + "/" + treeView1.SelectedNode.Text + "/"));
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(txtftpUserName.Text, txtftpPassword.Text);
reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
WebResponse response = reqFTP.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string line = reader.ReadLine();
while (line != null)
{
result.Append(line);
result.Append("\n");
line = reader.ReadLine();
}
result.Remove(result.ToString().LastIndexOf('\n'), 1);
reader.Close();
response.Close();
return result.ToString().Split('\n');
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
downloadFiles = null;
return downloadFiles;
}
}
This works fine indevidually , but when i try to combine the two:
private void btnDoIt_Click(object sender, EventArgs e)
{
string[] Parent_Name = GetFileList();
string[] Child_Name = GetChildFileList();
treeView1.Nodes.Clear();
if (Parent_Name != null)
{
/* Parent Node */
foreach (string filename in Parent_Name)
{
TreeNode ParentNode = new …
Antenka, you were right , readToEnd() is string format , but its not an array ... ahaaaaaa, so how can we make an array here is the new question...
foreach (char S in reader.ReadToEnd())
?????????????????????????????????????????????????
then i get little characters... hmmm...ok something doesnt click here ...
error CS0030: Cannot convert type 'char' to 'string'
i cant understand why its not reading it because ive even tried converting it ...
FTPRequest.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
there are the details
But im just in beta mode for now , never worked with MS FtpWebRequest before ...
but hey man , like i always say , give me a day and i'll be posting full code snippets on here..
Ps read your messages :P
I know , but it doesn't , its made up of char's, sadly enough ....
i just want to know how to convert this back to string...
After a lot of testing etc, i decided to move away from the 3rd party FTP classes and use the standard Microsoft FtpWebRequest for faster speeds etc...
What i want to do is list the directories in a treeview!
Now here's my code :
try
{
FTPRequest = (FtpWebRequest)WebRequest.Create("ftp://iwantstringsman");
FTPRequest.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
FTPRequest.Credentials = new NetworkCredential(txtftpUserName.Text, txtftpPassword.Text);
FtpWebResponse FTPResponse = (FtpWebResponse)FTPRequest.GetResponse();
Stream FTPResponseStream = FTPResponse.GetResponseStream();
StreamReader reader = new StreamReader(FTPResponseStream);
Console.WriteLine(reader.ReadToEnd());
Console.WriteLine("Directory List Complete, status {0}");
foreach (char S in reader.ReadToEnd())
{
/* Making parent node */
TreeNode ParentNode = new TreeNode();
ParentNode.Text = S.ToString(); ;
treeView1.Nodes.Add(ParentNode);
}
reader.Close();
FTPResponseStream.Close();
}
catch (Exception EX)
{
MessageBox.Show(EX.Message);
}
Problem is this (the reader.ReadToEnd() only supports Characters)
how can i get this in string format ???
Regards...
Thanks in advance
I am using FTP to upload and download files from my server , but it is incredibly slow...
When i use File Zilla it is really really fast, but for some reason my FTP program lags really badly, can anyone give me a reason or some help for this ??
Any Idea's would work ...
Regards,
I guess you could just use
FTPLIB.ChangeDir("//");
or something, on my server the previous folder is the "."-dir so going there takes you back back back ... cool navigation i tell you ...
FTPLIB.ChangeDir(".");
Takes you to the root folder again, this is just an example , i mean surely every person has a brain to take this code and play around with it ... i just wanted to help man ... seriously....
Its the theory you see there, i just gave an example , one can use this in small applications ... (i hate the treeview though, might do it with a listview....) but we already played with that hehehe
Thanks for all your help man , I'm finally finding some structure in my application to work with ...
Just because there is no help for this online that i could find, I'm posting this for all the other coders...
This makes use of a third part class downloaded from code project... AWESOME FTP class this , i owe the creators a huge thank you ...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Windows.Forms;
using System.IO;
using System.Net.Mail;
using System.Net;
using System.Net.Mime;
using System.Web;
using System.IO.Compression;
using Microsoft.Win32;
using System.Net.Sockets;
using System.Runtime;
namespace TestDummyTWO
{
public partial class Form1 : Form
{
FTPLib.FTP FTPLIB = new FTPLib.FTP();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
/* THIS IS THE FORMULA
* TreeNode MyNodeMain = new TreeNode();
* TreeNode MyNodeChild = new TreeNode();
* MyNodeMain.Text = "Main";
* MyNodeChild.Text = "child";
* mytree.Nodes.Add(MyNodeMain);
* MyNodeMain.Nodes.Add(MyNodeChild);
*/
FTPLIB.server = "******";
FTPLIB.user = "*******";
FTPLIB.pass = "******";
foreach (string S in FTPLIB.ListDirectories())
{
/* Making parent node */
TreeNode ParentNode = new TreeNode();
ParentNode.Text = S.Substring(55);
treeView1.Nodes.Add(ParentNode);
/* Making child node */
FTPLIB.ChangeDir("//" + S.Substring(55) + "/");
foreach (string S2 in FTPLIB.List())
{
FTPLIB.ChangeDir("//" + S.Substring(55) + "/");
TreeNode ChildNode = new TreeNode();
ChildNode.Text = S2.Substring(55);
ParentNode.Nodes.Add(ChildNode);
FTPLIB.ChangeDir(".");
}
}
}
}
}
Happy coding people , code is shibby ....
Nevermind , substring(55) eventually worked ... lalala, happy happy
now i converted it to a textbox and then used substring wich works .... awesome , thanks LiZR
Hey there,
ok i finally get my list of directories from my server , but these look like this
-x 10 test mail 4096 Dec 1 12:01 users
-x 10 test mail 4096 Dec 1 12:01 admin
etc etc...
basically i only need "users", or in the second string "admin"
So how can i cut the text to get only those texts ??
Substring(9) does not work....
Yo dude, maybe something like this will work , it works for me ...
Application.DoEvents();
listView1.Refresh();
I'm glad we both know the problem, but where can i go from here ??
i realize what the problem is , but the solution i do not know at this stage ... guess i will have to use a different FTP class
Ok i think i know whats wrong here
i think that the files are not registering in the array - what you said
private void FindFiles(object sender, EventArgs e)
{
try
{
m_ftp.Server = txtftpServerName.Text;
m_ftp.Username = txtftpUserName.Text;
m_ftp.Password = txtftpPassword.Text;
m_ftp.Login();
m_ftp.ChangeDir(txtToDirectory.Text);
string[] fi = m_ftp.GetFileList();
cboFindFile.Items.AddRange(fi);
m_ftp.Close();
}
catch(Exception EX)
{
MessageBox.Show("File Not Downloaded");
}
}
I dont even have a loop there but it works exactly the same ...
The directory contains about 5 zipped files , trust me i have been debugging ... hahaha, i guess this leaves me at phase one again, but rest asured, i never give up, i will post the working code soon, watch this space ... hehehe
The problem must be within the loop somewhere, thats why i think maybe doing a 'for' loop rather than a 'foreach' loop, because it does give me the first file in the dir, but there are about five .bak files that are zipped ... so lets say .zip files
Anyway , thanks for your attempt
NO luck yet ...
can you maybe give me some other example ??
Maybe a 'for' loop ??
Ok i understand that , thank you very much ... i tested a few other ways, but for argument sake lets say i said
string[] The_Files = m_ftp.GetFileList("/");
or
string[] The_Files = m_ftp.GetFileList("TestDir/");
or even
string[] The_Files = m_ftp.GetFileList("//TestDir/");
/* Just keep in mind that the TCP is already connected so specifying just a directory works for Upload and delete */
It gives me the same problem , so could you maybe make my day worth wile and help me try something else ?
Even a total different approach is fine, i can adjust my code...
LizR - you rock , thanks for your help
Hello fellow super coder people
i am rtying to list all the files in a certain directory (eg. "TestDir") in a combobox
try
{
m_ftp.Server = txtftpServerName.Text;
m_ftp.Username = txtftpUserName.Text;
m_ftp.Password = txtftpPassword.Text;
m_ftp.Login();
string[] The_File = m_ftp.GetFileList("TestDir");
foreach (string FILE in The_File)
{
cboFindFile.Items.Add(FILE);
Console.Write(FILE);
}
m_ftp.Close();
}
catch(Exception EX)
{
MessageBox.Show("Files Not Downloaded");
}
That only downloads one file into the combobox ...
Any ideas ???
please help...
Regards and thanks...
Cool , i realized my problem is not my actual domain, its the path i"m specifying, so i have this
private void FTP_Upload(object sender, EventArgs e)
{
FileStream fs_Upload = new FileStream(txtTo.Text + "/" + txtName.Text + ".zip", FileMode.Open, FileAccess.Read, FileShare.Read);
// Creating strings to hold values
string m_server = txtftpServerName.Text;
string m_username = txtftpUserName.Text;
string m_password = txtftpPassword.Text;
string m_UploadFile = fs_Upload.ToString();
string m_directory = txtftpServerName + "Backups/";
m_ftp.Server = txtftpServerName.Text;
m_ftp.Username = txtftpUserName.Text;
m_ftp.Password = txtftpPassword.Text;
AsyncCallback m_callback = new AsyncCallback(CloseConnection);
try
{
// Logging in to the server
m_ftp.Login();
// PROBLEM !!! ????
m_ftp.RemotePath = ".";
// PROBLEM !!! ????
m_ftp.UploadDirectory("Backups/", false);
// Uploading the selected file
m_ftp.Upload("c://DBNAME.bak.zip");
// Closing class
m_ftp.Close();
}
catch (Exception Ex)
{
// Messagebox shows errors
MessageBox.Show("File transfer protocol failed " + Ex.Message);
// Sending error Mail
MailOnError(sender, e);
}
Application.DoEvents();
}
I am uncertain about the "m_ftp.UploadDirectory("Backups/", false);" part , because it tries to FTP to my own PC, is there any other way of setting a path on a server ??
The Path should be Root -> Backups -> File must save here
Any help Please ...
Write an application that makes coffee ... hahaha, i'd buy that twice !!!
How about you send me a msg man , like to give you some ideas...
Maybe you could help me with some of my test dummy applications (like my new one , i am trying to write a self learning application...)
Hahaha, i had the same problem last year, welcome to the world of writing your own controls m friend ...
Hi there,
I would like to know if there is any default settings one can use to test FTP settings etc, i am doing an application that does database backups , then zips the backup and FTP it to the server, i believe it is working because at the moment i am using these settings
ftp.Server = "ftp.secureftp-test.com";
ftp.Username = "test";
ftp.Password = "test";
***FTP refers to the class i wrote that handles the ftp
Now this works all good and all but ftp.secureftp-test.com obviously declines my attempt to upload the files, does anyone know any better idea or location ??
Thanks in advance...
mr VonZipper
Yo dude, you can always just refresh the connection, you don't need to close your form,
i take it you want something like this
using System.Data.SqlClient;
namespace TestDummyTWO
{
public partial class Form1 : Form
{
SqlConnection sqlcon =
new SqlConnection("Data Source=.;Initial Catalog=your_table;Integrated Security=True;Asynchronous Processing = True");
SqlCommand sqlCom = new SqlCommand("SELECT ITEMS FROM YOUR_TABLENAME");
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
SqlDataReader reader = sqlCom .ExecuteReader();
// Looping throuhg the list of data
while (reader.Read())
{
// Fill combo Box with data
comboBox1.Items.Add(reader["ITEMS"]);
}
}
private void button1_Click(object sender, EventArgs e)
{
// you added the new item from the tex box into the DATA TABLE
// Not the combobox
// use sqlCom again to do so
sqlCom.CommandText = "Insert into blah blah";
/* THIS IS WHAT YOU HAVE TO DO */
sqlcon.Close();
sqlcon.Open();
}
Hope that helps ...
Whats up beautiful people
the fresh air today (because my code works)...
I thought I'd swing by to give you guys the code also because this could be confusing as many of us never ever used it ... its simple and it works...
1. Two Textboxes (txtSourcePath, txtDestpath)
2. Two buttons (btnZip, btnBrowse)
3. An open file dialog (openfiledialog1)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Compression;
using System.IO;
namespace TestDummyTWO
{
public partial class Form1 : Form
{
string srcPath;
string destPath;
private const int buffer_size = 100;
public Form1()
{
InitializeComponent();
}
private void btnBrowse_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
txtSourcePath.Text = openFileDialog1.FileName;
txtDestPath.Text = "C:/Documents and Settings/All Users/Desktop/Tester.zip";
openFileDialog1.Dispose();
}
private void btnzip_Click(object sender, EventArgs e)
{
zIpDatabseFile(srcPath, destPath);
}
// creating the Zip File
private void zIpDatabseFile(string srcPath, string destPath)
{
//This is for Zip a File
byte[] bufferWrite;
FileStream fsSource;
FileStream fsDest;
GZipStream gzCompressed;
fsSource = new FileStream(txtSourcePath.Text, FileMode.Open, FileAccess.Read, FileShare.Read);
bufferWrite = new byte[fsSource.Length];
fsSource.Read(bufferWrite, 0, bufferWrite.Length);
fsDest = new FileStream(txtDestPath.Text, FileMode.OpenOrCreate, FileAccess.Write);
gzCompressed = new GZipStream(fsDest, CompressionMode.Compress, true);
gzCompressed.Write(bufferWrite, 0, bufferWrite.Length);
fsSource.Close();
gzCompressed.Close();
fsDest.Close();
}
}
}
Special thanks to ddanbe for the motivation , i really needed it yesterday...
Happy coding people