void UploadFile(string filename) { //string srcPath = "..\\..\\..\\TestDriver2\\bin\\Debug\\"; string fqname = System.IO.Path.Combine(srcPath, filename); HiResTimer hrt = new HiResTimer(); try { hrt.Start(); using (var inputStream = new FileStream(fqname, FileMode.Open)) { FileTransferMessage msg = new FileTransferMessage(); msg.filename = filename; msg.transferStream = inputStream; channel.upLoadFile(msg); } hrt.Stop(); Console.WriteLine("\n------------------------Requirement 2 and 6 -- Line 248 Client_1.xaml.cs---------------"); Console.Write("\n Uploaded file to Repository \"{0}\" in {1} microsec.", filename, hrt.ElapsedMicroseconds); } catch (Exception e) { Console.Write("\n can't find \"{0}\"", fqname); } }
public void uploadFile(string filename, string toSend) // calluploader function calls it with name of the files and upload one by one { int numRetries = 10; int waitMilliSec = 50; string fqname = Path.Combine(toSend, filename); string x = Path.GetFullPath(fqname); for (int i = 0; i < numRetries; i++) { try { hrt.Start(); using (var inputStream = new FileStream(fqname, FileMode.OpenOrCreate)) { FileTransferMessage msg = new FileTransferMessage(); msg.fileName = filename; msg.transferStream = inputStream; channel.upLoadFile(msg); } hrt.Stop(); Console.Write("\n Uploaded file \"{0}\" in {1} microsec.", filename, hrt.ElapsedMicroseconds); break; } catch (Exception ex) { Thread.Sleep(waitMilliSec); Console.Write("\n Error: \"{0}\"", ex.Message); Console.WriteLine("\nRetry attempt: {0}", i + 1); } } }
public void uploadFile(string filename) // calluploader function calls it with name of the files and upload one by onee { int numRetries = 10; int waitMilliSec = 50; string fqname = Path.Combine(sourceDLL, filename); string x = Path.GetFullPath(fqname); for (int i = 0; i < numRetries; i++) // retry 10 times incase of a failure { try { hrt.Start(); using (var inputStream = new FileStream(fqname, FileMode.Open)) { FileTransferMessage msg = new FileTransferMessage(); msg.fileName = filename; msg.transferStream = inputStream; channel.upLoadFile(msg); } hrt.Stop(); Console.Write("\n Uploaded file \"{0}\" in {1} microsec.", filename, hrt.ElapsedMicroseconds); break; } catch (Exception ex) { // Sending files to repository using files Streaming.. Thread.Sleep(waitMilliSec); Console.WriteLine("\n ---------------------Unable to Send Files to the Repository--------------------- \n"); Console.Write("\n Error: \"{0}\"", ex.Message); Console.WriteLine("\nRetry attempt: {0} -->> To Send {1}", i + 1, Path.GetFileName(fqname)); } } }
void ClientUploadFile(string filename) { hrt.Start(); string fqname = System.IO.Path.Combine(ToSendPath, filename); using (var inputStream = new FileStream(fqname, FileMode.Open)) { FileTransferMessage msg = new FileTransferMessage(); msg.filename = filename; msg.transferStream = inputStream; fileProxy = CreateClientFileServiceChannel("http://localhost:8000/StreamService"); int i = 3; while (i > 0) { try { fileProxy.upLoadFile(msg); break; } catch (Exception ex) { Console.WriteLine("\nfileupload exception: {0}", ex.Message); i--; Thread.Sleep(500); } } } hrt.Stop(); Console.WriteLine("\n Uploaded file \"{0}\" in {1} microsec.", filename, hrt.ElapsedMicroseconds); listBox2.Items.Insert(0, "uploaded file " + filename + " in " + hrt.ElapsedMicroseconds + " microsec"); }
void uploadFile(string filename) { Console.Write("\n sending file \"{0}\"", filename); string fqname = Path.Combine(ToSendPath, filename); using (var inputStream = new FileStream(fqname, FileMode.Open)) { FileTransferMessage msg = new FileTransferMessage(); msg.filename = filename; msg.transferStream = inputStream; channel.upLoadFile(msg); } }
public bool uploadFile(string filename) { Console.Write("\n sending file \"{0}\"", filename); string fqname = Path.Combine(ToSendPath, filename); try { using (var inputStream = new FileStream(fqname, FileMode.Open)) { FileTransferMessage msg = new FileTransferMessage(); msg.filename = filename; msg.transferStream = inputStream; channel.upLoadFile(msg); } } catch { return(false); } return(true); }
void uploadFile(string filename) { string fqname = Path.Combine(ToSendPath, filename); try { hrt.Start(); using (var inputStream = new FileStream(fqname, FileMode.Open)) { FileTransferMessage msg = new FileTransferMessage(); msg.filename = filename; msg.transferStream = inputStream; channel.upLoadFile(msg); } hrt.Stop(); Console.Write("\n Uploaded file \"{0}\" in {1} microsec.", filename, hrt.ElapsedMicroseconds); } catch (Exception ex) { Console.Write("\n can't find the file\"{0}\"------->Requirement #3", fqname); } }