Пример #1
0
        public Node get_Node(string authTocken, long node_id)
        {
            DocumentManagementClient docManClient = new DocumentManagementClient();

            CWS.DocumentManagement.OTAuthentication otAuthDocManger = new CWS.DocumentManagement.OTAuthentication();
            otAuthDocManger.AuthenticationToken = authTocken;
            Node node = null;

            try
            {
                node = docManClient.GetNode(ref otAuthDocManger, node_id);
            }
            catch (FaultException e)
            {
                Console.WriteLine(e.Message);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                docManClient.Close();
            }
            return(node);
        }
Пример #2
0
        public long get_ID_Node(string authTocken, long parent_id, string nom_dossier)
        {
            DocumentManagementClient docManClient = new DocumentManagementClient();

            CWS.DocumentManagement.OTAuthentication otAuthDocManger = new CWS.DocumentManagement.OTAuthentication();
            otAuthDocManger.AuthenticationToken = authTocken;
            Node folder = null;

            try
            {
                folder = docManClient.GetNodeByName(ref otAuthDocManger, parent_id, nom_dossier);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                // Always close the client
                docManClient.Close();
            }
            if (folder != null)
            {
                return(folder.ID);
            }
            else
            {
                return(0);
            }
        }
Пример #3
0
        public Node[] get_List_Nodes(string authTocken, long parent_id)
        {
            DocumentManagementClient docManClient = new DocumentManagementClient();

            CWS.DocumentManagement.OTAuthentication otAuthDocManger = new CWS.DocumentManagement.OTAuthentication();
            otAuthDocManger.AuthenticationToken = authTocken;
            Node[] nodes = null;
            try
            {
                nodes = docManClient.ListNodes(ref otAuthDocManger, parent_id, true);
            }
            catch (FaultException e)
            {
                MessageBox.Show(e.Message);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
            finally
            {
                docManClient.Close();
            }
            return(nodes);
        }
Пример #4
0
        public void set_Node(string authTocken, long node_id, Metadata metadata)
        {
            DocumentManagementClient docManClient = new DocumentManagementClient();

            CWS.DocumentManagement.OTAuthentication otAuthDocManger = new CWS.DocumentManagement.OTAuthentication();
            otAuthDocManger.AuthenticationToken = authTocken;
            try
            {
                docManClient.SetNodeMetadata(ref otAuthDocManger, node_id, metadata);
            }
            catch (FaultException e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                docManClient.Close();
            }
        }
Пример #5
0
        public Stream dowlande(string authToken, string pathe, Node node)
        {
            //Create the DocumentManagement service client
            DocumentManagementClient docManClient = new DocumentManagementClient();

            CWS.DocumentManagement.OTAuthentication otAuth = new CWS.DocumentManagement.OTAuthentication();
            otAuth.AuthenticationToken = authToken;

            ContentServiceClient contentServiceClient = new ContentServiceClient();

            CWS.ContentService.OTAuthentication otAuthConServices = new CWS.ContentService.OTAuthentication();
            otAuthConServices.AuthenticationToken = authToken;
            //string fileName=null;
            string contextID = null;

            try
            {
                contextID = docManClient.GetVersionContentsContext(ref otAuth, node.ID, 0);
            }
            catch (FaultException e)
            {
                MessageBox.Show(e.Message);
            }
            finally
            {
                docManClient.Close();
            }

            Stream downloadStream = null;

            try
            {
                downloadStream = contentServiceClient.DownloadContent(ref otAuthConServices, contextID);
            }
            catch (FaultException e)
            {
                MessageBox.Show(e.Message);
            }
            finally
            {
                contentServiceClient.Close();
            }

            /*FileStream fileStream = null;
             * try
             * {
             *  string path = Path.GetDirectoryName(Application.ExecutablePath).Replace(@"bin\Debug", string.Empty);
             *  fileName = Path.Combine(path.Replace(@"bin\Debug", string.Empty), @"GED_image\" + node.Name + ".tif");
             *  if (File.Exists(fileName))
             *  {
             *      File.Delete(fileName);
             *  }
             *  fileStream = new FileStream(fileName, FileMode.Create);
             *  byte[] buffer = new byte[BUFFER_SIZE];
             *  long fileSize = 0;
             *  for (int read = downloadStream.Read(buffer, 0, buffer.Length); read > 0; read = downloadStream.Read(buffer, 0, buffer.Length))
             *  {
             *      fileStream.Write(buffer, 0, read);
             *      fileSize += read;
             *  }
             * }
             * catch (Exception e)
             * {
             *  //MessageBox.Show(e.Message);
             * }
             * finally
             * {
             *  if (fileStream != null)
             *  {
             *      fileStream.Close();
             *  }
             *  downloadStream.Close();
             * }*/
            return(downloadStream);
        }