示例#1
0
        public static List <GameUnit> LoadDesignXML(HashSet <FileInfo> unitXMLFiles)
        {
            var unitSet = new List <GameUnit>();

            // ... load them all up
            foreach (var x in unitXMLFiles)
            {
                try
                {
                    var newU = GameUnit.LoadNewUnit(x.FullName);
                    if (newU != null)
                    {
                        unitSet.Add(newU);
                        string unitInfoShortForm = newU.ToString();
                        Debug.WriteLine("\n{0}\n     -- added from {1,30}", unitInfoShortForm, x.FullName);
                    }
                }
                catch (NullReferenceException ex)
                {
                    Debug.WriteLine($"Unable to load {x.FullName} -- {ex.Message}");
                }
            }

            return(unitSet);
        }