Exemplo n.º 1
0
        public virtual void Serialize(BinaryFileWriter writer)
        {
            writer.Write((int)0);

            //version 0
            writer.WriteMobileList <Mobile>(_buddyList, true);
            writer.Write(_client);
            writer.WriteMobileList <Mobile>(_ignoreList, true);
            writer.Write(_visible);
        }
Exemplo n.º 2
0
        private static void EventSink_WorldSave(WorldSaveEventArgs e)
        {
            int queue   = 0;
            int deleted = RemovedDeletedQueue(out queue);

            if (queue != 0)
            {
                Console.Write("{0} Forum Posts Deleted...", deleted);
            }

            string SavePath = Path.Combine(m_SavePath, "forumdata.sig");

            if (!Directory.Exists(m_SavePath))
            {
                Directory.CreateDirectory(m_SavePath);
            }

            GenericWriter bin = new BinaryFileWriter(SavePath, true);

            try
            {
                bin.Write(( int )0);                  //Versioning

                WritePlayerStatistics(bin);

                bin.Write(( int )(m_Threads.Count));
                foreach (ThreadEntry te in m_Threads)
                {
                    te.Serialize(bin);
                }

                bin.WriteMobileList(m_Moderators);
                bin.Write(( int )m_ThreadDeleteAccessLevel);
                bin.Write(( int )m_ThreadLockAccesLevel);
                bin.Write(( bool )m_AutoCleanup);
                bin.Write(( int )m_AutoCleanupDays);
                bin.Write(( int )m_MinPostCharactersCount);
                bin.Write(( int )m_MaxPostCharactersCount);
                bin.Close();
            }
            catch (Exception err)
            {
                bin.Close();
                Console.Write("An error occurred while trying to save the forums. {0}", err.ToString());
            }
        }
Exemplo n.º 3
0
		private static void EventSink_WorldSave( WorldSaveEventArgs e )
		{
			int queue = 0;
			int deleted = RemovedDeletedQueue(out queue);

			if ( queue != 0 )
				Console.Write( "{0} Forum Posts Deleted...", deleted );
			
			string SavePath = Path.Combine( m_SavePath, "forumdata.sig" );

			if( !Directory.Exists( m_SavePath ) )
				Directory.CreateDirectory( m_SavePath );

			GenericWriter bin = new BinaryFileWriter( SavePath, true );
			
			try
			{
				bin.Write( ( int )0 );//Versioning

				WritePlayerStatistics( bin );
				
				bin.Write( ( int )( m_Threads.Count ) );
				foreach( ThreadEntry te in m_Threads )
				{
					te.Serialize( bin );
				}

				bin.WriteMobileList( m_Moderators );
				bin.Write( ( int )m_ThreadDeleteAccessLevel );
				bin.Write( ( int )m_ThreadLockAccesLevel );
				bin.Write( ( bool )m_AutoCleanup );
				bin.Write( ( int )m_AutoCleanupDays );
				bin.Write( ( int )m_MinPostCharactersCount );
				bin.Write( ( int )m_MaxPostCharactersCount );
				bin.Close();
			}
			catch( Exception err )
			{
				bin.Close();
				Console.Write( "An error occurred while trying to save the forums. {0}", err.ToString());
			}
		}
Exemplo n.º 4
0
		public static void SaveDuellers()
		{
			GenericWriter bin = new BinaryFileWriter(duellersBinPath, true);

			bin.WriteMobileList(duellers, true);

			bin.Close();
		}
Exemplo n.º 5
0
        private static void EventSink_WorldSave(WorldSaveEventArgs e)
        {
            DateTime start = DateTime.Now;

            Console.WriteLine("processing additional components.");
            Console.WriteLine("Forums: Saving...");

            if (AutoCleanup)
            {
                Console.Write("Auto Cleanup is checking posts...");
            }
            else
            {
                Console.Write("Checking deletion queue...");
            }

            int queue   = 0;
            int deleted = RemovedDeletedQueue(out queue);

            if (queue == 0)
            {
                Console.Write("Empty Queue...");
            }
            else
            {
                Console.Write("{1} Queued...{0} Deleted...", deleted, queue);
            }

            string SavePath = Path.Combine(m_SavePath, "forumdata.sig");

            if (!Directory.Exists(m_SavePath))
            {
                Directory.CreateDirectory(m_SavePath);
            }

            GenericWriter bin = new BinaryFileWriter(SavePath, true);

            try
            {
                bin.Write(( int )0);  //Versioning

                WritePlayerStatistics(bin);

                bin.Write(( int )(m_Threads.Count));
                foreach (ThreadEntry te in m_Threads)
                {
                    te.Serialize(bin);
                }

                bin.WriteMobileList(m_Moderators);
                bin.Write(( int )m_ThreadDeleteAccessLevel);
                bin.Write(( int )m_ThreadLockAccesLevel);
                bin.Write(( bool )m_AutoCleanup);
                bin.Write(( int )m_AutoCleanupDays);
                bin.Write(( int )m_MinPostCharactersCount);
                bin.Write(( int )m_MaxPostCharactersCount);
                bin.Close();

                DateTime end = DateTime.Now;
                Console.WriteLine("done in {0:F1} seconds.", (end - start).TotalSeconds);
                Console.Write("World: ");
            }
            catch (Exception err)
            {
                bin.Close();

                Console.Write("An error occurred while trying to save the forums. {0}", err.ToString());
            }
        }