Exemple #1
0
        public void deployExtension(myQv.QMSClientEnhanced qvClient, Guid qvsId, string fileName)
        {
            ExtensionUploadHandle handle = qvClient.InitiateUploadExtensionObject(qvsId);

            if (handle != null)
            {
                FileStream fs = new FileStream(fileName, FileMode.Open);

                int maxBufferSize = 1024 * 16;

                byte[] buffer = new byte[maxBufferSize];
                int    bytesRead;

                while ((bytesRead = fs.Read(buffer, 0, maxBufferSize)) > 0)
                {
                    //Copy the read bytes into a new buffer with the same size as the number of received bytes
                    byte[] byteWireBuffer = new byte[bytesRead];
                    Buffer.BlockCopy(buffer, 0, byteWireBuffer, 0, bytesRead);

                    //Write the buffer to the QVS
                    handle = qvClient.WriteExtensionObject(handle, byteWireBuffer);
                }

                //Finalize the upload. This will install the extension object if it is valid.
                List <QVSMessage> msg = qvClient.CloseAndInstallExtensionObject(handle);

                msg.ForEach(
                    m => myCore.Logging.log(m.Text, 2, myCore.LogType.Information)
                    );
            }
        }