Ejemplo n.º 1
0
        public Project CreateProject(
            IEnumerable <ProjectFile> files,
            String projectName,
            String sourceLanguage,
            String targetLanguage,
            String subject,
            Boolean useMemoryServer           = true,
            Boolean useMachineTranslation     = true,
            String privateKey                 = "",
            SegmentationRule segmantationRule = SegmentationRule.General,
            String ownerEmail                 = "anonymous")
        {
            var url = String.Concat(BaseUrl, "new");

            var httpFiles = files.Select(n => new HttpPostFile
            {
                Name     = Path.GetFileNameWithoutExtension(n.FileName),
                FileName = n.FileName,
                Stream   = n.Stream
            })
                            .ToList();

            var parameters = new NameValueCollection
            {
                { "project_name", projectName },
                { "source_lang", sourceLanguage },
                { "target_lang", targetLanguage },
                { "tms_engine", BooleanToIntegerString(useMemoryServer) },
                { "mt_engine", BooleanToIntegerString(useMachineTranslation) },
                { "private_tm_key", privateKey },
                { "subject", subject },
                { "segmentation_rule", segmantationRule.GetAttribute <CodeAttribute>().Value },
                { "owner_email", ownerEmail }
            };

            var response = HttpHelper.UploadFiles(url, httpFiles, parameters);

            return(DesirializeResponse <Project>(response));
        }
Ejemplo n.º 2
0
 public Project CreateProject(
     IEnumerable <ProjectFile> files,
     String projectName,
     String sourceLanguage,
     String targetLanguage,
     SupportedSubject subject          = SupportedSubject.General,
     Boolean useMemoryServer           = true,
     Boolean useMachineTranslation     = true,
     String privateKey                 = "",
     SegmentationRule segmantationRule = SegmentationRule.General,
     String ownerEmail                 = "anonymous")
 {
     return(CreateProject(
                files,
                projectName,
                sourceLanguage,
                targetLanguage,
                subject.GetAttribute <CodeAttribute>().Value,
                useMemoryServer,
                useMachineTranslation,
                privateKey,
                segmantationRule,
                ownerEmail));
 }
Ejemplo n.º 3
0
 public Project CreateProject(
     IEnumerable <ProjectFile> files,
     String projectName,
     String sourceLanguage,
     String targetLanguage,
     String subject,
     Boolean useMemoryServer             = true,
     Boolean useMachineTranslation       = true,
     IEnumerable <ProjectKey> privateKey = null,
     SegmentationRule segmantationRule   = SegmentationRule.General,
     String ownerEmail = "anonymous")
 {
     return(CreateProject(
                files,
                projectName,
                sourceLanguage,
                targetLanguage,
                subject,
                useMemoryServer,
                useMachineTranslation,
                (privateKey != null) ? String.Join(",", privateKey.Select(n => n.ToString())) : String.Empty,
                segmantationRule,
                ownerEmail));
 }