本文整理汇总了C#中ILogger.WarnFormat方法的典型用法代码示例。如果您正苦于以下问题:C# ILogger.WarnFormat方法的具体用法?C# ILogger.WarnFormat怎么用?C# ILogger.WarnFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILogger
的用法示例。
在下文中一共展示了ILogger.WarnFormat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveFolder
public static void RemoveFolder(string folderPath, ILogger logger)
{
if (Directory.Exists(folderPath))
{
try
{
Directory.Delete(folderPath, true);
}
catch (Exception e)
{
logger.WarnFormat(e, "Error removing folder: {0}", folderPath);
}
}
}
示例2: ClearCacheFolder
private static bool ClearCacheFolder(string cacheDirectory, ILogger logger)
{
try
{
var di = new DirectoryInfo(cacheDirectory);
if (!di.Exists)
{
di.Create();
}
else
{
foreach (var fi in di.EnumerateFiles())
{
try
{
fi.Delete();
}
catch (Exception ex)
{
logger.WarnFormat(ex, Properties.Resources.CacheFileDeleteFailed, fi.Name);
}
}
}
}
catch (Exception ex)
{
ShowStartupError(ex, Properties.Resources.CacheSetupFailed);
return false;
}
return true;
}
示例3: GenerateGeometry
//.........这里部分代码省略.........
if (!written.TryAdd(geomModel.RepresentationLabel, writtenGeomids))
{
//make maps
mapRefs.Enqueue(new MapRefData(map.Value)); //add ref
}
else
{
m3d = XbimMatrix3D.Multiply(geomModel.Transform, m3d);
WriteGeometry(model, written, geomModel, ref bounds, m3d, product, deflection);
}
Interlocked.Increment(ref tally);
if (progDelegate != null)
{
int newPercentage = Convert.ToInt32((double)tally / total * 100.0);
if (newPercentage > percentageParsed)
{
percentageParsed = newPercentage;
progDelegate(percentageParsed, "Meshing");
}
}
map.Value.Clear(); //release any native memory we are finished with this
}
#if DOPARALLEL
);
#endif
//clear up maps
mappedModels.Clear();
XbimGeometryCursor geomMapTable = model.GetGeometryTable();
XbimLazyDBTransaction mapTrans = geomMapTable.BeginLazyTransaction();
foreach (var map in mapRefs) //don't do this in parallel to avoid database thrashing as it is very fast
{
int[] geomIds;
if (!written.TryGetValue(map.RepresentationLabel, out geomIds))
{
if (Logger != null) Logger.WarnFormat("A geometry mapped reference (#{0}) has been found that has no base geometry", map.RepresentationLabel);
}
else
{
byte[] matrix = map.Matrix.ToArray(true);
foreach (var geomId in geomIds)
{
geomMapTable.AddMapGeometry(geomId, map.EntityLabel, map.EntityTypeId, matrix, map.SurfaceStyleLabel);
}
mapTrans.Commit();
mapTrans.Begin();
}
Interlocked.Increment(ref tally);
if (progDelegate != null)
{
int newPercentage = Convert.ToInt32((double)tally / total * 100.0);
if (newPercentage > percentageParsed)
{
percentageParsed = newPercentage;
progDelegate(percentageParsed, "Meshing");
}
}
if (tally % 100 == 100)
{
mapTrans.Commit();
mapTrans.Begin();
}
}
mapTrans.Commit();
// Store model regions in the database.
// all regions are stored for the project in one row and need to be desirialised to XbimRegionCollection before being enumerated on read.
//
// todo: bonghi: currently geometry labels of partitioned models are not stored, only their bounding box and count are.
//
mapTrans.Begin();
XbimRegionCollection regions = PartitionWorld(model, bounds);
IfcProject project = model.IfcProject;
int projectId = 0;
if (project != null)
projectId = Math.Abs(project.EntityLabel);
geomMapTable.AddGeometry(projectId, XbimGeometryType.Region, IfcMetaData.IfcTypeId(typeof(IfcProject)), XbimMatrix3D.Identity.ToArray(), regions.ToArray());
mapTrans.Commit();
model.FreeTable(geomMapTable);
if (progDelegate != null)
{
progDelegate(0, "Ready");
}
}
catch (Exception e2)
{
if (Logger != null) Logger.Warn("General Error Triangulating geometry", e2);
}
finally
{
}
}