Exemplo n.º 1
0
    public System.Threading.Tasks.Task <GetInfoResponse> GetInfoAsync(www.mnb.hu.webservices.GetInfoRequestBody GetInfo)
    {
        GetInfoRequest inValue = new GetInfoRequest();

        inValue.GetInfo = GetInfo;
        return(((MNBArfolyamServiceSoap)(this)).GetInfoAsync(inValue));
    }
Exemplo n.º 2
0
        public GetInfoResponse GetInfo(GetInfoRequest request)
        {
            var respone = new GetInfoResponse()
            {
                ErrorCode = "00", IsSuccess = "0", Message = "成功"
            };
            var info = curdData.GetInfo(request.Id);

            if (info == null)
            {
                respone.ErrorCode = "失败";
            }
            else
            {
                respone.UserInfo = new UserInfo()
                {
                    Name   = info.Name,
                    Id     = info.Id,
                    Gender = info.Gender,
                    Age    = info.Age
                };
                respone.IsSuccess = "1";
            }

            return(respone);
        }
Exemplo n.º 3
0
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new InfoApi(configuration);

            try
            {
                var fileInfo = new FileInfo
                {
                    FilePath    = "words-processing/docx/password-protected.docx",
                    Password    = "******",
                    StorageName = Common.MyStorage
                };

                var options = new InfoOptions()
                {
                    FileInfo = fileInfo
                };

                var request = new GetInfoRequest(options);

                var response = apiInstance.GetInfo(request);
                Console.WriteLine("InfoResult.PageCount: " + response.PageCount);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling InfoApi: " + e.Message);
            }
        }
Exemplo n.º 4
0
        public void TestGetInfoWithProjectOptions()
        {
            // Arrange
            var testFile    = TestFiles.ProjectMpp;
            var viewOptions = new ViewOptions
            {
                FileInfo      = testFile.ToFileInfo(),
                RenderOptions = new RenderOptions
                {
                    ProjectManagementOptions = new ProjectManagementOptions
                    {
                        PageSize  = ProjectManagementOptions.PageSizeEnum.Unspecified,
                        TimeUnit  = ProjectManagementOptions.TimeUnitEnum.Months,
                        StartDate = new DateTime(2008, 7, 1),
                        EndDate   = new DateTime(2008, 7, 31)
                    }
                }
            };
            var request = new GetInfoRequest(viewOptions);

            // Act & Assert
            var infoResult = InfoApi.GetInfo(request);

            Assert.IsTrue(infoResult.Pages.Count == 1 || infoResult.Pages.Count == 2);
        }
Exemplo n.º 5
0
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new InfoApi(configuration);

            try
            {
                var viewOptions = new ViewOptions()
                {
                    FileInfo = new FileInfo()
                    {
                        FilePath    = "viewerdocs/with-hidden-rows-and-columns.xlsx",
                        Password    = "",
                        StorageName = Common.MyStorage
                    },
                    RenderOptions = new RenderOptions()
                    {
                        SpreadsheetOptions = new SpreadsheetOptions()
                        {
                            PaginateSheets   = true,
                            CountRowsPerPage = 5
                        }
                    }
                };

                var request = new GetInfoRequest(viewOptions);

                var response = apiInstance.GetInfo(request);
                Console.WriteLine("Expected response type is InfoResult: " + response.Pages.Count.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling InfoApi: " + e.Message);
            }
        }
Exemplo n.º 6
0
        public void TestGetInfoWithImageViewOptions()
        {
            // Arrange
            var testFile    = TestFiles.OnePageDocx;
            var viewOptions = new ViewOptions
            {
                FileInfo      = testFile.ToFileInfo(),
                ViewFormat    = ViewOptions.ViewFormatEnum.PNG,
                RenderOptions = new ImageOptions {
                    ExtractText = true
                }
            };

            var request = new GetInfoRequest(viewOptions);

            // Act & Assert
            var infoResult = InfoApi.GetInfo(request);

            Assert.AreEqual(1, infoResult.Pages.Count);
            Assert.AreEqual(0, infoResult.Attachments.Count);

            var page = infoResult.Pages[0];

            Assert.AreEqual(1, page.Number);
            Assert.Greater(page.Lines.Count, 0);
        }
        /// <summary>
        /// Retrieve information about document.
        /// </summary>
        /// <param name="request">Request. <see cref="GetInfoRequest" /></param>
        /// <returns><see cref="InfoResult"/></returns>
        public InfoResult GetInfo(GetInfoRequest request)
        {
            // verify the required parameter 'options' is set
            if (request.options == null)
            {
                throw new ApiException(400, "Missing required parameter 'options' when calling GetInfo");
            }

            // create path and map variables
            var resourcePath = this.configuration.GetServerUrl() + "/metadata/info";

            resourcePath = Regex
                           .Replace(resourcePath, "\\*", string.Empty)
                           .Replace("&amp;", "&")
                           .Replace("/?", "?");
            var postBody = SerializationHelper.Serialize(request.options); // http body (model) parameter
            var response = this.apiInvoker.InvokeApi(
                resourcePath,
                "POST",
                postBody,
                null,
                null);

            if (response != null)
            {
                return((InfoResult)SerializationHelper.Deserialize(response, typeof(InfoResult)));
            }

            return(null);
        }
Exemplo n.º 8
0
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new InfoApi(configuration);

            try
            {
                var viewOptions = new ViewOptions()
                {
                    FileInfo = new FileInfo()
                    {
                        FilePath    = "viewerdocs/password-protected.docx",
                        Password    = "******",
                        StorageName = Common.MyStorage
                    }
                };

                var request = new GetInfoRequest(viewOptions);

                var response = apiInstance.GetInfo(request);
                Console.WriteLine("Expected response type is InfoResult: " + response.Pages.Count.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling InfoApi: " + e.Message);
            }
        }
Exemplo n.º 9
0
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new InfoApi(configuration);

            try
            {
                var viewOptions = new ViewOptions()
                {
                    FileInfo = new FileInfo()
                    {
                        FilePath    = "viewerdocs/one-page.docx",
                        Password    = "",
                        StorageName = Common.MyStorage
                    },
                    RenderOptions = new ImageOptions()
                    {
                        ExtractText = true
                    },
                    ViewFormat = ViewOptions.ViewFormatEnum.PNG
                };

                var request = new GetInfoRequest(viewOptions);

                var response = apiInstance.GetInfo(request);
                Console.WriteLine("Expected response type is InfoResult: " + response.Pages.Count.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling InfoApi: " + e.Message);
            }
        }
Exemplo n.º 10
0
    public www.mnb.hu.webservices.GetInfoResponseBody GetInfo(www.mnb.hu.webservices.GetInfoRequestBody GetInfo1)
    {
        GetInfoRequest inValue = new GetInfoRequest();

        inValue.GetInfo = GetInfo1;
        GetInfoResponse retVal = ((MNBArfolyamServiceSoap)(this)).GetInfo(inValue);

        return(retVal.GetInfoResponse1);
    }
Exemplo n.º 11
0
        public FactoryInfo GetInfo(uint deviceID)
        {
            var request = new GetInfoRequest {
                DeviceID = deviceID
            };
            var response = deviceClient.GetInfo(request);

            return(response.Info);
        }
        public void TestGetInfoReturnsMissingFileInfo()
        {
            // Arrange
            var request = new GetInfoRequest(null);

            // Act & Assert
            Assert.Throws <ApiException>(() => {
                InfoApi.GetInfo(request);
            });
        }
Exemplo n.º 13
0
        private void GetInfoRequestReceived(GetInfoRequest packet, Connection connection)
        {
            string imageUrl = "";

            if (MediaServer.HasImage)
            {
                imageUrl = "http://" + MediaserverIp + ":" + MediaserverPort + "/server-image.png";
            }

            connection.Send(new GetInfoResponse(Name, Password, imageUrl, Files.ToArray(), SubtitleFonts, packet));
        }
Exemplo n.º 14
0
        public void InfoApiTest_FileNotFoundResult()
        {
            var options = new InfoOptions {
                FileInfo = TestFiles.NotExist.ToFileInfo()
            };
            var request = new GetInfoRequest(options);

            var ex = Assert.Throws <ApiException>(() => { InfoApi.GetInfo(request); });

            Assert.AreEqual($"Can't find file located at '{TestFiles.NotExist.FullName}'.", ex.Message);
        }
        public void TestPostInfoWithMinimalOptions()
        {
            // Arrange
            var fileInfo = TestFiles.FourPagesDocx.ToFileInfo();

            var request = new GetInfoRequest(fileInfo);

            // Act & Assert
            var infoResult = InfoApi.GetInfo(request);

            Assert.AreEqual(4, infoResult.PageCount);
        }
        public void TestGetInfoReturnsFileNotFound()
        {
            // Arrange
            var fileInfo = TestFiles.NotExist.ToFileInfo();

            var request = new GetInfoRequest(fileInfo);

            // Act & Assert
            Assert.Throws <ApiException>(() => {
                InfoApi.GetInfo(request);
            });
        }
Exemplo n.º 17
0
        public void InfoApiTest_Not_Supported()
        {
            var testFile = TestFiles.Zip;
            var options  = new InfoOptions {
                FileInfo = testFile.ToFileInfo()
            };
            var request = new GetInfoRequest(options);

            var ex = Assert.Throws <ApiException>(() => { InfoApi.GetInfo(request); });

            Assert.AreEqual($"The specified file '{testFile.FullName}' has type which is not currently supported.", ex.Message);
        }
        public void TestPostInfoWithPassword()
        {
            // Arrange
            var fileInfo = TestFiles.PasswordProtectedDocx.ToFileInfo();

            var request = new GetInfoRequest(fileInfo);

            // Act & Assert
            var infoResult = InfoApi.GetInfo(request);

            Assert.AreEqual(4, infoResult.PageCount);
        }
        public void TestGetInfoReturnsMissingFileInfo()
        {
            // Arrange
            var request = new GetInfoRequest();

            // Act & Assert
            var ex = Assert.Throws <ApiException>(() => {
                InfoApi.GetInfo(request);
            });

            Assert.AreEqual("Missing required parameter 'fileInfo' when calling GetInfo", ex.Message);
        }
Exemplo n.º 20
0
        public static void Run()
        {
            var apiInstance = new InfoApi(Constants.GetConfig());

            var request = new GetInfoRequest(new FileInfo {
                FilePath = "one-page.docx"
            });

            var response = apiInstance.GetInfo(request);

            Console.WriteLine("GetDocumentInfo: pages count = " + response.Pages.Count);
        }
Exemplo n.º 21
0
        public void InfoApiTest_Not_Supported()
        {
            var testFile = TestFiles.Json;
            var options  = new InfoOptions {
                FileInfo = testFile.ToFileInfo()
            };
            var request = new GetInfoRequest(options);

            var ex = Assert.Throws <ApiException>(() => { InfoApi.GetInfo(request); });

            Assert.AreEqual($"The file format is not supported at the moment. Basic operations are not implemented for the loaded file", ex.Message);
        }
Exemplo n.º 22
0
        public void InfoApiTest_Visio()
        {
            var options = new InfoOptions {
                FileInfo = TestFiles.Visio.ToFileInfo()
            };
            var request = new GetInfoRequest(options);

            var result = InfoApi.GetInfo(request);

            Assert.IsNotNull(result);
            Assert.AreEqual("VISIO DRAWING", result.FileType.FileFormat.ToUpper());
            Assert.AreEqual(1665923L, result.Size);
        }
Exemplo n.º 23
0
        public void InfoApiTest_Msg()
        {
            var options = new InfoOptions {
                FileInfo = TestFiles.Msg.ToFileInfo()
            };
            var request = new GetInfoRequest(options);

            var result = InfoApi.GetInfo(request);

            Assert.IsNotNull(result);
            Assert.AreEqual("OUTLOOK MAIL MESSAGE", result.FileType.FileFormat.ToUpper());
            Assert.AreEqual(4090880L, result.Size);
        }
Exemplo n.º 24
0
        public void InfoHandlerTest_Jpeg()
        {
            var options = new InfoOptions {
                FileInfo = TestFiles.Jpg.ToFileInfo()
            };
            var request = new GetInfoRequest(options);

            var result = InfoApi.GetInfo(request);

            Assert.IsNotNull(result);
            Assert.AreEqual("IMAGE/JPEG", result.FileType.MimeType.ToUpper());
            Assert.AreEqual(1, result.PageCount);
        }
Exemplo n.º 25
0
        public void InfoHandlerTest_Docx()
        {
            var options = new InfoOptions {
                FileInfo = TestFiles.Docx.ToFileInfo()
            };
            var request = new GetInfoRequest(options);

            var result = InfoApi.GetInfo(request);

            Assert.IsNotNull(result);
            Assert.AreEqual("APPLICATION/VND.OPENXMLFORMATS-OFFICEDOCUMENT.WORDPROCESSINGML.DOCUMENT", result.FileType.MimeType.ToUpper());
            Assert.AreEqual(1, result.PageCount);
        }
Exemplo n.º 26
0
        public void InfoHandlerTest_Xlsx()
        {
            var options = new InfoOptions {
                FileInfo = TestFiles.Xlsx.ToFileInfo()
            };
            var request = new GetInfoRequest(options);

            var result = InfoApi.GetInfo(request);

            Assert.IsNotNull(result);
            Assert.AreEqual("APPLICATION/VND.OPENXMLFORMATS-OFFICEDOCUMENT.SPREADSHEETML.SHEET", result.FileType.MimeType.ToUpper());
            Assert.AreEqual(3, result.PageCount);
        }
Exemplo n.º 27
0
        public void InfoHandlerTest_Slides()
        {
            var options = new InfoOptions {
                FileInfo = TestFiles.Pptx.ToFileInfo()
            };
            var request = new GetInfoRequest(options);

            var result = InfoApi.GetInfo(request);

            Assert.IsNotNull(result);
            Assert.AreEqual("PRESENTATION", result.FileType.FileFormat.ToUpper());
            Assert.AreEqual(1, result.PageCount);
        }
Exemplo n.º 28
0
        public void InfoApiTest_Pdf()
        {
            var options = new InfoOptions {
                FileInfo = TestFiles.Pdf.ToFileInfo()
            };
            var request = new GetInfoRequest(options);

            var result = InfoApi.GetInfo(request);

            Assert.IsNotNull(result);
            Assert.AreEqual("PORTABLE DOCUMENT FORMAT FILE", result.FileType.FileFormat.ToUpper());
            Assert.AreEqual(2, result.PageCount);
        }
Exemplo n.º 29
0
        public void InfoApiTest_Pptx()
        {
            var options = new InfoOptions {
                FileInfo = TestFiles.Pptx.ToFileInfo()
            };
            var request = new GetInfoRequest(options);

            var result = InfoApi.GetInfo(request);

            Assert.IsNotNull(result);
            Assert.AreEqual("POWERPOINT OPEN XML PRESENTATION", result.FileType.FileFormat.ToUpper());
            Assert.AreEqual(3, result.PageCount);
        }
Exemplo n.º 30
0
        public void InfoApiTest_Xlsx()
        {
            var options = new InfoOptions {
                FileInfo = TestFiles.Xlsx.ToFileInfo()
            };
            var request = new GetInfoRequest(options);

            var result = InfoApi.GetInfo(request);

            Assert.IsNotNull(result);
            Assert.AreEqual("MICROSOFT EXCEL OPEN XML SPREADSHEET", result.FileType.FileFormat.ToUpper());
            Assert.AreEqual(3, result.PageCount);
        }
Exemplo n.º 31
0
 /// <summary>
 /// Get a summary of a service identity
 /// </summary>
 /// <returns> GetInfoResponse object</returns>
 /// <param name="request"> GetInfoRequest object</param>
 public GetInfoResponse GetInfo(GetInfoRequest request)
 {
     return GetInfo(request, Guid.NewGuid().ToString());
 }
Exemplo n.º 32
0
 /// <summary>
 /// Get a summary of a service identity
 /// </summary>
 /// <returns> GetInfoResponse object</returns>
 /// <param name="request"> GetInfoRequest object</param>
 /// <param name='jsonRpcCallId'>
 /// The json rpc call identifier. This is a string generated by the client, which can be used to correlate the response to the request. Max length is 256 characters. A JSON-RPC id must be generated on a per call invocation basis. The Rogerthat platform uses the id of the call to store the call result for a certain amount of time so that if something fails during the communication, the same call (having the same JSON-RPC id) can be resent to the Rogerthat service, allowing to fetch the result, without actually executing the call again. This avoids annoying problems such as duplicate delivery of messages.
 /// 
 /// You should use a different JSON-RPC id for every call you make.
 /// 
 /// In case of an intermittent failure such as a network connectivity problem, you can retry the same call using the same JSON-RPC id, without running the risk of duplicate execution of your call (e.g. duplicate message delivery).
 /// </param>
 public GetInfoResponse GetInfo(GetInfoRequest request, string jsonRpcCallId)
 {
     GetInfoResponse result = new GetInfoResponse();
     WireRequest(0, jsonRpcCallId, "system.get_info", (writer) =>
         {
             request.Write(writer, false);
         }, (reader) =>
         {
             result.Read(reader);
         }
     );
     return result;
 }