Exemple #1
0
        public static string GetSpecificUnit(string unitName)
        {
            string unitWords = Pastebin.Get("https://pastebin.com/raw/szdPcs2Q", "pastebinWordsAndUnits"); // resets the words for the test

            using (StringReader sr = new StringReader(unitWords))
            {
                unitWords = "";
                string s = "";
                while ((s = sr.ReadLine()) != null)
                {
                    if (s.Contains("%%%" + unitWords))
                    {
                        while (!(s = sr.ReadLine()).Contains("%%%") && s != null)
                        {
                            if (s == "--- END OF UNITS ---")
                            {
                                break;
                            }
                            unitWords = unitWords + s + "\n";
                        }
                    }
                }
            }
            return(unitWords);
        }
 public static void Update()
 {
     if (Pastebin.CheckForUpdate())
     {
         if (MessageBox.Show("New version available, would you like to download it?", "Update available!", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
         {
             using (WebClient wc = new WebClient())
             {
                 string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), @"ETG " + Pastebin.Get("https://pastebin.com/raw/6aupTvgs", "version") + ".exe");
                 wc.DownloadFile(wc.DownloadString("https://pastebin.com/raw/ZUS8BfyC"), path);
                 Process.Start(path);
                 Application.Exit();
             }
         }
     }
     else
     {
         MessageBox.Show("You are running the latest version of ETG!", "No update available", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemple #3
0
        //-----FORM LOAD SETTINGS-----
        private void Form1_Load(object sender, EventArgs e)
        {
            panel1.BringToFront();                                                                                                                   // brings the dictionary panel to the front
            button1.BackColor = Color.FromArgb(255, 217, 66, 53);                                                                                    // changes color of the button
            button2.BackColor = Color.FromArgb(255, 20, 20, 20);                                                                                     // changes color of the button
            button3.BackColor = Color.FromArgb(255, 20, 20, 20);                                                                                     // changes color of the button
            button4.BackColor = Color.FromArgb(255, 20, 20, 20);                                                                                     // changes color of the button
            textBox1.AutoSize = false;                                                                                                               // disable autosize because windows forms are bad
            textBox1.Height   = comboBox1.Height;                                                                                                    // set the height so that it matches with the combobox
            ActiveControl     = textBox1;                                                                                                            // focus on textBox1
            richTextBox1.SelectionAlignment = HorizontalAlignment.Center;                                                                            // centers the text on richTextBox1
            richTextBox3.SelectionAlignment = HorizontalAlignment.Center;                                                                            // centers the text on richTextBox3
            comboBox1.SelectedIndex         = 0;                                                                                                     // select first value
            checkBox1.Checked        = Properties.Settings.Default.autoUpdate;                                                                       // changes checkBox1 value to match user preference
            checkBox2.Checked        = Properties.Settings.Default.autoSearch;                                                                       // changes checkBox2 value to match user preference
            monoFlat_TrackBar1.Value = volume;                                                                                                       // changes trackbar1 value to match user preference
            monoFlat_TrackBar2.Value = rate;                                                                                                         // changes trackbar2 value to match user preference
            label16.Text             = "Volume: " + monoFlat_TrackBar1.Value;                                                                        // changes label16 value to match user preference
            label17.Text             = "Speed: " + monoFlat_TrackBar2.Value;                                                                         // changes label17 value to match user preference
            Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"ETGCachedData/Examples"));    // creates directory in MyDocuments for cache
            Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"ETGCachedData/Definitions")); // creates directory in MyDocuments for cache
            Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"ETGCachedData/Pastebin"));    // creates directory in MyDocuments for cache
            Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"ETGCachedData/Synonyms"));    // creates directory in MyDocuments for cache
            units     = Pastebin.Get("https://pastebin.com/raw/szdPcs2Q", "pastebinWordsAndUnits");
            comboBox2 = Utility.LoadUnits(units, comboBox2);
            if (!Utility.HasRequestsLeft(appId, appKey))
            {
                Utility.GetNewCredentials();
            }
            if (Properties.Settings.Default.autoUpdate)
            {
                new Thread(() => { Program.Update(); }).Start();
            }
            if (!IsApplicationInstalled.Check("Notepad++")) // check if notepad++ is installed and if it's not - removes radiobutton6
            {
                radioButton6.Visible  = false;
                radioButton8.Location = new Point(17, 96);
            }
            switch (region) // change borders to user preference
            {
            case "gb":
                button9.FlatAppearance.BorderSize  = 1;
                button10.FlatAppearance.BorderSize = 0;
                break;

            case "us":
                button9.FlatAppearance.BorderSize  = 0;
                button10.FlatAppearance.BorderSize = 1;
                break;
            }
            switch (userEditor) // changes radiobuttons in settings to user preference
            {
            case "notepad.exe":
                radioButton5.Checked = true;
                break;

            case "notepad++.exe":
                radioButton6.Checked = true;
                break;

            case "MS Word":
                radioButton7.Checked = true;
                break;

            case "wordpad":
                radioButton8.Checked = true;
                break;
            }
            switch (transToLanguage) // changes the label to match the current transToLanguage
            {
            case "en":
                label8.Text = "Bulgarian to English";
                webBrowser1.Navigate("https://translate.google.com/#bg/en/");
                break;

            case "bg":
                label8.Text = "English to Bulgarian";
                webBrowser1.Navigate("https://translate.google.com/#en/bg/");
                break;
            }
            switch (userTheme)
            {
            case "Dark":
                foreach (Control panel in Controls)     // check each panel or groupbox...
                {
                    if (panel is Panel)
                    {
                        foreach (Control c in panel.Controls)
                        {
                            if (c is TextBox || c is RichTextBox || c is ComboBox || c is NumericUpDown) // ... and for each textBox, richTextBox, comboBox and numericUpDown in them
                            {
                                c.ForeColor = Color.FromArgb(255, 235, 235, 235);                        // change the color
                                c.BackColor = Color.FromArgb(255, 29, 29, 29);
                            }
                            if (c is GroupBox)
                            {
                                foreach (Control cInGroupBox in c.Controls)
                                {
                                    if (cInGroupBox is TextBox || cInGroupBox is RichTextBox || cInGroupBox is ComboBox || cInGroupBox is NumericUpDown) // ... and for each textBox, richTextBox, comboBox and numericUpDown in them
                                    {
                                        cInGroupBox.ForeColor = Color.FromArgb(255, 235, 235, 235);                                                      // change the color
                                        cInGroupBox.BackColor = Color.FromArgb(255, 29, 29, 29);
                                    }
                                }
                            }
                        }
                    }
                }
                radioButton9.Checked = true;
                break;

            case "Light":
                foreach (Control panel in Controls)     // check each panel or groupbox...
                {
                    if (panel is Panel)
                    {
                        foreach (Control c in panel.Controls)
                        {
                            if (c is TextBox || c is RichTextBox || c is ComboBox || c is NumericUpDown) // ... and for each textBox, richTextBox, comboBox and numericUpDown in them
                            {
                                c.ForeColor = Color.FromName("WindowText");                              // change the color
                                c.BackColor = Color.FromName("Window");
                            }
                            if (c is GroupBox)
                            {
                                foreach (Control cInGroupBox in c.Controls)
                                {
                                    if (cInGroupBox is TextBox || cInGroupBox is RichTextBox || cInGroupBox is ComboBox || cInGroupBox is NumericUpDown) // ... and for each textBox, richTextBox, comboBox and numericUpDown in them
                                    {
                                        cInGroupBox.ForeColor = Color.FromName("WindowText");                                                            // change the color
                                        cInGroupBox.BackColor = Color.FromName("Window");
                                    }
                                }
                            }
                        }
                    }
                }
                radioButton10.Checked = true;
                break;
            }
            switch (generatingSpeed)
            {
            case "Fast":
                radioButton12.Checked = true;
                break;
            }
            Launcher.l.Hide();
        }