private string ReadAndEncodedFile(string FullFileName) { string return_value; return_value = ReadAndEncodedFile(FullFileName, true); return return_value; } private string ReadAndEncodedFile(string FullFileName, bool bBase64Encode) { // read the file System.IO.FileStream inFile; byte[] binaryData; try { inFile = new System.IO.FileStream(FullFileName, System.IO.FileMode.Open, System.IO.FileAccess.Read); binaryData = new byte[inFile.Length]; long bytesRead = inFile.Read(binaryData, 0, System.Convert.ToInt32(inFile.Length)); inFile.Close(); } catch (System.Exception exp) { // Error creating stream or reading from it. System.Console.WriteLine("{0}", exp.Message); return "FAIL"; } string base64String; if (bBase64Encode) { // Convert the binary input into Base64 UUEncoded output. try { base64String = System.Convert.ToBase64String(binaryData, 0); } catch (System.ArgumentNullException) { System.Console.WriteLine("Binary data array is null."); return "FAIL"; } // done Encoding file } else { base64String = binaryData.ToString(); } return base64String; } private void chkUseProxy_CheckedChanged(object sender, EventArgs e) { if (chkUseProxy.Checked) groupBox1.Enabled = true; else groupBox1.Enabled = false; } private void Set_Server_and_Proxy(System.Web.Services.Protocols.SoapHttpClientProtocol EM) { EM.Url = GetSystemServer(); //the EasyLink URL to submit to. if (chkProxyTrace.Checked) EM.Proxy = new System.Net.WebProxy("http://localhost:8080"); if (chkUseProxy.Checked) { EM.Proxy = new System.Net.WebProxy(txtProxyIP.Text); EM.Credentials = new System.Net.NetworkCredential(txtProxyUser.Text, txtProxyPass.Text); } } //used to extract XML static void serializeResult(String filename, System.Object res) { System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(res.GetType()); System.IO.TextWriter w = new System.IO.StreamWriter(filename); x.Serialize(w, res); w.Close(); }