Esempio n. 1
0
 static void Main(string[] args)
 {
     Console.WriteLine("Running...");
     try
     {
         FL_RPC.Init();
     }
     catch (Exception e)
     {
         Console.WriteLine("\n \nERROR: " + e.Message);
         Console.WriteLine("INFO: Exception Name: " + e.GetType());
         Console.WriteLine("\n");
         FL_RPC.StopAndExit();
         Environment.Exit(-1);
     }
 }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try {
                SaveSettings();
                DialogResult r = MessageBox.Show("Settings were saved! Do you wish to restart the RPC now?", "Success!", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (r == DialogResult.Yes)
                {
                    FL_RPC.Stop();
                    //Give it some time to rest
                    //Thread.Sleep(2000);

                    //Reboot
                    Thread t = new Thread(FL_RPC.Init);
                    t.Start();
                }
            } catch (Exception exx)
            {
                MessageBox.Show("An error occured: " + exx.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 3
0
 private void GetSettingsAndFillControls()
 {
     xml              = FL_RPC.ReadSettings();
     noPrj_txt.Text   = xml.NoNameMessage;
     SecMode_txt.Text = xml.SecretMessage;
     if (xml.Secret)
     {
         sec_mode_sel.Checked      = true;
         def_mode_selector.Checked = false;
     }
     else if (!xml.Secret)
     {
         sec_mode_sel.Checked      = false;
         def_mode_selector.Checked = true;
     }
     debugLevel_sel.Value = (int)xml.logLevel;
     numericUpDown1.Value = xml.RefeshInterval / 1000;
     textBox1.Text        = xml.ClientID;
     numericUpDown2.Value = xml.Pipe;
 }
Esempio n. 4
0
        private void SaveSettings()
        {
            XmlSettings settings = new XmlSettings();

            settings.ClientID       = textBox1.Text;
            settings.RefeshInterval = (int)numericUpDown1.Value * 1000;
            settings.Pipe           = (int)numericUpDown2.Value;
            settings.logLevel       = (DiscordRPC.Logging.LogLevel)debugLevel_sel.Value;
            settings.SecretMessage  = SecMode_txt.Text;
            settings.NoNameMessage  = noPrj_txt.Text;
            if (sec_mode_sel.Checked && !def_mode_selector.Checked)
            {
                settings.Secret = true;
            }
            else if (!sec_mode_sel.Checked && def_mode_selector.Checked)
            {
                settings.Secret = false;
            }
            settings.AcceptedWarning = dangerZone_enable.Checked;
            FL_RPC.SaveToXml(settings);
        }
Esempio n. 5
0
 private void button2_Click(object sender, EventArgs e)
 {
     textBox1.AppendText("Stopping thread... \n");
     FL_RPC.StopAndExit();
     Environment.Exit(0);
 }