예제 #1
0
파일: BoxData.cs 프로젝트: zerodowned/annox
        /// <summary>
        /// Creates a BoxData object provided the items and mobiles
        /// </summary>
        /// <param name="boxItems">A list of BoxItem objects</param>
        /// <param name="boxMobiles">A list of BoxMobile objects</param>
        /// <returns>A BoxData object containing a categories structure</returns>
        public static BoxData Create(ArrayList boxItems, ArrayList boxMobiles)
        {
            BoxData data = new BoxData();

            // Items
            foreach (BoxItem item in boxItems)
            {
                GenericNode node = data.GetNode(data.m_Items, item.Path);
                node.Elements.Add(item);
            }

            // Mobiles
            foreach (BoxMobile mobile in boxMobiles)
            {
                GenericNode node = data.GetNode(data.m_Mobiles, mobile.Path);
                node.Elements.Add(mobile);
            }

            return(data);
        }
예제 #2
0
		/// <summary>
		/// Creates a BoxData object provided the items and mobiles
		/// </summary>
		/// <param name="boxItems">A list of BoxItem objects</param>
		/// <param name="boxMobiles">A list of BoxMobile objects</param>
		/// <returns>A BoxData object containing a categories structure</returns>
		public static BoxData Create( ArrayList boxItems, ArrayList boxMobiles )
		{
			BoxData data = new BoxData();

			// Items
			foreach ( BoxItem item in boxItems )
			{
				GenericNode node = data.GetNode( data.m_Items, item.Path );
				node.Elements.Add( item );
			}

			// Mobiles
			foreach ( BoxMobile mobile in boxMobiles )
			{
				GenericNode node = data.GetNode( data.m_Mobiles, mobile.Path );
				node.Elements.Add( mobile );
			}

			return data;
		}
예제 #3
0
파일: BoxData.cs 프로젝트: zerodowned/annox
        /// <summary>
        /// Generates the BoxData.xml for the current configuration
        /// </summary>
        public static void GenerateData()
        {
            World.Broadcast(BoxConfig.MessageHue, false, "Generating datafile for Pandora's Box. Please wait.");
            DateTime start = DateTime.Now;

            StringDictionary classes = CategorizeClasses();
            ArrayList        types   = LoadTypes();

            ArrayList items   = new ArrayList();
            ArrayList mobiles = new ArrayList();

            ProcessTypes(types, items, mobiles, classes);

            BoxData data = BoxData.Create(items, mobiles);

            data.Items.Sort();
            data.Mobiles.Sort();

            Save(data);

            TimeSpan duration = DateTime.Now - start;

            World.Broadcast(BoxConfig.MessageHue, false, "Generation complete. The process took {0} seconds.", duration.TotalSeconds);
        }
예제 #4
0
        /// <summary>
        /// Loads the BoxData from file
        /// </summary>
        /// <returns></returns>
        public static BoxData Load()
        {
            BoxData data = new BoxData();

            string filename = Path.Combine(Pandora.Profile.BaseFolder, "BoxData.xml");

            if (File.Exists(filename))
            {
                try
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(BoxData));
                    FileStream    stream     = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
                    data = serializer.Deserialize(stream) as BoxData;
                    stream.Close();
                    Pandora.Log.WriteEntry(string.Format("BoxData read correctly from file: {0}", filename));
                }
                catch (Exception err)
                {
                    Pandora.Log.WriteError(err, string.Format("Cannot read BoxData from file {0}", filename));
                }
            }

            return(data);
        }
예제 #5
0
		/// <summary>
		/// Loads the BoxData from file
		/// </summary>
		/// <returns></returns>
		public static BoxData Load()
		{
			BoxData data = new BoxData();

			string filename = Path.Combine( Pandora.Profile.BaseFolder, "BoxData.xml" );

			if ( File.Exists( filename ) )
			{
				try
				{
					XmlSerializer serializer = new XmlSerializer( typeof( BoxData ) );
					FileStream stream = new FileStream( filename, FileMode.Open, FileAccess.Read, FileShare.Read );
					data = serializer.Deserialize( stream ) as BoxData;
					stream.Close();
					Pandora.Log.WriteEntry( string.Format( "BoxData read correctly from file: {0}", filename ) );
				}
				catch ( Exception err )
				{
					Pandora.Log.WriteError( err, string.Format( "Cannot read BoxData from file {0}", filename ) );
				}
			}

			return data;
		}
예제 #6
0
파일: BoxData.cs 프로젝트: zerodowned/annox
        /// <summary>
        /// Saves the box data to file
        /// </summary>
        private static void Save(BoxData data)
        {
            string path = Path.Combine(BoxUtil.BoxFolder, "BoxData.xml");

            BoxUtil.XmlSave(data, path);
        }
예제 #7
0
		/// <summary>
		/// Saves the box data to file
		/// </summary>
		private static void Save( BoxData data )
		{
			string path = Path.Combine( BoxUtil.BoxFolder, "BoxData.xml" );
			BoxUtil.XmlSave( data, path );
		}