本文整理汇总了C#中Server.SaveMetrics.OnModuleSaved方法的典型用法代码示例。如果您正苦于以下问题:C# SaveMetrics.OnModuleSaved方法的具体用法?C# SaveMetrics.OnModuleSaved怎么用?C# SaveMetrics.OnModuleSaved使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.SaveMetrics
的用法示例。
在下文中一共展示了SaveMetrics.OnModuleSaved方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveModules
protected void SaveModules(SaveMetrics metrics)
{
Dictionary<CustomSerial, BaseModule> modules = World.Modules;
GenericWriter indexWriter;
GenericWriter typeWriter;
GenericWriter dataWriter;
if (this.UseSequentialWriters)
{
indexWriter = new BinaryFileWriter(World.ModuleIndexPath, false);
typeWriter = new BinaryFileWriter(World.ModuleTypesPath, false);
dataWriter = new BinaryFileWriter(World.ModulesDataPath, true);
}
else
{
indexWriter = new AsyncWriter(World.ModuleIndexPath, false);
typeWriter = new AsyncWriter(World.ModuleTypesPath, false);
dataWriter = new AsyncWriter(World.ModulesDataPath, true);
}
indexWriter.Write(modules.Count);
foreach (BaseModule module in modules.Values)
{
long start = dataWriter.Position;
indexWriter.Write(module._TypeID);
indexWriter.Write((int)module.Serial);
indexWriter.Write(start);
module.Serialize(dataWriter);
if (metrics != null)
metrics.OnModuleSaved((int)(dataWriter.Position - start));
dataWriter.Write((int)(dataWriter.Position - start));
}
indexWriter.Write(World._ModuleTypes.Count);
for (int i = 0; i < World._ModuleTypes.Count; ++i)
typeWriter.Write(World._ModuleTypes[i].FullName);
indexWriter.Close();
typeWriter.Close();
dataWriter.Close();
}