Example #1
0
        private void btn_Download_Click(object sender, EventArgs e)
        {
            var ini = new classINI(settingspath);

            try
            {
                server_url = ini.Read("url");
            }
            catch
            {
                server_url = "SET SERVER URL";
            }
            s_username = cbb_Users.Text;
            if (s_username != "")
            {
                try
                {
                    f_controls(false);
                    f_read();
                }
                catch { MessageBox.Show("Connection failed."); }

                f_controls(true);
            }
            else
            {
                MessageBox.Show("No username given");
            }
        }
Example #2
0
        private void visualsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fontDialog1.ShowColor = true;

            fontDialog1.Font = rtb_Logview.Font;

            if (fontDialog1.ShowDialog() != DialogResult.Cancel)
            {
                setFonts(fontDialog1.Font);
                var ini = new classINI();
                ini.Write("font", fontDialog1.Font.ToString());
            }
        }
Example #3
0
        public void savesetting()
        {
            var ini = new classINI(settingspath);

            ini.Write("url", txt_URL.Text);
            frmMain.server_url = ini.Read("url");
            frmMain.checkFiles();
            frmMain.downloadUserlist();

            MessageBox.Show("Saved your server URL, the software will restart now and initialize with the new server");
            this.Close();
            Application.Restart();
        }
Example #4
0
        private void FrmServerurl_Load(object sender, EventArgs e)
        {
            var ini = new classINI(settingspath);

            try
            {
                txt_URL.Text = ini.Read("url");
            }
            catch
            {
                txt_URL.Text = "enter your server url";
            }
        }
Example #5
0
        public void f_init()
        {
            alog("Initializing now");
            rtb_Logview.Visible = false;
            this.Width          = 822;
            lbl_Time.Visible    = false;
            var    inif     = new classINI(settingspath);
            string tempfont = inif.Read("font");

            //ts(StringToFont(tempfont));

            alog("UI init done");
            try
            {
                alog("reading settings");
                var ini = new classINI(settingspath);
                server_url = ini.Read("url");
                alog("Checking files");
                checkFiles();
                getUserlist();
                alog("loading users from database");
                this.Text += " - connected to server on : " + server_url;
            }
            catch (Exception e) {
                MessageBox.Show(e.ToString());; frmServerurl ss = new frmServerurl();
                ss.ShowDialog();
            }

            WebRequest.DefaultWebProxy = null; alog("Proxy set");
            System.Windows.Forms.Timer heartbeat = new System.Windows.Forms.Timer();

            alog("calculating correct opacity");

            tb_Opacity.Value = 10;
            int actualOpacity = 0;

            actualOpacity  = tb_Opacity.Value;
            global_opacity = Convert.ToInt32(this.Opacity);
            this.Opacity   = ((double)(tb_Opacity.Value) / 10.0);
            alog("opacity set");
        }
Example #6
0
        public bool updateAvailable()
        {
            alog("init settings ini");
            var ini = new classINI(settingspath);

            server_url = ini.Read("url");
            alog("read the settings");
            try
            {
                alog("Checking for update");
                WebClient wc = new WebClient();
                string    serverversion_todisplay = wc.DownloadString(server_url + server_version_url);
                alog("parsing server version");
                string serverversion = serverversion_todisplay.Replace(".", "");
                string localversion  = appversion.Replace(".", "");
                server_version = serverversion_todisplay;
                version_local  = localversion;
                alog("re-store version informations");
                string serverbranch = "";
                string localbranch  = "";
                alog("calculating branch");
                if (serverversion.Contains("a"))
                {
                    serverbranch = "alpha";
                }
                else if (serverversion.Contains("b"))
                {
                    serverbranch = "beta";
                }
                else if (serverversion.Contains("r"))
                {
                    serverbranch = "release";
                }
                if (localversion.Contains("a"))
                {
                    localbranch = "alpha";
                }
                else if (localversion.Contains("b"))
                {
                    localbranch = "beta";
                }
                else if (localversion.Contains("r"))
                {
                    localbranch = "release";
                }

                if (serverbranch == "alpha" && localbranch == "alpha")
                {
                    serverbranchnewer = true;
                }
                else if (serverbranch == "alpha" && localbranch == "beta")
                {
                    serverbranchnewer = false;
                }
                else if (serverbranch == "alpha" && localbranch == "release")
                {
                    serverbranchnewer = false;
                }
                else if (serverbranch == "beta" && localbranch == "alpha")
                {
                    serverbranchnewer = true;
                }
                else if (serverbranch == "release" && localbranch == "alpha")
                {
                    serverbranchnewer = true;
                }
                else if (serverbranch == "beta" && localbranch == "beta")
                {
                    serverbranchnewer = false;
                }
                else if (serverbranch == "release" && localbranch == "beta")
                {
                    serverbranchnewer = true;
                }
                //Convert
                s_localbranch  = localbranch;
                s_serverbranch = serverbranch;

                alog("branches set.");

                if (serverversion != localversion)
                {
                    string serverversion02 = Regex.Replace(serverversion.Replace("0", ""), "[^.0-9]", "");
                    string localversion02  = Regex.Replace(localversion.Replace("0", ""), "[^.0-9]", "");

                    int iserver = Convert.ToInt32(serverversion02);
                    int ilocal  = Convert.ToInt32(localversion02);

                    alog("checking versions against eachother");
                    if (iserver > ilocal && serverbranchnewer)
                    {
                        alog("server is newer");
                        return(true);
                    }
                    else if (iserver < ilocal && !serverbranchnewer)
                    {
                        alog("local is newer but not branch");
                        return(false);
                    }
                    else if (iserver < ilocal && serverbranchnewer)
                    {
                        alog("local is newer but serverbranch is newer");
                        return(true);
                    }
                    else if (iserver > ilocal && !serverbranchnewer)
                    {
                        alog("server is newer and local branch is not newer.");
                        return(true);
                    }
                }
                alog("method returned false");
                return(false);
            }

            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                alog("method returned false");
                return(false);
            }
        }