[Mantisconnect-cvs] SF.net SVN: mantisconnect: [137] mantisconnect/trunk/clients/dotnet/ mantisconn
Brought to you by:
vboctor
From: <vb...@us...> - 2007-05-30 06:11:16
|
Revision: 137 http://svn.sourceforge.net/mantisconnect/?rev=137&view=rev Author: vboctor Date: 2007-05-29 23:11:04 -0700 (Tue, 29 May 2007) Log Message: ----------- Fixed a bug in IssueAttachmentAdd() C# library. Modified Paths: -------------- mantisconnect/trunk/clients/dotnet/mantisconnect/Request.cs Modified: mantisconnect/trunk/clients/dotnet/mantisconnect/Request.cs =================================================================== --- mantisconnect/trunk/clients/dotnet/mantisconnect/Request.cs 2007-04-22 04:53:32 UTC (rev 136) +++ mantisconnect/trunk/clients/dotnet/mantisconnect/Request.cs 2007-05-30 06:11:04 UTC (rev 137) @@ -474,17 +474,15 @@ /// Uploads the specified file to the specified issue. /// </summary> /// <param name="issueId">The issue id</param> - /// <param name="fileName">The file</param> - /// <returns></returns> - public int IssueAttachmentAdd(int issueId, string fileName) + /// <param name="filePath">The file path of the file to attach.</param> + /// <param name="fileName"> + /// The name of the file (without any path) to be associated with the uploaded file + /// (if null, will extract name from full path). + /// </param> + /// <returns>The attachment id.</returns> + public int IssueAttachmentAdd(int issueId, string filePath, string fileName) { - byte[] bytes = File.ReadAllBytes(fileName); - string base64 = Convert.ToBase64String(bytes); - - ASCIIEncoding encoding = new ASCIIEncoding(); - byte[] encoded = encoding.GetBytes(base64); - - return this.IssueAttachmentAdd(issueId, Path.GetFileName(fileName), MimeTypes.GetMimeType(Path.GetExtension(fileName)), encoded); + return this.IssueAttachmentAdd(issueId, fileName ?? Path.GetFileName(filePath), MimeTypes.GetMimeType(Path.GetExtension(fileName)), File.ReadAllBytes(filePath)); } /// <summary> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |