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); }
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()); } }
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()); } }
public static void SaveDuellers() { GenericWriter bin = new BinaryFileWriter(duellersBinPath, true); bin.WriteMobileList(duellers, true); bin.Close(); }
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()); } }