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


C# Server.WorldSaveEventArgs类代码示例

本文整理汇总了C#中Server.WorldSaveEventArgs的典型用法代码示例。如果您正苦于以下问题:C# WorldSaveEventArgs类的具体用法?C# WorldSaveEventArgs怎么用?C# WorldSaveEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WorldSaveEventArgs类属于Server命名空间,在下文中一共展示了WorldSaveEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnSave

        private static void OnSave(WorldSaveEventArgs args)
        {
            DateTime time = DateTime.Now;
            if (Data.Debug)
            {
                Console.WriteLine("");
                Console.WriteLine(General.Local(241));
            }

            Data.Save();
            Channel.Save();
            GumpInfo.Save();

            foreach (Data data in Data.Datas.Values)
                if (data.SevenDays)
                    foreach (Message msg in new ArrayList(data.Messages))
                        if (msg.Received < DateTime.Now - TimeSpan.FromDays(7))
                            data.Messages.Remove(msg);

            if (Data.Debug)
            {
                TimeSpan elapsed = DateTime.Now - time;
                Console.WriteLine(General.Local(240) + " {0}", (elapsed.Minutes != 0 ? elapsed.Minutes + " minutes" : "") + (elapsed.Seconds != 0 ? elapsed.Seconds + " seconds" : "") + elapsed.Milliseconds + " milliseconds");
            }
        }
开发者ID:Jascen,项目名称:UOSmart,代码行数:25,代码来源:General.cs

示例2: OnSave

        public static void OnSave(WorldSaveEventArgs e)
        {
            Persistence.Serialize(
                FilePath,
                writer =>
                {
                    writer.Write((int)1);

                    Server.Regions.SeaMarketRegion.Save(writer);

                    writer.Write(PlayerFishingEntry.FishingEntries.Count);

                    foreach (PlayerFishingEntry entry in PlayerFishingEntry.FishingEntries.Values)
                        entry.Serialize(writer);

                    if (CharydbisSpawner.SpawnInstance != null)
                    {
                        writer.Write(0);
                        CharydbisSpawner.SpawnInstance.Serialize(writer);
                    }
                    else
                        writer.Write(1);

                    ForgedPardon.Save(writer);
                });
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:26,代码来源:Persistence.cs

示例3: World_Save

		private static void World_Save( WorldSaveEventArgs args )
		{
			DateTime now = DateTime.Now;

			if ( AuctionConfig.InterestHour <= now.Hour && SavingsAccount.DateLastPaid != now.Date )
			{
				ArrayList accounts = new ArrayList();

				foreach ( Item item in World.Items.Values )
				{
					if ( item is SavingsAccount && item.Parent is BankBox )
						accounts.Add( item );
				}

				foreach ( Item item in accounts )
				{
					SavingsAccount account = item as SavingsAccount;

					account.Gold += (long)( AuctionConfig.GoldInterestRate * account.Gold );
					if ( Arya.Savings.SavingsAccount.EnableTokens )
						account.Tokens += (long)( AuctionConfig.TokensInterestRate * account.Tokens );

					BankBox box = account.Parent as BankBox;

					if ( null != box && null != box.Owner && box.Owner.Map != Map.Internal )
						box.Owner.SendMessage( Xanthos.Utilities.Misc.kRedHue, "Interest has been paid on the {0} in your savings account!", AuctionConfig.EnableTokens ? "gold and tokens" : "gold" );
				}
				SavingsAccount.DateLastPaid = now.Date;
			}
		}
开发者ID:ITLongwell,项目名称:aedilis2server,代码行数:30,代码来源:SavingsAccount.cs

示例4: OnSave

		public static void OnSave( WorldSaveEventArgs e )
		{
			foreach( TownHouseSign sign in new ArrayList( TownHouseSign.AllSigns ) )
				sign.ValidateOwnership();

			foreach( TownHouse house in new ArrayList( TownHouse.AllTownHouses ) )
				if ( house.Deleted )
				{
					TownHouse.AllTownHouses.Remove( house );
					continue;
				}
		}
开发者ID:greeduomacro,项目名称:vivre-uo,代码行数:12,代码来源:General.cs

示例5: OnSave

        private static void OnSave(WorldSaveEventArgs e)
        {
            foreach (TownHouseSign sign in new List<TownHouseSign>(TownHouseSign.AllSigns))
            {
                sign.ValidateOwnership();
            }

            foreach (TownHouse house in new List<TownHouse>(TownHouse.AllTownHouses).Where(house => house.Deleted))
            {
                TownHouse.AllTownHouses.Remove(house);
            }
        }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:12,代码来源:General.cs

示例6: OnSave

        public static void OnSave(WorldSaveEventArgs e)
        {
            Persistence.Serialize(
                FilePath,
                writer =>
                {
                    writer.Write(0); // version

                    writer.Write(DistillationSystem.Contexts.Count);

                    foreach (KeyValuePair<Mobile, DistillationContext> kvp in DistillationSystem.Contexts)
                    {
                        writer.Write(kvp.Key);
                        kvp.Value.Serialize(writer);
                    }
                });
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:17,代码来源:DistillationContext.cs

示例7: OnSave

		public static void OnSave(WorldSaveEventArgs e)
		{
            Persistence.Serialize(
                FilePath,
                writer =>
                {
                    writer.Write((int)0);

                    if (BestWave != null)
                    {
                        writer.Write(1);
                        BestWave.Serialize(writer);
                    }
                    else
                        writer.Write(0);

                    writer.Write(BestSingle.Count);
                    foreach (KeyValuePair<Mobile, long> kvp in BestSingle)
                    {
                        writer.Write(kvp.Key);
                        writer.Write(kvp.Value);
                    }

                    writer.Write(OverallTotal.Count);
                    foreach (KeyValuePair<Mobile, long> kvp in OverallTotal)
                    {
                        writer.Write(kvp.Key);
                        writer.Write(kvp.Value);
                    }

                    writer.Write(Top20.Count);
                    foreach(Dictionary<Mobile, long> dic in Top20)
                    {
                        writer.Write(dic.Count);
                        foreach (KeyValuePair<Mobile, long> kvp in dic)
                        {
                            writer.Write(kvp.Key);
                            writer.Write(kvp.Value);
                        }
                    };
                });
		}
开发者ID:Ravenwolfe,项目名称:ServUO,代码行数:42,代码来源:VoidPoolStats.cs

示例8: OnSave

		private static void OnSave( WorldSaveEventArgs e )
		{try{

			if ( !Directory.Exists( "Saves/Gumps/" ) )
				Directory.CreateDirectory( "Saves/Gumps/" );

			GenericWriter writer = new BinaryFileWriter( Path.Combine( "Saves/Gumps/", "Gumps.bin" ), true );

			writer.Write( 0 ); // version

			ArrayList list = new ArrayList();

			GumpInfo gumpi;
			foreach( object obj in new ArrayList( s_Infos.Values ) )
			{
				if ( !(obj is Hashtable) )
					continue;

				foreach( object obje in new ArrayList( ((Hashtable)obj).Values ) )
				{
					if ( !(obje is GumpInfo ) )
						continue;

					gumpi = (GumpInfo)obje;

					if ( gumpi.Mobile != null
					&& gumpi.Mobile.Player
					&& !gumpi.Mobile.Deleted
					&& gumpi.Mobile.Account != null
					&& ((Account)gumpi.Mobile.Account).LastLogin > DateTime.Now - TimeSpan.FromDays( 30 ) )
						list.Add( obje );
				}
			}

			writer.Write( list.Count );

			foreach( GumpInfo info in list )
				info.Save( writer );

			writer.Close();

		}catch{ Errors.Report( "GumpInfo-> OnSave" ); } }
开发者ID:greeduomacro,项目名称:uodarktimes-1,代码行数:42,代码来源:GumpInfo.cs

示例9: event_worldSave

        private static void event_worldSave( WorldSaveEventArgs args )
        {
            if( !Directory.Exists(savePath) )
                Directory.CreateDirectory(savePath);

            using( StreamWriter writer = new StreamWriter(saveMintFile) )
            {
                XmlTextWriter xml = new XmlTextWriter(writer);

                xml.Formatting = Formatting.Indented;
                xml.IndentChar = '\t';
                xml.Indentation = 1;

                xml.WriteStartDocument(true);
                xml.WriteStartElement("mints");
                xml.WriteAttributeString("count", mintList.Count.ToString());

                mintList.ForEach(delegate( CoinMint cm ) { cm.Save(xml); });

                xml.WriteEndElement();
                xml.WriteEndDocument();
                xml.Close();
            }
        }
开发者ID:greeduomacro,项目名称:hubroot,代码行数:24,代码来源:Currency.cs

示例10: OnSave

        public static void OnSave( WorldSaveEventArgs e )
        {
            if( !Directory.Exists( SAVE_PATH ) )
            {
                Directory.CreateDirectory( SAVE_PATH );
            }

            GenericWriter writer = new BinaryFileWriter( Path.Combine( SAVE_PATH, FILENAME ), true );

            writer.Write( 0 );

            writer.Write( GameData.Count );

            foreach( BoardGameData data in GameData )
            {
                data.Serialize( writer );
            }

            writer.Close();
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:20,代码来源:BoardGameData.cs

示例11: Event_WorldSave

        private static void Event_WorldSave(WorldSaveEventArgs args)
        {
            try
            {
                if (!Directory.Exists(SavePath))
                    Directory.CreateDirectory(SavePath);

                BinaryFileWriter writer = new BinaryFileWriter(SaveFile, true);

                Serialize(writer);

                ConstructXML();
            }

            catch { Console.WriteLine("Error: Event_WorldSave Failed in Alliance Definition."); }
        }
开发者ID:greeduomacro,项目名称:hubroot,代码行数:16,代码来源:Alliances.cs

示例12: EventSink_WorldSave

		private static void EventSink_WorldSave( WorldSaveEventArgs e )
		{
			Save();
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:4,代码来源:CTFScore.cs

示例13: EventSink_WorldSave

 private static void EventSink_WorldSave(WorldSaveEventArgs e)
 {
     // Args: bool e.Message
     SR_Save.WriteData();
 }
开发者ID:rokann,项目名称:JustUO,代码行数:5,代码来源:Main.cs

示例14: Save

        public static void Save(WorldSaveEventArgs e)
        {
            if (XmlAttach.MobileAttachments == null && XmlAttach.ItemAttachments == null) return;

            CleanUp();

            if (!Directory.Exists("Saves/Attachments"))
                Directory.CreateDirectory("Saves/Attachments");

            string filePath = Path.Combine("Saves/Attachments", "Attachments.bin");        // the attachment serializations
            string imaPath = Path.Combine("Saves/Attachments", "Attachments.ima");         // the item/mob attachment tables
            string fpiPath = Path.Combine("Saves/Attachments", "Attachments.fpi");        // the file position indices

            BinaryFileWriter writer = null;
            BinaryFileWriter imawriter = null;
            BinaryFileWriter fpiwriter = null;

            try
            {
                writer = new BinaryFileWriter(filePath, true);
                imawriter = new BinaryFileWriter(imaPath, true);
                fpiwriter = new BinaryFileWriter(fpiPath, true);

            }
            catch (Exception err)
            {
                ErrorReporter.GenerateErrorReport(err.ToString());
                return;
            }

            if (writer != null && imawriter != null && fpiwriter != null)
            {
                // save the current global attachment serial state
                ASerial.GlobalSerialize(writer);

                // remove all deleted attachments
                XmlAttach.FullDefrag();

                // save the attachments themselves
                if (XmlAttach.AllAttachments != null)
                {
                    writer.Write(XmlAttach.AllAttachments.Count);

                    object[] valuearray = new object[XmlAttach.AllAttachments.Count];
                    XmlAttach.AllAttachments.Values.CopyTo(valuearray, 0);

                    object[] keyarray = new object[XmlAttach.AllAttachments.Count];
                    XmlAttach.AllAttachments.Keys.CopyTo(keyarray, 0);

                    for (int i = 0; i < keyarray.Length; i++)
                    {
                        // write the key
                        writer.Write((int)keyarray[i]);

                        XmlAttachment a = valuearray[i] as XmlAttachment;

                        // write the value type
                        writer.Write((string)a.GetType().ToString());

                        // serialize the attachment itself
                        a.Serialize(writer);

                        // save the fileposition index
                        fpiwriter.Write((long)writer.Position);
                    }
                }
                else
                {
                    writer.Write((int)0);
                }

                writer.Close();

                // save the hash table info for items and mobiles
                // mobile attachments
                if (XmlAttach.MobileAttachments != null)
                {
                    imawriter.Write(XmlAttach.MobileAttachments.Count);

                    object[] valuearray = new object[XmlAttach.MobileAttachments.Count];
                    XmlAttach.MobileAttachments.Values.CopyTo(valuearray, 0);

                    object[] keyarray = new object[XmlAttach.MobileAttachments.Count];
                    XmlAttach.MobileAttachments.Keys.CopyTo(keyarray, 0);

                    for (int i = 0; i < keyarray.Length; i++)
                    {
                        // write the key
                        imawriter.Write((Mobile)keyarray[i]);

                        // write out the attachments
                        ArrayList alist = (ArrayList)valuearray[i];

                        imawriter.Write((int)alist.Count);
                        foreach (XmlAttachment a in alist)
                        {
                            // write the attachment serial
                            imawriter.Write((int)a.Serial.Value);

                            // write the value type
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:vivre-uo,代码行数:101,代码来源:XmlAttach.cs

示例15: OnShardSave

 private static void OnShardSave(WorldSaveEventArgs e)
 {
     CustomSave();
 }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:4,代码来源:CustomSaving.cs


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