Example #1
0
        public virtual string GetDescription()
        {
            var descriptionBuilder = new StringBuilder();

            descriptionBuilder.AppendLine($"Model name: {ModelName}");
            descriptionBuilder.AppendLine($"{Battery.ToString()}");
            descriptionBuilder.AppendLine($"{Speaker.ToString()}");
            descriptionBuilder.AppendLine($"Keyboard type : {KeyBoard.ToString()}");
            descriptionBuilder.AppendLine($"Microphone : {Microphone.ToString()}");
            descriptionBuilder.AppendLine($"Sim card : {SimCard.ToString()}");
            descriptionBuilder.AppendLine($"{Screen.ToString()}");
            return(descriptionBuilder.ToString());
        }
        public override string ToString()
        {
            var descriptionBuilder = new StringBuilder();

            descriptionBuilder.AppendLine($"Model: {Model.ToString()}");
            descriptionBuilder.AppendLine($"SerialNamber: {SerialNumber.ToString()}");
            descriptionBuilder.AppendLine($"SimCard Type: {SimCard.ToString()}");
            descriptionBuilder.AppendLine($"Screen Type: {Screen.ToString()}");
            descriptionBuilder.AppendLine($"Battery Type: {Battery.ToString()}");
            descriptionBuilder.AppendLine($"Dynamic Type: {Dynamic.ToString()}");
            descriptionBuilder.AppendLine($"Microphone Type: {Microphone.ToString()}");
            return(descriptionBuilder.ToString());
        }
Example #3
0
        public override string ToString()
        {
            var descriptionBuilder = new StringBuilder();

            descriptionBuilder.AppendLine($"Screen Type: {Screen.ToString()}");
            descriptionBuilder.AppendLine($"Dynamic Type: {Speaker.ToString()}");
            descriptionBuilder.AppendLine($"Battery Type: {Battery.ToString()}");
            descriptionBuilder.AppendLine($"Keyboard Type: {Keyboard.ToString()}");
            descriptionBuilder.AppendLine($"Microphone Type: {Microphone.ToString()}");
            descriptionBuilder.AppendLine($"Simcard Type: {SimCard.ToString()}");

            return(descriptionBuilder.ToString());
        }
        public void CreateSimCorpMobile()
        {
            Screen = defineScreen();

            int ktype = defineEnumParam(typeof(KeybordType));
            int ltype = defineEnumParam(typeof(Language));

            Keyboard = new Keyboard(ktype, ltype);

            Console.WriteLine("Enter battery capacity");
            int bcapacity = Convert.ToInt32(Console.ReadLine());
            int btype     = defineEnumParam(typeof(BatteryType));

            Battery = new Battery(bcapacity, (BatteryType)btype);

            int stype = defineEnumParam(typeof(SimFormat));

            SimCard = new SimCard(stype);

            int ostype = defineEnumParam(typeof(OStype));

            OperatingSystem = new MobilePhoneComponents.OperatingSystem(ostype);

            Console.WriteLine("Enter camera quality (MPx)");
            double cquality = Convert.ToDouble(Console.ReadLine());

            Console.WriteLine("Choose autofocus (false/true)");
            bool cautofocus = Convert.ToBoolean(Console.ReadLine());

            Console.WriteLine("Choose flash (false/true)");
            bool cflash = Convert.ToBoolean(Console.ReadLine());

            Camera = new Camera(cquality, cautofocus, cflash);


            Console.WriteLine("_______________________");
            Console.WriteLine("Defined parameters:");
            Console.WriteLine(Screen.ToString());
            Console.WriteLine(Keyboard.ToString());
            Console.WriteLine(Battery.ToString());
            Console.WriteLine(SimCard.ToString());
            Console.WriteLine(OperatingSystem.ToString());
            Console.WriteLine(Camera.ToString());
        }
Example #5
0
        private void validateRule(string behavName)
        {
            var rejectedRule     = new List <string>();
            var repairedRules    = 0;
            var MulliganRulesTmp = new Dictionary <string, string>();

            foreach (var oneRule in this.MulliganRules)
            {
                var ruleKey      = oneRule.Key.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                var ruleValue    = oneRule.Value.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                var ruleValueOne = oneRule.Value;

                if (ruleKey.Length != 4 || ruleValue.Length != 3)
                {
                    rejectedRule.Add(this.getClearRule(oneRule.Key));
                    continue;
                }

                if (ruleKey[0] != ruleKey[0])
                {
                    rejectedRule.Add(this.getClearRule(oneRule.Key));
                    continue;
                }

                if (ruleKey[1] != ruleKey[1])
                {
                    rejectedRule.Add(this.getClearRule(oneRule.Key));
                    continue;
                }

                if (ruleKey[2] != ruleKey[2])
                {
                    rejectedRule.Add(this.getClearRule(oneRule.Key));
                    continue;
                }

                if (ruleValue[0] != "Hold" && ruleValue[0] != "Discard")
                {
                    rejectedRule.Add(this.getClearRule(oneRule.Key));
                    continue;
                }

                try
                {
                    Convert.ToInt32(ruleValue[1]);
                }
                catch (Exception eee)
                {
                    rejectedRule.Add(this.getClearRule(oneRule.Key));
                    continue;
                }

                if (ruleValue[2] != "/")
                {
                    if (ruleValue[2].Length < 4) // if lenght < 4 then it a manarule
                    {
                        var manaRule = 4;
                        try
                        {
                            manaRule = Convert.ToInt32(ruleValue[2]);
                        }
                        catch { }

                        if (manaRule < 0)
                        {
                            manaRule = 0;
                        }
                        else if (manaRule > 100)
                        {
                            manaRule = 100;
                        }

                        var tmpSB = new StringBuilder(ruleValue[0], 500);
                        tmpSB.Append(";").Append(ruleValue[1]).Append(";").Append(manaRule);
                        ruleValueOne = tmpSB.ToString();
                    }
                    else
                    {
                        var wasBreak               = false;
                        var addedCards             = ruleValue[2].Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
                        var MulliganRulesManualTmp = new Dictionary <SimCard, string>();
                        foreach (var s in addedCards)
                        {
                            SimCard tempID = s;
                            if (s != tempID.ToString())
                            {
                                rejectedRule.Add(this.getClearRule(oneRule.Key));
                                wasBreak = true;
                                break;
                            }

                            if (MulliganRulesManualTmp.ContainsKey(tempID))
                            {
                                repairedRules++;
                            }
                            else
                            {
                                MulliganRulesManualTmp.Add(tempID, "");
                            }
                        }

                        if (wasBreak)
                        {
                            continue;
                        }

                        var tmpSB = new StringBuilder(ruleValue[0], 500);
                        tmpSB.Append(";").Append(ruleValue[1]).Append(";");
                        for (var i = 0; i < MulliganRulesManualTmp.Count; i++)
                        {
                            if (i + 1 == MulliganRulesManualTmp.Count)
                            {
                                break;
                            }

                            tmpSB.Append(MulliganRulesManualTmp.ElementAt(i).Key.ToString()).Append("/");
                        }

                        tmpSB.Append(MulliganRulesManualTmp.ElementAt(MulliganRulesManualTmp.Count - 1).Key.ToString());
                        ruleValueOne = tmpSB.ToString();
                    }
                }

                MulliganRulesTmp.Add(oneRule.Key, ruleValueOne);
            }

            if (rejectedRule.Count > 0)
            {
                Helpfunctions.Instance.ErrorLog("[开局留牌] 弃掉卡牌的规则列表:");
                foreach (var tmp in rejectedRule)
                {
                    Helpfunctions.Instance.ErrorLog(tmp);
                }

                Helpfunctions.Instance.ErrorLog("[开局留牌] 关闭规则列表.");
            }

            if (repairedRules > 0)
            {
                Helpfunctions.Instance.ErrorLog($"{repairedRules} repaired rules");
            }

            this.MulliganRules.Clear();

            foreach (var oneRule in MulliganRulesTmp)
            {
                this.MulliganRules.Add(oneRule.Key, oneRule.Value);
            }

            Helpfunctions.Instance.ErrorLog(
                $"[开局留牌] {(this.MulliganRules.Count > 0 ? this.MulliganRules.Count + " 读取留牌规则成功" : "并没有特殊的规则.")}");
            this.mulliganRulesLoaded = true;
            if (behavName == "") //oldCompatibility
            {
                this.MulliganRulesDB.Add("控场模式", new Dictionary <string, string>(this.MulliganRules));
                this.MulliganRulesDB.Add("怼脸模式", new Dictionary <string, string>(this.MulliganRules));
            }
            else
            {
                this.MulliganRulesDB.Add(behavName, new Dictionary <string, string>(this.MulliganRules));
            }
        }