Example #1
0
        private void TestResizeOriginal(int nodeId)
        {
            try
            {
                imagelinks.ImageLinksClient imageLinksClient = new imagelinks.ImageLinksClient();
                imageLinksClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(imagelinksUri);

                imagelinks.OTAuthentication imagelinksAuthentication = new imagelinks.OTAuthentication();

                String fileName = @"C:\Users\Public\Pictures\Sample Pictures\preview.jpg";
                ContentServerContentService.FileAtts testFileAtts = new ContentServerContentService.FileAtts();
                FileInfo testFileInfo = new FileInfo(fileName);
                testFileAtts.CreatedDate  = testFileInfo.CreationTime;
                testFileAtts.FileName     = testFileInfo.Name;
                testFileAtts.FileSize     = testFileInfo.Length;
                testFileAtts.ModifiedDate = testFileInfo.LastWriteTime;

                documentManagementClient = new ContentServerDocumentManagement.DocumentManagementClient();
                documentManagementClient.Endpoint.Address            = new System.ServiceModel.EndpointAddress(documentManagementUri);
                documentManagementAuthentication                     = new ContentServerDocumentManagement.OTAuthentication();
                documentManagementAuthentication.AuthenticationToken = contentServerToken;

                ContentServerDocumentManagement.Node testNodeResult = documentManagementClient.GetNode(ref documentManagementAuthentication, nodeId);
                imagelinksAuthentication.AuthenticationToken = contentServerToken;
                imagelinks.ResizeOriginalResult resizeOriginalResult = imageLinksClient.ResizeOriginal(ref imagelinksAuthentication, nodeId, new imagelinks.Metadata());

                Stream content = File.Open(fileName, FileMode.Open);

                ContentServerContentService.ContentServiceClient contentServiceClient = new ContentServerContentService.ContentServiceClient();
                contentServiceClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(contentServiceUri);
                ContentServerContentService.OTAuthentication contentServiceAuthentication = new ContentServerContentService.OTAuthentication();

                contentServiceAuthentication.AuthenticationToken = contentServerToken;
                string s = contentServiceClient.UploadContent(ref contentServiceAuthentication, resizeOriginalResult.OriginalContext, testFileAtts, content);
                content.Close(); content.Dispose();
            }
            catch (Exception ex)
            {
            }
        }
Example #2
0
        private void TestResizeOriginal(int nodeId)
        {
            try
            {
                imagelinks.ImageLinksClient imageLinksClient = new imagelinks.ImageLinksClient();
                imageLinksClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(imagelinksUri);

                imagelinks.OTAuthentication imagelinksAuthentication = new imagelinks.OTAuthentication();

                String fileName = @"C:\Users\Public\Pictures\Sample Pictures\preview.jpg";
                ContentServerContentService.FileAtts testFileAtts = new ContentServerContentService.FileAtts();
                FileInfo testFileInfo = new FileInfo(fileName);
                testFileAtts.CreatedDate = testFileInfo.CreationTime;
                testFileAtts.FileName = testFileInfo.Name;
                testFileAtts.FileSize = testFileInfo.Length;
                testFileAtts.ModifiedDate = testFileInfo.LastWriteTime;

                documentManagementClient = new ContentServerDocumentManagement.DocumentManagementClient();
                documentManagementClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(documentManagementUri);
                documentManagementAuthentication = new ContentServerDocumentManagement.OTAuthentication();
                documentManagementAuthentication.AuthenticationToken = contentServerToken;

                ContentServerDocumentManagement.Node testNodeResult = documentManagementClient.GetNode(ref documentManagementAuthentication, nodeId);
                imagelinksAuthentication.AuthenticationToken = contentServerToken;
                imagelinks.ResizeOriginalResult resizeOriginalResult = imageLinksClient.ResizeOriginal(ref imagelinksAuthentication, nodeId, new imagelinks.Metadata());

                Stream content = File.Open(fileName, FileMode.Open);

                ContentServerContentService.ContentServiceClient contentServiceClient = new ContentServerContentService.ContentServiceClient();
                contentServiceClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(contentServiceUri);
                ContentServerContentService.OTAuthentication contentServiceAuthentication = new ContentServerContentService.OTAuthentication();

                contentServiceAuthentication.AuthenticationToken = contentServerToken;
                string s = contentServiceClient.UploadContent(ref contentServiceAuthentication, resizeOriginalResult.OriginalContext, testFileAtts, content);
                content.Close(); content.Dispose();
            }
            catch (Exception ex)
            {

            }
        }
Example #3
0
        private void TestAddVersion(int p)
        {
            ContentServerContentService.ContentServiceClient contentServiceClient;
            ContentServerContentService.OTAuthentication     contentServiceAuthentication;

            Stream content = null;

            OpenFileDialog openFile = new OpenFileDialog();

            openFile.InitialDirectory = @"C:\Users\Public\Documents\LEADTOOLS Images\ImageProcessingDemo";

            if (openFile.ShowDialog() == DialogResult.OK)
            {
                //connect
                try
                {
                    documentManagementClient = new ContentServerDocumentManagement.DocumentManagementClient();
                    documentManagementClient.Endpoint.Address            = new System.ServiceModel.EndpointAddress(documentManagementUri);
                    documentManagementAuthentication                     = new ContentServerDocumentManagement.OTAuthentication();
                    documentManagementAuthentication.AuthenticationToken = contentServerToken;
                }
                catch (Exception ex)
                {
                }

                try
                {
                    documentManagementAuthentication.AuthenticationToken = contentServerToken;
                    ContentServerDocumentManagement.Node testNodeResult = documentManagementClient.GetNode(ref documentManagementAuthentication, p);

                    ContentServerDocumentManagement.Metadata testMetadata = new ContentServerDocumentManagement.Metadata();

                    documentManagementAuthentication.AuthenticationToken = contentServerToken;
                    String addVersionContext = documentManagementClient.AddVersionContext(ref documentManagementAuthentication, testNodeResult.ID, testMetadata);

                    ContentServerContentService.FileAtts testFileAtts = new ContentServerContentService.FileAtts();
                    FileInfo testFileInfo = new FileInfo(openFile.FileName);
                    testFileAtts.CreatedDate  = testFileInfo.CreationTime;
                    testFileAtts.FileName     = testFileInfo.Name;
                    testFileAtts.FileSize     = testFileInfo.Length;
                    testFileAtts.ModifiedDate = testFileInfo.LastWriteTime;

                    content = File.Open(openFile.FileName, FileMode.Open);

                    contentServiceClient = new ContentServerContentService.ContentServiceClient();
                    contentServiceClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(contentServiceUri);
                    contentServiceAuthentication          = new ContentServerContentService.OTAuthentication();

                    contentServiceAuthentication.AuthenticationToken = contentServerToken;
                    contentServiceClient.UploadContent(ref contentServiceAuthentication, addVersionContext, testFileAtts, content);

                    System.Windows.Forms.MessageBox.Show(String.Format("Version to {0} succesfully added!", testNodeResult.ID.ToString()));
                }
                catch (Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show(ex.Message);
                }
                finally
                {
                    if (content != null)
                    {
                        content.Close();
                        content.Dispose();
                    }
                }
            }
        }
Example #4
0
        private void TestAddVersion(int p)
        {
            ContentServerContentService.ContentServiceClient contentServiceClient;
            ContentServerContentService.OTAuthentication contentServiceAuthentication;

            Stream content = null;

            OpenFileDialog openFile = new OpenFileDialog();
            openFile.InitialDirectory = @"C:\Users\Public\Documents\LEADTOOLS Images\ImageProcessingDemo";

            if (openFile.ShowDialog() == DialogResult.OK)
            {

                //connect
                try
                {
                    documentManagementClient = new ContentServerDocumentManagement.DocumentManagementClient();
                    documentManagementClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(documentManagementUri);
                    documentManagementAuthentication = new ContentServerDocumentManagement.OTAuthentication();
                    documentManagementAuthentication.AuthenticationToken = contentServerToken;
                }
                catch (Exception ex)
                {
                }

                try
                {
                    documentManagementAuthentication.AuthenticationToken = contentServerToken;
                    ContentServerDocumentManagement.Node testNodeResult = documentManagementClient.GetNode(ref documentManagementAuthentication, p);

                    ContentServerDocumentManagement.Metadata testMetadata = new ContentServerDocumentManagement.Metadata();

                    documentManagementAuthentication.AuthenticationToken = contentServerToken;
                    String addVersionContext = documentManagementClient.AddVersionContext(ref documentManagementAuthentication, testNodeResult.ID, testMetadata);

                    ContentServerContentService.FileAtts testFileAtts = new ContentServerContentService.FileAtts();
                    FileInfo testFileInfo = new FileInfo(openFile.FileName);
                    testFileAtts.CreatedDate = testFileInfo.CreationTime;
                    testFileAtts.FileName = testFileInfo.Name;
                    testFileAtts.FileSize = testFileInfo.Length;
                    testFileAtts.ModifiedDate = testFileInfo.LastWriteTime;

                    content = File.Open(openFile.FileName, FileMode.Open);

                    contentServiceClient = new ContentServerContentService.ContentServiceClient();
                    contentServiceClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(contentServiceUri);
                    contentServiceAuthentication = new ContentServerContentService.OTAuthentication();

                    contentServiceAuthentication.AuthenticationToken = contentServerToken;
                    contentServiceClient.UploadContent(ref contentServiceAuthentication, addVersionContext, testFileAtts, content);

                    System.Windows.Forms.MessageBox.Show(String.Format("Version to {0} succesfully added!", testNodeResult.ID.ToString()));
                }
                catch (Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show(ex.Message);
                }
                finally
                {
                    if (content != null)
                    {
                        content.Close();
                        content.Dispose();
                    }
                }
            }
        }