aminkeshani
چهارشنبه 26 مهر 1385, 11:27 صبح
با سلام 
 برای کپی کردن یک فایل از یک نقطه به نقطه دیگر در ویندوز چه دستوری را باید به کار ببرم.
  با تشکر از همه دوستان
ali_firouz_ir
چهارشنبه 26 مهر 1385, 13:29 عصر
public string File_Copy(string strSource, 
          string strDestination,FileMode mode, 
          int bufferSize,int Action)
{
    byte[] Readbytes;
    Readbytes = new byte[bufferSize];
    ///1 read file Binary 
    ///
    FileStream Sfs = File.OpenRead(strSource);
    Dfs = File.Open(strDestination,mode);
    FileInfo Sinfo = new FileInfo(Sfs.Name);
    FileInfo Dinfo=new FileInfo(Dfs.Name);
    //
    //Set Progress File Name On Form1
    Form1.progCurrentFile.Text = strSource;
    while (Sfs.Length - Sfs.Position>=bufferSize)
    {
        
        Sfs.Read(Readbytes,0,bufferSize);
        
        Dfs.Write(Readbytes,0,bufferSize);
        UpdatePersentageOfFile(Sfs.Position,Sfs.Length);
        ///try to change Buffer Size at Copping file 
        
        bufferSize = Settings.bufferSize;
        Readbytes = null;
        Readbytes = new  byte[Settings.bufferSize];
         
        System.Windows.Forms.Application.DoEvents();
     
        if (Sfs.Position < Sfs.Length)
        {
            Sfs.Read(Readbytes,0, 
              int.Parse(Sfs.Length.ToString()) - 
              int.Parse(Sfs.Position.ToString()));
            Dfs.Write(Readbytes,0, 
              int.Parse(Sfs.Length.ToString()) - 
              int.Parse(Sfs.Position.ToString()));
            UpdatePersentageOfFile(Sfs.Position,Sfs.Position);
            TotalCopiedSize+=Sfs.Length;
          
            
            //Do Events 
            System.Windows.Forms.Application.DoEvents();
        }
    }
    //end write 
}
Milad Mohseny
چهارشنبه 26 مهر 1385, 15:11 عصر
system.IO.FILE.Copy(source,des)
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.