예제 #1
0
        public static RPCMeterConfig ParseConfig(string str)
        {
            RPCMeterConfig rpcmeterConfig = new RPCMeterConfig();
            Tokenizer      tokenizer      = new Tokenizer(str);

            for (;;)
            {
                string text = tokenizer.NextString();
                if (text == null)
                {
                    break;
                }
                if (text == null)
                {
                    goto IL_CF;
                }
                if (!(text == "method"))
                {
                    if (!(text == "income_per_second:"))
                    {
                        if (!(text == "initial_balance:"))
                        {
                            if (!(text == "cap_balance:"))
                            {
                                if (!(text == "startup_period:"))
                                {
                                    goto IL_CF;
                                }
                                rpcmeterConfig.StartupPeriod = tokenizer.NextFloat();
                            }
                            else
                            {
                                rpcmeterConfig.CapBalance = tokenizer.NextUInt32();
                            }
                        }
                        else
                        {
                            rpcmeterConfig.InitialBalance = tokenizer.NextUInt32();
                        }
                    }
                    else
                    {
                        rpcmeterConfig.IncomePerSecond = tokenizer.NextUInt32();
                    }
                }
                else
                {
                    rpcmeterConfig.AddMethod(RPCMeterConfigParser.ParseMethod(tokenizer));
                }
                continue;
IL_CF:
                tokenizer.SkipUnknownToken();
            }
            return(rpcmeterConfig);
        }
예제 #2
0
        public static RPCMeterConfig ParseConfig(string str)
        {
            RPCMeterConfig rPCMeterConfig = new RPCMeterConfig();
            Tokenizer      tokenizer      = new Tokenizer(str);

            while (true)
            {
Label2:
                string str1 = tokenizer.NextString();
                if (str1 == null)
                {
                    break;
                }
                if (str1 == null)
                {
                    goto Label0;
                }
                else if (str1 == "method")
                {
                    rPCMeterConfig.AddMethod(RPCMeterConfigParser.ParseMethod(tokenizer));
                }
                else if (str1 == "income_per_second:")
                {
                    rPCMeterConfig.IncomePerSecond = tokenizer.NextUInt32();
                }
                else if (str1 == "initial_balance:")
                {
                    rPCMeterConfig.InitialBalance = tokenizer.NextUInt32();
                }
                else if (str1 == "cap_balance:")
                {
                    rPCMeterConfig.CapBalance = tokenizer.NextUInt32();
                }
                else
                {
                    if (str1 != "startup_period:")
                    {
                        goto Label0;
                    }
                    rPCMeterConfig.StartupPeriod = tokenizer.NextFloat();
                }
            }
            return(rPCMeterConfig);

Label0:
            tokenizer.SkipUnknownToken();
            goto Label2;
        }
예제 #3
0
        public static RPCMeterConfig ParseConfig(string str)
        {
            RPCMeterConfig rPCMeterConfig = new RPCMeterConfig();
            Tokenizer      tokenizer      = new Tokenizer(str);

            while (true)
            {
                string text = tokenizer.NextString();
                if (text == null)
                {
                    break;
                }
                string text2 = text;
                if (text2 == null)
                {
                    goto IL_108;
                }
                if (RPCMeterConfigParser.< > f__switch$mapD == null)
                {
                    Dictionary <string, int> dictionary = new Dictionary <string, int>(5);
                    dictionary.Add("method", 0);
                    dictionary.Add("income_per_second:", 1);
                    dictionary.Add("initial_balance:", 2);
                    dictionary.Add("cap_balance:", 3);
                    dictionary.Add("startup_period:", 4);
                    RPCMeterConfigParser.< > f__switch$mapD = dictionary;
                }
                int num;
                if (!RPCMeterConfigParser.< > f__switch$mapD.TryGetValue(text2, ref num))
                {
                    goto IL_108;
                }
                switch (num)
                {
                case 0:
                    rPCMeterConfig.AddMethod(RPCMeterConfigParser.ParseMethod(tokenizer));
                    break;

                case 1:
                    rPCMeterConfig.IncomePerSecond = tokenizer.NextUInt32();
                    break;

                case 2:
                    rPCMeterConfig.InitialBalance = tokenizer.NextUInt32();
                    break;

                case 3:
                    rPCMeterConfig.CapBalance = tokenizer.NextUInt32();
                    break;

                case 4:
                    rPCMeterConfig.StartupPeriod = tokenizer.NextFloat();
                    break;

                default:
                    goto IL_108;
                }
                continue;
IL_108:
                tokenizer.SkipUnknownToken();
            }
            return(rPCMeterConfig);
        }