예제 #1
0
파일: wallets.cs 프로젝트: Gerz-inc/mminer
        private void button2_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == -1)
            {
                MessageBox.Show("Select exchange");
                return;
            }

            if (comboBox2.SelectedIndex == -1)
            {
                MessageBox.Show("Select coin");
                return;
            }

            if (textBox1.Text == "")
            {
                MessageBox.Show("Type wallet address");
                return;
            }

            base_func.ComboBoxItem t = (base_func.ComboBoxItem)comboBox1.Items[comboBox1.SelectedIndex];
            base_func.ComboBoxItem c = (base_func.ComboBoxItem)comboBox2.Items[comboBox2.SelectedIndex];

            db.update_or_insert("update wallets set coin = '" + c.Value.ToString() + "', id_exchange = " + t.Value.ToString() + ", name = '" + textBox1.Text + "' where id = " + id_edit + "; ");

            is_redact = false;
            refresh();
            clear_fields();
        }
예제 #2
0
파일: wallets.cs 프로젝트: Gerz-inc/mminer
        private void wallets_Load(object sender, EventArgs e)
        {
            comboBox1.Items.Clear();
            db.select("select * from exchanges; ", new db_sqlite.dell((System.Data.Common.DbDataRecord record) =>
            {
                base_func.ComboBoxItem it = new base_func.ComboBoxItem();
                it.Text  = record["name"].ToString();
                it.Value = base_func.ParseInt32(record["id"]);

                comboBox1.Items.Add(it);
                return(true);
            }));

            comboBox2.Items.Clear();
            foreach (var c in dlls.get_coins())
            {
                base_func.ComboBoxItem it = new base_func.ComboBoxItem();
                it.Text  = c.Value.name;
                it.Value = c.Value.name;

                comboBox2.Items.Add(it);
            }

            refresh();
        }
예제 #3
0
파일: pools.cs 프로젝트: Gerz-inc/mminer
        private void button1_Click(object sender, EventArgs e)
        {
            if (is_redact)
            {
                is_redact = false;
                clear_fields();
            }
            else
            {
                if (comboBox1.SelectedIndex == -1)
                {
                    MessageBox.Show("Select connection type");
                    return;
                }

                if (comboBox2.SelectedIndex == -1)
                {
                    MessageBox.Show("Select algorithm");
                    return;
                }

                if (textBox1.Text == "")
                {
                    MessageBox.Show("Type url");
                    return;
                }

                if (textBox2.Text == "")
                {
                    MessageBox.Show("Type pool name");
                    return;
                }

                if (comboBox3.SelectedIndex == -1)
                {
                    MessageBox.Show("Select wallet");
                    return;
                }

                base_func.ComboBoxItem t = (base_func.ComboBoxItem)comboBox1.Items[comboBox1.SelectedIndex];
                base_func.ComboBoxItem a = (base_func.ComboBoxItem)comboBox2.Items[comboBox2.SelectedIndex];
                base_func.ComboBoxItem w = (base_func.ComboBoxItem)comboBox3.Items[comboBox3.SelectedIndex];

                db.update_or_insert("insert into pools (name, id_connection_type, url, id_wallet, pass, id_algo) values ('" + textBox2.Text + "', " + t.Value.ToString() + ", '" + textBox1.Text + "', " + w.Value.ToString() + ", '" + textBox3.Text + "', " + a.Value.ToString() + "); ");

                refresh();
                clear_fields();
            }
        }
예제 #4
0
파일: pools.cs 프로젝트: Gerz-inc/mminer
        private void refresh()
        {
            listView1.Items.Clear();

            db.select("select a.*, b.name as wallet_name, b.coin, c.name as exchange_name " +
                      "from pools a " +
                      "left join wallets b on a.id_wallet = b.id " +
                      "left join exchanges c on b.id_exchange = c.id " +
                      "; ", new db_sqlite.dell((System.Data.Common.DbDataRecord record) =>
            {
                ListViewItem item = new ListViewItem(record["id"].ToString());

                item.SubItems.Add(record["name"].ToString());

                for (int i = 0; i < comboBox2.Items.Count; ++i)
                {
                    base_func.ComboBoxItem it = (base_func.ComboBoxItem)comboBox2.Items[i];
                    if (it.Value.ToString() == record["id_algo"].ToString())
                    {
                        item.SubItems.Add(it.Text);
                        break;
                    }
                }

                for (int i = 0; i < comboBox1.Items.Count; ++i)
                {
                    base_func.ComboBoxItem it = (base_func.ComboBoxItem)comboBox1.Items[i];
                    if (it.Value.ToString() == record["id_connection_type"].ToString())
                    {
                        item.SubItems.Add(it.Text);
                        break;
                    }
                }

                item.SubItems.Add(record["url"].ToString());
                item.SubItems.Add(record["coin"].ToString() + " (" + record["wallet_name"].ToString() + ") on " + record["exchange_name"].ToString());
                item.SubItems.Add(record["pass"].ToString());
                item.SubItems.Add("-");

                listView1.Items.Add(item);

                return(true);
            }));
        }
예제 #5
0
파일: pools.cs 프로젝트: Gerz-inc/mminer
        /// <summary>
        /// save
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == -1)
            {
                MessageBox.Show("Select connection type");
                return;
            }

            if (comboBox2.SelectedIndex == -1)
            {
                MessageBox.Show("Select algorithm");
                return;
            }

            if (textBox1.Text == "")
            {
                MessageBox.Show("Type url");
                return;
            }

            if (textBox2.Text == "")
            {
                MessageBox.Show("Type pool name");
                return;
            }

            if (comboBox3.SelectedIndex == -1)
            {
                MessageBox.Show("Select wallet");
                return;
            }

            base_func.ComboBoxItem t = (base_func.ComboBoxItem)comboBox1.Items[comboBox1.SelectedIndex];
            base_func.ComboBoxItem a = (base_func.ComboBoxItem)comboBox2.Items[comboBox2.SelectedIndex];
            base_func.ComboBoxItem w = (base_func.ComboBoxItem)comboBox3.Items[comboBox3.SelectedIndex];

            db.update_or_insert("update pools set name = '" + textBox2.Text + "', id_connection_type = " + t.Value.ToString() + ", url = '" + textBox1.Text + "', id_wallet = " + w.Value.ToString() + ", pass = '******', id_algo = " + a.Value.ToString() + " where id = " + id_edit + "; ");

            is_redact = false;
            refresh();
            clear_fields();
        }
예제 #6
0
파일: wallets.cs 프로젝트: Gerz-inc/mminer
        private void refresh()
        {
            listView1.Items.Clear();

            db.select("select * from wallets; ", new db_sqlite.dell((System.Data.Common.DbDataRecord record) =>
            {
                ListViewItem item = new ListViewItem(record["id"].ToString());

                //image
                var coins = dlls.get_coins();
                if (coins.ContainsKey(record["coin"].ToString()))
                {
                    item.SubItems.Add(new EXMultipleImagesListViewSubItem(new ArrayList(new object[] { Image.FromFile(dlls.get_coin_image(coins[record["coin"].ToString()].name)) })));
                }
                else
                {
                    item.SubItems.Add("-");
                }

                item.SubItems.Add(record["coin"].ToString());

                for (int i = 0; i < comboBox1.Items.Count; ++i)
                {
                    base_func.ComboBoxItem it = (base_func.ComboBoxItem)comboBox1.Items[i];
                    if (it.Value.ToString() == record["id_exchange"].ToString())
                    {
                        item.SubItems.Add(it.Text);
                        break;
                    }
                }

                item.SubItems.Add(record["name"].ToString());
                item.SubItems.Add("-");

                listView1.Items.Add(item);

                return(true);
            }));
        }
예제 #7
0
파일: set_item.cs 프로젝트: Gerz-inc/mminer
        public void set(int id_, bool enabled, int id_pool, string miner, string diff, string manual_diff, int min_running, dell del_)
        {
            id  = id_;
            del = del_;

            checkBox1.Checked = enabled;
            for (int i = 0; i < comboBox1.Items.Count; ++i)
            {
                base_func.ComboBoxItem it = (base_func.ComboBoxItem)comboBox1.Items[i];
                if ((int)it.Value == id_pool)
                {
                    comboBox1.SelectedIndex = i;
                    break;
                }
            }

            for (int i = 0; i < comboBox2.Items.Count; ++i)
            {
                var it = comboBox2.Items[i];
                if (it.ToString() == miner)
                {
                    comboBox2.SelectedIndex = i;
                    break;
                }
            }

            for (int i = 0; i < comboBox5.Items.Count; ++i)
            {
                var it = comboBox5.Items[i];
                if (it.ToString() == diff)
                {
                    comboBox5.SelectedIndex = i;
                    break;
                }
            }

            textBox1.Text = manual_diff;
            textBox2.Text = min_running.ToString();
        }
예제 #8
0
파일: set_item.cs 프로젝트: Gerz-inc/mminer
        public set_item()
        {
            InitializeComponent();
            foreach (var p in sets.pools)
            {
                base_func.ComboBoxItem it = new base_func.ComboBoxItem();
                it.Text  = p.Value;
                it.Value = p.Key;

                comboBox1.Items.Add(it);
            }

            foreach (var it in dlls.get_miners())
            {
                comboBox2.Items.Add(it.Key);
            }

            comboBox5.Items.Add("Manual");
            foreach (string it in dlls.get_statistics())
            {
                comboBox5.Items.Add(it);
            }
        }
예제 #9
0
파일: pools.cs 프로젝트: Gerz-inc/mminer
        private void pools_Load(object sender, EventArgs e)
        {
            comboBox1.Items.Clear();
            db.select("select * from connection_types; ", new db_sqlite.dell((System.Data.Common.DbDataRecord record) =>
            {
                base_func.ComboBoxItem it = new base_func.ComboBoxItem();
                it.Text  = record["name"].ToString();
                it.Value = base_func.ParseInt32(record["id"]);

                comboBox1.Items.Add(it);
                return(true);
            }));

            comboBox2.Items.Clear();
            db.select("select * from algo; ", new db_sqlite.dell((System.Data.Common.DbDataRecord record) =>
            {
                base_func.ComboBoxItem it = new base_func.ComboBoxItem();
                it.Text  = record["name"].ToString();
                it.Value = base_func.ParseInt32(record["id"]);

                comboBox2.Items.Add(it);
                return(true);
            }));

            comboBox3.Items.Clear();
            db.select("select a.*, b.name as exchange_name from wallets a left join exchanges b on a.id_exchange = b.id; ", new db_sqlite.dell((System.Data.Common.DbDataRecord record) =>
            {
                base_func.ComboBoxItem it = new base_func.ComboBoxItem();
                it.Text  = record["coin"].ToString() + " (" + record["name"].ToString() + ") on " + record["exchange_name"].ToString();
                it.Value = base_func.ParseInt32(record["id"]);

                comboBox3.Items.Add(it);
                return(true);
            }));

            refresh();
        }
예제 #10
0
파일: wallets.cs 프로젝트: Gerz-inc/mminer
        private void button1_Click(object sender, EventArgs e)
        {
            if (is_redact)
            {
                is_redact = false;
                clear_fields();
            }
            else
            {
                if (comboBox1.SelectedIndex == -1)
                {
                    MessageBox.Show("Select exchange");
                    return;
                }

                if (comboBox2.SelectedIndex == -1)
                {
                    MessageBox.Show("Select coin");
                    return;
                }

                if (textBox1.Text == "")
                {
                    MessageBox.Show("Type wallet address");
                    return;
                }

                base_func.ComboBoxItem t = (base_func.ComboBoxItem)comboBox1.Items[comboBox1.SelectedIndex];
                base_func.ComboBoxItem c = (base_func.ComboBoxItem)comboBox2.Items[comboBox2.SelectedIndex];

                db.update_or_insert("insert into wallets (coin, name, id_exchange) values ('" + c.Value.ToString() + "', '" + textBox1.Text + "', " + t.Value.ToString() + "); ");

                refresh();
                clear_fields();
            }
        }
예제 #11
0
파일: set_item.cs 프로젝트: Gerz-inc/mminer
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == -1)
            {
                MessageBox.Show("Select pool");
                return;
            }

            if (comboBox2.SelectedIndex == -1)
            {
                MessageBox.Show("Select miner");
                return;
            }

            if (comboBox5.SelectedIndex == -1)
            {
                MessageBox.Show("Select difficulty");
                return;
            }

            if (textBox1.Text == "")
            {
                MessageBox.Show("Type manual difficulty");
                return;
            }

            int min_running = baseFunc.base_func.ParseInt32(textBox2.Text);

            base_func.ComboBoxItem t = (base_func.ComboBoxItem)comboBox1.Items[comboBox1.SelectedIndex];

            string m       = (baseFunc.base_func.ParseDouble(textBox1.Text).ToString()).Replace(",", ".");
            string enabled = checkBox1.Checked ? "1" : "0";

            db.update_or_insert("update sets set min_running = " + min_running + ", miner = '" + comboBox2.SelectedItem.ToString() + "', statistic = '" + comboBox5.SelectedItem.ToString() + "', id_pool = " + t.Value.ToString() + ", manual_diff = " + m + ", enabled = " + enabled + " where id = " + id + "; ");
            del();
        }
예제 #12
0
파일: wallets.cs 프로젝트: Gerz-inc/mminer
        private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            #region //определение элемента листвью
            int curr_item = 0;
            try
            {
                Point mousePositioni     = listView1.PointToClient(Control.MousePosition);
                ListViewHitTestInfo hiti = listView1.HitTest(mousePositioni);
                curr_item = hiti.Item.Index;
            }
            catch (Exception ex) { }

            //three step to detected which of columns of items to was clicked
            int columnindex = 0;
            try
            {
                Point mousePosition     = listView1.PointToClient(Control.MousePosition);
                ListViewHitTestInfo hit = listView1.HitTest(mousePosition);
                columnindex = hit.Item.SubItems.IndexOf(hit.SubItem);
            }
            catch (Exception ex) { }

            if (listView1.Items.Count == 0)
            {
                return;
            }
            #endregion

            string id = listView1.Items[curr_item].Text;

            if (columnindex == 5) //remove
            {
                if (MessageBox.Show("Remove wallet?", "Warning", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    db.update_or_insert("delete from wallets where id = " + id + "; ");
                    refresh();
                }
            }
            else
            {
                id_edit   = id;
                is_redact = true;

                comboBox1.SelectedIndex = -1;
                comboBox2.SelectedIndex = -1;

                for (int i = 0; i < comboBox1.Items.Count; ++i)
                {
                    base_func.ComboBoxItem it = (base_func.ComboBoxItem)comboBox1.Items[i];
                    if (it.Text.ToString() == listView1.Items[curr_item].SubItems[3].Text)
                    {
                        comboBox1.SelectedIndex = i;
                        break;
                    }
                }

                for (int i = 0; i < comboBox2.Items.Count; ++i)
                {
                    base_func.ComboBoxItem it = (base_func.ComboBoxItem)comboBox2.Items[i];
                    if (it.Text.ToString() == listView1.Items[curr_item].SubItems[2].Text)
                    {
                        comboBox2.SelectedIndex = i;
                        break;
                    }
                }

                textBox1.Text = listView1.Items[curr_item].SubItems[4].Text;
            }
        }