// Get the Sdl.Community.TMBackup.exe path from the Unpacked folder when plugin is loaded in Studio
        private static string GetUnpackedFolder()
        {
            var executableVersion = new StudioVersionService().GetStudioVersion()?.ExecutableVersion?.Major;

            foreach (var pluginFolderLocation in _pluginFolderLocations)
            {
                var unpackedFolder = $@"{Environment.GetFolderPath(pluginFolderLocation)}\SDL\SDL Trados Studio\{executableVersion}\Plugins\Unpacked\{PluginResources.Plugin_Name}";

                if (Directory.Exists(unpackedFolder))
                {
                    var pluginExePath = Directory.GetFiles(unpackedFolder, "*.exe").FirstOrDefault();
                    return(pluginExePath);
                }
            }
            return(string.Empty);
        }
Beispiel #2
0
        public override void Initialize()
        {
            _controllers = SdlTradosStudio.Application.GetController <TranscreateViewController>().Controllers;
            SetupTranscreateController();
            _customerProvider         = new CustomerProvider();
            _pathInfo                 = new PathInfo();
            _imageService             = new ImageService();
            _dialogService            = new DialogService();
            _segmentBuilder           = new SegmentBuilder();
            _studioVersionService     = new StudioVersionService();
            _projectAutomationService = new ProjectAutomationService(
                _imageService, _controllers.TranscreateController, _controllers.ProjectsController, _customerProvider, _studioVersionService);
            _projectSettingsService = new ProjectSettingsService();

            Enabled = false;
        }
 public InstallerForm(PluginPackageInfo pluginPackageInfo, Logger logger)
     : this()
 {
     _logger = logger;
     try
     {
         _pluginPackageInfo    = pluginPackageInfo;
         _studioVersionService = new StudioVersionService();
         _installService       = new InstallService(_pluginPackageInfo);
     }
     catch (Exception exception)
     {
         _logger.Error(exception, "Error constructing installer window", null);
         throw;
     }
 }
        /// <summary>
        /// Get installed version for Studio 2019
        /// </summary>
        /// <returns>studio version</returns>
        public string GetStudioVersion()
        {
            try
            {
                var studioVersion = new StudioVersionService().GetInstalledStudioVersions()?.FirstOrDefault(v => v.Version.Equals("Studio15"));
                if (studioVersion != null)
                {
                    return($"{studioVersion.PublicVersion}-{studioVersion.ExecutableVersion}");
                }
            }
            catch
            {
                // catch all; ignore
            }

            return(string.Empty);
        }
        private string GetProductName()
        {
            if (!string.IsNullOrEmpty(_productName))
            {
                return(_productName);
            }

            var studioVersionService = new StudioVersionService();
            var studioVersion        = studioVersionService.GetStudioVersion();

            if (studioVersion != null)
            {
                _productName = studioVersion.StudioDocumentsFolderName;
            }

            return(_productName);
        }
Beispiel #6
0
        /// <summary>
        /// Get current Studio version
        /// </summary>
        /// <returns>studio version</returns>
        public string GetStudioVersion()
        {
            try
            {
                var studioVersion = new StudioVersionService().GetStudioVersion();
                if (studioVersion != null)
                {
                    return($"{studioVersion.PublicVersion}-{studioVersion.ExecutableVersion}");
                }
            }
            catch
            {
                // catch all; ignore
            }

            return(string.Empty);
        }
Beispiel #7
0
        /// <summary>
        /// Get installed version for Studio 2021
        /// </summary>
        /// <returns></returns>
        public static string GetInstalledStudioPath()
        {
            try
            {
                var studio = new StudioVersionService().GetInstalledStudioVersions()?.Where(v => v.Version.Equals("Studio16")).FirstOrDefault();
                if (studio != null)
                {
                    return(studio.InstallPath);
                }

                MessageBox.Show(Constants.Studio2021ErrorMessage, Constants.InformativeMessage, MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (Exception ex)
            {
                Log.Logger.Error($"{Constants.GetInstalledStudioPath}: {ex.Message}\n {ex.StackTrace}");
            }
            return(string.Empty);
        }
Beispiel #8
0
        public override void Initialize()
        {
            Enabled = false;

            _customerProvider         = new CustomerProvider();
            _pathInfo                 = new PathInfo();
            _imageService             = new ImageService();
            _settings                 = GetSettings();
            _segmentBuilder           = new SegmentBuilder();
            _controllers              = SdlTradosStudio.Application.GetController <TranscreateViewController>().Controllers;
            _studioVersionService     = new StudioVersionService();
            _projectAutomationService = new ProjectAutomationService(
                _imageService, _controllers.TranscreateController, _controllers.ProjectsController, _customerProvider, _studioVersionService);

            _controllers.TranscreateController.ProjectSelectionChanged += ProjectsController_SelectedProjectsChanged;

            var projects = _controllers?.TranscreateController?.GetSelectedProjects();

            SetEnabled(projects?[0]);
        }
        public TranslationMemoriesViewModel(PackageDetailsViewModel packageDetailsViewModel)
        {
            _package = packageDetailsViewModel.GetPackageModel();
            if (!(_package is null))
            {
                _package.MTMemories = new List <string>();
            }
            SetPackageLanguagePairs();

            _selectedIndex           = 0;
            _visibility              = "Collapsed";
            _isTmErrorMessageVisible = "Collapsed";
            _isNoneChecked           = true;
            _title           = $"Please select Translation memory for pair {LanguagePairs?[0]?.PairName}";
            _importMtVisible = "Collapsed";

            var studioVersion = new StudioVersionService().GetStudioVersion();

            _initialFolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                                              studioVersion.StudioDocumentsFolderName, "Translation Memories");
        }
Beispiel #10
0
 public override void Initialize()
 {
     _filesController      = SdlTradosStudio.Application.GetController <FilesController>();
     _projectsController   = SdlTradosStudio.Application.GetController <ProjectsController>();
     _studioVersionService = new StudioVersionService();
 }
Beispiel #11
0
        // Get the short Studio's version
        public virtual string GetInstalledStudioShortVersion()
        {
            var studioService = new StudioVersionService();

            return(studioService.GetStudioVersion()?.ShortVersion);
        }
Beispiel #12
0
        public MigrateUtility(StudioVersionService studioVersionService)
        {
            InitializeComponent();

            _studioVersionService = studioVersionService;
        }
Beispiel #13
0
 public ProjectService(ProjectsController projectsController, StudioVersionService studioVersionService)
 {
     _projectsController   = projectsController;
     _studioVersionService = studioVersionService;
 }
Beispiel #14
0
        private static string GetInstalledStudioShortVersion()
        {
            var studioService = new StudioVersionService();

            return(studioService?.GetStudioVersion()?.ShortVersion);
        }
Beispiel #15
0
        public static string GetStudioInstalationPath()
        {
            var studioVersionService = new StudioVersionService();

            return(Path.GetDirectoryName(studioVersionService.GetStudioVersion().InstallPath));
        }
Beispiel #16
0
        public List <StudioVersion> GetInstalledStudioVersion()
        {
            var studioVersionService = new StudioVersionService();

            return(studioVersionService.GetInstalledStudioVersions());
        }
Beispiel #17
0
        public ProjectHelperMain()
        {
            var studioVersionService = new StudioVersionService();

            ProjectsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + studioVersionService.GetStudioVersion().StudioDocumentsFolderName + @"\Projects\";
        }
Beispiel #18
0
        /// <summary>
        /// Get installed version for Studio16(Studio 2021).
        /// The call studio.GetStudioVersion() is not working when using the installer, because the app is running outside the Studio context,
        /// so the workaround is to get all the installed studio versions and use the needed one (Studio16)
        /// </summary>
        /// <returns></returns>
        private static StudioVersion GetInstalledStudioVersion()
        {
            var allStudioVersions = new StudioVersionService().GetInstalledStudioVersions();

            return(allStudioVersions?.FirstOrDefault(v => v.Version.Equals("Studio16")));
        }
Beispiel #19
0
        public static int GetInstalledStudioMajorVersion()
        {
            var studioService = new StudioVersionService();

            return(studioService.GetStudioVersion().ExecutableVersion.Major);
        }
Beispiel #20
0
        public StudioVersion GetStudioVersion()
        {
            var studioVersionService = new StudioVersionService();

            return(studioVersionService.GetStudioVersion());
        }