/// <summary> /// Send a binary file to the cvs server. /// </summary> /// <param name="outStream">Writable stream to the cvs server.</param> /// <param name="fileName">The name of the file to stream across.</param> public virtual void SendBinaryFile(CvsStream outStream, string fileName) { FileStream fs = File.OpenRead(fileName); byte[] data = new byte[fs.Length]; fs.Read(data, 0, data.Length); fs.Close(); outStream.SendString(data.Length.ToString() + "\n"); outStream.Write(data); }
/// <summary> /// Send a binary file to the cvs server. /// </summary> /// <param name="outStream"></param> /// <param name="fileName"></param> public override void SendBinaryFile(CvsStream outStream, string fileName) { FileStream fs = File.OpenRead(fileName); byte[] data = new byte[fs.Length]; fs.Read(data, 0, data.Length); fs.Close(); Stream oldStream = outStream.BaseStream; outStream.BaseStream = new GZipOutputStream(outStream.BaseStream); outStream.SendString("z" + data.Length.ToString() + "\n"); outStream.Write(data); outStream.BaseStream = oldStream; }
/// <summary> /// Submit a request to the cvs repository. /// </summary> /// <param name="request"></param> public void SubmitRequest(IRequest request) { if (null != request && null != request.RequestString) { if (null != this.RequestMessageEvent) { this.RequestMessageEvent(this, new MessageEventArgs(request, request.GetType().Name)); } } outputStream.SendString(request.RequestString); if (request.DoesModifyConnection) { request.ModifyConnection(this); } if (request.IsResponseExpected) { HandleResponses(); } }