コード例 #1
0
        private void ProcessBlueprint(string[] parameters)
        {
            //parameters[0] = name of blueprint.
            //Creates BlueprintParseData

            //Put the blueprint data in the dictionary
            BlueprintParseData bp = new BlueprintParseData();
            AddBlueprintData(parameters[0], bp);

            //Add every following command
            string command = NextCommand();
            while (command != null)
            {
                //If it's the end of the blueprint, break.
                if (command.Equals(END_BLUEPRINT_TOKEN))
                {
                    break;
                }

                //Add the command and move on.
                bp.AddCommand(command);
                command = NextCommand();
            }
        }
コード例 #2
0
        private void AddBlueprintData(string blueprintName, BlueprintParseData blueprint)
        {
            //Adds a blueprint to the dictionary

            //Throw an error if the blueprint name is already in use
            if (blueprints.ContainsKey(blueprintName))
            {
                throw new DuplicateBlueprintNameException();
            }

            //Add the blueprint
            blueprints.Add(blueprintName, blueprint);
        }