Interface IProject
Represents a project. Provides access to project information and settings, and provides functionality for modifying the project, running tasks etc.
Namespace: Sdl.ProjectAutomation.Core
Assembly: Sdl.ProjectAutomation.Core.dll
Syntax
public interface IProject
Methods
AddBilingualReferenceFile(BilingualFileMapping)
Associates a bilingual reference file with a particular source file and target language using a BilingualFileMapping
Declaration
void AddBilingualReferenceFile(BilingualFileMapping mapping)
Parameters
Type | Name | Description |
---|---|---|
BilingualFileMapping | mapping | A BilingualFileMapping Object that holds the association |
Remarks
This is used to associate bilingual reference files prior to running the project prepare task sequance so that bilingual reference files can be associated with target files before the files have been copied to the target languages
AddBilingualReferenceFiles(BilingualFileMapping[])
Associates a number of Bilingual reference file to particular source file in a target language using an array of BilingualFileMapping
Declaration
void AddBilingualReferenceFiles(BilingualFileMapping[] mappings)
Parameters
Type | Name | Description |
---|---|---|
BilingualFileMapping[] | mappings | An array of BilingualFileMapping Objects |
Remarks
This is used to associate bilingual reference files prior to running the project prepare task sequance so that bilingual reference files can be associated with target files before the files have been copied to the target languages
AddFiles(String[])
Adds a set of files into the project, in the root folder.
Declaration
ProjectFile[] AddFiles(string[] filePaths)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | filePaths | The paths of the files to add. These should be absolute paths. |
Returns
Type | Description |
---|---|
ProjectFile[] | The added files |
Remarks
When adding files to a project, these files are copied into the project folder; they are not referenced in their original location.
AddFiles(String[], String)
Adds a set of files into the project, below a specified project folder.
Declaration
ProjectFile[] AddFiles(string[] filePaths, string folderPathInProject)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | filePaths | The paths of the files to add. These should be absolute paths. |
System.String | folderPathInProject | The folder in this project below which the files should be added. If empty the files will be in the project root folder. |
Returns
Type | Description |
---|---|
ProjectFile[] | The added files |
Remarks
When adding files to a project, these files are copied into the project folder; they are not referenced in their original location.
AddFolderWithFiles(String, Boolean)
Adds all the files from a folder into the project, in the root folder
Declaration
ProjectFile[] AddFolderWithFiles(string localFolderPath, bool recursive)
Parameters
Type | Name | Description |
---|---|---|
System.String | localFolderPath | The absolute path of the folder containing the files to add. |
System.Boolean | recursive | If |
Returns
Type | Description |
---|---|
ProjectFile[] | The added project files. |
Remarks
When adding files to a project, these files are copied into the project folder; they are not referenced in their original location.
AddFolderWithFiles(String, String, Boolean)
Adds all the files from a folder into the project, below a specified project folder.
Declaration
ProjectFile[] AddFolderWithFiles(string localFolderPath, string folderPathInProject, bool recursive)
Parameters
Type | Name | Description |
---|---|---|
System.String | localFolderPath | The absolute path of the folder containing the files to add. |
System.String | folderPathInProject | The folder in this project below which the files should be added. If empty the files will be in the project root folder. |
System.Boolean | recursive | If |
Returns
Type | Description |
---|---|
ProjectFile[] | The added project files. |
Remarks
When adding files to a project, these files are copied into the project folder; they are not referenced in their original location.
AddNewFileVersion(Guid, String)
Adds a new version of the file into the project.
Declaration
void AddNewFileVersion(Guid projectFileId, string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | projectFileId | The file to add a new version for. |
System.String | filePath | The absolute file path of the new version of the file. |
Remarks
When adding files to a project, these files are copied into the project folder; they are not referenced in their original location.
CreateManualTask(String, String, DateTime, TaskFileInfo[])
Creates a manual task. A manual task includes a set of files that is assigned to a user. The created manual task can be used to create a project package using CreateProjectPackage(Guid, String, String, ProjectPackageCreationOptions, EventHandler<ProgressEventArgs>, EventHandler<MessageEventArgs>)
Declaration
ManualTask CreateManualTask(string manualTaskName, string assignToUser, DateTime dueDate, TaskFileInfo[] inputFiles)
Parameters
Type | Name | Description |
---|---|---|
System.String | manualTaskName | The name of the manual task. Typically "Translate" or "Review", but other task names can be |
System.String | assignToUser | The user to assign the task to. |
System.DateTime | dueDate | The date by which the task should be completed. |
TaskFileInfo[] | inputFiles | The files to include in the task. |
Returns
Type | Description |
---|---|
ManualTask | The newly created manual task. |
CreateManualTask(String, String, DateTime, Guid[])
Creates a manual task. A manual task includes a set of files that is assigned to a user. The created manual task can be used to create a project package using CreateProjectPackage(Guid, String, String, ProjectPackageCreationOptions, EventHandler<ProgressEventArgs>, EventHandler<MessageEventArgs>)
Declaration
ManualTask CreateManualTask(string manualTaskName, string assignToUser, DateTime dueDate, Guid[] projectFileIds)
Parameters
Type | Name | Description |
---|---|---|
System.String | manualTaskName | The name of the manual task. Typically "Translate" or "Review", but other task names can be |
System.String | assignToUser | The user to assign the task to. |
System.DateTime | dueDate | The date by which the task should be completed. |
System.Guid[] | projectFileIds | The project files to include in the task. Reference files will be marked as "read only" task files |
Returns
Type | Description |
---|---|
ManualTask | The newly created manual task. |
Remarks
This overload allows a list of project file IDs to be specified rather than TaskFileInfo objects. A project file will be marked as a "read only" task file if it has a role of Reference.
CreateMergedProjectFile(String, String, Guid[])
Creates a merged file from a number of translatable files in the project. This allows manipulating the content of all the child files within one physical file. For more information, see MergedProjectFile.
Declaration
MergedProjectFile CreateMergedProjectFile(string mergedFileName, string folderPathInProject, Guid[] projectFileIds)
Parameters
Type | Name | Description |
---|---|---|
System.String | mergedFileName | The file name for the newly created merged file. This must have the ".sdlxliff" extension. |
System.String | folderPathInProject | The folder in this project in which the merged file be added. If empty the merged file will be in the project root folder. |
System.Guid[] | projectFileIds | The IDs of the translatable files to be merged in to one. |
Returns
Type | Description |
---|---|
MergedProjectFile | The newly created and added merged project file. |
CreateProjectPackage(Guid, String, String, ProjectPackageCreationOptions)
Creates a project package. The package can then be obtained using SavePackageAs(Guid, String).
Declaration
ProjectPackageCreation CreateProjectPackage(Guid manualTaskId, string packageName, string comment, ProjectPackageCreationOptions options)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | manualTaskId | The ID of the task that the package relates to. (The task defines which files are included in the package.) |
System.String | packageName | The name of the package. |
System.String | comment | Optional comment. |
ProjectPackageCreationOptions | options | Various options to control what will be included in a project package. |
Returns
Type | Description |
---|---|
ProjectPackageCreation | A ProjectPackageCreation object, which contains the results of the package creation. |
CreateProjectPackage(Guid, String, String, ProjectPackageCreationOptions, EventHandler<ProgressEventArgs>, EventHandler<MessageEventArgs>)
Creates a project package. The package can then be obtained using SavePackageAs(Guid, String).
Declaration
ProjectPackageCreation CreateProjectPackage(Guid manualTaskId, string packageName, string comment, ProjectPackageCreationOptions options, EventHandler<ProgressEventArgs> statusEventHandler, EventHandler<MessageEventArgs> messageEventHandler)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | manualTaskId | The ID of the task that the package relates to. (The task defines which files are included in the package.) |
System.String | packageName | The name of the package. |
System.String | comment | Optional comment. |
ProjectPackageCreationOptions | options | Various options to control what will be included in a project package. |
System.EventHandler<ProgressEventArgs> | statusEventHandler | Event handler for package creation status events. |
System.EventHandler<MessageEventArgs> | messageEventHandler | Event handler for message events. |
Returns
Type | Description |
---|---|
ProjectPackageCreation | A ProjectPackageCreation object, which contains the results of the package creation. |
CreateReturnPackage(Guid[], String, String)
Creates a return package from a set of files. The files must all have previously been received as part of a project package in order for the return package to be created.
Declaration
ReturnPackageCreation CreateReturnPackage(Guid[] projectFileIds, string packageName, string comment)
Parameters
Type | Name | Description |
---|---|---|
System.Guid[] | projectFileIds | The files to include in the return package. |
System.String | packageName | The name of the package. |
System.String | comment | A comment for the package. |
Returns
Type | Description |
---|---|
ReturnPackageCreation | A ReturnPackageCreation object, representing the results of the return package creation. |
Remarks
It is only valid to call this method if this project was created from a project package
CreateReturnPackage(Guid[], String, String, EventHandler<ProgressEventArgs>, EventHandler<MessageEventArgs>)
Creates a return package from a set of files. The files must all have previously been received as part of a project package in order for the return package to be created.
Declaration
ReturnPackageCreation CreateReturnPackage(Guid[] projectFileIds, string packageName, string comment, EventHandler<ProgressEventArgs> statusEventHandler, EventHandler<MessageEventArgs> messageEventHandler)
Parameters
Type | Name | Description |
---|---|---|
System.Guid[] | projectFileIds | The files to include in the return package. |
System.String | packageName | The name of the package. |
System.String | comment | A comment for the package. |
System.EventHandler<ProgressEventArgs> | statusEventHandler | Event handler for status events |
System.EventHandler<MessageEventArgs> | messageEventHandler | Event handler for message events |
Returns
Type | Description |
---|---|
ReturnPackageCreation |
Remarks
It is only valid to call this method if this project was created from a project package
GetAutomaticTask(Guid)
Retrieves an existing automatic task.
Declaration
AutomaticTask GetAutomaticTask(Guid automaticTaskId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | automaticTaskId | The ID of the automatic task. |
Returns
Type | Description |
---|---|
AutomaticTask |
GetFile(Guid)
Retrieves the file with specified ID.
Declaration
ProjectFile GetFile(Guid projectFileId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | projectFileId | The ID of the file to retrieve. |
Returns
Type | Description |
---|---|
ProjectFile | The added project file. |
GetFileTypeConfiguration()
Returns the configuration for the file types asssociated to this project
Declaration
ProjectFileTypeConfiguration GetFileTypeConfiguration()
Returns
Type | Description |
---|---|
ProjectFileTypeConfiguration |
GetManualTask(Guid)
Retrieves an existing manual task.
Declaration
ManualTask GetManualTask(Guid manualTaskId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | manualTaskId | The ID of the manual task |
Returns
Type | Description |
---|---|
ManualTask |
GetProjectInfo()
Retrieves information about the project
Declaration
ProjectInfo GetProjectInfo()
Returns
Type | Description |
---|---|
ProjectInfo |
GetProjectStatistics()
Gets the aggregated analysis, word count and confirmation statistics for all the files in the project. This will not actually compute the statistics, but just return a snapshot of the statistics that where most recently computed. To update the statistics, run the relevant task: WordCount, AnalyzeFiles or TranslationCount.
Declaration
ProjectStatistics GetProjectStatistics()
Returns
Type | Description |
---|---|
ProjectStatistics | The aggregated analysis, word count and confirmation statistics for all the files in the project. |
GetSettings()
Gets the project-level settings.
Declaration
ISettingsBundle GetSettings()
Returns
Type | Description |
---|---|
ISettingsBundle | A settings bundle containing the project settings. Never returns |
Remarks
Project settings can be overridden for a specific target language using UpdateSettings(Language, ISettingsBundle). The override mechanism works on an individual setting level, not on a settings bundle or group level. This means that any setting that is not specifically defined/overridden on the target language level will be inherited from the project-level settings.
GetSettings(Language)
Gets the settings for a specific target language.
Declaration
ISettingsBundle GetSettings(Language targetLanguage)
Parameters
Type | Name | Description |
---|---|---|
Language | targetLanguage | The project target language for which to retrieve the settings. |
Returns
Type | Description |
---|---|
ISettingsBundle | A settings bundle containing the target language specific settings. The settings bundle returned will have a parent
settings bundle which represent the current project settings. Never returns |
Remarks
Target language settings override settings specified on the project level (see GetSettings(). The override mechanism works on an individual setting level, not on a settings bundle or group level. This means that any setting that is not specifically defined/overridden on the target language level will be inherited from the project-level settings.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when |
GetSourceLanguageFiles()
Retrieves all source language files.
Declaration
ProjectFile[] GetSourceLanguageFiles()
Returns
Type | Description |
---|---|
ProjectFile[] | All the source language files in this project. |
GetTargetLanguageFiles()
Retrieves all target language files.
Declaration
ProjectFile[] GetTargetLanguageFiles()
Returns
Type | Description |
---|---|
ProjectFile[] |
Remarks
For merged files (MergedProjectFile) with merge state NotMerged or Merged the merged file will be returned from this method, but not the child files. When the merge state is Split, only the child files are returned, not the merged file.
GetTargetLanguageFiles(Language)
Retrieves all files for the specified target language.
Declaration
ProjectFile[] GetTargetLanguageFiles(Language targetLanguage)
Parameters
Type | Name | Description |
---|---|---|
Language | targetLanguage | The target language to retrieve files for. |
Returns
Type | Description |
---|---|
ProjectFile[] |
Remarks
For merged files (MergedProjectFile) with merge state NotMerged or Merged the merged file will be returned from this method, but not the child files. When the merge state is Split, only the child files are returned, not the merged file.
GetTermbaseConfiguration(Boolean)
Retrieves all termbase-related settings that are associated with this project.
Declaration
TermbaseConfiguration GetTermbaseConfiguration(bool obtainCopy)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | obtainCopy |
Returns
Type | Description |
---|---|
TermbaseConfiguration | A TermbaseConfiguration object containing all termbase-related configuration for this project. |
GetTranslationProviderConfiguration()
Gets the translation provider configuration for this project.
Declaration
TranslationProviderConfiguration GetTranslationProviderConfiguration()
Returns
Type | Description |
---|---|
TranslationProviderConfiguration | The translation provider configuration. This never returns |
Remarks
The translation provider configuration can be overridden for a specific target language (see GetTranslationProviderConfiguration(Language)) and UpdateTranslationProviderConfiguration(Language, TranslationProviderConfiguration)).
GetTranslationProviderConfiguration(Language)
Gets the translation provider configuration for the specified target language. If no specific configuration has been specified for the specified target language,
this method returns an empty (not null
!) configuration.
Declaration
TranslationProviderConfiguration GetTranslationProviderConfiguration(Language targetLanguage)
Parameters
Type | Name | Description |
---|---|---|
Language | targetLanguage | The target language for which to get the translation provider configuration. |
Returns
Type | Description |
---|---|
TranslationProviderConfiguration | The translation provider configuration for the specified target language. This never returns |
ImportReturnPackage(String)
Imports a return package into this project.
Declaration
ReturnPackageImport ImportReturnPackage(string returnPackageFilePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | returnPackageFilePath | The file path of the return package to import. Has file extension .sdlrpx |
Returns
Type | Description |
---|---|
ReturnPackageImport | Information about the import operation. |
ImportReturnPackage(String, EventHandler<ProgressEventArgs>, EventHandler<MessageEventArgs>)
Imports a return package into this project.
Declaration
ReturnPackageImport ImportReturnPackage(string returnPackageFilePath, EventHandler<ProgressEventArgs> statusEventHandler, EventHandler<MessageEventArgs> messageEventHandler)
Parameters
Type | Name | Description |
---|---|---|
System.String | returnPackageFilePath | The file path of the return package to import. Has file extension .sdlrpx |
System.EventHandler<ProgressEventArgs> | statusEventHandler | Event handler for status events |
System.EventHandler<MessageEventArgs> | messageEventHandler | Event handler for message events |
Returns
Type | Description |
---|---|
ReturnPackageImport | Information about the import operation. |
OpenProjectFileStream(Guid)
Returns a stream that can be used to save out the latest version of the file.
Declaration
Stream OpenProjectFileStream(Guid projectFileId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | projectFileId | The file to obtain the stream for. |
Returns
Type | Description |
---|---|
System.IO.Stream | A stream from which the file contents can be read. It is the responsibility of the caller to close this stream. |
RemoveBilingualReferenceFile(Guid)
Removes a Bilingual reference file from a target project file
Declaration
void RemoveBilingualReferenceFile(Guid ProjectTargetFileId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | ProjectTargetFileId | The file that where the bilingual reference needs to be removed |
RunAutomaticTask(Guid[], String)
Runs an automatic task on a set of files. Automatic task template IDs are defined in AutomaticTaskTemplateIds.
Declaration
AutomaticTask RunAutomaticTask(Guid[] projectFileIds, string taskTemplateId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid[] | projectFileIds | The files to run the task on. |
System.String | taskTemplateId | The ID of the task template (i.e. the type of task) to run. |
Returns
Type | Description |
---|---|
AutomaticTask | Information about the automatic task that has been run. |
Remarks
Multiple automatic tasks can be run together in a sequence using FileBasedProject.RunAutomaticTasks
RunAutomaticTask(Guid[], String, EventHandler<TaskStatusEventArgs>, EventHandler<TaskMessageEventArgs>)
Runs an automatic task on a set of files. Automatic task template IDs are defined in AutomaticTaskTemplateIds. This overload allows event handlers to be specified for task status and message events. These events support cancellation of the task.
Declaration
AutomaticTask RunAutomaticTask(Guid[] projectFileIds, string taskTemplateId, EventHandler<TaskStatusEventArgs> statusEventHandler, EventHandler<TaskMessageEventArgs> messageEventHandler)
Parameters
Type | Name | Description |
---|---|---|
System.Guid[] | projectFileIds | The files to run the task on. |
System.String | taskTemplateId | The ID of the task template (i.e. the type of task) to run. |
System.EventHandler<TaskStatusEventArgs> | statusEventHandler | Event handler for task status events. |
System.EventHandler<TaskMessageEventArgs> | messageEventHandler | Event handler for message events. |
Returns
Type | Description |
---|---|
AutomaticTask | Information about the automatic task that has been run. |
Remarks
Multiple automatic tasks can be run together in a sequence using FileBasedProject.RunAutomaticTasks
Save()
Persists the project file. The file has extension .sdlproj and is located in the folder given by LocalProjectFolder. .
Declaration
void Save()
Remarks
It is recommended to regularly save the project, for example after making a set of changes and after running a task.
SavePackageAs(Guid, String)
Saves out a created project or return package to a specified file location.
Declaration
void SavePackageAs(Guid packageId, string path)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | packageId | The ID of the package to save. See PackageId. |
System.String | path | The file path to save the package to. |
SaveProjectFileAs(Guid, String)
Saves out the file to a specified file location.
Declaration
void SaveProjectFileAs(Guid projectFileId, string outputFilePath)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | projectFileId | The file to save. |
System.String | outputFilePath | The file path to save the project file to. |
SaveTaskReportAs(Guid, String, ReportFormat)
Saves the task report out to a file, in the specified format
Declaration
void SaveTaskReportAs(Guid reportId, string path, ReportFormat reportFormat)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | reportId | The id of the task report to save. |
System.String | path | The file path to save the report to. |
ReportFormat | reportFormat | The format used when saving out the report. |
SetFileRole(Guid[], FileRole)
Changes the role of the file. A Scan task (Scan) should be run after changing the file role in this way.
Declaration
void SetFileRole(Guid[] projectFileIds, FileRole fileRole)
Parameters
Type | Name | Description |
---|---|---|
System.Guid[] | projectFileIds | The IDs of the project files. |
FileRole | fileRole | The new FileRole value. |
UpdateProject(ProjectInfo)
Updates the project with the new information contained in projectInfo
.
Declaration
ProjectInfo UpdateProject(ProjectInfo projectInfo)
Parameters
Type | Name | Description |
---|---|---|
ProjectInfo | projectInfo | The updated project information. |
Returns
Type | Description |
---|---|
ProjectInfo | The updated project information. |
Remarks
It is only valid to update certain properties. See the comments in ProjectInfo properties for more details. It is recommended to first obtain a ProjectInfo object using GetProjectInfo(), then modify its properties before passing into this update method.
UpdateSettings(Language, ISettingsBundle)
Updates the settings for a specific target language.
Declaration
void UpdateSettings(Language targetLanguage, ISettingsBundle settings)
Parameters
Type | Name | Description |
---|---|---|
Language | targetLanguage | The target language for which to update the settings. |
ISettingsBundle | settings | A settings bundle representing the new target language settings. |
Remarks
Note that this method will only update the target-language settings. If you have changed the parent project-level settings too, thee need to be updated with a separate call to UpdateSettings(ISettingsBundle).
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when |
System.ArgumentNullException | Thrown if |
UpdateSettings(ISettingsBundle)
Updates the project-level settings.
Declaration
void UpdateSettings(ISettingsBundle settings)
Parameters
Type | Name | Description |
---|---|---|
ISettingsBundle | settings | A settings bundle object containing the new project settings. |
Remarks
The project settings will be completely replaced with the specified settings, so any settings not present in the updated settings bundle will revert to their defaults.
You can also override settings for a specific target language. See UpdateSettings(Language, ISettingsBundle).
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if |
UpdateTermbaseConfiguration(TermbaseConfiguration)
Updates the termbase-related settings for this project.
Declaration
void UpdateTermbaseConfiguration(TermbaseConfiguration termbaseConfiguration)
Parameters
Type | Name | Description |
---|---|---|
TermbaseConfiguration | termbaseConfiguration | A TermbaseConfiguration object containing all termbase-related configuration for this project. This can either be newly created termbase configuration object or one that was retrieved via GetTermbaseConfiguration(Boolean). |
UpdateTranslationProviderConfiguration(Language, TranslationProviderConfiguration)
Updates the translation provider configuration for a specific project target language.
Declaration
void UpdateTranslationProviderConfiguration(Language targetLanguage, TranslationProviderConfiguration translationProviderConfiguration)
Parameters
Type | Name | Description |
---|---|---|
Language | targetLanguage | The project target language for which to update the configuration. |
TranslationProviderConfiguration | translationProviderConfiguration | The translation provider configuration. Note that you need to set OverrideParent to in order for the configuration to be used. If this is
set to , the project-wide translation provider configuration will be used instead (GetTranslationProviderConfiguration()).
|
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when |
System.ArgumentNullException | Thrown when |
System.ArgumentException | Thrown when |
UpdateTranslationProviderConfiguration(TranslationProviderConfiguration)
Updates the project-wide translation provider configuration.
Declaration
void UpdateTranslationProviderConfiguration(TranslationProviderConfiguration translationProviderConfiguration)
Parameters
Type | Name | Description |
---|---|---|
TranslationProviderConfiguration | translationProviderConfiguration | The translation provider configuration. Note that the project-wide configuration might have been overridden for one or more specific project target languages (see UpdateTranslationProviderConfiguration(Language, TranslationProviderConfiguration)). The project-wide configuration will not be used for these target languages. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.ArgumentException | Thrown when |