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


C# ILogger.WarnFormat方法代码示例

本文整理汇总了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);
         }
     }
 }
开发者ID:MRCollective,项目名称:AzureWebFarm,代码行数:14,代码来源:FilesHelper.cs

示例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;
 }
开发者ID:harlam357,项目名称:hfm-net,代码行数:31,代码来源:BootStrapper.cs

示例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
            {

            }
        }
开发者ID:bnaand,项目名称:xBim-Toolkit,代码行数:101,代码来源:XbimMesher.cs


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