public override bool Equals(object obj)
 {
     return(obj is TranslateSubtitlesFileToNewFile file &&
            ToTranslate.Equals(file.ToTranslate) &&
            TargetLanguage.Equals(file.TargetLanguage) &&
            OutputFile.Equals(file.OutputFile));
 }
Exemplo n.º 2
0
        public async Task <HttpResponseMessage> ConvertXml2HtmlPost([FromBody] ToTranslate toTranslate)
        {
            HttpResponseMessage response;
            string HTMLstring = await new LanguageClass(blobConnectionString, containerName).ConvertXml2Html(toTranslate.TextToTranslate, toTranslate.ToLanguage);

            response = Request.CreateResponse(HttpStatusCode.OK, HTMLstring);
            return(response);
        }
Exemplo n.º 3
0
        public async Task <HttpResponseMessage> Post([FromBody] ToTranslate toTranslate)
        {
            HttpResponseMessage response;
            string translatedWord = new LanguageClass(blobConnectionString, containerName).GetTranslation(toTranslate.TextToTranslate, toTranslate.ToLanguage);

            // call the trans service get resp
            response         = Request.CreateResponse(HttpStatusCode.OK);
            response.Content = new StringContent(translatedWord, Encoding.UTF8, "text/plain");
            return(response);
        }
Exemplo n.º 4
0
        public async Task <HttpResponseMessage> TranslateTestPost([FromBody] ToTranslate toTranslate)
        {
            HttpResponseMessage response;
            // var translation = await languageClass.translate(textToTranslate, ToLanguageComboBox.Text, fromLanguage);
            string newTranslation = await new LanguageClass(blobConnectionString, containerName).translate(toTranslate.TextToTranslate, toTranslate.ToLanguage, toTranslate.FromLanguage);

            response         = Request.CreateResponse(HttpStatusCode.OK);
            response.Content = new StringContent(newTranslation, Encoding.UTF8, "text/plain");
            return(response);
        }
Exemplo n.º 5
0
        public HttpResponseMessage Post([FromBody] ToTranslate toTranslate)
        {
            HttpResponseMessage response;

            try
            {
                Task <string> HTMLstring = new LanguageClass(blobConnectionString, containerName).ConvertXml2Html(toTranslate.TextToTranslate, toTranslate.ToLanguage /*, Path.GetFileName(openFileDialog.FileName)*/);
                HTMLstring.Wait();
                response = Request.CreateResponse(HttpStatusCode.OK, HTMLstring.Result);
                return(response);
            }
            catch (Exception e)
            {
                response         = Request.CreateResponse(HttpStatusCode.BadRequest);
                response.Content = new StringContent(e.Message, Encoding.UTF8, "text/plain");
                return(response);
            }
        }
Exemplo n.º 6
0
        public HttpResponseMessage DectectPost([FromBody] ToTranslate toTranslate)
        {
            HttpResponseMessage response;

            try
            {
                Translation translation  = new Translation();
                string      languageCode = new LanguageClass(blobConnectionString, containerName).DetectLanguage(toTranslate.TextToTranslate);
                translation.Language = new LanguageClass(blobConnectionString, containerName).GetLanguageFromCode(languageCode);

                response = Request.CreateResponse(HttpStatusCode.OK, translation);
                //response.Content = new StringContent(translation.Language, Encoding.UTF8, "text/plain");
                return(response);
            }
            catch (Exception e)
            {
                response         = Request.CreateResponse(HttpStatusCode.BadRequest);
                response.Content = new StringContent(e.Message, Encoding.UTF8, "text/plain");
                return(response);
            }
        }