示例#1
0
        /// <summary>
        /// Loads the spawn groups according to the current profile
        /// </summary>
        /// <returns>A SpawnGroups object</returns>
        public static SpawnGroups Load()
        {
            string filename = Path.Combine(Pandora.Profile.BaseFolder, "SpawnGroups.xml");

            SpawnGroups sg = null;

            if (File.Exists(filename))
            {
                try
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(SpawnGroups));
                    FileStream    stream     = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                    sg = serializer.Deserialize(stream) as SpawnGroups;
                    stream.Close();
                    Pandora.Log.WriteEntry("Spawn groups loaded correctly from {0}", filename);
                }
                catch (Exception err)
                {
                    Pandora.Log.WriteError(err, "Couldn't read spawn groups from {0}", filename);
                    sg = new SpawnGroups();
                }
            }
            else
            {
                sg = new SpawnGroups();
            }

            return(sg);
        }
示例#2
0
		/// <summary>
		/// Loads the spawn groups according to the current profile
		/// </summary>
		/// <returns>A SpawnGroups object</returns>
		public static SpawnGroups Load()
		{
			string filename = Path.Combine( Pandora.Profile.BaseFolder, "SpawnGroups.xml" );

			SpawnGroups sg = null;

			if ( File.Exists( filename ) )
			{
				try
				{
					XmlSerializer serializer = new XmlSerializer( typeof( SpawnGroups ) );
					FileStream stream = new FileStream( filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite );
					sg = serializer.Deserialize( stream ) as SpawnGroups;
					stream.Close();
					Pandora.Log.WriteEntry( "Spawn groups loaded correctly from {0}", filename );
				}
				catch ( Exception err )
				{
					Pandora.Log.WriteError( err, "Couldn't read spawn groups from {0}", filename );
					sg = new SpawnGroups();
				}
			}
			else
			{
				sg = new SpawnGroups();
			}

			return sg;
		}