Beispiel #1
0
 public Replacement(string replace, int create, int quantity, ReplacementFlag flag, Type customType = null)
 {
     this.ItemToReplace    = replace;
     this.ItemToCreate     = create;
     this.QuantityToCreate = quantity;
     this.Flag             = flag;
     this.CustomType       = customType;
 }
Beispiel #2
0
        public void ParseLine(string line, string packName)
        {
            var parseResult = parseRegex.Match(line);

            if (!parseResult.Success)
            {
                this.ParseCustomType(line, packName);
                return;
            }

            string name         = parseResult.Groups[1].ToString();
            string itemToCreate = parseResult.Groups[3].ToString();

            switch (itemToCreate)
            {
            case "Garden Pot":
                this.AddReplacement(new Replacement(name, 0, 1, ReplacementFlag.CreateGardenPot));
                return;

            default:
                ReplacementFlag flag = ReplacementFlag.Normal;
                if (parseResult.Groups[5].Length > 0)
                {
                    flag = ReplacementFlag.CreateFurniture;
                }

                if (Int32.TryParse(parseResult.Groups[2].ToString(), out int quantity))
                {
                    this.AddReplacement(new Replacement(
                                            name,
                                            Int32.Parse(parseResult.Groups[4].ToString()),
                                            quantity,
                                            flag));
                }
                else
                {
                    this.AddReplacement(new Replacement(
                                            name,
                                            Int32.Parse(parseResult.Groups[4].ToString()),
                                            1,
                                            flag));
                }

                break;
            }
        }