示例#1
0
 private void context_CurrentResourceBundleChanged(object sender, EventArgs e)
 {
     // create a manager that will manage exclusion patterns, based on the patterns defined in the current
     // resource bundle
     this.exclusionManager = new ExclusionManager();
     exclusionManager.ExclusionPatterns = this.context.CurrentBaseResourceSet.Exclusions;
 }
示例#2
0
        public SettingsDialogue()
        {
            VisibleChanged += Me_VisibleChanged;
            InitializeComponent();

            ReBuildGroups();
            Application.EnableVisualStyles();

            TrayIcon.Icon    = Icon;
            TrayIcon.Visible = Settings.ShowTrayIcon;

            this.Text              = Application.ProductName;
            ProgramName.Text       = Application.ProductName;
            ProgramVersion.Text    = Application.ProductVersion;
            Developer.Text         = Application.CompanyName;
            ProductWebsite.Text    = Program.BorderSkinWebsite;
            DefaultWebsite.Text    = Program.KomaloWebsite;
            GithubWebsite.Text     = Program.KomaloGithubWebsite;
            SourceCodeWebsite.Text = Program.SourceCodeWebsite;

            InclusionManager.IsInclusionList = true;
            InclusionManager.RebuildList();
            ExclusionManager.RebuildList();

            BlurStrength.Value = Settings.BlurStrength;
            double Ref1 = Settings.ReflectionSpeed - 1;
            double Ref2 = Ref1 * 10;

            try {
                ReflectionSpeed.Value = Convert.ToInt32(Ref2);
            } catch (Exception ex) {
                ErrorManager.ProccessError(ex, "Reflection Value Error, Value =" + Ref2);
            }

            BlurStrength_Scroll(null, null);
            ReflectionSpeed_Scroll(null, null);

            SetSettingsCheck(Controls);
            AddHandlers(Controls);
            ApplyLanguage();
        }
        public void ExcludeRestoreTest()
        {
            // set up
            const string originalText = "Windows is an operating system created by Microsoft, which was founded by Bill Gates";

            var exclusionManager = new ExclusionManager();

            exclusionManager.ExclusionPatterns.Add(new Exclusion("Windows"));  // We want these words not to be translated
            exclusionManager.ExclusionPatterns.Add(new Exclusion("Gates"));    // We want these words not to be translated

            // run 1
            var textWithExclusions = exclusionManager.Exclude(originalText);

            // assert 1
            Assert.AreEqual("[### 0 ###] is an operating system created by Microsoft, which was founded by Bill [### 1 ###]", textWithExclusions);

            // run 2
            var restoredText = exclusionManager.Restore(textWithExclusions);

            // assert 2
            Assert.AreEqual(originalText, restoredText);
        }
        public void ValidateTest()
        {
            // set up
            const string originalText         = "Windows is an operating system created by Microsoft, which was founded by Bill Gates";
            const string correctTranslation   = "Τα Windows είναι ένα λειτουργικό σύστημα που δημιουργήθηκε από την Microsoft, η οποία ιδρύθηκε από τον Bill Gates";
            const string incorrectTranslation = "Τα Παράθυρα είναι ένα λειτουργικό σύστημα που δημιουργήθηκε από την Microsoft, η οποία ιδρύθηκε από τον Bill Πύλες";

            var exclusionManager = new ExclusionManager();

            exclusionManager.ExclusionPatterns.Add(new Exclusion("Windows"));  // We want these words not to be translated
            exclusionManager.ExclusionPatterns.Add(new Exclusion("Gates"));    // We want these words not to be translated

            // correct case
            var actual = exclusionManager.Validate(correctTranslation, originalText);

            Assert.AreEqual(0, actual.Length);

            // incorrect case
            actual = exclusionManager.Validate(incorrectTranslation, originalText);
            Assert.AreEqual(2, actual.Length);
            Assert.AreEqual("Windows", actual[0]);
            Assert.AreEqual("Gates", actual[1]);
        }