コード例 #1
0
ファイル: TranslationApi.cs プロジェクト: xiangyuan/Unreal4
        public static TranslationExport Export(OneSkyService service, int projectId, string sourceFilename, string cultureName, Stream destinationStream)
        {
            //https://github.com/onesky/api-documentation-platform/blob/master/resources/translation.md
            Debug.Assert(!String.IsNullOrWhiteSpace(sourceFilename));
            Debug.Assert(cultureName != null);

            string url = service.AddAuthenticationParameters(String.Format("https://platform.api.onesky.io/1/projects/{0}/translations", projectId));
            url += "&locale=" + cultureName + "&source_file_name=" + sourceFilename;

            var req = (HttpWebRequest)WebRequest.Create(url);
            req.Method = "GET";
            using (HttpWebResponse Response = (HttpWebResponse)req.GetResponse()) 
            {
                if (Response.StatusCode == HttpStatusCode.Accepted)
                {
                    return TranslationExport.Accepted;
                }
                else if (Response.StatusCode == HttpStatusCode.NoContent)
                {
                    return TranslationExport.NoContent;
                }

                using (Stream rawResponseStream = Response.GetResponseStream())
                {
                    rawResponseStream.CopyTo(destinationStream);
                }
                return TranslationExport.Completed;
            }
        }
コード例 #2
0
    private void UploadProjectToOneSky(string RootWorkingDirectory, OneSkyService OneSkyService, ProjectGroup OneSkyProjectGroup, string OneSkyBranchSuffix, ProjectInfo ProjectInfo)
    {
        var OneSkyProject = GetOneSkyProject(OneSkyService, OneSkyProjectGroup.Name, ProjectInfo.ProjectName);

        Func <string, FileInfo> GetPathForCulture = (string Culture) =>
        {
            if (ProjectInfo.ExportInfo.bUseCultureDirectory)
            {
                return(new FileInfo(Path.Combine(RootWorkingDirectory, ProjectInfo.ExportInfo.DestinationPath, Culture, ProjectInfo.ExportInfo.PortableObjectName)));
            }
            else
            {
                return(new FileInfo(Path.Combine(RootWorkingDirectory, ProjectInfo.ExportInfo.DestinationPath, ProjectInfo.ExportInfo.PortableObjectName)));
            }
        };

        // Upload the .po file for the native culture first
        UploadFileToOneSky(OneSkyProject, OneSkyBranchSuffix, GetPathForCulture(ProjectInfo.ExportInfo.NativeCulture), ProjectInfo.ExportInfo.NativeCulture);

        // Upload the remaining .po files for the other cultures
        foreach (var Culture in ProjectInfo.ExportInfo.CulturesToGenerate)
        {
            // Skip native culture as we uploaded it above
            if (Culture != ProjectInfo.ExportInfo.NativeCulture)
            {
                UploadFileToOneSky(OneSkyProject, OneSkyBranchSuffix, GetPathForCulture(Culture), Culture);
            }
        }
    }
コード例 #3
0
ファイル: FileApi.cs プロジェクト: kidaa/UnrealEngineVR
        public static UploadFileResponse HttpWebRequestUploadFile(OneSkyService service, string url, string file, string paramName, Stream fileStream, string contentType)
        {
            string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
            byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");

            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
            req.ContentType = "multipart/form-data; boundary=" + boundary;
            req.Method = "POST";
            req.KeepAlive = true;

            using (var DataStream = new BinaryWriter(req.GetRequestStream(), System.Text.Encoding.UTF8))
            {
                DataStream.Write(boundarybytes, 0, boundarybytes.Length);

                string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\nContent-Type: {2}\r\n\r\n";
                string header = string.Format(headerTemplate, paramName, file, contentType);
                byte[] headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
                DataStream.Write(headerbytes, 0, headerbytes.Length);

                byte[] buffer = new byte[4096];
                int bytesRead = 0;
                while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
                {
                    DataStream.Write(buffer, 0, bytesRead);
                }

                byte[] trailer = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "--\r\n");
                DataStream.Write(trailer, 0, trailer.Length);
                DataStream.Flush();
                DataStream.Close();
            }

            try
            {
                using (HttpWebResponse Response = (HttpWebResponse)req.GetResponse())
                {

                    using (Stream rawResponseStream = Response.GetResponseStream())
                    {
                        var responseText = service.StreamToString(rawResponseStream);
                        if (!string.IsNullOrWhiteSpace(responseText))
                        {
                            using (var responseStream = service.StringToStream(responseText))
                            {
                                var jsonSerializer = new DataContractJsonSerializer(typeof(UploadFileResponse));
                                return (UploadFileResponse)jsonSerializer.ReadObject(responseStream);
                            }
                        }
                    }
                }
            }
            catch (WebException)
            {
            }
            return null;
        }
コード例 #4
0
    private void ExportProjectToDirectory(OneSkyService oneSkyService, ProjectGroup projectGroup, string ProjectName)
    {
        var project = GetProject(oneSkyService, projectGroup.Name, ProjectName);
        var file = project.UploadedFiles.FirstOrDefault(f => f.Filename == (ProjectName + ".po"));

        //Export
        if (file != null)
        {
            ExportFileToDirectory(file, new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/" + ProjectName), project.EnabledCultures);
        }
    }
コード例 #5
0
    private void ExportProjectToDirectory(OneSkyService oneSkyService, ProjectGroup projectGroup, string ProjectName)
    {
        var project = GetProject(oneSkyService, projectGroup.Name, ProjectName);
        var file    = project.UploadedFiles.FirstOrDefault(f => f.Filename == (ProjectName + ".po"));

        //Export
        if (file != null)
        {
            ExportFileToDirectory(file, new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/" + ProjectName), project.EnabledCultures);
        }
    }
コード例 #6
0
    private static ProjectGroup GetOneSkyProjectGroup(OneSkyService OneSkyService, string ProjectGroupName)
    {
        var OneSkyProjectGroup = OneSkyService.ProjectGroups.FirstOrDefault(g => g.Name == ProjectGroupName);

        if (OneSkyProjectGroup == null)
        {
            OneSkyProjectGroup = new ProjectGroup(ProjectGroupName, "en");
            OneSkyService.ProjectGroups.Add(OneSkyProjectGroup);
        }

        return(OneSkyProjectGroup);
    }
    private static ProjectGroup GetLauncherGroup(OneSkyService oneSkyService)
    {
        var launcherGroup = oneSkyService.ProjectGroups.FirstOrDefault(g => g.Name == "Launcher");

        if (launcherGroup == null)
        {
            launcherGroup = new ProjectGroup("Launcher", "en");
            oneSkyService.ProjectGroups.Add(launcherGroup);
        }

        return(launcherGroup);
    }
コード例 #8
0
    private static ProjectGroup GetProjectGroup(OneSkyService oneSkyService, string GroupName)
    {
        var launcherGroup = oneSkyService.ProjectGroups.FirstOrDefault(g => g.Name == GroupName);

        if (launcherGroup == null)
        {
            launcherGroup = new ProjectGroup(GroupName, "en");
            oneSkyService.ProjectGroups.Add(launcherGroup);
        }

        return(launcherGroup);
    }
コード例 #9
0
ファイル: ProjectTypeApi.cs プロジェクト: xiangyuan/Unreal4
        public static ListProjectTypesResponse List(OneSkyService service)
        {
            //https://github.com/onesky/api-documentation-platform/blob/master/resources/project_type.md

            string url = service.AddAuthenticationParameters("https://platform.api.onesky.io/1/project-types");

            using (var client = new WebClient())
            using (var stream = client.OpenRead(url))
            {
                var jsonSerializer = new DataContractJsonSerializer(typeof(ListProjectTypesResponse));
                return (ListProjectTypesResponse)jsonSerializer.ReadObject(stream);
            }
        }
コード例 #10
0
ファイル: FileApi.cs プロジェクト: kidaa/UnrealEngineVR
        public static ListUploadedFilesResponse List(OneSkyService service, int projectId, int startPage, int itemsPerPage)
        {
            //https://github.com/onesky/api-documentation-platform/blob/master/resources/file.md#upload---upload-a-file
            Debug.Assert(startPage >= 1);
            Debug.Assert(itemsPerPage >= 1);

            string url = service.AddAuthenticationParameters(String.Format("https://platform.api.onesky.io/1/projects/{0}/files", projectId));
            url += "&page=" + startPage + "&per_page=" + itemsPerPage;

            using (var client = new WebClient())
            using (var stream = client.OpenRead(url))
            {
                var jsonSerializer = new DataContractJsonSerializer(typeof(ListUploadedFilesResponse));
                return (ListUploadedFilesResponse)jsonSerializer.ReadObject(stream);
            }
        }
    private static OneSky.Project GetAppProject(OneSkyService oneSkyService)
    {
        var launcherGroup = GetLauncherGroup(oneSkyService);

        OneSky.Project appProject = launcherGroup.Projects.FirstOrDefault(p => p.Name == "App");

        if (appProject == null)
        {
            ProjectType projectType = oneSkyService.ProjectTypes.First(pt => pt.Code == "website");

            appProject = new OneSky.Project("App", "The core application text that ships with the Launcher", projectType);
            launcherGroup.Projects.Add(appProject);
        }

        return(appProject);
    }
コード例 #12
0
    private static OneSky.Project GetProject(OneSkyService oneSkyService, string GroupName, string ProjectName, string ProjectDescription = "")
    {
        var launcherGroup = GetProjectGroup(oneSkyService, GroupName);

        OneSky.Project appProject = launcherGroup.Projects.FirstOrDefault(p => p.Name == ProjectName);

        if (appProject == null)
        {
            ProjectType projectType = oneSkyService.ProjectTypes.First(pt => pt.Code == "website");

            appProject = new OneSky.Project(ProjectName, ProjectDescription, projectType);
            launcherGroup.Projects.Add(appProject);
        }

        return(appProject);
    }
コード例 #13
0
    private static OneSky.Project GetOneSkyProject(OneSkyService OneSkyService, string GroupName, string ProjectName, string ProjectDescription = "")
    {
        var OneSkyProjectGroup = GetOneSkyProjectGroup(OneSkyService, GroupName);

        OneSky.Project OneSkyProject = OneSkyProjectGroup.Projects.FirstOrDefault(p => p.Name == ProjectName);

        if (OneSkyProject == null)
        {
            ProjectType projectType = OneSkyService.ProjectTypes.First(pt => pt.Code == "website");

            OneSkyProject = new OneSky.Project(ProjectName, ProjectDescription, projectType);
            OneSkyProjectGroup.Projects.Add(OneSkyProject);
        }

        return(OneSkyProject);
    }
コード例 #14
0
	public OneSkyLocalizationProvider(LocalizationProviderArgs InArgs)
		: base(InArgs)
	{
		var OneSkyConfigName = CommandUtils.ParseParamValue("OneSkyConfigName");
		if (OneSkyConfigName == null)
		{
			throw new AutomationException("Missing required command line argument: 'OneSkyConfigName'");
		}

		var OneSkyProjectGroupName = CommandUtils.ParseParamValue("OneSkyProjectGroupName");
		if (OneSkyProjectGroupName == null)
		{
			throw new AutomationException("Missing required command line argument: 'OneSkyProjectGroupName'");
		}

		OneSkyConfigData OneSkyConfig = OneSkyConfigHelper.Find(OneSkyConfigName);
		OneSkyService = new OneSkyService(OneSkyConfig.ApiKey, OneSkyConfig.ApiSecret);
		OneSkyProjectGroup = GetOneSkyProjectGroup(OneSkyProjectGroupName);
	}
コード例 #15
0
    private void ExportOneSkyProjectToDirectory(string RootWorkingDirectory, OneSkyService OneSkyService, ProjectGroup OneSkyProjectGroup, string OneSkyBranchSuffix, ProjectInfo ProjectInfo)
    {
        var OneSkyFileName = GetOneSkyFilename(ProjectInfo.ImportInfo.PortableObjectName, OneSkyBranchSuffix);
        var OneSkyProject  = GetOneSkyProject(OneSkyService, OneSkyProjectGroup.Name, ProjectInfo.ProjectName);
        var OneSkyFile     = OneSkyProject.UploadedFiles.FirstOrDefault(f => f.Filename == OneSkyFileName);

        //Export
        if (OneSkyFile != null)
        {
            var CulturesToExport = new List <string>();
            foreach (var OneSkyCulture in OneSkyProject.EnabledCultures)
            {
                // Only export the OneSky cultures that we care about for this project
                if (ProjectInfo.ImportInfo.CulturesToGenerate.Contains(OneSkyCulture))
                {
                    CulturesToExport.Add(OneSkyCulture);
                }
            }

            ExportOneSkyFileToDirectory(OneSkyFile, new DirectoryInfo(CombinePaths(RootWorkingDirectory, ProjectInfo.ImportInfo.DestinationPath)), ProjectInfo.ImportInfo.PortableObjectName, CulturesToExport, ProjectInfo.ImportInfo.bUseCultureDirectory);
        }
    }
コード例 #16
0
        public OneSkyLocalizationProvider(LocalizationProviderArgs InArgs)
            : base(InArgs)
        {
            var OneSkyConfigName = CommandUtils.ParseParamValue("OneSkyConfigName");

            if (OneSkyConfigName == null)
            {
                throw new AutomationException("Missing required command line argument: 'OneSkyConfigName'");
            }

            var OneSkyProjectGroupName = CommandUtils.ParseParamValue("OneSkyProjectGroupName");

            if (OneSkyProjectGroupName == null)
            {
                throw new AutomationException("Missing required command line argument: 'OneSkyProjectGroupName'");
            }

            OneSkyConfigData OneSkyConfig = OneSkyConfigHelper.Find(OneSkyConfigName);

            OneSkyService      = new OneSkyService(OneSkyConfig.ApiKey, OneSkyConfig.ApiSecret);
            OneSkyProjectGroup = GetOneSkyProjectGroup(OneSkyProjectGroupName);
        }
コード例 #17
0
        public static Task Status(OneSkyService service, int projectId, string filename, CultureInfo culture)
        {
            return Task.Factory.StartNew((obj) =>
            {
                //https://github.com/onesky/api-documentation-platform/blob/master/resources/translation.md
                Debug.Assert(!String.IsNullOrWhiteSpace(filename));
                Debug.Assert(culture != null);

                string url = service.AddAuthenticationParameters(String.Format("https://platform.api.onesky.io/1/projects/{0}/translations/status", projectId));
                url += "&locale=" + LocaleCodeHelper.ConvertToLocaleCode(culture.Name) + "&file_name=" + filename;

                var state = (TranslationExportStatus)obj;
                TranslationStatusResponse response;

                using (var client = new WebClient())
                using (var stream = client.OpenRead(url))
                {
                    var jsonSerializer = new DataContractJsonSerializer(typeof(TranslationStatusResponse));
                    response = (TranslationStatusResponse)jsonSerializer.ReadObject(stream);
                }

                state.Progress = response.Data.Progress;

                while (response.Meta.Status == 200 && response.Data.Progress != "100%")
                {
                    Thread.Sleep(5000); // Wait 5 seconds
                    state.Progress = response.Data.Progress;

                    using (var client = new WebClient())
                    using (var stream = client.OpenRead(url))
                    {
                        var jsonSerializer = new DataContractJsonSerializer(typeof(TranslationStatusResponse));
                        response = (TranslationStatusResponse)jsonSerializer.ReadObject(stream);
                    }
                }
            }, new TranslationExportStatus());
        }
コード例 #18
0
	private static ProjectGroup GetLauncherGroup(OneSkyService oneSkyService)
	{
		var launcherGroup = oneSkyService.ProjectGroups.FirstOrDefault(g => g.Name == "Launcher");

		if (launcherGroup == null)
		{
			launcherGroup = new ProjectGroup("Launcher", "en");
			oneSkyService.ProjectGroups.Add(launcherGroup);
		}

		return launcherGroup;
	}
    public override void ExecuteBuild()
    {
        if (ParseParam("BuildEditor"))
        {
            UE4Build.BuildAgenda Agenda = new UE4Build.BuildAgenda();
            Agenda.AddTarget("UE4Editor", HostPlatform.Current.HostEditorPlatform, UnrealTargetConfiguration.Development);
            Agenda.AddTarget("ShaderCompileWorker", HostPlatform.Current.HostEditorPlatform, UnrealTargetConfiguration.Development);

            UE4Build Builder = new UE4Build(this);
            Builder.Build(Agenda, InDeleteBuildProducts: true, InUpdateVersionFiles: true, InForceNoXGE: true);
        }

        var EditorExe = CombinePaths(CmdEnv.LocalRoot, @"Engine/Binaries/Win64/UE4Editor-Cmd.exe");

        if (P4Enabled)
        {
            Log("Sync necessary content to head revision");
            P4.Sync(P4Env.Branch + "/Engine/Config/...");
            P4.Sync(P4Env.Branch + "/Engine/Content/...");
            P4.Sync(P4Env.Branch + "/Engine/Source/...");

            P4.Sync(P4Env.Branch + "/Portal/Config/...");
            P4.Sync(P4Env.Branch + "/Portal/Content/...");
            P4.Sync(P4Env.Branch + "/Portal/Source/...");
        }

        OneSkyConfigData OneSkyConfig = OneSkyConfigHelper.Find("OneSkyConfig_EpicGames");
        var oneSkyService             = new OneSkyService(OneSkyConfig.ApiKey, OneSkyConfig.ApiSecret);

        // Export Launcher text from OneSky
        {
            var launcherGroup = GetLauncherGroup(oneSkyService);
            var appProject    = GetAppProject(oneSkyService);
            var appFile       = appProject.UploadedFiles.FirstOrDefault(f => f.Filename == "App.po");

            //Export
            if (appFile != null)
            {
                ExportFileToDirectory(appFile, new DirectoryInfo(CmdEnv.LocalRoot + "/Portal/Content/Localization/App"), launcherGroup.EnabledCultures);
            }
        }

        // Setup editor arguments for SCC.
        string EditorArguments = String.Empty;

        if (P4Enabled)
        {
            EditorArguments = String.Format("-SCCProvider={0} -P4Port={1} -P4User={2} -P4Client={3} -P4Passwd={4}", "Perforce", P4Env.ServerAndPort, P4Env.User, P4Env.Client, P4.GetAuthenticationToken());
        }
        else
        {
            EditorArguments = String.Format("-SCCProvider={0}", "None");
        }

        // Setup commandlet arguments for SCC.
        string CommandletSCCArguments = String.Empty;

        if (P4Enabled)
        {
            CommandletSCCArguments += "-EnableSCC";
        }
        if (!AllowSubmit)
        {
            CommandletSCCArguments += (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " ") + "-DisableSCCSubmit";
        }

        // Setup commandlet arguments with configurations.
        var CommandletArgumentSets = new string[]
        {
            String.Format("-config={0}", @"../Portal/Config/Localization/App.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments)
        };

        // Execute commandlet for each set of arguments.
        foreach (var CommandletArguments in CommandletArgumentSets)
        {
            Log("Localization for {0} {1}", EditorArguments, CommandletArguments);

            Log("Running UE4Editor to generate Localization data");

            string Arguments = String.Format("-run=GatherText {0} {1}", EditorArguments, CommandletArguments);
            var    RunResult = Run(EditorExe, Arguments);

            if (RunResult.ExitCode != 0)
            {
                throw new AutomationException("Error while executing localization commandlet '{0}'", Arguments);
            }
        }

        // Upload Launcher text to OneSky
        UploadDirectoryToProject(GetAppProject(oneSkyService), new DirectoryInfo(CmdEnv.LocalRoot + "/Portal/Content/Localization/App"), "*.po");
    }
コード例 #20
0
	private static OneSky.Project GetAppProject(OneSkyService oneSkyService)
	{
		var launcherGroup = GetLauncherGroup(oneSkyService);

		OneSky.Project appProject = launcherGroup.Projects.FirstOrDefault(p => p.Name == "App");

		if (appProject == null)
		{
			ProjectType projectType = oneSkyService.ProjectTypes.First(pt => pt.Code == "website");

			appProject = new OneSky.Project("App", "The core application text that ships with the Launcher", projectType);
			launcherGroup.Projects.Add(appProject);
		}

		return appProject;
	}
コード例 #21
0
	public override void ExecuteBuild()
	{
		if (ParseParam("BuildEditor"))
		{
			UE4Build.BuildAgenda Agenda = new UE4Build.BuildAgenda();
			Agenda.AddTarget("UE4Editor", HostPlatform.Current.HostEditorPlatform, UnrealTargetConfiguration.Development);
			Agenda.AddTarget("ShaderCompileWorker", HostPlatform.Current.HostEditorPlatform, UnrealTargetConfiguration.Development);

			UE4Build Builder = new UE4Build(this);
			Builder.Build(Agenda, InDeleteBuildProducts: true, InUpdateVersionFiles: true, InForceNoXGE: true);
		}

		var EditorExe = CombinePaths(CmdEnv.LocalRoot, @"Engine/Binaries/Win64/UE4Editor-Cmd.exe");

		if (P4Enabled)
		{
			Log("Sync necessary content to head revision");
			P4.Sync(P4Env.BuildRootP4 + "/Engine/Config/...");
			P4.Sync(P4Env.BuildRootP4 + "/Engine/Content/...");
			P4.Sync(P4Env.BuildRootP4 + "/Engine/Source/...");

            P4.Sync(P4Env.BuildRootP4 + "/Portal/Config/...");
            P4.Sync(P4Env.BuildRootP4 + "/Portal/Content/...");
            P4.Sync(P4Env.BuildRootP4 + "/Portal/Source/...");

			Log("Localize from label {0}", P4Env.LabelToSync);
		}

		OneSkyConfigData OneSkyConfig = OneSkyConfigHelper.Find("OneSkyConfig_EpicGames");
		var oneSkyService = new OneSkyService(OneSkyConfig.ApiKey, OneSkyConfig.ApiSecret);

		// Export Launcher text from OneSky
		{
			var launcherGroup = GetLauncherGroup(oneSkyService);
			var appProject = GetAppProject(oneSkyService);
			var appFile = appProject.UploadedFiles.FirstOrDefault(f => f.Filename == "App.po");

			//Export
			if (appFile != null)
			{
				ExportFileToDirectory(appFile, new DirectoryInfo(CmdEnv.LocalRoot + "/Portal/Content/Localization/App"), launcherGroup.EnabledCultures);
			}
		}

		// Setup editor arguments for SCC.
		string EditorArguments = String.Empty;
		if (P4Enabled)
		{
			EditorArguments = String.Format("-SCCProvider={0} -P4Port={1} -P4User={2} -P4Client={3} -P4Passwd={4}", "Perforce", P4Env.P4Port, P4Env.User, P4Env.Client, P4.GetAuthenticationToken());
		}
		else
		{
			EditorArguments = String.Format("-SCCProvider={0}", "None");
		}

		// Setup commandlet arguments for SCC.
		string CommandletSCCArguments = String.Empty;
		if (P4Enabled) { CommandletSCCArguments += (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " ") + "-EnableSCC"; }
		if (!AllowSubmit) { CommandletSCCArguments += (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " ") + "-DisableSCCSubmit"; }

		// Setup commandlet arguments with configurations.
		var CommandletArgumentSets = new string[] 
			{
				String.Format("-config={0}", @"../Portal/Config/Localization/App.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments)
			};

		// Execute commandlet for each set of arguments.
		foreach (var CommandletArguments in CommandletArgumentSets)
		{
			Log("Localization for {0} {1}", EditorArguments, CommandletArguments);

			Log("Running UE4Editor to generate Localization data");

			string Arguments = String.Format("-run=GatherText {0} {1}", EditorArguments, CommandletArguments);
			var RunResult = Run(EditorExe, Arguments);

			if (RunResult.ExitCode != 0)
			{
				throw new AutomationException("Error while executing localization commandlet '{0}'", Arguments);
			}
		}

		// Upload Launcher text to OneSky
		UploadDirectoryToProject(GetAppProject(oneSkyService), new DirectoryInfo(CmdEnv.LocalRoot + "/Portal/Content/Localization/App"), "*.po");
	}
コード例 #22
0
ファイル: ProjectGroupApi.cs プロジェクト: xiangyuan/Unreal4
        public static ListProjectGroupLanguagesResponse ListEnabledLanguages(OneSkyService service, int projectGroupId)
        {
            //https://github.com/onesky/api-documentation-platform/blob/master/resources/project_group.md

            string url = service.AddAuthenticationParameters(string.Format("https://platform.api.onesky.io/1/project-groups/{0}/languages", projectGroupId));

            using (var client = new WebClient())
            using (var stream = client.OpenRead(url))
            {
                var jsonSerializer = new DataContractJsonSerializer(typeof(ListProjectGroupLanguagesResponse));
                return (ListProjectGroupLanguagesResponse)jsonSerializer.ReadObject(stream);
            }
        }
コード例 #23
0
ファイル: ProjectApi.cs プロジェクト: xiangyuan/Unreal4
        public static CreateProjectResponse Create(OneSkyService service, int projectGroupId, string name, string description, string projectType)
        {
            //https://github.com/onesky/api-documentation-platform/blob/master/resources/project.md

            string url = String.Format("https://platform.api.onesky.io/1/project-groups/{0}/projects", projectGroupId);
            string parameters = service.GetAuthenticationParameters() + "&name=" + name + "&description=" + description + "&project_type=" + projectType;

            url += "?" + parameters;

            using (var client = new WebClient())
            {
                var jsonSerializer = new DataContractJsonSerializer(typeof(CreateProjectResponse));
                using (var stream = service.StringToStream(client.UploadString(url, parameters)))
                {
                    return (CreateProjectResponse)jsonSerializer.ReadObject(stream);
                }
            }
        }
コード例 #24
0
    public override void ExecuteBuild()
    {
        var EditorExe = CombinePaths(CmdEnv.LocalRoot, @"Engine/Binaries/Win64/UE4Editor-Cmd.exe");

        if (P4Enabled)
        {
            Log("Sync necessary content to head revision");
            P4.Sync(P4Env.BuildRootP4 + "/Engine/Config/...");
            P4.Sync(P4Env.BuildRootP4 + "/Engine/Content/...");
            P4.Sync(P4Env.BuildRootP4 + "/Engine/Source/...");
            Log("Localize from label {0}", P4Env.LabelToSync);
        }

        OneSkyConfigData OneSkyConfig = OneSkyConfigHelper.Find("OneSkyConfig_EpicGames");
        var oneSkyService             = new OneSkyService(OneSkyConfig.ApiKey, OneSkyConfig.ApiSecret);
        var projectGroup = GetProjectGroup(oneSkyService, "Unreal Engine");

        // Create changelist for backed up POs from OneSky.
        if (P4Enabled)
        {
            OneSkyDownloadedPOChangeList = P4.CreateChange(P4Env.Client, "OneSky downloaded PO backup.");
        }

        // Export all text from OneSky
        ExportProjectToDirectory(oneSkyService, projectGroup, "Engine");
        ExportProjectToDirectory(oneSkyService, projectGroup, "Editor");
        ExportProjectToDirectory(oneSkyService, projectGroup, "EditorTutorials");
        ExportProjectToDirectory(oneSkyService, projectGroup, "PropertyNames");
        ExportProjectToDirectory(oneSkyService, projectGroup, "ToolTips");
        ExportProjectToDirectory(oneSkyService, projectGroup, "Category");
        ExportProjectToDirectory(oneSkyService, projectGroup, "Keywords");

        // Submit changelist for backed up POs from OneSky.
        if (P4Enabled)
        {
            int SubmittedChangeList;
            P4.Submit(OneSkyDownloadedPOChangeList, out SubmittedChangeList);
        }

        // Setup editor arguments for SCC.
        string EditorArguments = String.Empty;

        if (P4Enabled)
        {
            EditorArguments = String.Format("-SCCProvider={0} -P4Port={1} -P4User={2} -P4Client={3} -P4Passwd={4}", "Perforce", P4Env.P4Port, P4Env.User, P4Env.Client, P4.GetAuthenticationToken());
        }
        else
        {
            EditorArguments = String.Format("-SCCProvider={0}", "None");
        }

        // Setup commandlet arguments for SCC.
        string CommandletSCCArguments = String.Empty;

        if (P4Enabled)
        {
            CommandletSCCArguments += (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " ") + "-EnableSCC";
        }
        if (!AllowSubmit)
        {
            CommandletSCCArguments += (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " ") + "-DisableSCCSubmit";
        }

        // Setup commandlet arguments with configurations.
        var CommandletArgumentSets = new string[]
        {
            String.Format("-config={0}", @"./Config/Localization/Engine.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
            String.Format("-config={0}", @"./Config/Localization/Editor.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
            String.Format("-config={0}", @"./Config/Localization/EditorTutorials.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
            String.Format("-config={0}", @"./Config/Localization/PropertyNames.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
            String.Format("-config={0}", @"./Config/Localization/ToolTips.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
            String.Format("-config={0}", @"./Config/Localization/Category.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
            String.Format("-config={0}", @"./Config/Localization/Keywords.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
        };

        // Execute commandlet for each set of arguments.
        foreach (var CommandletArguments in CommandletArgumentSets)
        {
            Log("Localization for {0} {1}", EditorArguments, CommandletArguments);

            Log("Running UE4Editor to generate localization data");

            string Arguments = String.Format("-run=GatherText {0} {1}", EditorArguments, CommandletArguments);
            var    RunResult = Run(EditorExe, Arguments);

            if (RunResult.ExitCode != 0)
            {
                throw new AutomationException("Error while executing localization commandlet '{0}'", Arguments);
            }
        }

        // Upload all text to OneSky
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "Engine"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/Engine"), "*.po");
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "Editor"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/Editor"), "*.po");
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "EditorTutorials"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/EditorTutorials"), "*.po");
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "PropertyNames"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/PropertyNames"), "*.po");
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "ToolTips"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/ToolTips"), "*.po");
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "Category"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/Category"), "*.po");
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "Keywords"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/Keywords"), "*.po");

        // Localisation statistics estimator.
        if (P4Enabled)
        {
            // Available only for P4
            var EstimatorExePath   = CombinePaths(CmdEnv.LocalRoot, @"Engine/Binaries/DotNET/TranslatedWordsCountEstimator.exe");
            var StatisticsFilePath = @"\\epicgames.net\root\UE3\Localization\WordCounts\udn.csv";

            var Arguments = string.Format(
                "{0} {1} {2} {3} {4}",
                StatisticsFilePath,
                P4Env.P4Port,
                P4Env.User,
                P4Env.Client,
                Environment.GetEnvironmentVariable("P4PASSWD"));

            var RunResult = Run(EstimatorExePath, Arguments);

            if (RunResult.ExitCode != 0)
            {
                throw new AutomationException("Error while executing TranslatedWordsCountEstimator with arguments '{0}'", Arguments);
            }
        }
    }
コード例 #25
0
    public override void ExecuteBuild()
    {
        var EditorExe = CombinePaths(CmdEnv.LocalRoot, @"Engine/Binaries/Win64/UE4Editor-Cmd.exe");

        if (P4Enabled)
        {
            Log("Sync necessary content to head revision");
            P4.Sync(P4Env.BuildRootP4 + "/Engine/Config/...");
            P4.Sync(P4Env.BuildRootP4 + "/Engine/Content/...");
            P4.Sync(P4Env.BuildRootP4 + "/Engine/Source/...");
            Log("Localize from label {0}", P4Env.LabelToSync);
        }

        OneSkyConfigData OneSkyConfig = OneSkyConfigHelper.Find("OneSkyConfig_EpicGames");
        var oneSkyService = new OneSkyService(OneSkyConfig.ApiKey, OneSkyConfig.ApiSecret);
        var projectGroup = GetProjectGroup(oneSkyService, "Unreal Engine");

        // Export all text from OneSky
        ExportProjectToDirectory(oneSkyService, projectGroup, "Engine");
        ExportProjectToDirectory(oneSkyService, projectGroup, "Editor");
        ExportProjectToDirectory(oneSkyService, projectGroup, "EditorTutorials");
        ExportProjectToDirectory(oneSkyService, projectGroup, "PropertyNames");
        ExportProjectToDirectory(oneSkyService, projectGroup, "ToolTips");

        // Setup editor arguments for SCC.
        string EditorArguments = String.Empty;
        if (P4Enabled)
        {
            EditorArguments = String.Format("-SCCProvider={0} -P4Port={1} -P4User={2} -P4Client={3} -P4Passwd={4}", "Perforce", P4Env.P4Port, P4Env.User, P4Env.Client, P4.GetAuthenticationToken());
        }
        else
        {
            EditorArguments = String.Format("-SCCProvider={0}", "None");
        }

        // Setup commandlet arguments for SCC.
        string CommandletSCCArguments = String.Empty;
        if (P4Enabled) { CommandletSCCArguments += (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " ") + "-EnableSCC"; }
        if (!AllowSubmit) { CommandletSCCArguments += (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " ") + "-DisableSCCSubmit"; }

        // Setup commandlet arguments with configurations.
        var CommandletArgumentSets = new string[]
            {
                String.Format("-config={0}", @"./Config/Localization/Engine.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
                String.Format("-config={0}", @"./Config/Localization/Editor.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
                String.Format("-config={0}", @"./Config/Localization/EditorTutorials.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
                String.Format("-config={0}", @"./Config/Localization/PropertyNames.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
                String.Format("-config={0}", @"./Config/Localization/ToolTips.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
                String.Format("-config={0}", @"./Config/Localization/WordCount.ini"),
            };

        // Execute commandlet for each set of arguments.
        foreach (var CommandletArguments in CommandletArgumentSets)
        {
            Log("Localization for {0} {1}", EditorArguments, CommandletArguments);

            Log("Running UE4Editor to generate localization data");

            string Arguments = String.Format("-run=GatherText {0} {1}", EditorArguments, CommandletArguments);
            var RunResult = Run(EditorExe, Arguments);

            if (RunResult.ExitCode != 0)
            {
                throw new AutomationException("Error while executing localization commandlet '{0}'", Arguments);
            }
        }

        // Upload all text to OneSky
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "Engine"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/Engine"), "*.po");
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "Editor"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/Editor"), "*.po");
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "EditorTutorials"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/EditorTutorials"), "*.po");
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "PropertyNames"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/PropertyNames"), "*.po");
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "ToolTips"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/ToolTips"), "*.po");

        // Localisation statistics estimator.
        if (P4Enabled)
        {
            // Available only for P4
            var EstimatorExePath = CombinePaths(CmdEnv.LocalRoot, @"Engine/Binaries/DotNET/TranslatedWordsCountEstimator.exe");
            var StatisticsFilePath = @"\\epicgames.net\root\UE3\Localization\WordCounts\udn.csv";

            var Arguments = string.Format(
                "{0} {1} {2} {3} {4}",
                StatisticsFilePath,
                P4Env.P4Port,
                P4Env.User,
                P4Env.Client,
                Environment.GetEnvironmentVariable("P4PASSWD"));

            var RunResult = Run(EstimatorExePath, Arguments);

            if (RunResult.ExitCode != 0)
            {
                throw new AutomationException("Error while executing TranslatedWordsCountEstimator with arguments '{0}'", Arguments);
            }
        }
    }
コード例 #26
0
    private static ProjectGroup GetProjectGroup(OneSkyService oneSkyService, string GroupName)
    {
        var launcherGroup = oneSkyService.ProjectGroups.FirstOrDefault(g => g.Name == GroupName);

        if (launcherGroup == null)
        {
            launcherGroup = new ProjectGroup(GroupName, new CultureInfo("en"));
            oneSkyService.ProjectGroups.Add(launcherGroup);
        }

        return launcherGroup;
    }
コード例 #27
0
	public override void ExecuteBuild()
	{

		var EditorExe = CombinePaths(CmdEnv.LocalRoot, @"Engine/Binaries/Win64/UE4Editor-Cmd.exe");

		if (P4Enabled)
		{
			Log("Sync necessary content to head revision");
			P4.Sync(P4Env.BuildRootP4 + "/Engine/Config/...");
			P4.Sync(P4Env.BuildRootP4 + "/Engine/Content/...");
			P4.Sync(P4Env.BuildRootP4 + "/Engine/Source/...");

			P4.Sync(P4Env.BuildRootP4 + "/Engine/Programs/NoRedist/UnrealEngineLauncher/Config/...");
			P4.Sync(P4Env.BuildRootP4 + "/Engine/Programs/NoRedist/UnrealEngineLauncher/Content/...");
			//P4.Sync(P4Env.BuildRootP4 + "/Engine/Source/..."); <- takes care of syncing Launcher source already

			Log("Localize from label {0}", P4Env.LabelToSync);
		}

		OneSkyConfigData OneSkyConfig = OneSkyConfigHelper.Find("OneSkyConfig_EpicGames");
		var oneSkyService = new OneSkyService(OneSkyConfig.ApiKey, OneSkyConfig.ApiSecret);

		// Export Launcher text from OneSky
		{
			var launcherGroup = GetLauncherGroup(oneSkyService);
			var appProject = GetAppProject(oneSkyService);
			var appFile = appProject.UploadedFiles.FirstOrDefault(f => f.Filename == "App.po");

			//Export
			if (appFile != null)
			{
				ExportFileToDirectory(appFile, new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Programs/NoRedist/UnrealEngineLauncher/Content/Localization/App"), launcherGroup.EnabledCultures);
			}
		}

		// Setup editor arguments for SCC.
		string EditorArguments = String.Empty;
		if (P4Enabled)
		{
			EditorArguments = String.Format("-SCCProvider={0} -P4Port={1} -P4User={2} -P4Client={3} -P4Passwd={4}", "Perforce", P4Env.P4Port, P4Env.User, P4Env.Client, P4.GetAuthenticationToken());
		}
		else
		{
			EditorArguments = String.Format("-SCCProvider={0}", "None");
		}

		// Setup commandlet arguments for SCC.
		string CommandletSCCArguments = String.Empty;
		if (P4Enabled) { CommandletSCCArguments += (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " ") + "-EnableSCC"; }
		if (!AllowSubmit) { CommandletSCCArguments += (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " ") + "-DisableSCCSubmit"; }

		// Setup commandlet arguments with configurations.
		var CommandletArgumentSets = new string[] 
			{
				String.Format("-config={0}", @"./Programs/NoRedist/UnrealEngineLauncher/Config/Localization/App.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
				String.Format("-config={0}", @"./Programs/NoRedist/UnrealEngineLauncher/Config/Localization/WordCount.ini"),
			};

		// Execute commandlet for each set of arguments.
		foreach (var CommandletArguments in CommandletArgumentSets)
		{
			Log("Localization for {0} {1}", EditorArguments, CommandletArguments);

			Log("Running UE4Editor to generate Localization data");

			string Arguments = String.Format("-run=GatherText {0} {1}", EditorArguments, CommandletArguments);
			var RunResult = Run(EditorExe, Arguments);

			if (RunResult.ExitCode != 0)
			{
				throw new AutomationException("Error while executing localization commandlet '{0}'", Arguments);
			}
		}

		// Upload Launcher text to OneSky
		UploadDirectoryToProject(GetAppProject(oneSkyService), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Programs/NoRedist/UnrealEngineLauncher/Content/Localization/App"), "*.po");
	}
コード例 #28
0
ファイル: ProjectApi.cs プロジェクト: xiangyuan/Unreal4
        public static ShowProjectResponse Show(OneSkyService service, int projectId)
        {
            //https://github.com/onesky/api-documentation-platform/blob/master/resources/project.md

            string url = service.AddAuthenticationParameters(String.Format("https://platform.api.onesky.io/1/projects/{0}", projectId));

            using (var client = new WebClient())
            using (var stream = client.OpenRead(url))
            {
                var jsonSerializer = new DataContractJsonSerializer(typeof(ShowProjectResponse));
                return (ShowProjectResponse)jsonSerializer.ReadObject(stream);
            }
        }
コード例 #29
0
ファイル: ProjectApi.cs プロジェクト: xiangyuan/Unreal4
        public static bool Update(OneSkyService service, int projectId, string name, string description)
        {
            //https://github.com/onesky/api-documentation-platform/blob/master/resources/project.md

            string url = String.Format("https://platform.api.onesky.io/1/projects/{0}", projectId);
            string parameters = service.GetAuthenticationParameters() + "&name=" + name + "&description=" + description;

            url += "?" + parameters;

            try
            {
                using (var client = new WebClient())
                {
                    client.UploadString(url, "PUT", parameters);
                }
                return true;
            }
            catch (WebException)
            {
                return false;
            }
        }
コード例 #30
0
    public override void ExecuteBuild()
    {
        var EditorExe = CombinePaths(CmdEnv.LocalRoot, @"Engine/Binaries/Win64/UE4Editor-Cmd.exe");

        // Parse out the required command line arguments
        var UEProjectDirectory = ParseParamValue("UEProjectDirectory");

        if (UEProjectDirectory == null)
        {
            throw new AutomationException("Missing required command line argument: 'UEProjectDirectory'");
        }

        var UEProjectName = ParseParamValue("UEProjectName");

        if (UEProjectName == null)
        {
            UEProjectName = "";
        }

        var OneSkyConfigName = ParseParamValue("OneSkyConfigName");

        if (OneSkyConfigName == null)
        {
            throw new AutomationException("Missing required command line argument: 'OneSkyConfigName'");
        }

        var OneSkyProjectGroupName = ParseParamValue("OneSkyProjectGroupName");

        if (OneSkyProjectGroupName == null)
        {
            throw new AutomationException("Missing required command line argument: 'OneSkyProjectGroupName'");
        }

        var OneSkyProjectNames = new List <string>();
        {
            var OneSkyProjectNamesStr = ParseParamValue("OneSkyProjectNames");
            if (OneSkyProjectNamesStr == null)
            {
                throw new AutomationException("Missing required command line argument: 'OneSkyProjectNames'");
            }
            foreach (var ProjectName in OneSkyProjectNamesStr.Split(','))
            {
                OneSkyProjectNames.Add(ProjectName.Trim());
            }
        }

        var OneSkyBranchSuffix = ParseParamValue("OneSkyBranchSuffix");

        var RootWorkingDirectory = CombinePaths(CmdEnv.LocalRoot, UEProjectDirectory);

        // Make sure the Localization configs and content is up-to-date to ensure we don't get errors later on
        if (P4Enabled)
        {
            Log("Sync necessary content to head revision");
            P4.Sync(P4Env.BuildRootP4 + "/" + UEProjectDirectory + "/Config/Localization/...");
            P4.Sync(P4Env.BuildRootP4 + "/" + UEProjectDirectory + "/Content/Localization/...");
        }

        // Generate the info we need to gather for each project
        var ProjectInfos = new List <ProjectInfo>();

        foreach (var ProjectName in OneSkyProjectNames)
        {
            ProjectInfos.Add(GenerateProjectInfo(RootWorkingDirectory, ProjectName));
        }

        OneSkyConfigData OneSkyConfig = OneSkyConfigHelper.Find(OneSkyConfigName);
        var OneSkyService             = new OneSkyService(OneSkyConfig.ApiKey, OneSkyConfig.ApiSecret);
        var OneSkyProjectGroup        = GetOneSkyProjectGroup(OneSkyService, OneSkyProjectGroupName);

        // Create changelist for backed up POs from OneSky.
        if (P4Enabled)
        {
            OneSkyDownloadedPOChangeList = P4.CreateChange(P4Env.Client, "OneSky downloaded PO backup.");
        }

        // Export all text from OneSky
        foreach (var ProjectInfo in ProjectInfos)
        {
            ExportOneSkyProjectToDirectory(RootWorkingDirectory, OneSkyService, OneSkyProjectGroup, OneSkyBranchSuffix, ProjectInfo);
        }

        // Submit changelist for backed up POs from OneSky.
        if (P4Enabled)
        {
            int SubmittedChangeList;
            P4.Submit(OneSkyDownloadedPOChangeList, out SubmittedChangeList);
        }

        // Setup editor arguments for SCC.
        string EditorArguments = String.Empty;

        if (P4Enabled)
        {
            EditorArguments = String.Format("-SCCProvider={0} -P4Port={1} -P4User={2} -P4Client={3} -P4Passwd={4}", "Perforce", P4Env.P4Port, P4Env.User, P4Env.Client, P4.GetAuthenticationToken());
        }
        else
        {
            EditorArguments = String.Format("-SCCProvider={0}", "None");
        }

        // Setup commandlet arguments for SCC.
        string CommandletSCCArguments = String.Empty;

        if (P4Enabled)
        {
            CommandletSCCArguments += (String.IsNullOrEmpty(CommandletSCCArguments) ? "" : " ") + "-EnableSCC";
        }
        if (!AllowSubmit)
        {
            CommandletSCCArguments += (String.IsNullOrEmpty(CommandletSCCArguments) ? "" : " ") + "-DisableSCCSubmit";
        }

        // Execute commandlet for each config in each project.
        foreach (var ProjectInfo in ProjectInfos)
        {
            foreach (var LocalizationConfigFile in ProjectInfo.LocalizationConfigFiles)
            {
                var CommandletArguments = String.Format("-config={0}", LocalizationConfigFile) + (String.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments);

                Log("Localization for {0} {1}", EditorArguments, CommandletArguments);

                Log("Running UE4Editor to generate localization data");

                string Arguments = String.Format("{0} -run=GatherText {1} {2}", UEProjectName, EditorArguments, CommandletArguments);
                var    RunResult = Run(EditorExe, Arguments);

                if (RunResult.ExitCode != 0)
                {
                    Console.WriteLine("[ERROR] Error while executing localization commandlet '{0}'", Arguments);
                }
            }
        }

        // Upload all text to OneSky
        foreach (var ProjectInfo in ProjectInfos)
        {
            UploadProjectToOneSky(RootWorkingDirectory, OneSkyService, OneSkyProjectGroup, OneSkyBranchSuffix, ProjectInfo);
        }
    }
コード例 #31
0
    public override void ExecuteBuild()
    {
        var EditorExe = CombinePaths(CmdEnv.LocalRoot, @"Engine/Binaries/Win64/UE4Editor-Cmd.exe");

        if (P4Enabled)
        {
            Log("Sync necessary content to head revision");
            P4.Sync(P4Env.BuildRootP4 + "/Engine/Config/...");
            P4.Sync(P4Env.BuildRootP4 + "/Engine/Content/...");
            P4.Sync(P4Env.BuildRootP4 + "/Engine/Source/...");

            P4.Sync(P4Env.BuildRootP4 + "/Engine/Programs/NoRedist/UnrealEngineLauncher/Config/...");
            P4.Sync(P4Env.BuildRootP4 + "/Engine/Programs/NoRedist/UnrealEngineLauncher/Content/...");
            //P4.Sync(P4Env.BuildRootP4 + "/Engine/Source/..."); <- takes care of syncing Launcher source already

            Log("Localize from label {0}", P4Env.LabelToSync);
        }

        OneSkyConfigData OneSkyConfig = OneSkyConfigHelper.Find("OneSkyConfig_EpicGames");
        var oneSkyService             = new OneSkyService(OneSkyConfig.ApiKey, OneSkyConfig.ApiSecret);

        // Export Launcher text from OneSky
        {
            var launcherGroup = GetLauncherGroup(oneSkyService);
            var appProject    = GetAppProject(oneSkyService);
            var appFile       = appProject.UploadedFiles.FirstOrDefault(f => f.Filename == "App.po");

            //Export
            if (appFile != null)
            {
                ExportFileToDirectory(appFile, new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Programs/NoRedist/UnrealEngineLauncher/Content/Localization/App"), launcherGroup.EnabledCultures);
            }
        }

        // Setup editor arguments for SCC.
        string EditorArguments = String.Empty;

        if (P4Enabled)
        {
            EditorArguments = String.Format("-SCCProvider={0} -P4Port={1} -P4User={2} -P4Client={3} -P4Passwd={4}", "Perforce", P4Env.P4Port, P4Env.User, P4Env.Client, P4.GetAuthenticationToken());
        }
        else
        {
            EditorArguments = String.Format("-SCCProvider={0}", "None");
        }

        // Setup commandlet arguments for SCC.
        string CommandletSCCArguments = String.Empty;

        if (P4Enabled)
        {
            CommandletSCCArguments += (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " ") + "-EnableSCC";
        }
        if (!AllowSubmit)
        {
            CommandletSCCArguments += (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " ") + "-DisableSCCSubmit";
        }

        // Setup commandlet arguments with configurations.
        var CommandletArgumentSets = new string[]
        {
            String.Format("-config={0}", @"./Programs/NoRedist/UnrealEngineLauncher/Config/Localization/App.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
            String.Format("-config={0}", @"./Programs/NoRedist/UnrealEngineLauncher/Config/Localization/WordCount.ini"),
        };

        // Execute commandlet for each set of arguments.
        foreach (var CommandletArguments in CommandletArgumentSets)
        {
            Log("Localization for {0} {1}", EditorArguments, CommandletArguments);

            Log("Running UE4Editor to generate Localization data");

            string Arguments = String.Format("-run=GatherText {0} {1}", EditorArguments, CommandletArguments);
            var    RunResult = Run(EditorExe, Arguments);

            if (RunResult.ExitCode != 0)
            {
                throw new AutomationException("Error while executing localization commandlet '{0}'", Arguments);
            }
        }

        // Upload Launcher text to OneSky
        UploadDirectoryToProject(GetAppProject(oneSkyService), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Programs/NoRedist/UnrealEngineLauncher/Content/Localization/App"), "*.po");
    }
コード例 #32
0
ファイル: ProjectGroupApi.cs プロジェクト: xiangyuan/Unreal4
        public static CreateProjectGroupResponse Create(OneSkyService service, string name, string cultureName)
        {
            //https://github.com/onesky/api-documentation-platform/blob/master/resources/project_group.md
            string url = "https://platform.api.onesky.io/1/project-groups";
            string parameters = service.GetAuthenticationParameters() + "&name=" + name + "&locale=" + cultureName;

            url += "?" + parameters;

            using (var client = new WebClient())
            {
                var jsonSerializer = new DataContractJsonSerializer(typeof(CreateProjectGroupResponse));
                using (var stream = service.StringToStream(client.UploadString(url, parameters)))
                {
                    return (CreateProjectGroupResponse)jsonSerializer.ReadObject(stream);
                }
            }
        }
コード例 #33
0
    private static OneSky.Project GetProject(OneSkyService oneSkyService, string GroupName, string ProjectName, string ProjectDescription = "")
    {
        var launcherGroup = GetProjectGroup(oneSkyService, GroupName);

        OneSky.Project appProject = launcherGroup.Projects.FirstOrDefault(p => p.Name == ProjectName);

        if (appProject == null)
        {
            ProjectType projectType = oneSkyService.ProjectTypes.First(pt => pt.Code == "website");

            appProject = new OneSky.Project(ProjectName, ProjectDescription, projectType);
            launcherGroup.Projects.Add(appProject);
        }

        return appProject;
    }
コード例 #34
0
ファイル: ProjectGroupApi.cs プロジェクト: xiangyuan/Unreal4
        public static bool Delete(OneSkyService service, int projectGroupId)
        {
            //https://github.com/onesky/api-documentation-platform/blob/master/resources/project_group.md
 
            string url = service.AddAuthenticationParameters(string.Format("https://platform.api.onesky.io/1/project-groups/{0}", projectGroupId));

            try
            {
                using (var client = new WebClient())
                {
                    client.UploadString(url, "DELETE", "");
                }
                return true;
            }
            catch (WebException)
            {
                return false;
            }
        }
コード例 #35
0
ファイル: FileApi.cs プロジェクト: kidaa/UnrealEngineVR
        public static Task<UploadFileResponse> Upload(OneSkyService service, int projectId, string filename, Stream stream, CultureInfo culture)
        {
            //https://github.com/onesky/api-documentation-platform/blob/master/resources/file.md#upload---upload-a-file
            Debug.Assert(stream != null);
            Debug.Assert(culture != null);

            string url = service.AddAuthenticationParameters(String.Format("https://platform.api.onesky.io/1/projects/{0}/files", projectId));

            string fileFormat = GetFileFormat(Path.GetExtension(filename));
            if (fileFormat == null)
            {
                return null;
            }

            url += "&file_format=" + fileFormat + "&locale=" + LocaleCodeHelper.ConvertToLocaleCode(culture.Name);

            return Task.Factory.StartNew(() => {

                return HttpWebRequestUploadFile(service, url, filename, "file", stream, fileFormat);
            });
        }
コード例 #36
0
    public override void ExecuteBuild()
    {
        var EditorExe = CombinePaths(CmdEnv.LocalRoot, @"Engine/Binaries/Win64/UE4Editor-Cmd.exe");

        if (P4Enabled)
        {
            Log("Sync necessary content to head revision");
            P4.Sync(P4Env.BuildRootP4 + "/Engine/Config/...");
            P4.Sync(P4Env.BuildRootP4 + "/Engine/Content/...");
            P4.Sync(P4Env.BuildRootP4 + "/Engine/Source/...");
            Log("Localize from label {0}", P4Env.LabelToSync);
        }

        OneSkyConfigData OneSkyConfig = OneSkyConfigHelper.Find("OneSkyConfig_EpicGames");
        var oneSkyService = new OneSkyService(OneSkyConfig.ApiKey, OneSkyConfig.ApiSecret);
        var projectGroup = GetProjectGroup(oneSkyService, "Unreal Engine");

        // Create changelist for backed up POs from OneSky.
        if (P4Enabled)
        {
            OneSkyDownloadedPOChangeList = P4.CreateChange(P4Env.Client, "OneSky downloaded PO backup.");
        }

        // Export all text from OneSky
        ExportProjectToDirectory(oneSkyService, projectGroup, "Engine");
        ExportProjectToDirectory(oneSkyService, projectGroup, "Editor");
        ExportProjectToDirectory(oneSkyService, projectGroup, "EditorTutorials");
        ExportProjectToDirectory(oneSkyService, projectGroup, "PropertyNames");
        ExportProjectToDirectory(oneSkyService, projectGroup, "ToolTips");
        ExportProjectToDirectory(oneSkyService, projectGroup, "Category");
        ExportProjectToDirectory(oneSkyService, projectGroup, "Keywords");

        // Submit changelist for backed up POs from OneSky.
        if (P4Enabled)
        {
            int SubmittedChangeList;
            P4.Submit(OneSkyDownloadedPOChangeList, out SubmittedChangeList);
        }

        // Setup editor arguments for SCC.
        string EditorArguments = String.Empty;
        if (P4Enabled)
        {
            EditorArguments = String.Format("-SCCProvider={0} -P4Port={1} -P4User={2} -P4Client={3} -P4Passwd={4}", "Perforce", P4Env.P4Port, P4Env.User, P4Env.Client, P4.GetAuthenticationToken());
        }
        else
        {
            EditorArguments = String.Format("-SCCProvider={0}", "None");
        }

        // Setup commandlet arguments for SCC.
        string CommandletSCCArguments = String.Empty;
        if (P4Enabled) { CommandletSCCArguments += (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " ") + "-EnableSCC"; }
        if (!AllowSubmit) { CommandletSCCArguments += (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " ") + "-DisableSCCSubmit"; }

        // Setup commandlet arguments with configurations.
        var CommandletArgumentSets = new string[]
            {
                String.Format("-config={0}", @"./Config/Localization/Engine.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
                String.Format("-config={0}", @"./Config/Localization/Editor.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
                String.Format("-config={0}", @"./Config/Localization/EditorTutorials.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
                String.Format("-config={0}", @"./Config/Localization/PropertyNames.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
                String.Format("-config={0}", @"./Config/Localization/ToolTips.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
                String.Format("-config={0}", @"./Config/Localization/Category.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
                String.Format("-config={0}", @"./Config/Localization/Keywords.ini") + (string.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments),
            };

        // Execute commandlet for each set of arguments.
        foreach (var CommandletArguments in CommandletArgumentSets)
        {
            Log("Localization for {0} {1}", EditorArguments, CommandletArguments);

            Log("Running UE4Editor to generate localization data");

            string Arguments = String.Format("-run=GatherText {0} {1}", EditorArguments, CommandletArguments);
            var RunResult = Run(EditorExe, Arguments);

            if (RunResult.ExitCode != 0)
            {
                throw new AutomationException("Error while executing localization commandlet '{0}'", Arguments);
            }
        }

        // Upload all text to OneSky
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "Engine"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/Engine"), "*.po");
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "Editor"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/Editor"), "*.po");
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "EditorTutorials"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/EditorTutorials"), "*.po");
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "PropertyNames"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/PropertyNames"), "*.po");
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "ToolTips"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/ToolTips"), "*.po");
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "Category"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/Category"), "*.po");
        UploadDirectoryToProject(GetProject(oneSkyService, "Unreal Engine", "Keywords"), new DirectoryInfo(CmdEnv.LocalRoot + "/Engine/Content/Localization/Keywords"), "*.po");
    }