Exemplo n.º 1
0
        public void Validate()
        {
            LowerLayers  = new List <string>(LowerLayers.Distinct());
            MiddleLayers = new List <string>(MiddleLayers.Distinct());
            UpperLayers  = new List <string>(UpperLayers.Distinct());

            var reservedLayers = new string[] { Attributes, Npcs, Lights, Events };

            All.Clear();
            All.AddRange(LowerLayers);
            All.AddRange(MiddleLayers);
            All.AddRange(UpperLayers);

            if (All.Count() == 0)
            {
                //Must have at least 1 map layer!
                throw new Exception("Config Error: You must have at least 1 map layer configured! Please update your server config.");
            }

            foreach (var reserved in reservedLayers)
            {
                if (All.Contains(reserved))
                {
                    throw new Exception($"Config Error: Layer '{reserved}' is reserved for editor use. Please choose different naming for map layers in your server config.");
                }
            }

            if (All.Count != All.Distinct().Count())
            {
                //Duplicate layers!
                throw new Exception("Config Error: Duplicate map layers detected! Map layers must be unique in name. Please update your server config.");
            }
        }