Пример #1
0
        private void ObjectListView_ButtonClick(object sender, CellClickEventArgs e)
        {
            CheckProcesses(_processNames);

            try
            {
                var studio = _installedStudioVersions.FirstOrDefault(sVersion => sVersion.PublicVersion == e.Item.Text);
                if (studio != null)
                {
                    var appVersion = new ApplicationVersion
                    {
                        InstallPath       = studio.InstallPath,
                        PublicVersion     = studio.PublicVersion,
                        ResourceFileName  = "SDLTradosStudio.exe.manifest",
                        StudioVersions    = _installedStudioVersions,
                        MultiTermVersions = _installedMultiTermVersions
                    };
                    _versions.Add(appVersion);
                }

                var multiTerm = _installedMultiTermVersions.FirstOrDefault(mtVersion => mtVersion.PublicVersion.Equals(e.Item.Text));
                if (multiTerm != null)
                {
                    var appVersion = new ApplicationVersion
                    {
                        InstallPath       = multiTerm.InstallPath,
                        PublicVersion     = multiTerm.PublicVersion,
                        ResourceFileName  = "MultiTerm.exe.manifest",
                        StudioVersions    = _installedStudioVersions,
                        MultiTermVersions = _installedMultiTermVersions
                    };
                    _versions.Add(appVersion);
                }

                foreach (var version in _versions.Where(version => version.PublicVersion == e.Item.Text))
                {
                    if (e.SubItem.Text == "Apply changes")
                    {
                        Helpers.ApplyChanges(version.InstallPath, version.ResourceFileName);
                    }
                    else
                    {
                        Helpers.UndoChanges(version, version.InstallPath, version.ResourceFileName);
                    }
                }
            }
            catch (UnauthorizedAccessException ex)
            {
                MessageBox.Show(this, "Admin rights are required!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                InitializeLog.Retlogger().Error(ex, "Error when adding files!");
            }
        }
Пример #2
0
        private static void Main()
        {
            LoadAssemblies();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (Process.GetProcessesByName(Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location)).Length > 1)
            {
                Process.GetCurrentProcess().Kill();
            }

            InitializeLog.InitializeLoggingConfiguration();

            Application.Run(new HighDPIChange());
        }