Beispiel #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // populate drop-down lists

            cbInterval.Items.Add(new Item("Week", "604800"));
            cbInterval.Items.Add(new Item("Day", "86400"));
            cbInterval.Items.Add(new Item("Hour", "3600"));
            cbInterval.SelectedIndex = 1;

            cbHashrateUnit.Items.Add(new Item("GH/s", "1000000000"));
            cbHashrateUnit.Items.Add(new Item("MH/s", "1000000"));
            cbHashrateUnit.Items.Add(new Item("kH/s", "1000"));
            cbHashrateUnit.Items.Add(new Item("H/s", "1"));
            cbHashrateUnit.SelectedIndex = 1;

            foreach (string i in rs.GetCoinTypes())
            {
                cbCoinType.Items.Add(i);
            }
        }
Beispiel #2
0
        static int Main(string[] args)
        {
            RegistrySettings rs = new RegistrySettings();
            Getopt           go = new Getopt("profit", args, "hlc:br:x:i:a",
                                             new LongOpt[]
            {
                new LongOpt("help", Argument.No, null, 'h'),
                new LongOpt("list", Argument.No, null, 'l'),
                new LongOpt("coin", Argument.Required, null, 'c'),
                new LongOpt("bitcoin", Argument.No, null, 'b'),
                new LongOpt("hashrate", Argument.Required, null, 'r'),
                new LongOpt("exchange", Argument.Required, null, 'x'),
                new LongOpt("interval", Argument.Required, null, 'i'),
                new LongOpt("all", Argument.No, null, 'a')
            });
            int    opt            = -1;
            bool   bLookUpAll     = false;
            bool   bIncomeInBTC   = false;
            string szSelectedCoin = "";

            foreach (string name in rs.GetCoinTypes())
            {
                if (name.ToLower() == "bitcoin")
                {
                    szSelectedCoin = name;
                }
            }
            decimal hashrate = 0;
            string  exchange = "";
            long    interval = 86400;

            while ((opt = go.getopt()) != -1)
            {
                switch (opt)
                {
                case 'h':
                    Help();
                    return(0);

                case 'l':
                    foreach (string name in rs.GetCoinTypes())
                    {
                        Console.WriteLine(name);
                    }
                    return(0);

                case 'c':
                    szSelectedCoin = go.Optarg;
                    break;

                case 'b':
                    bIncomeInBTC = true;
                    break;

                case 'r':
                    hashrate = Convert.ToDecimal(go.Optarg);
                    break;

                case 'x':
                    exchange = go.Optarg;
                    break;

                case 'i':
                    interval = Convert.ToInt64(go.Optarg);
                    break;

                case 'a':
                    bLookUpAll = true;
                    break;

                default:
                    Help();
                    return(-1);
                }
            }
            if (bLookUpAll)
            {
                foreach (string name in rs.GetCoinTypes())
                {
                    Console.Write(name + ": ");
                    Lookup(name, hashrate, bIncomeInBTC, interval, exchange, rs);
                }
                return(0);
            }
            if (szSelectedCoin == "")
            {
                Console.WriteLine("No coin selected");
                return(-1);
            }
            return(Lookup(szSelectedCoin, hashrate, bIncomeInBTC, interval, exchange, rs));
        }