当前位置: 首页>>代码示例>>C#>>正文


C# GenericWriter.Close方法代码示例

本文整理汇总了C#中GenericWriter.Close方法的典型用法代码示例。如果您正苦于以下问题:C# GenericWriter.Close方法的具体用法?C# GenericWriter.Close怎么用?C# GenericWriter.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GenericWriter的用法示例。


在下文中一共展示了GenericWriter.Close方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Save

			public void Save()
			{
				string str = "Saving game...";
				allConnectedAccounts.BroadCastMessage( str );
				DateTime now = DateTime.Now;
				//allAccounts.Serialize( new GenericWriter( "accounts.bin" ) );
				GenericWriter gw = null;
				if ( File.Exists( World.Path + "accounts.4.xml" ) )
					File.Copy( World.Path + "accounts.4.xml", World.Path + "accounts.5.xml", true );
				if ( File.Exists( World.Path + "accounts.3.xml" ) )
					File.Copy( World.Path + "accounts.3.xml", World.Path + "accounts.4.xml", true );
				if ( File.Exists( World.Path + "accounts.2.xml" ) )
					File.Copy( World.Path + "accounts.2.xml", World.Path + "accounts.3.xml", true );
				if ( File.Exists( World.Path + "accounts.xml" ) )
					File.Copy( World.Path + "accounts.xml", World.Path + "accounts.2.xml", true );
				allAccounts.Save( World.Path + "accounts.xml" );
				if ( allGameObjects.Dirty )
				{
					allGameObjects.Serialize( gw = new GenericWriter( World.Path + "objects.bin" ) );
				}
				if ( trajets.Dirty )
				{
					if ( File.Exists( "coord.bin" ) )
						File.Copy( World.Path + "coord.bin", World.Path + "coord" + DateTime.Now.Ticks.ToString() + ".bin", true );
					trajets.Serialize( gw = new GenericWriter( World.Path + "coord.bin" ) );
				}
				if ( allSpawners.Dirty )
				{
					allSpawners.Serialize( gw = new GenericWriter( World.Path + "spawnpoints.bin" ) );
				}

				if ( File.Exists( World.Path + "savegame.4.bin" ) )
					File.Copy( World.Path + "savegame.4.bin", World.Path + "savegame.5.bin", true );
				if ( File.Exists( World.Path + "savegame.3.bin" ) )
					File.Copy( World.Path + "savegame.3.bin", World.Path + "savegame.4.bin", true );
				if ( File.Exists( World.Path + "savegame.2.bin" ) )
					File.Copy( World.Path + "savegame.2.bin", World.Path + "savegame.3.bin", true );
				if ( File.Exists( World.Path + "savegame.bin" ) )
					File.Copy( World.Path + "savegame.bin", World.Path + "savegame.2.bin", true );				

				gw = new GenericWriter( World.Path + "savegame.bin" );	
				allMobiles.Serialize( gw );
				foreach( Account acc in allAccounts )
					foreach( Character ch in acc.characteres )
					{
						gw.Write( (int)1 );
						ch.Serialize( gw );
					}
				gw.Write( (int)0 );
				gw.Close();

	
				if ( onSave != null )
					onSave();

				//GC.Collect();
				/*Process p = Process.GetCurrentProcess();
				Console.WriteLine("{0}",p.MinWorkingSet,p.MaxWorkingSet );*/
				TimeSpan ts = DateTime.Now.Subtract( now );
				str = "Game saved in " + ts.TotalSeconds.ToString() + " sec";
				allConnectedAccounts.BroadCastMessage( str );
			}
开发者ID:karliky,项目名称:wowwow,代码行数:62,代码来源:World.cs

示例2: Serialize

 public virtual void Serialize( GenericWriter gw )
 {
     gw.Write( (int)0 );
     gw.Write( (int)List.Count );
     foreach( Trajet t in this )
         t.Serialize( gw );
     gw.Close();
     Dirty = false;
 }
开发者ID:karliky,项目名称:wowwow,代码行数:9,代码来源:Trajets.cs

示例3: Serialize

 public void Serialize( GenericWriter gw )
 {
     gw.Write( (int)0 );
     gw.Write( (int)this.Count );
     foreach( Account a in this )
     {
         a.Serialize( gw );
     }
     gw.Close();
 }
开发者ID:karliky,项目名称:wowwow,代码行数:10,代码来源:Accounts.cs

示例4: Serialize

 public virtual void Serialize( GenericWriter gw )
 {
     gw.Write( (int)0 );
     foreach( GameObject m in this )
     {
         if ( m.SpawnerLink == null )
         {
             gw.Write( 1 );
             m.Serialize( gw );
         }
     }
     gw.Write( 0 );
     gw.Close();
     dirty = false;
 }
开发者ID:karliky,项目名称:wowwow,代码行数:15,代码来源:GameObjects.cs

示例5: Serialize

 public virtual void Serialize( GenericWriter gw )
 {
     gw.Write( (int)0 );
     foreach( BaseSpawner m in this )
     {
         gw.Write( 1 );
         if ( m is MobileSpawner )
             gw.Write( 0 );
         else
             gw.Write( 1 );
         m.Serialize( gw );
     }
     gw.Write( 0 );
     gw.Write( (int)World.regSpawners.Count );
     //Console.WriteLine("{0} spawn path", World.regSpawners.Count );
     IDictionaryEnumerator regcountEnumerator = World.regSpawners.GetEnumerator();
     while ( regcountEnumerator.MoveNext() )
     {
         if ( regcountEnumerator.Value == null )
             continue;
         gw.Write( (int)regcountEnumerator.Key );
         gw.Write( (int)( regcountEnumerator.Value as ArrayList ).Count );
         foreach( int t in ( regcountEnumerator.Value as ArrayList ) )
         {
             gw.Write( t );
         }
     }
     gw.Close();
     dirty = false;
 }
开发者ID:karliky,项目名称:wowwow,代码行数:30,代码来源:SpawnerList.cs


注:本文中的GenericWriter.Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。