Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
GeneralRe: mysql connect + retrieving record Pin
benjamin yap3-Jun-09 0:07
benjamin yap3-Jun-09 0:07 
GeneralRe: mysql connect + retrieving record Pin
Moreno Airoldi3-Jun-09 0:33
Moreno Airoldi3-Jun-09 0:33 
QuestionControlling Navigation in IE using c# Pin
svt gdwl2-Jun-09 23:38
svt gdwl2-Jun-09 23:38 
AnswerRe: Controlling Navigation in IE using c# Pin
Pete O'Hanlon2-Jun-09 23:54
mvePete O'Hanlon2-Jun-09 23:54 
QuestionCopying a file with progress Pin
musefan2-Jun-09 23:31
musefan2-Jun-09 23:31 
AnswerRe: Copying a file with progress Pin
Pete O'Hanlon2-Jun-09 23:51
mvePete O'Hanlon2-Jun-09 23:51 
GeneralRe: Copying a file with progress Pin
musefan3-Jun-09 0:30
musefan3-Jun-09 0:30 
AnswerRe: Copying a file with progress Pin
Xmen Real 3-Jun-09 0:07
professional Xmen Real 3-Jun-09 0:07 
here is a code snippet that I use

public static void Copy(string sourcePath, string destPath, bool overwrite, int bufferSize, ProgressBar tmp_pb)
{
    if (!overwrite && File.Exists(destPath))
        throw new ArgumentException("File already exists.");

    if (!Directory.Exists(Path.GetDirectoryName(destPath)))
        Directory.CreateDirectory(Path.GetDirectoryName(destPath));

    ////creating non exists directories
    //string[] tmp_destSecs = .Split('\\');
    //for (int a = 1; a <= tmp_destSecs.Length; a++)
    //{
    //    if (!Directory.Exists(string.Join("\\", tmp_destSecs, 0, a)))
    //        Directory.CreateDirectory(string.Join("\\", tmp_destSecs, 0, a));
    //}


    FileStream tmp_fr = new FileStream(sourcePath, FileMode.Open);
    FileStream tmp_fw = new FileStream(destPath, FileMode.Create);

    long fileSize = new FileInfo(sourcePath).Length;
    if (fileSize < bufferSize)
        bufferSize = (int)fileSize;
    long numOfLoops = (fileSize / bufferSize);
    tmp_pb.Step = tmp_pb.Maximum / (int)numOfLoops;
    byte[] tmp_data;
    for (int a = 0; a < numOfLoops; a++)
    {
        tmp_data = new byte[bufferSize];
        tmp_fr.Read(tmp_data, 0, bufferSize);
        tmp_fw.Write(tmp_data, 0, bufferSize);
        tmp_pb.PerformStep();
        Application.DoEvents();
    }
    int leftBytes = (int)(fileSize - tmp_fr.Position);
    if (leftBytes > 0)
    {
        tmp_data = new byte[leftBytes];
        tmp_fr.Read(tmp_data, 0, leftBytes);
        tmp_fw.Write(tmp_data, 0, leftBytes);
    }
    tmp_fr.Close();
    tmp_fw.Flush();
    tmp_fw.Close();
    tmp_pb.Value = 0;
}




TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia>

-----------------------------------------------
128 bit encrypted signature, crack if you can

GeneralRe: Copying a file with progress Pin
musefan3-Jun-09 0:32
musefan3-Jun-09 0:32 
GeneralRe: Copying a file with progress Pin
Xmen Real 3-Jun-09 2:36
professional Xmen Real 3-Jun-09 2:36 
GeneralRe: Copying a file with progress Pin
musefan3-Jun-09 3:10
musefan3-Jun-09 3:10 
AnswerRe: Copying a file with progress Pin
harold aptroot3-Jun-09 0:27
harold aptroot3-Jun-09 0:27 
GeneralRe: Copying a file with progress Pin
musefan3-Jun-09 0:42
musefan3-Jun-09 0:42 
AnswerRe: Copying a file with progress [modified] Pin
Alan N3-Jun-09 0:52
Alan N3-Jun-09 0:52 
GeneralRe: Copying a file with progress Pin
musefan3-Jun-09 0:55
musefan3-Jun-09 0:55 
AnswerRe: Copying a file with progress [modified] Pin
harold aptroot3-Jun-09 0:55
harold aptroot3-Jun-09 0:55 
GeneralRe: Copying a file with progress Pin
musefan3-Jun-09 1:05
musefan3-Jun-09 1:05 
GeneralRe: Copying a file with progress Pin
Alan N3-Jun-09 1:05
Alan N3-Jun-09 1:05 
GeneralRe: Copying a file with progress Pin
musefan3-Jun-09 1:07
musefan3-Jun-09 1:07 
QuestionHow to Repeat execution of AT commands to read SMS from Mobile? Pin
Md. Ali Naser Khan2-Jun-09 23:24
Md. Ali Naser Khan2-Jun-09 23:24 
QuestionHow to disable back button on IE? Pin
svt gdwl2-Jun-09 23:17
svt gdwl2-Jun-09 23:17 
AnswerRe: How to disable back button on IE? Pin
Blue_Boy2-Jun-09 23:25
Blue_Boy2-Jun-09 23:25 
AnswerRe: How to disable back button on IE? Pin
J4amieC2-Jun-09 23:27
J4amieC2-Jun-09 23:27 
AnswerRe: How to disable back button on IE? Pin
Manas Bhardwaj2-Jun-09 23:39
professionalManas Bhardwaj2-Jun-09 23:39 
Questionvariable which is assing class value and array.sort problem Pin
karayel_kara2-Jun-09 22:48
karayel_kara2-Jun-09 22:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.