private void OnRemoteStatusUpdate(DocumentSharingStatusUpdate msg)
 {
     lblStatus.Text = msg.strMessage;
 }
Example #2
0
        public int StartDocumentSharing(ref MessageObject msg)
        {
            try
            {
                DocumentSharing Message = (DocumentSharing)msg;
                string strUploadedPath = ConferenceServer.staticServerInstance.WEBSERVER_DOCUMENTSHARING_UPLOAD_PATH;
                string documentFolderName = "";
                if(Message.DocumentType == DocumentMessageType.typeDocument)
                    documentFolderName = "Documents";
                else if(Message.DocumentType == DocumentMessageType.typeExcel)
                    documentFolderName = "WorkBooks";
                else if(Message.DocumentType == DocumentMessageType.typePDF)
                    documentFolderName = "PDF";
                else if(Message.DocumentType == DocumentMessageType.typePresentation)
                    documentFolderName = "Presentations";

                strUploadedPath += "\\" + this.ConferenceId + "\\" + Message.sessionID + "\\" + documentFolderName + "\\" + Message.DownloadURL;
                strUploadedPath = strUploadedPath.Replace("\\\\","\\");

                string strLocalPath ="";// ConferenceServer.staticServerInstance.WEBSERVER_DOCUMENTSHARING_DOWNLOAD_PATH ;

                /*  ccode for making temporary directory
                strLocalPath += "\\" + this.ConferenceId ;//+ "\\" + Message.SenderID
                CreateDirectory(strLocalPath);
                strLocalPath += "\\" + Message.sessionID;
                CreateDirectory(strLocalPath);
                strLocalPath += "\\" + Message.DownloadURL;
                strLocalPath  = strLocalPath .Replace("\\\\","\\");
                */
                WebMeeting.Common.ICSharpZip.UnzipZip(strUploadedPath +".zip",Path.GetDirectoryName(strUploadedPath) + @"\");

                ////////////////START  Code for create local copy of the document for conversion and send update message
                strLocalPath = Path.GetDirectoryName(strUploadedPath) + "\\" + Path.GetFileNameWithoutExtension(Message.DownloadURL) ;//+ ".htm";
                //				if(!Directory.Exists(strLocalPath))
                //					Directory.CreateDirectory(strLocalPath);
                //				strLocalPath += "\\Converted";
                //				if(!Directory.Exists(strLocalPath))
                //					Directory.CreateDirectory(strLocalPath);
                //				strLocalPath += "\\" + Path.GetFileNameWithoutExtension(Message.DownloadURL) + ".htm";
                DocumentSharingStatusUpdate updateMsg = new DocumentSharingStatusUpdate();
                updateMsg.sessionID = Message.sessionID;
                updateMsg.SenderID = -1;
                updateMsg.strMessage = "Converting Document...";
                ((IMessageReceiver) this._dispatcher.TransparentProxy).DocumentSharingStatusUpdate(updateMsg);
                //
                ////////////////END  Code for create local copy of the document for conversion

                // code for converting documents.
                switch(Message.DocumentType)
                {
                    case DocumentMessageType.typeDocument:
                        if(!ConvertWordDocument(strUploadedPath,strLocalPath))
                            return 0;
                        break;
                    case DocumentMessageType.typePresentation:

                        if(!ConvertPresentationDocument(strUploadedPath,Directory.GetParent(strLocalPath).FullName,ref Message))
                            return 0;
                        break;
                    case DocumentMessageType.typeExcel:
                        if(File.Exists(strLocalPath))
                            File.Delete(strLocalPath);
                        if(!ConvertExcelDocument(strUploadedPath,strLocalPath ,ref Message))
                            return 0;
                        break;
                    case DocumentMessageType.typePDF:
                    {
                        if(File.Exists(strLocalPath))
                            File.Delete(strLocalPath);
                        if(!ConvertPDFDocument(strUploadedPath,strLocalPath))
                            return 0;
                        break;
                    }
                }
                System.Threading.Thread.Sleep(500);
                /*
                ArrayList Files = new ArrayList();
                GetFilesofDirectories(Path.GetDirectoryName(strLocalPath),Files);
                for(int i = 0 ; i < Files.Count ; i++)
                {
                    zip.AddFile(Files[i].ToString());
                }
                */

                //string temp = Directory.GetParent(strLocalPath).FullName;
                //strLocalPath = Directory.GetParent(strLocalPath).Parent.FullName + "\\" +  Path.GetFileName(strLocalPath) + ".zip";

                /*  for sending message to clients
                 updateMsg.strMessage = "Compressing Document...";
                ((IMessageReceiver) this._dispatcher.TransparentProxy).DocumentSharingStatusUpdate(updateMsg);*/
                //updateMsg = null;
                //ICSharpZip.ZipDirectory(temp,strLocalPath);
                //Message.DownloadURL = ConferenceServer.staticServerInstance.WEBSERVER_DOCUMENTSHARING_DOWNLOAD_URL + "/" + this.ConferenceId + "/" + Message.sessionID + "/" + Path.GetFileNameWithoutExtension(Message.DownloadURL) + "/" + Path.GetFileName(strLocalPath);

                //Directory.Delete(temp,true);

                msg = Message;

                return 1;
            }
            catch(Exception ee)
            {
                Console.Write("\n\nERRRRRRRRRRRORRRR " + ee.Message);
            }
            return 0;
        }