コード例 #1
0
        public static PictureCropInfo FromStr(string imageCrop)
        {
            PictureCropInfo result = new PictureCropInfo();

            result.Width = MinWidth;
            if (string.IsNullOrWhiteSpace(imageCrop))
            {
                return(result);
            }
            string[] arguments = imageCrop.Split(',');
            if (arguments.Length > 0)
            {
                result.X = MathUtils.GetDouble(arguments[0].Trim());
                if (arguments.Length > 1)
                {
                    result.Y = MathUtils.GetDouble(arguments[1].Trim());
                    if (arguments.Length > 2)
                    {
                        result.Width = MathUtils.GetDouble(arguments[2].Trim());
                        if (arguments.Length > 3)
                        {
                            result.DpiFactor = MathUtils.GetDouble(arguments[3].Trim());
                        }
                    }
                }
            }
            return(result);
        }
コード例 #2
0
ファイル: Monster.cs プロジェクト: CodeItQuick/MrAnnouncerBot
        public static Monster From(MonsterDto monsterDto)
        {
            Monster monster = new Monster();

            monster.SetFromMeta(monsterDto.Meta);
            monster.Kind = monsterDto.Kind;
            monster.SetArmorClassFromStr(monsterDto.ArmorClass);
            monster.SetHitPointsFromStr(monsterDto.HitPoints);
            monster.SetAbilitiesFrom(monsterDto);
            monster.SetSavingThrowModsFrom(monsterDto.SavingThrows);
            monster.SetSpeedFromStr(monsterDto.Speed);
            monster.SetSkillCheckBonuses(monsterDto.Skills);
            monster.SetDamageImmunities(monsterDto.DamageImmunities);
            monster.SetConditionImmunities(monsterDto.ConditionImmunities);
            monster.SetDamageVulnerabilities(monsterDto.DamageVulnerabilities);
            monster.SetDamageResistances(monsterDto.DamageResistances);
            monster.SetSensesFromStr(monsterDto.Senses);
            monster.SetChallengeRatingXpFromStr(monsterDto.Challenge);
            monster.ImageUrl      = monsterDto.img_url;
            monster.ImageCropInfo = PictureCropInfo.FromStr(monsterDto.imageCrop);
            return(monster);
        }